PDA

View Full Version : run 64-bit program from a 32-bit mode program



Unregistered
02-03-2010, 09:29 AM
We would like to install our software on 64-bit machines but have been having some problems getting them to run on the different OS's. Some of the things we need to do, such as installing IIS if it is not already there, fails on 64-bit machines. Our thought was that it is running the installer in 32-bit mode and then calls pkgmgr to install IIS, and pkgmgr is then also running in 32-bit mode, which then causes it to fail. We get a "An attempt was made to load a program with an incorrect format" error from the package manager. Has any one run into issues like this with 64-bit machines? We would like to keep the installer in 32-bit mode so that our program gets installed to the Program Files (x86) directory and so that it uses the 32-bit registry hive, but we would also like to install IIS so that our customers do not have to. Any suggestions?

Thank you
Jonathon

linder
02-03-2010, 09:37 AM
Jonathon,

You would only compile a 64-bit mode installer if your software is native 64-bit. But as I understand it, your software is 32-bit, so using a 32-bit mode installer is correct here. What function do you use to launch the pkgmgr Package Manager (on Vista and/or Windows 7)?

Friedrich

Unregistered
02-03-2010, 11:24 AM
Jonathon,

You would only compile a 64-bit mode installer if your software is native 64-bit. But as I understand it, your software is 32-bit, so using a 32-bit mode installer is correct here. What function do you use to launch the pkgmgr Package Manager (on Vista and/or Windows 7)?

Friedrich

Yes our software is 32-bit. We have so far only tested this on Windwos 7 64-bit, though 32-bit installations work fine.

We can not use the Run Program command in SetupBuilder to call pkgmgr directly because it can not hold all of the components that we want to install with IIS (character limit reached it seems like). We are currently using Run Program to call a .bat file which just contains one line: "pkgmgr /iu:<package list>".

jmcewan
02-03-2010, 02:39 PM
Our software is 32-bit. We have only tested the 64-bit install on Windows 7, though it works fine on 32-bit OSs. We do need this to work on Server 2003 as well, but I figured the solution would be similar on both OSs.

We tried using Run Program command in SetupBuilder to run pkgmg but there was not enough room for all of the components we wanted to install (seemed like a character limit was reached). We are currently using Run Program to run a .bat file that just has one line in it: "pkgmgr /iu:<list of components>".

linder
02-04-2010, 02:19 AM
Hello,


Yes our software is 32-bit. We have so far only tested this on Windwos 7 64-bit, though 32-bit installations work fine.

We can not use the Run Program command in SetupBuilder to call pkgmgr directly because it can not hold all of the components that we want to install with IIS (character limit reached it seems like). We are currently using Run Program to call a .bat file which just contains one line: "pkgmgr /iu:<package list>".

Try to create a custom runtime variable (e.g. %MY_COMMAND_LINE%) and then use this in the Run Program "Command Line" field.

Does this help?

Friedrich

jmcewan
02-04-2010, 07:52 AM
I tried packing all of the components into a variable but I still get the same error message. When I open up task manager, it looks like pkgmgr is still running in 32-bit mode. I set the target folder to %SYS32DIR%, shouldn't that take a 64-bit version of pkgmgr and run that?

Thanks for any help

jmcewan
02-04-2010, 07:56 AM
I forgot to mention, we are running SetupBuilder 6.9. Does 7.1 handle this any differently?

linder
02-04-2010, 08:00 AM
Hello,

No, %SYS32DIR% points to the SysWOW64 folder on 64-bit Windows operating systems.

WOW64, short for "Windows-32-on-Windows-64," is responsible for providing two levels of support for 32-bit legacy applications. WOW64 prevents file and registry collisions between 32-bit and 64-bit versions of applications by redirecting the 32-bit registry and file system accesses.

The system files in Windows x64 Edition are not present on just the Windows\System32 folder, but split into two folders to separate the 32-bit applications from the 64-bit applications. The WOW64 subsystem intercepts calls from a 32-bit legacy application and redirects it to the Windows\SysWow64 folder. If the call is from a 64-bit application, then the call is routed to the Windows\System32 folder and does not involve the WOW64. Microsoft has retained the name System32 for the folder, which hosts the 64-bit system files. The "Program Files" folder on a x64 system which stores 32-bit legacy applications is named Program Files (x86). 64-bit applications are stored in the Program Files folder.

Friedrich

linder
02-04-2010, 08:15 AM
I don't think this has anything to do with SetupBuilder at all!!!!!

In most cases, the "An attempt was made to load a program with an incorrect format" error occurs when a program has been compiled as a specific "bitness", e.g. you try to use x86 versions on a x64 machine.

Friedrich

linder
02-04-2010, 08:24 AM
BTW, I am not sure what exactly you are doing. But the following is worth a try.

You can use "Set x64 Mode..." script function to (temporarily) switch the installer into 64-bit mode. For example, if you do this before your "Run Program" call, then %SYS32DIR% will not point to the 32-bit System32 folder but to the "real" System32 folder for 64-bit applications. After that, switch back to 32-bit mode.

Hope this helps.

Friedrich

jmcewan
02-04-2010, 11:23 AM
That is just the thing i was looking for. I enable x64 mode before i install IIS and it installs fine on a 64-bit machine. Sorry, I didnt even notice that command in the list.

Thank you very much for your quick help on this issue.

linder
02-05-2010, 12:47 AM
You are very welcome :)

Friedrich