Discussion:
dll redirection
(too old to reply)
muta...@gmail.com
2023-07-17 16:39:16 UTC
Permalink
I am trying the use of ".local" at the bottom of this:

https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection

My application is called pdptest.exe so I created a dummy
text file called pdptest.exe.local

I wanted it to use my own msvcrt.dll in the same directory.

Nothing happened - it still used the normal one provided
by Windows 10.

Then I recompiled pdptest.exe - and voila, it worked - ie
it executed my msvcrt.dll when I ran pdptest.

Then I created another directory and copied pdptest.exe,
pdptest.exe.local and msvcrt.dll to it.

It didn't work - ie it went to the Windows-provided one.

Any idea what is happening?

Although that's still not what I want.

What I would like to be able to do is have my existing
unchanged executables that depend on msvcrt.dll and
that I have put into my c:\winpath execute an msvcrt.dll
from a specified directory, or follow the PATH variable
or some other variable. Or even if they execute an
msvcrt.dll that is in c:\winpath, that would also be ok.

I don't want to create a ".local" dummy file for every
single one of my executables. Nor do I want to change
any of my executables.

Any idea how to do that?

BTW, I wasn't able to rename msvcrt.dll to msvcrt.dxx
in c:\windows\syswow64 so that I could put in my own.

I really want different windows to be able to have a
different PATH variable, so normally syswow64 is
right, and default, but I in select windows I can
change my PATH and start getting my own msvcrt.dll
executed, because all the programs I will be running
will work nicely with that one.

I checked knowndlls as described here:

https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

and msvcrt is on the list.

Maybe I need to delete that?

Thanks. Paul.
JJ
2023-07-17 22:11:30 UTC
Permalink
Post by ***@gmail.com
https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection
My application is called pdptest.exe so I created a dummy
text file called pdptest.exe.local
I wanted it to use my own msvcrt.dll in the same directory.
Nothing happened - it still used the normal one provided
by Windows 10.
Then I recompiled pdptest.exe - and voila, it worked - ie
it executed my msvcrt.dll when I ran pdptest.
Then I created another directory and copied pdptest.exe,
pdptest.exe.local and msvcrt.dll to it.
It didn't work - ie it went to the Windows-provided one.
Any idea what is happening?
Although that's still not what I want.
What I would like to be able to do is have my existing
unchanged executables that depend on msvcrt.dll and
that I have put into my c:\winpath execute an msvcrt.dll
from a specified directory, or follow the PATH variable
or some other variable. Or even if they execute an
msvcrt.dll that is in c:\winpath, that would also be ok.
I don't want to create a ".local" dummy file for every
single one of my executables. Nor do I want to change
any of my executables.
Any idea how to do that?
BTW, I wasn't able to rename msvcrt.dll to msvcrt.dxx
in c:\windows\syswow64 so that I could put in my own.
I really want different windows to be able to have a
different PATH variable, so normally syswow64 is
right, and default, but I in select windows I can
change my PATH and start getting my own msvcrt.dll
executed, because all the programs I will be running
will work nicely with that one.
https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order
and msvcrt is on the list.
Maybe I need to delete that?
Thanks. Paul.
If I understand it correctly, the priority of things which affect the DLL
loading is:

1. Application bitness. i.e. 32-bit or 64-bit.

2. Application manifest.

3. DLL redirection.

4. Safe DLL search mode.

5. DLL search order.

Loading...