Summary
Create a 64-bit Windows Registry Entry via an InstallScript Custom Action
Cause
When creating a Windows Registry entry using an InstallScript custom action, by default, the custom action will create the entry under WOW6432Node, which is a 32-bit Windows Registry location.
Resolution
If a user specifically wants to create a Windows Registry entry under a 64-bit Windows Registry location, the user should disable WOW64 Windows Registry Redirection using REGDB_OPTIONS as follows:
#define TITLE_TEXT "RegDBCreateKeyEx & RegDBKeyExist"
#define TITLE "RegDBSetKeyValueEx & RegDBGetKeyValueEx"
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_RegDBCreateKeyEx(HWND);
function ExFn_RegDBCreateKeyEx(hMSI)
STRING szKey, szClass, szKeyRoot, szMsg, szAppCount, svLogFile,szRegName;
NUMBER nResult1, nResult2;
begin
// Disable WOW64 Windows Registry redirection
REGDB_OPTIONS = REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;
// Disable WOW64 file system redirection
Disable(WOW64FSREDIRECTION);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//szKey = INSTALL_REGISTRY_KEY;
szKey = "SOFTWARE\\ISTest";
if (RegDBCreateKeyEx(szKey, szClass) < 0) then
MessageBox ("First call to RegDBCreateKeyEx failed.", SEVERE);
abort;
else
SprintfBox (INFORMATION, TITLE_TEXT, "Successfully created: %s", szKey);
// Check to see if the key just created exists.
if (RegDBKeyExist (szKey) < 0) then
MessageBox ("First call to RegDBKeyExist failed.", SEVERE);
else
SprintfBox (INFORMATION, TITLE_TEXT, "%s exists.", szKey);
endif;
endif;
szAppCount ="ISTesting";
szRegName = "ApplicationCount";
nResult1 = RegDBSetKeyValueEx(szKey,szRegName, REGDB_STRING, szAppCount, -1);
if ((nResult1 <0)) then
MessageBox ("RegDBSetKeyValueEx failed.", SEVERE);
abort;
else
// Display what RegDBSetKeyValueEx has done.
szMsg = "%s set to: %s";
SprintfBox (INFORMATION, TITLE, szMsg, szRegName, szAppCount);
endif;
// Enable WOW64 file system redirection
Enable(WOW64FSREDIRECTION);
// Enable WOW64 Windows Registry redirection
REGDB_OPTIONS = REGDB_OPTIONS & ~REGDB_OPTION_WOW64_64KEY
end;
Reference
Click here for more information about the InstallScript RegDBCreateKeyEx function.
Click here for an example of how to call the InstallScript RegDBCreateKeyEx function.
Click here for more information about the InstallScript RegDBSetKeyValueEx function.
Click here for an example of how to call the InstallScript RegDBSetKeyValueEx function.
Click here for more information about the InstallScript REGDB_OPTIONS function.
Click here for more information about the InstallScript Enable function.
Click here for more information about the InstallScript Disable function.
A ZIP file containing a sample project is attached. The sample project is configured to execute the InstallScript custom action during the Execute Sequence of the install with a condition of Not Installed. The condition configures the custom action to only run during a clean, fresh, first-time install.
Related Articles
Deleting a 64 bit Windows Registry Entry via an InstallScript Custom Action 5Number of Views Create a Windows Registry Entry with Type REG_NONE for Windows File Type Association 6Number of Views Access SUPPORTDIR from an InstallScript Custom Action 6Number of Views Delete/Disable a Scheduled Task Using an InstallScript Custom Action 5Number of Views Implement an InstallScript Custom Action to Detect and Display Message About Whether a Directory Exists 3Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago