List Info

Thread: PDK PerlMSI - WriteRegistry




PDK PerlMSI - WriteRegistry
country flaguser name
Australia
2007-04-10 06:44:37

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

           ;        Serial          ;  1234

           ;        Version        ;  2.0

           ;        User   ;          Bill

           ;        Company       ClientX

           ;        Default        ;  10 lines

 

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

 

$installer->WriteRegistry(

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

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

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

 &nbsp; &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; &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

RE: PDK PerlMSI - WriteRegistry
user name
2007-04-11 19:02:28

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.&nbsp; 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; &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; &nbsp;  <ComponentFile>;, 'HKEY_LOCAL_MACHINE', [{

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

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

 &nbsp; &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; &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 R16;blahR17; 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-2]

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