cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Snoopstah
Level 7

UAC and patches

I have the following script in my OnPatchUIAfter() function:

RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
szKey = "SOFTWARE\\MyCompanyName\\MyProductName";
szName = "CurrentVersion";
nvType = REGDB_STRING;
szValue = IFX_PRODUCT_VERSION;
RegDBSetKeyValueEx ( szKey, szName, nvType, szValue, nSize );

When running the patch on Vista, it never performs this function correctly. The RegDBSetKeyValueEx returns a negative value. If I execute the update.exe as "run as administrator" everything works fine.

Can someone tell me what is going wrong?
Labels (1)
0 Kudos
(4) Replies
ChandanOmkar
Level 8

Your update.exe is not elevated and you cannot write on HKLM on vista unless you have admin rights. So, you have to elevate your update setup. Check that whether yout update.exe file has a shield icon?
0 Kudos
Snoopstah
Level 7

My update.exe does have the shield icon.
I am logged onto vista as a member of the administrator group.

How do I go about elevating the privileges?
0 Kudos
ChandanOmkar
Level 8

May be its writing in the program files because the folders may have some special permissions provided by your original setup. You must run it as asministrator to write in HKLM on win Vista.
0 Kudos
Snoopstah
Level 7

Even though "previous1" when installed could write to the HKLM path?

For logic sake, I have taken out the step that writes my custom information to HKLM. I can install the patch but I still have an issue that there are now two entries in add/remove programs for my product.

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BD76AECE-6647-4297-8251-817B1711D1BA}
Display Version = correct updated patch version

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{BD76AECE-6647-4297-8251-817B1711D1BA}
Display Version = version of previous1 that should have been updated.
0 Kudos