Reputation:
I have a driver I have written in unmanaged C++ using Visual Studio 2010. When compiling the DLL on a 64-bit Windows 7 the post-build step is:
echo Copying $(TargetFileName) to the OS's 64-bit system folder ...
xcopy $(TargetPath) $(SystemRoot)\System32\. /Y /Q
However, the dll is copied to $(SystemRoot)\SysWOW64\ instead, which supposedly only happends to 32-bit assemblies.
BUT! If I copy the dll to System32 using Windows Explorer or with xcopy from a command shell the dll is correctly placed in the System32 folder. What am I doing wrong? Is it because Visual Studio is a 32-bit program and the POST-BUILD event is run in context of that 32-bit process?
Upvotes: 1
Views: 2436
Reputation: 40226
Your script is being run from a 32-bit process. As a sort of band-aid solution you should be able to replace system32
with sysnative
and the WOW64 layer should do the right thing.
Update: Sorry, maybe this instead: %windir%\sysnative\cmd.exe /C "xcopy ..."
Upvotes: 3
Reputation: 13690
The variable SystemRoot is expanded corresponding to the calling program.
Since the calling program (devenv.exe) is a 32-Bit program it is replaced with the SysWOW64.
Upvotes: 0