Question

I'm building an x86 compilation of a Wix project.

For some technical reasons, I need to copy some .dlls in system 32 folder. To do so, I wrote the following lines:

// In an external .wxs file
<?define System32Dir= "C:\Windows\System32" />

<Component Id="cmp32bits"  Directory="System32Dir" Guid="*">
    <Condition>NOT VersionNT64</Condition>
    <File Id="file32bits" KeyPath="yes" Source="mypathtothefile" />
</Component>

<Component Id="cmp64bits"  Directory="System32Dir" Guid="*">
    <Condition>VersionNT64</Condition>
    <File Id="file32bits" KeyPath="yes" Source="mypathtothefile" />
</Component>

But then it fails as System32Dir contains slashes, points...

Following this guide, if I use the SystemFolder for x86 systems and the System32Folder for x64 systems, when I install the product, for 64 bits machines the .dlls are installed in SysWOW64. I understand that, if I compile the Wix project in x86, the System32Folder will be translated the same for 64 bits systems.

That's the reason why I came to hand write the "C:\Windows\System32", but it's not working yet.

The question and important point is, how to copy anything in C:\Windows\System32 directory if I'm installing an x86 project into a 64 bits machine?

Thanks a lot.

EDIT: Added a CustomAction but could not make it work.

 <CustomAction Id="CopyToSystem32" ExeCommand="[INSTALLFOLDER]copy.bat" Directory="INSTALLFOLDER" Execute="deferred" Return="asyncWait" />

<InstallExecuteSequence>
  <Custom Action="CopyToSystem32" After="InstallFiles" >NOT Installed</Custom>
</InstallExecuteSequence>

Where the .bat file looks like this:

copy 64bits.txt C:\Windows\System32

But actually, I can't make the CustomAction work...

Was it helpful?

Solution

You can't officially install 64-bit components from a 32-bit package:

http://msdn.microsoft.com/en-us/library/aa367451(v=vs.85).aspx

and Windows will typically keep redirecting you to 32-bit folders.

I'd examine the reasons why you are being asked to install Dlls to the 64-bit system folder from a 32-bit install. If they are 64-bit Dlls then you potentially need a separate 64-bit install:

http://blogs.msdn.com/b/heaths/archive/2008/01/15/different-packages-are-required-for-different-processor-architectures.aspx

and if they are 32-bit Dlls then an app that requires them in the 64-bit system folder needs some re-architecting to get up to date with 64-bit systems.

OTHER TIPS

I did the below things in my installer for this requirement.

Ship files to somewhere in installation location and later copy those files to “C:\Windows\System32” using DTF deferred custom action.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top