Thanks Palbinder.

It's good to know the VersionNT64 property. It's sad to learn I've to do it the 
long way.



________________________________
From: Pally Sandher <pally.sand...@iesve.com>
To: General discussion for Windows Installer XML toolset. 
<wix-users@lists.sourceforge.net>
Sent: Wed, August 4, 2010 3:39:46 AM
Subject: Re: [WiX-users] How to copy registry subkey which includes some entries

1 - http://msdn.microsoft.com/en-us/library/aa372497.aspx
2 - Nope you'll have to do it the long way.

You'll need 2 MSI's if you want to access the 64-bit areas of the
registry on x64 platforms. MSI's are platform architecture specific.

Palbinder Sandher 
Software Deployment & IT Administrator
T: +44 (0) 141 945 8500 
F: +44 (0) 141 945 8501 

http://www.iesve.com 
**Design, Simulate + Innovate with the <Virtual Environment>**
Integrated Environmental Solutions Limited. Registered in Scotland No.
SC151456 
Registered Office - Helix Building, West Of Scotland Science Park,
Glasgow G20 0SP
Email Disclaimer

-----Original Message-----
From: little.forest [mailto:little.for...@ymail.com] 
Sent: 04 August 2010 01:28
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] How to copy registry subkey which includes some
entries

We need to do these:
1. Detect the "HKCU\Software\CompanyX\ProductY" key(this key includes 5
entries) in registry, if the key exists, then copy it to be
"HKCU\Software\CompanyX\ProductY_Fix". 
2. For 32 bit machine, detect if "HKLM\Software\CompanyX\ProductY"
exists. If it exists, then copy the key to be
"HKLM\Software\CompanyX\ProductY_Fix".
3. For 64 bit machine, detect if
"HKLM\Software\Wow6432Node\CompanyX\ProductY" 
exists. If it exists, then copy the key to be
"HKLM\Software\Wow6432Node\CompanyX\ProductY_Fix".

I have a couple of questions:
1. How to detect if the target machine is 32 bit or 64 bit?
2. The "ProductY" key includes 5 entries, is there any easy way to copy
the whole key instead of doing it one by one entry? 

I know a way to it for one entry:
- detect the new key
- if it doesn't exist, then query the old key, and then create the new
key

<Property Id='QUERY_PRODUCTY_LIB'>
<RegistrySearch Id='QueryProductYKey' 
Root='HKCU' 
Key='Software\CompanyX\ProductY' 
Name='lib'
Type='raw' />
</Property>

<Property Id='DETECT_PRODUCTY_FIX'>
<RegistrySearch Id='DetectProductYFix' 
Root='HKCU' 
Key='Software\CompanyX\ProductY_Fix' 
Type='raw' />
</Property>

<Component Id="WriteRegKey" Guid="*">
<Condition>NOT DETECT_PRODUCTY_FIX and QUERY_PRODUCTY_LIB <>
''</Condition> <RegistryKey Root="HKCU" 
Key="Software\CompanyX\ProductY_Fix" 
Action="create" >
<RegistryValue Type="string" 
Name='lib'
Value='[QUERY_PRODUCTY_LIB]' 
KeyPath="yes" />
</RegistryKey>
</Component>

<ComponentRef Id="WriteRegKey" /> 



So is there an "easy way" that I can do it for the whole key once?
Otherwise, I'll have to repeat these 25 lines of code multiple times.
That is really error-prone. Based on the requirements we have, I'd think
we'll have to end with
375 lines of coce((5+5+5) x 25 = 375) to deal with HKCU, HKLM, and
HKLM\Software\Wow6432Node. But really, they are really identical code
except the key entries are different such as 'lib', 'network', or 'key'
etc. If there is a way to do it easily, please let me know.

Also I'm stuck on how to detect if the machine is 32 bit or 64 bit.

Many thanks.

------------------------------------------------------------------------
------
The Palm PDK Hot Apps Program offers developers who use the Plug-In
Development Kit to bring their C/C++ apps to Palm for a share of $1
Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to