0

I've noticed a couple of times that it looks like I can't use NTFS junctions under %SystemRoot%, put the ensuing file path in my PATH, and get it to work for DLL lookup.

For example, if I put a vendor's "bin" directory under there as a junction, and put it in my %PATH%, then I can run executables there just by typing the executable's name on the command line (without the path), but they immediately throw up a dialog that the DLLs the executable uses from that same directory cannot be found.

If I instead put the vendor's "bin" directory path directly into the %PATH%, they run fine.

What exactly is going on here? Is there a good reason for it, or is it just a bug?

1 Answer 1

1

You’re forgetting the File System Redirector.

If the program you are running is 32-bit, then c:\windows\system32 silently redirects to c:\windows\SysWOW64.

You haven’t placed the bin folder under syswow64 and so it doesn’t exist.

Not a bug at all. Just standard Windows behavior you should be aware of.

2
  • That's a very good point (so I've upvoted you). However, I did indeed do exactly that. In particular, there's a junction pointing to the same folder (which contains only 32-bit exes and DLLs) under both %SystemRoot%\system32\ and %SystemRoot%\SysWOW64\. I added both of those folders to PATH jic. The exes can be found that way, but not the DLLs.
    – T.E.D.
    Dec 29, 2017 at 19:05
  • ...my suspicion is MS disabled DLL lookups through junctions (perhaps only %SystemRoot% junctions?) to forestall OS attacks, but I can't find anything saying that.
    – T.E.D.
    Dec 29, 2017 at 19:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .