Write Registry Key

For all your non-technical questions.
garylyb
Posts: 10
Joined: Sun Jan 22, 2006 9:34 am

Write Registry Key

Postby garylyb » Mon Jan 23, 2006 6:11 pm

I'm having a terrible time writing a registry key.

Here is the sequence:

Read Registry Key HKLM\\Software\\Quotes Plus\\Setup\\components\\Data\\Installed into INSTALLEDDATA
.
.
INSTALLEDDATA = $INSTALLEDDATA$ or 1
.
.
INSTALLEDDATA = $INSTALLEDDATA$ or 2
.
.
INSTALLEDDATA = $INSTALLEDDATA$ or 4
.
.

Everything works up to this point, the watch window shows a value of 7 for INSTALLEDDATA



I've tried both of these write statements, and nothing ever gets written to the registry.


Write Registry Key HKLM\\Software\\Quotes Plus\\Setup\\components\\Data\\Installed, INSTALLEDDATA

Write Registry Key HKLM\\Software\\Quotes Plus\\Setup\\components\\Data\\Installed, $INSTALLEDDATA$


INSTALLEDDATA is a DWORD in the registry. I've also tried a string, nothing ever gets written.





This key works fine:

Read Registry Key HKLM\\Software\\Quotes Plus\\Setup\\DataDir into DATADIR
.
.
The value is changed in a dialog box.
.
.
Write Registry Key HKLM\\SOFTWARE\\Quotes Plus\\Setup\\DataDir, $DATADIR$




I'm using the Ponderosa build, just downloaded from the web.


I've spent all day on this, and can't get any farther until I can write to the registry.

Gary Lyben

CandiceJones
Posts: 904
Joined: Thu Dec 22, 2005 7:03 pm
Contact:

Postby CandiceJones » Mon Jan 23, 2006 6:13 pm

Are you testing for writes after Apply Install executes?
Candice Jones
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

garylyb
Posts: 10
Joined: Sun Jan 22, 2006 9:34 am

Postby garylyb » Mon Jan 23, 2006 6:21 pm

"Are you testing for writes after Apply Install executes?"


I don't know what that means.

The write registry commands are both before apply install.

CandiceJones
Posts: 904
Joined: Thu Dec 22, 2005 7:03 pm
Contact:

Postby CandiceJones » Mon Jan 23, 2006 6:38 pm

It sounded to me like you are stepping through the debugger. Wait for Apply Install to execute - only then will your changes actually apply to the system, including writing to the registry.
Candice Jones

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

garylyb
Posts: 10
Joined: Sun Jan 22, 2006 9:34 am

Postby garylyb » Mon Jan 23, 2006 8:23 pm

OK, I think I got it now, if the registry key didn't exist, the read returns a null string. Every subsequent operation on a null string silently fails.

If I check for the null, and set it to 0, then the code works as expected.

Thanks, everyone sure responded quickly on this, I'm impressed.

Best regards,

Gary Lyben


Return to “Non-Technical”

Who is online

Users browsing this forum: No registered users and 29 guests