Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Registry


8 replies to this topic

cherukus

cherukus
  • Members
  • 68 posts

Posted 22 January 2004 - 18:07

Hi All,
I am using InstallShield Developer 8.0 and I am using Basic script.
I am trying to delete the registry entires when I uninstall my application using a little function. What I noticed is that this function is getting called, but it is not deleting the registry entires.

Can anyone suggest me what I am doing wrong and suggest me on how I can make this work.

//added to check for registry entries during uninstall
//remove them, if present
function RemoveRegistryKeys ()
STRING szKey, szName, svValue;
NUMBER nvType, nvSize, nResult;
begin

//Set the Key and information from which to read from
RegDBSetDefaultRoot (HKEY_CURRENT_USER);
szKey = "SOFTWARE\\App1";
szName = "TestApp";
nvType = REGDB_STRING;
nvSize = -1;

// Retrieve the registry key value.
if ( RegDBGetKeyValueEx ( szKey , szName , nvType , svValue , nvSize ) = 0 ) then
MessageBox("Inside the RemoveRegistryKeys method 2", SEVERE);
RegDBDeleteKey ( szName) ;
MessageBox("Inside the RemoveRegistryKeys method 3", SEVERE);
endif;
end;

Thanks,
Cheruku.

sjimmerson

sjimmerson
  • Members
  • 36 posts

Posted 23 January 2004 - 00:26

You can accomplish the same thing if you create the registry key you want to delete in the Registry view in the IDE, right click on the key and select "Uninstall entire key".
If this is a registry entry your installation is creating, the key should be removed by default when your application is uninstalled. If this is the case and the key is not being removed then you have other problems.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 23 January 2004 - 00:45

If you always want to delete the key I wouldn't check if it exists first. Just call the deletekey directly. Perhaps calling the RegDBGetKeyValueEx locks the key and hence it cannot be deleted?

Besides: It should be RegDBDeleteKey ( szKey) ; not RegDBDeleteKey ( szName) ; as far as I can see from your code.
Regards
-Stein Åsmul

cherukus

cherukus
  • Members
  • 68 posts

Posted 23 January 2004 - 20:48

sjimmerson, I did as you suggested, but still it is not deleting the registry entries during uninstall. We are also creating some registry entries programatically.

This is the location in which we are creating the registry entires.
HKEY_CURRENT_USER\\Software\\Company Name\\AppName


Glytzhkof, I am checking for the condition because I don't want this function to be executed during install/uninstall. Also I am using RegDBDeleteKey ( szName) , because I want to delete all entries specific to that AppName. I will have several Apps with in the Company Name folder right ?

I would really appreciate any further ideas on this.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 25 January 2004 - 05:54

Sorry, I don't fully understand this. To run the action only during installation you can condition the action with Not Installed. If you only want to run the action during uninstall you can use REMOVE="ALL". Modify / Repair can be detected by Installed. More about conditions: http://www.installsh...iconditions.asp

Do you want to delete a registry value or a registry key? This is a big difference. It is like deleting a file and a folder respectively.
Regards
-Stein Åsmul

cherukus

cherukus
  • Members
  • 68 posts

Posted 27 January 2004 - 17:26

Hi Glytzhkof,
Thanks for the reply.
I am trying to do the following as shown in the attached JPG file. I want to delete the entire EVDO_Optimizer folder and it's contents.
What I did was, I am executing this function using custom action and in the sequence, I tried adding the CONDITION : REMOVE = "ALL".

Do you think what I am doing is right or not ?

Thanks for your help.

-Cheruku

cherukus

cherukus
  • Members
  • 68 posts

Posted 27 January 2004 - 17:31

I don't see the attachment being added, but this is how the structure of it is :

"HKEY_CURRENT_USER\\Software\\CompanyName\\AppName"

and I am trying to delete the entire AppName folder from the registry.


sjimmerson

sjimmerson
  • Members
  • 36 posts

Posted 28 January 2004 - 16:40

I am not sure why it didn't work.

You should have a registry key associated with the following registry key:

HKEY_CURRENT_USER\Software\CompanyName\AppName

If you right click on the AppName registry key and select "Uninstall entire key" the AppName registry key should get deleted on uninstall.

Keep in mind that deleteing an HKEY_CURRENT_USER registy entry only deletes it for the user that is logged in when you run the uninstall.

If you continue using your custom action you should use:

RegDBDeleteKey ( szKey)

as Glytzhkof suggested.

When you are looking at the registry editor the folders you see in the tree in the left pane are called registry keys and the data in the right hand pane are registry key values. A registry key value can be broken down further into a registry key value name, registry key value type and registry key value data. It is important to understand the difference between them when performing registry operations.

"szName" in your custom action is a registry key value name, but you want to delete the registry key "szKey".

Unless you conditionalize your custom action like Glytzhkof suggested, the logic in your custome action will delete the registry key on an upgrade, re-install or uninstall.

cherukus

cherukus
  • Members
  • 68 posts

Posted 05 February 2004 - 17:18

Guys, Thank you very much for your suggestions. It finally worked both ways.