List Info

Thread: RE: PDK PerlMSI - WriteRegistry




RE: PDK PerlMSI - WriteRegistry
country flaguser name
Australia
2007-04-11 19:30:20

Hi Jan,

 

Thank you for the response… I can confirm that I am only using registry to store values that could also be stored in say an .ini file. I have been using the installer to set a serial number in Registry as a very simple form of copy protection, as the computer users have a restricted set of privileges.

 

I don’t need to install specific components, and was unable to use the method as it won’t allow to not enter some value.

 

I can not find any examples or other methods for writing a key to Registry.

 

Are you aware of any other method to add a key to hold a value in Registry.

 

Regards

 

Chris

 

 


From: Jan Dubois [mailto:jandactivestate.com]
Sent: Thursday, 12 April 2007 8:02 AM
To: 'Chris Wearn'; pdklistserv.ActiveState.com
Subject: RE: PDK PerlMSI - WriteRegistry

 

Hi Chris,

 

I have not used WriteRegistry() myself (most of the time I just call AddData() to explicitly add stuff to the various tables directly), but from looking at the source I would think that the <ComponentFile> argument should just be the name of an executable file in your application.  It is only being used to set the Component_ column in the Registry table, which is only relevant when you have multiple components, and only want the registry settings being set when you install a specific component.

 

In the ScriptGenerator generated installer I would expect to use a filename like this:

 

 &nbsp;  PRIMARY_FOLDER . “/bin/myapp.exe

 

Cheers,

-Jan

 

From: pdk-bounceslistserv.ActiveState.com [mailto:pdk-bounceslistserv.ActiveState.com] On Behalf Of Chris Wearn
Sent: April 10, 2007 4:45 AM
To: pdklistserv.ActiveState.com
Subject: PDK PerlMSI - WriteRegistry

 

Hi,

 

I am converting an old installation script from InnoSetup to PerlMSI and have almost completed the script however I would like to add some keys to Registry.

 

I am trying to add keys to hold the applications configuration data which works with the old setup.exe but am having trouble getting it to work with PerlMSI.

 

I would like create a series of keys and subkeys like so:

 

HKLM/SOFTWARE/MyCompany/MyApp

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  Serial&nbsp; &nbsp; &nbsp;   ; &nbsp;  1234

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  Version&nbsp; &nbsp;   ; &nbsp;  2.0

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  User ; &nbsp; &nbsp; &nbsp; &nbsp;   ; Bill

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  Company&nbsp; &nbsp;   ; ClientX

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;  Default&nbsp; &nbsp;   ; &nbsp;  10 lines

 

And have been trying to use the undocumented WriteRegistry method as follows:

 

$installer->WriteRegistry(

 &nbsp; &nbsp; &nbsp;   ; <ComponentFile&gt;, 'HKEY_LOCAL_MACHINE', [{

 &nbsp; &nbsp; &nbsp;   ; KeyName&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   =&gt; "SOFTWARE/MyCompany/MyApp&quot;,   ;

 &nbsp; &nbsp; &nbsp;   &nbsp;DefVal&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  =&gt; "&quot;,

 &nbsp; &nbsp; &nbsp;   ; Values&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; =>[

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; {

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; Name => 'Serial',

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; Value => '1234',

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; }

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; {

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; Name => 'Version',

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; Value => '2.0',

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; }

 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp;  ],

 &nbsp; &nbsp; &nbsp;   ; &nbsp; },

]);

 

 

Not sure if I have the syntax correct for adding the keys or if I am not adding a data value first, but my biggest problem is the <ComponentFile> value. I am not sure what it is asking for here and despite trying to input several values, I always end up with the same error:

 

File ‘blah’ not found in File Table at c:devetc.pl line 123

 

I’m not sure what value it requires, and the few links that point to MSDN references now appear to be outdated and cannot be retrieved.

 

I have done a fairly exhaustive search and can find no examples of its usage.

 

Anyone used this method before or can anyone explain how to correctly use the method.

 

Cheers

 

Chris

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )