PDA

View Full Version : Incorrect Registry Entry in 64Bit OS (Small images attached)



NewsArchive
12-14-2009, 01:42 AM
Hi All,

SB 7.0.2762

During the install I am allowing the user to select locations for the
program files and the data files. I then want to record these locations in a
registry key so my app can retrieve the paths.

I have inserted a request in the Registry Visualizer to have SB create two
entries in the "HKEY_LOCAL_MACHINE\SOFTWARE\CYA" key. ( See registry1.png)

When attempting to install on Windows 7 - 64Bit, SB refuses to create the
key in the target I have specified. Instead it is creating it in
"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\CYA" ( See registry2.png )

My application is attempting to retrieve the path information from the
registry location that I asked SB to put it in. Of course it isn't there and
it fails.

It appears SB is ignoring my request to create this key where *I want it*
and is putting it where it thinks it should be.

Is this expected behavior?

Thanks for any help.

--
Regards,

Lee
http://www.cya2day.com

NewsArchive
12-14-2009, 01:45 AM
> I have inserted a request in the Registry Visualizer to have SB create two
> entries in the "HKEY_LOCAL_MACHINE\SOFTWARE\CYA" key. ( See registry1.png)

Hi Lee,

Is your installer code signed and manifested for RequireAdministrator?

If not then it would not be able to write to HKEY_LOCAL_MACHINE.

Charles

--
-------------------------------------------------------------------------------------------------------
Charles Edmonds
www.clarionproseries.com - "Get ProPath, make your Clarion programs ready
for Windows 7 and Vista!"
www.ezchangelog.com - "Free ChangeLog software to manage your projects!"
www.setupcast.com - "A revolutionary new publishing system for software
developers - enhanced for SetupBuilder users!"
www.pagesnip.com - "Print and Save the Web, just the way you want it!"
www.clarionproseries.com - "Serious tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
12-14-2009, 01:45 AM
Hi Charles,

Thanks for the reply.

Yes. It is both code signed and set to require administrator.

Wow6432Node is in HKEY_LOCAL_MACHINE so it seems SB is able to write here
just fine. However, SB is not writing the entries in the key I asked for.

--
Regards,

Lee
http://www.cya2day.com

NewsArchive
12-14-2009, 01:45 AM
> Hi Charles,
>
> Thanks for the reply.
>
> Yes. It is both code signed and set to require administrator.
>
> Wow6432Node is in HKEY_LOCAL_MACHINE so it seems SB is able to write here
> just fine. However, SB is not writing the entries in the key I asked for.

Lee,

A 32 bit program must write its registry entries to
(HKEY_LOCAL_MACHINE\Software\WOW6432Node) area (when a 32 bit program is
installed on a 64 bit OS) - check out the WOW6432Node - all your 32 bit
programs that write to the registry are in that node, including
SetupBuilder itself (it's a Clarion app - therefore 32 bit).

http://support.microsoft.com/kb/305097

WOW64 presents 32-bit programs with an alternate view of the registry.
32-bit programs see a 32-bit HKEY_LOCAL_MACHINE\Software tree
(HKEY_LOCAL_MACHINE\Software\WOW6432Node) that is completely separate from
the true 64-bit

If your Clarion app is trying to read the registry entry (after SB
correctly places it in the WOW6432Node area), then your method in the
Clarion app sounds like the trouble area.

David

--
From David Troxell - Product Scope 7.9 - Encourager Software
Product Scope 7 Viewer - NO Registration Fee! Free to Use!
http://www.encouragersoftware.com/
Clarion Third Party Profile Exchange Online
http://encouragersoftware.com/profile/clarlinks.html
http://www.profileexchanges.com/blog/

NewsArchive
12-14-2009, 01:46 AM
Hi David,

Thanks for the reply and explanation.

I have some studying to do.

--
Regards,

Lee
http://www.cya2day.com

NewsArchive
12-14-2009, 01:47 AM
Lee,

David's answer is correct. Your installer is 32-bit. It writes in the WOW
("Windows on Windows) area.

Your 32-bit Clarion app also reads from there. (At least, mine does). And
my 32-bit apps write there.

Pics attached show a simple test.

Jane

NewsArchive
12-14-2009, 01:48 AM
But then, I'm assuming your app was written in Clarion.

If you're using a 64-bit compiler, you may in fact be looking at the real
key instead of the WOW node.

In that case, I'd suggest making a small 64-bit "helper app" and having SB
run that during the installation to write to the 64-bit registry area.
Friedrich may have a better answer.

jf

NewsArchive
12-14-2009, 01:48 AM
Hi Jane,

Thank you for your reply, however, now I'm more puzzled than ever.

The application is a 32-Bit Clarion app but somehow mine is not behaving the
same as yours.

CYADataPath = GETREG( REG_LOCAL_MACHINE,'SOFTWARE\CYA','DataPath') is what I
am using to retrieve the value into the app and it fails on 64-Bit.

CYADataPath = GETREG(
REG_LOCAL_MACHINE,'SOFTWARE\Wow6432Node\CYA','Data Path') retrieves it with
it no problem.

As I see it my Clarion GetReg() call is exactly the same as yours and fails
while yours works.

Any ideas?

--
Regards,

Lee
http://www.cya2day.com

NewsArchive
12-14-2009, 01:49 AM
Hi Lee,

>
> Is this expected behavior?
>

Yes, this is the expected behaviour on all 64-bit Windows operating systems.

64-bit applications read/write:

HKEY_LOCAL_MACHINE\SOFTWARE\CYA

32-bit applications read/write:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\CYA

To write to HKEY_LOCAL_MACHINE\SOFTWARE\CYA on a 64-bit operating system,
you have to run the installer in 64-bit mode. But you only do this if your
application is native 64-bit (not the case here). Only native 64-bit
applications use the 64-bit registry.

BTW, applications should avoid using "Wow6432Node" in registry key paths!!!

Hope this helps.

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder is Windows 7 installation -- "point. click. ship"

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
12-14-2009, 01:49 AM
Hi Friedrich,

I think I understand what you are saying.

What I am struggling with is my app is failing to read from the registry
location using
GETREG( REG_LOCAL_MACHINE,'SOFTWARE\CYA','DataPath')

It does read it correctly if I use
GETREG( REG_LOCAL_MACHINE,'SOFTWARE\Wow6432Node\CYA','Data Path')

Jane posted a small example using the same GetReg() format as my first
example and hers works. Mine doesn't so something is obviously out of place.
I'll just keep digging until I find the problem.

Thanks for the feedback.

--
Regards,

Lee
http://www.cya2day.com

NewsArchive
12-15-2009, 01:51 AM
Of course, if I would RTFM I would know that SB can be switched into 64-bit
mode :rolleyes:

(But then, a co-worker used to refer to me as "ol' 8-bit"... )

jf

NewsArchive
12-15-2009, 01:51 AM
> Of course, if I would RTFM I would know that SB can be switched into
> 64-bit mode :rolleyes:
>
> (But then, a co-worker used to refer to me as "ol' 8-bit"... )

Hahahahaha :)

Friedrich

NewsArchive
12-15-2009, 01:52 AM
I don't know, Lee.

Although UAC should have nothing to do with it, as an experiment I turned it
off on my 64-bit Vista laptop. Still reads from WOW. As does my 64-bit
Win7 machine.

Windows obviously needs to segregate programs according to how they run. So
you'll see a bunch of 32-bit DLL files in the Windows\SysWOW64 folder that
32-bit programs use while they think they're using the DLLs in the regular
Windows\System32 folder (which actually contains 64-bit DLLs).

I'm attaching the example project from which I made the screen shots. Try
it on your machine. With or without the manifest makes no difference.

Jane

NewsArchive
12-15-2009, 01:53 AM
It just keeps getting more weird.

My GetReg() code is in the global "Program Setup" embed. To see what was
actually being populated into my receiving variable I placed a MESSAGE()
just after the GetReg() call. The GetReg() line of code was untouched.

Guess what!! Apparently that triggered something within the app that caused
it to start working. I have absolutely no idea what, but I removed the
MESSAGE() statement and now all is well. (scary)

I guess it will remain a mystery, however it is now working so I am relieved
and can get back to work.

Thanks again for taking the time to help.

--
Regards,

Lee
http://www.cya2day.com