Randem Systems Support Board

Inno Setup => Inno Setup - General Questions => Topic started by: afridy on December 10, 2008, 06:45:55 AM

Title: Registry issue
Post by: afridy on December 10, 2008, 06:45:55 AM
Hai all,
 
Where to specify in innosetup to create the registry keys for all users who have account in the computer and who creates account in future which my software is installing
 
currently my software creates keys only to the user who installing the software. so when a new user login and try to use my program, he gets and error.
 
pls help.
Title: Registry issue
Post by: Randem on December 10, 2008, 08:55:41 AM
You do not create keys for all users in the installation. You create registry keys only at your program start-up when the user actually runs the app. Then the registry keys will be created in his profile and user areas. This is a job for your application not the installer. However you can create a separate installer that will only generate the registry keys and each user will run it at first run of the application if the keys do not exist.
Title: Registry issue
Post by: afridy on December 10, 2008, 06:16:03 PM
Thank You randem and now it well clear.
But, when un-installing, how to remove the values and keys?
coz if installer creates, then we have the option to tell him to remove them while uninstall no?
Title: Registry issue
Post by: Randem on December 10, 2008, 07:34:27 PM
Well, yes and no.When you uninstall only the current users keys can be uninstalled. Since you have no access to the other users areas you cannot uninstall those keys. The only way to uninstall all keys is to create the keys for each user in the HKLM area, then all the keys can be deleted at once. But this has to be done in your application not automatically by the installer.
 
(Message edited by randem on December 10, 2008)
Title: Registry issue
Post by: afridy on December 10, 2008, 07:48:15 PM
Ok Thank you.
Title: Registry issue
Post by: Randem on December 10, 2008, 08:00:29 PM
You are welcome. So you will want to create an uninstaller application that the uninstaller can run to remove the keys (or vice verse).
Title: Registry issue
Post by: afridy on December 10, 2008, 08:32:18 PM
yah rendam,
my plan is like this. my current installer creates (& removes when unstall) all the values & keys necessary for the current user who run the installation.  
 
so for other uses i plan to create the values and keys manually.  
 
so this will uninstall the regkeys atleast for the user who intalled the app is it.
Title: Registry issue
Post by: Randem on December 10, 2008, 08:40:14 PM
The problem with that is the keys will still exist after installation, however if you create all keys in the HKLM\Software\YOURCOMPANYNAME\YOURAPPNAME\USERNAME you can delete them all at unistall time from and application you create to delete these keys that can be called from the uninstaller.
Title: Registry issue
Post by: afridy on December 10, 2008, 08:55:39 PM
i have never seen any one doing this  
seems a very good trick.
is there any populer products doing this for example?
Title: Registry issue
Post by: Randem on December 10, 2008, 08:57:59 PM
Lots of product do this because if they have an update to the application they can change the keys of all users and it is done. If each user is responsible for the update... there can be many problems.
Title: Registry issue
Post by: afridy on December 10, 2008, 09:00:32 PM
wow, very good tip i got finally from you !
ok ill instruct the installer to create the base key so it will be uninstalled lator. then ill create all the values using my app for each user on the first run under that key. :D
Title: Registry issue
Post by: afridy on December 10, 2008, 10:48:06 PM
one more question,
what is the best way to determine weather the user running out app for the first time or not?
Title: Registry issue
Post by: Randem on December 11, 2008, 10:33:46 AM
Check to see if the key for that user exists, if it doesn't exist then it is the first time the user is running the app, then create the keys for that user.
 
(Message edited by randem on December 11, 2008)
Title: Registry issue
Post by: afridy on December 12, 2008, 08:31:18 AM
Got in to a problem Rendam,
 
QuoteWell, yes and no.When you uninstall only the current users keys can be uninstalled. Since you have no access to the other users areas you cannot uninstall those keys. The only way to uninstall all keys is to create the keys for each user in the HKLM area, then all the keys can be deleted at once. But this has to be done in your application not automatically by the installer.

It seems the user requir admin privileges to create registry keys under HKLMsoftwaremysoftware  
 
what shall i do now?
Title: Registry issue
Post by: Randem on December 12, 2008, 09:15:29 AM
Still do the same thing, you just have to have a separate exe the is set to run as administrator and the only thing it does is to create the keys.
Title: Registry issue
Post by: afridy on December 12, 2008, 09:20:19 AM
Quoteseparate exe the is set to run as administrator

sorry, i could not get the plan. pls explain a bit.
where to place this exe. how to run as admin etc.
Title: Registry issue
Post by: Randem on December 12, 2008, 09:29:27 AM
The exe is just an exe that creates the registry entries for the user. This exe will be in the {app} folder.
 
Option 1: In a limited users account create a shortcut for the exe. Right click on the shortcut then click on properties, then click on advanced. Tick the box to run under different credentials.
 
When this exe is run it will as for the account to be run under. You can mark this exe to use the administrator account. The user will need to set the user account and password for it to work.
 
Option 2: Create a service that will run in the system account and this service will create the user account in the registry.
Title: Registry issue
Post by: afridy on December 12, 2008, 09:39:29 AM
ok fair enough. ill try D
Title: Registry issue
Post by: Randem on December 12, 2008, 06:38:01 PM
BTW, when you create the shortcut and have gotten the admin name and password for it store the shortcut in the All Users Desktop folder so that when a new user is create the desktop application is there to run.