Trick to replace opengl32.dll can't seem to overwrite it.

501ec2e2118d2ebde854665f5b3776b6
0
Nicholas_Christopher 101 May 23, 2007 at 13:43

I’m trying to replace opengl32.dll but windows won’t allow me.

Is their a trick to prevent windows or fool it somehow, or do I need to boot from a CD and replace it in DOS or something like that?

I was hoping not to have to do that.

Nicholas

7 Replies

Please log in or register to post a reply.

4e70f904a74bd2aa8773733b25b77d41
0
SigKILL 101 May 23, 2007 at 13:52

Why would you want to do that?

If you require some special opengl implementation (like 3dfx or sgi’s software renderer) then simply rename the dll to opengl32.dll and put it in the application directory. Alternatively you can load the dll dynamically.

340bf64ac6abda6e40f7e860279823cb
0
_oisyn 101 May 23, 2007 at 14:50

Rename it, then copy the alternative to it’s original name.

501ec2e2118d2ebde854665f5b3776b6
0
Nicholas_Christopher 101 May 23, 2007 at 15:16

Here is what is happening:

I am copying opengl32.dll to the windows/system32 directory and replacing the current copy. Then windows is replacing the one I copied and restoring it back to the original.

Even when I completely delete the original, windows restores it.

I have googl’d about this problem, and I have found
only one link discussing a work-around for this problem but it won’t
work for me.

The reason I’m doing this is to install a debug version of opengl32.dll

Nicholas

C4b4ac681e11772d2e07ed9a84cffe3f
0
kusma 101 May 23, 2007 at 16:10

The simplest solution would be to put your debug-dll in the working dir of your application. That way it will be loaded instead of the standard dll.

501ec2e2118d2ebde854665f5b3776b6
0
Nicholas_Christopher 101 May 23, 2007 at 17:00

@kusma

I thought windows always searched the windows directories first for dll’s
before searching the paths in the path environment variable.

Also If the path of your application is not in your path environment variable
It will not even be able to find the dll at all.

But I will test the path environment variable as I may be wrong on my facts

Nicholas …

4e70f904a74bd2aa8773733b25b77d41
0
SigKILL 101 May 23, 2007 at 17:09

It always searches the ‘working dir´ first before checking system and path dir’s. Thats why you should put it in the app’s working dir (which most probably is the same path the executable is in).

501ec2e2118d2ebde854665f5b3776b6
0
Nicholas_Christopher 101 May 23, 2007 at 17:27

LoadLibrary From MSDN..

If no file name extension is specified in the lpFileName parameter, the default library extension .dll is appended. However, the file name string can include a trailing point character (.) to indicate that the module name has no extension. When no path is specified, the function searches for loaded modules whose base name matches the base name of the module to be loaded. If the name matches, the load succeeds. Otherwise, the function searches for the file in the following sequence:

1-The directory from which the application loaded.
2-The current directory.
3-Windows 95/98: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
4-Windows NT/ 2000: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEM32.

5-Windows NT/ 2000: The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is SYSTEM.
6-The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
7-The directories that are listed in the PATH environment variable.

I guess this answers that, which really sucks… thanks for the post Sig.