Write Registry Key

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

Write Registry Key

Post by garylyb »

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:

Post by CandiceJones »

Are you testing for writes after Apply Install executes?
Candice Jones
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
garylyb
Posts: 10
Joined: Sun Jan 22, 2006 9:34 am

Post by garylyb »

"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:

Post by CandiceJones »

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
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
garylyb
Posts: 10
Joined: Sun Jan 22, 2006 9:34 am

Post by garylyb »

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
Post Reply