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

Deleting a 64 bit Windows Registry Entry via an InstallScript Custom Action

Deleting a 64 bit Windows Registry Entry via an InstallScript Custom Action

Summary

Delete a 64 bit created registry using installscript Customaction

 

Cause

When user try to delete a registry using installscript Custom action by default it will check under WOW6432 location and it will fail to delete the registry

 

Resolution

 

To delete a 64 bit registry using installscript first we should disable wow64 redirection,

#define TITLE_TEXT "RegDBDeleteKey Example"

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"
 

export prototype ExFn_RegDBDeleteKey(HWND);

 
function ExFn_RegDBDeleteKey(hMSI)

    STRING szKey, szMsg, svLogFile;
    

begin

REGDB_OPTIONS =REGDB_OPTIONS | REGDB_OPTION_WOW64_64KEY;

Disable(WOW64FSREDIRECTION);

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

szKey = "SOFTWARE\\ISTest"; 

    
//RegDBDeleteKey ("SOFTWARE\\ISTest") ;
  
if (RegDBDeleteKey (szKey) < 0) then

        MessageBox ("RegDBDeleteKey failed.", SEVERE);

    else

        SprintfBox (INFORMATION, TITLE_TEXT, "%s successfully deleted.", szKey);

    endif;

Enable(WOW64FSREDIRECTION);
 

end;

 

Reference:

https://docs.revenera.com/installshield26helplib/LangRef/LangrefRegDBDeleteKey_example.htm#langref_appendixd_1114639831_1022761

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 REMOVE=ALL . The condition configures the custom action to only run during Uninstallation

Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Jun 03, 2021 12:04 AM
Updated by:
Contributors