Hi,

I had to create two separate binaries for this, in a similar case. One built 
for x64, the other x86 - then I trigger the appropriate one depending on the OS 
architecture.
The issue is that C# Registry.LocalMachine will run against the Wow6432Node in 
the registry, if the binary is 32-bit. This was my way of how to easiest 
resolve it, but if you figure out some other way, feel free to let us know :)

Kind regards,

Daniel Norman
Support Specialist

-----Original Message-----
From: wixtester [mailto:sangee...@hotmail.com] 
Sent: den 8 januari 2015 13:27
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] CustomAction built for AnyCPU does not read 64-bit 
registry hive


I may have not been clear in my earlier emails, sorry about that. 
I have a C# custom action that uses Microsoft.Win32.RegistryKey. I am building 
this custom action with AnyCPU. The custom action searches for JRE on the 
system and set a value to Session variable. I have 64-bit JRE installed on the 
machine. 
When the installer runs, it doesn't seem to search the 64-bit registry when run 
on 64-bit Operating system, which is quite confusing. My understanding is that 
the msiexec process that runs the custom action will be 64-bit in this case and 
will launch the CA as 64-bit too.
I also confirmed with Corflags that the customAction was built correctly. 

I don't think marking the custom action as 'Defer' matters here.



Custom Action definition
----------------------------
    <Binary Id="provisionCA"
SourceFile="$(var.ProvCustomAction.TargetDir)Provision.CA.dll" />
    <CustomAction Id='customActioncheckJavaHomeEnvVar'
BinaryKey='provisionCA' DllEntry='SearchJRE' Execute="immediate"
Return="check"/>





Snippet from custom action
-------------------------------

            session.Log("Begin SearchJRE");

            RegistryKey root = Registry.LocalMachine;
            string path = @"Software\Javasoft\Java Runtime Environment";

            using (RegistryKey jreRoot = root.OpenSubKey(path))
            {
                if (jreRoot == null)
                {
                    session.Log("Java is not installed. JRE entry not found in 
registry at " + path);
                    session["JAVA_HOME_PATH"] = "0";
                    return ActionResult.Success;
                }
           ..... 
           ..... AND MUCH MORE


Thanks!






--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/CustomAction-built-for-AnyCPU-does-not-read-64-bit-registry-hive-tp7598754p7598766.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website, sponsored 
by Intel and developed in partnership with Slashdot Media, is your hub for all 
things parallel software development, from weekly thought leadership blogs to 
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to