PDA

View Full Version : I have a huge bug in my installer (my fault)



NewsArchive
09-02-2012, 03:51 AM
This is not the fault of SB but I would be interested in the response. This
is all to do with C6 installs to a 64 bit machine.

Currently I have the attached to check if there is an existing version on
the machine (see attached SB1). However this does not work on a 64 bit
machine. I need something like SB2 attached as well.

So I have to check both registry entries.

There are 3 questions arising from this.

1. Can I test for a 64 bit machine in the script?
2. Can WOW6432 be relied on as a valid registry entry (presumably 64 bit
machine running 32 bit code).
3. Does Windows 8 change any of this?
4. Does C8 affect any of this.

TIA

John

NewsArchive
09-02-2012, 03:51 AM
John,

First of all, if your application is native 32-bit and you install it on a
64-bit machine then you should always install in 32-bit mode. Never use the
Hybrid (32/64) or 64-bit install mode in this case. As a result, you do not
have anything in the 64-bit branch of the Windows registry (or in the 64-bit
file system).

The WOW64 subsystem provides redirection at the Registry level. Computers
that are running an Windows x64-based operating system use a different
registry layout to handle both 32-bit and 64-bit programs. The registry
layout changes in x64 Edition versions of the Windows operating system make
sure that the programs hard-coded .dll paths, program settings, and other
parameter values are not overwritten. If the call is from a 32-bit
application, then the call to access the HKLM\Software registry hive is
intercepted by the WOW64 subsystem and redirected to the
HKLM\Software\Wow6432Node. If the call is from a 64-bit application, then
it is routed to the HKLM\ Software node.

In other words, you never ever hardcode "Wow6432Node"!!!

So the question is why do you have to check the 64-bit registry key for a
32-bit application?

But to answer your questions:

> 1. Can I test for a 64 bit machine in the script?

The "Get Systen Info (WOW64 Status)" script function lets you determine
whether the SetupBuilder application is running under WOW64 (64-bit
Windows). It returns "1" on x64 systems.

> 2. Can WOW6432 be relied on as a valid registry entry (presumably 64 bit
> machine running 32 bit code).

It's not allowed to make use of the "Wow6432Node" item. To check the 32-bit
registry key, you have to run the installer in 32-bit mode (the default).
To access the 64-bit part of the Windows registry, you have to switch the
installer to 64-bit mode (see "Set x64 Mode..." script function). See link
below.

> 3. Does Windows 8 change any of this?

No. Microsoft introduced the WOW64 subsystem in Windows XP x64 (April
2005).

> 4. Does C8 affect any of this.

No. If you have registry items in the 64-bit registry branch for your
native 32-bit Clarion application then you did something fundamentally
wrong. Never install a 32-bit application in x64-mode!!!!!

BTW, here is an interesting demo project on how to read a 32-bit and 64-bit
registry key:

http://www.lindersoft.com/forums/showthread.php?p=55620#post55620

Friedrich

NewsArchive
09-03-2012, 12:22 AM
EEEEEEEEEEEEEEEEKKKKKKKKKKKKKK

But I have been doing this for years! I have several 64 machines using my
software and none reporting problems. Now what!

I have not changed anything in my script Friedrich.

I will send an example privately to see why it should go into 64 bit mode.

Thanks

John

NewsArchive
09-03-2012, 12:22 AM
Hi John,

> EEEEEEEEEEEEEEEEKKKKKKKKKKKKKK
>
> But I have been doing this for years! I have several 64 machines using my
> software and none reporting problems. Now what!
>
> I have not changed anything in my script Friedrich.
>
> I will send an example privately to see why it should go into 64 bit mode.

I assume you compile a Hybrid (32/64-bit) installer (WRONG if you deploy a
32-bit only application) -or- you switch your installer into 64-bit mode at
runtime (e.g. to read from 64-bit OS resources) and then forgot to switch
back to 32-bit mode.

You can send the .sb7 script and I can tell you what you are doing wrong.

Friedrich

NewsArchive
09-03-2012, 12:23 AM
Hi John,

The script you sent runs in 32-bit mode and does not write anything to the
64-bit OS resource.

In other words, your installer does not write to the 64-bit branch of the
registry.

Friedrich

NewsArchive
09-03-2012, 12:23 AM
Quick question: why don't you use the "Detect Previous Version..." script
function to detect a previously installed version of your application? This
function returns the installation path, installed version, and even allows
you to automatically uninstall the previous version (if needed).

Friedrich