GetModuleFileNameExA of 32bit app from 64bit app behaves differently on Win7 vs Win Server 2012?

938 Views Asked by At

Kind of a complicated question that I can't properly summarize in the title.

I have a 64 bit process (Foo64) that creates a 32 bit child process (Bar32), then tries to get the full path of Bar32's version of kernel32.dll. Obviously I expect Bar32 to have loaded it from C:\Windows\SysWow64\kernel32.dll

On Windows 7, I call GetModuleFileNameExA() from Foo64, and correctly get "C:\Windows\SysWow64\Kernel32.dll" back.

On Windows Server 2012, the exact same code gives me back "c:\Windows\system32\kernel32.dll", which is the 64bit dll location. It's obviously not possible for Bar32 to have loaded a 64 bit dll.

My hunch is that Server 2012 is telling me the location of where Bar32 tried to load it from, rather than the actual redirected location. How can I get it to tell me the true location?

Is there something fundamental I'm misunderstanding?

I have read all of the relevant MSDN pages, and the first three pages of all relevant google searches.

0

There are 0 best solutions below