Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an installer condition that test for 32 and 64 bit Windows

I am creating a visual studio set-up project. I need to test to see if the version of Windows I am being installed on is 64 or 32 bit. I am planning on checking for the existence of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node as a way of telling that I am being installed on 64 bit windows. Is this a good idea and/or is there a better way?

The reason that I want to know which version of Windows I am on is so I can create a directory under either System32 or SysWOW64. I would rather not create two installers one targeting 64 bit platforms and one targeting 32 bit platforms.

like image 220
Spencer Booth Avatar asked Sep 20 '10 13:09

Spencer Booth


1 Answers

The easiest way to check for a 64 bit machine in an MSI installer is to use the VersionNT64 property. This will only be set if the target machine is running a 64 bit operating system.

  • http://msdn.microsoft.com/en-us/library/aa372497(VS.85).aspx
like image 130
JaredPar Avatar answered Sep 27 '22 18:09

JaredPar