Community Forums
Results 1 to 3 of 3

Thread: Uninstall Reg Keys

  1. #1
    Join Date
    Jul 2010
    Posts
    14

    Question Uninstall Reg Keys

    How should one go about creating an installation that does nothing to the registry during initial installation or maintenance, but deletes specified registry keys during uninstall?

    The same functionality should work if the uninstall is invoked from the Control Panel or via the InstallShield installation file.

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    683
    Which project type do you use?
    For Basic MSI you might take a look at the RemoveRegistry Table.

  3. #3
    Join Date
    Jul 2010
    Posts
    14
    It is a Basic MSI installation. I've gotten as far as creating a custom action with an InstallShield script that only gets executed during an uninstall. The script first attempts to delete the keys under HKLM and then the keys under HKCU. The keys under HKCU are successfully deleted, but the keys under HKLM fail to delete. It seems as if the uninstall (invoked from the control panel) is not running the script with elevated admin privileges. The installation is being run on Windows 7 x64. And this is the current script:

    function DeleteRegKeys(hMSI)
    // To Do: Declare local variables.
    begin

    // HKEY_LOCAL_MACHINE
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

    if(RegDBDeleteKey("Software\\Wow6432Node\\My Company") < 0) then
    MessageBox("RegDBDeleteKey(Software\\Wow6432Node\\My Company) FAILED", SEVERE);
    else
    MessageBox("RegDBDeleteKey(Software\\Wow6432Node\\My Company) SUCCEEDED", INFORMATION);
    endif;

    if(RegDBDeleteKey("Software\\My Company") < 0) then
    MessageBox("RegDBDeleteKey(Software\\My Company) FAILED", SEVERE);
    else
    MessageBox("RegDBDeleteKey(Software\\My Company) SUCCEEDED", INFORMATION);
    endif;


    // HKEY_CURRENT_USER
    RegDBSetDefaultRoot(HKEY_CURRENT_USER);

    if(RegDBDeleteKey("Software\\My Company") < 0) then
    MessageBox("RegDBDeleteKey(Software\\My Company) FAILED", SEVERE);
    else
    MessageBox("RegDBDeleteKey(Software\\My Company) SUCCEEDED", INFORMATION);
    endif;

    end;
    Last edited by sirhaden; 11-04-2010 at 09:00 AM. Reason: Comment

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •