Writing to 32 bit registry values in a 64 bit O - google-chrome-extension

I am facing an issue while using Wix Installer for 64 bit machines having 64 bit Chrome.
I need to write to both the Wow6432 Path and regular path (HKLM\Software\Google\Chrome) for 64 bit machines to enable our app extension in Chrome (Chrome 32 reads from Wow6432 Path and Chrome 64 reads from Regular path). I have the following code snippet
<Component Id='RegistryComponents' Guid='{771E66CF-7086-4A56-AAF9-3571ADBEB9AA}' Win64='no'>
<RegistryKey Id='ChromeExtnInstaller' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)' Action='createAndRemoveOnUninstall'>
<RegistryValue Name='update_url' KeyPath='yes' Type='string' Value='https://clients2.google.com/service/update2/crx' />
</RegistryKey>
<RegistryKey Id='NativeMessagingHost' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts\<NM_ID>' Action='createAndRemoveOnUninstall'>
<RegistryValue Type='string' Value='[INSTALLDIR]<Value>' />
</RegistryKey>
<RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)'/>
<RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts'/>
</Component>
<?if $(var.Platform)=x64 ?>
<Component Id='RegistryComponents64' Guid='{20A0BA25-0EFC-49F5-8945-24F084EC3635}' Win64='yes'>
<RegistryKey Id='ChromeExtnInstaller64' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)' Action='createAndRemoveOnUninstall'>
<RegistryValue Name='update_url' KeyPath='yes' Type='string' Value='https://clients2.google.com/service/update2/crx' />
</RegistryKey>
<RegistryKey Id='NativeMessagingHost64' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts\com.sling.wbsp' Action='createAndRemoveOnUninstall'>
<RegistryValue Name='Default' Type='string' Value='[INSTALLDIR]com.sling.wbsp.json' />
</RegistryKey>
<RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)'/>
<RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts'/>
</Component>
<?endif?>
And in the Feature Section:
<ComponentRef Id="RegistryComponents"/>
<?if $(var.Platform)=x64 ?>
<ComponentRef Id="RegistryComponents64"/>
<?endif?>
When I try to install using a x86 Installer on a 64 bit machine, only the Wow6432Node keys are updated. Because of this, 64 bit Chrome cannot get the Extension installed. If I make a 64 bit Installer, Chrome 64 works but Chrome 32 fails. How can I ensure that, using a standard 32 bit Installer, I can write to both the paths? Can anyone tell me what I am doing wrong? Appreciate your help.

The general situation is that 32-bit MSIs can contain only 32-bit components, and that includes the registry:
http://msdn.microsoft.com/en-us/library/aa367451(v=vs.85).aspx
and separate MSIs are needed for different architectures:
http://blogs.msdn.com/b/heaths/archive/2008/01/15/different-packages-are-required-for-different-processor-architectures.aspx
If you have a 64-bit setup you should be able to write to the 32-bit registry as well as the 64-bit registry, as that top link says, so I guess that what you are missing in your 64-bit setup is a component that writes to the native 64-bit registry, and another identical entry that has Win64="no" for the 32-bit registry.

Related

Enabing IIS using CAQuietExec64 in Wix installer does not work

I need to make a windows installer which enables (installs) IIS on windows.
When I run the .msi file, it runs without any give any however, IIS does not get enabled(installed) when I go to Program and Features/Turn Windows Feature on off, it does not get installed
Here is my wxs file:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="IISInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Company" UpgradeCode="21ece05f-bf5c-4f97-850e-cb7cef2bf65e">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Property Id="QtExec64CmdLine" Value='"[WindowsFolder]Sysnative\dism.exe" /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-WebServer
/FeatureName:IIS-WebServerRole /FeatureName:IIS-RequestFiltering /FeatureName:IIS-Security
/FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ASPNET /FeatureName:IIS-ISAPIExtensions
/FeatureName:IIS-ISAPIFilter /FeatureName:IIS-DefaultDocument /FeatureName:IIS-HttpErrors /FeatureName:IIS-StaticContent
/FeatureName:IIS-HttpLogging /FeatureName:IIS-RequestMonitor /FeatureName:IIS-HttpCompressionStatic
/FeatureName:IIS-HttpCompressionDynamic /FeatureName:IIS-RequestFiltering /FeatureName:IIS-WindowsAuthentication'/>
<CustomAction Id="SilentLaunch" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="immediate" Return="check" />
</Product>
</Wix>
even when I change the value in the property to run a simple command to make directory
mkdir test
it does not work either.
Could you please help me what is the problem?
Thanks
Two potential problems:
You have declared the custom action but you haven't put it in a sequence by declaring where it's going to run and what conditions apply. So it didn't run.
Step 2 is missing: http://wixtoolset.org/documentation/manual/v3/wixdev/extensions/authoring_custom_actions.html
After you've done that, the custom action is marked immediate which is usually an error because changes to the system should be done in deferred mode, and immediate custom actions don't run elevated.

WIX Installer error during the build

I try to learn how to do an installer with WIX on Visual Studio 2012, First I create an HelloWorld Project to test WIX and to do an easy configuration. But I have an error during the building : It says me :
"Failed to open the database. During validation, this most commonly happens when attempting to open a database using an unsupported code page or a file that is not a valid Windows Installer database. Please use a different code page in Module/#Codepage, Package/#SummaryCodepage, Product/#Codepage, or WixLocalization/#Codepage; or make sure you provide the path to a valid Windows Installer database. light.exe 0 1 SetupProject1"
I see several solution like change XML's encoding, switch utf-8 by utf-16. And I also try to delete the encoding statement. But it changes nothing.
Here is my WIX XML :
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="54612752-7163-4B36-8CA6-01615090CD7F" Name="WIXTestSetup" Language="1033" Codepage="1252" Version="1.0.0.0" Manufacturer="MyCompany Ltd."
UpgradeCode="1756bfd5-c713-412a-9524-fb1b72886116">
<Package Id="*" Keywords="Installer" Description="My WIXTest Installer" Languages="1033" SummaryCodepage="1252" InstallerVersion="200"
Compressed="yes" InstallScope="perMachine" Comments="WIXTest Installer is a registered trademark of MyCompany and Co.Ltd" />
<Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM #1" />
<Property Id="DiskPrompt" Value="WIXTestSetup Installation [1]"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Feature Id="ProductFeature" Title="WIXTestSetup" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="MyCompany" Name = "MyCompany" >
<Directory Id="INSTALLFOLDER" Name="WIXTestSetup" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<Component Id="MainExecutable" Guid="4BFF8919-9C07-4BBE-BD1C-46AB49524566">
<!-- TODO: Insert files, registry keys, and other resources here. -->
<File Id="WIxTestExe" Name ="WIXTest.exe" DiskId="1" Source="D:\PROJETS VISUAL STUDIO\Projects\MyFirstWIXProject\MyFirstWIXProject\bin\Debug\MyFirstWIXProject.exe" KeyPath="yes" />
</Component>
<Component Id="ProgramFilesFolder" Guid="53B3FC8A-9D2B-4CDD-BE68-D155435C6163">
<RemoveFolder Id="ProgramFilesFolder" On="uninstall"/>
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I also check "CodePage" and "SummaryCodePage" but I've not resolve the build problem.
I've tried that too : WiX ICE validation errors
Have you some Idea to fix it ?
In the database validation step, light.exe tries to reopen the MSI file for read/write access While anti virus scanning the new msi file that been created.
Try to do the following:
Exclude the temporary directory from the real-time virus scan.
Adding English input language in Windows' regional settings.
Disable the ICE validation. Go to the wix Project Properties, Tool Settings, then checked "Suppress ICE validation".
You can check discussion related to this topic, here:
Error LGHT0301: Failed to open the database

How to make shortcuts and add an icon through wix toolset

I got tired while dealing with installshield errors and limitations, so I searched for a better alternative to get stuck with wix toolset v3.8
I read that it is very good to make setup files , I tried it to make a setup for my win forms application , after searching and reading , I wrote and modified its code :
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="Fb Messages Stealer v1.0" Language="1033"
Version="1.0.0.0" Manufacturer="Karam Najjar"
UpgradeCode="GUID-HERE">
<Package Id="*" InstallerVersion="200" Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="Newer version already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature"
Title="Fb Messages Stealer v1.0" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="Fb Messages Stealer v1.0" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Guid="*" >
<File Source="$(var.FbMessagesStealer.TargetPath)" KeyPath="yes"></File>
</Component>
</ComponentGroup>
</Fragment>
It works and make a setup file ,, but I want to make a shortcut in desktop and in start menu in addition to adding an icon to it .
I searched a lot in the internet and tried many codes , can any one help me , I need to finish making a setup as early as I can , thanx in advance.
Stick with Wix, it provides a lot more flexibility and once you get going it will be easier.
Perhaps try this well known Wix tutorial.
And also the actual Wix toolset documentation's how-to section.
And this ad-hoc link heavy answer with WiX resources.
Finally, and this is the best advice for a tinkerer: I use dark.exe (part of the Wix toolkit) to decompile MSI files compiled by Installshield and other tools. This means you can use Installshield to create an MSI with bells and whistles, and then decompile it to a wxs file and you can then copy and paste the relevant Wix code sections from the decompiled WXS to your main WXS. This works very fast and is better than any tutorial.
Other answers dealing more with the actual xml code:
Create shortcut to desktop using WiX
From MSI to WiX, Part 10 - Shortcuts

WiX bootstrapper application

I want a bootstrapper to install .NET 4.5 (if not available) before installing my setup.msi. If the machine has .NET 4.5 then I want to install the product setup.msi only.
Following is my code:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="AAA" Version="1.0.0.0" UpgradeCode="8DA460D6-B4CB-4ED0-A1FE-44F269070647">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="Netfx45FullP"/>
<MsiPackage Compressed="yes" Vital="yes" Id="PMService" Cache="yes" Visible="no"
SourceFile="C:\Users\abc.msi">
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx45Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="Netfx4x64FullVersion" Win64="yes" />
<PackageGroup Id="Netfx45FullP">
<ExePackage Id="Netfx45" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
InstallCommand="/q"
SourceFile="dotNetFx45_Full_x86_x64.exe"
DetectCondition="(Netfx4FullVersion="4.5.50709") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.50709"))"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709"))"/>
</PackageGroup>
</Fragment>
</Wix>
You'll want to remove the AND (NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709") part of your install condition.
The detect condition will handle the case of telling if the .NET Framework is installed. If it is detected as installed, it will not be installed again.
The install condition will determine if the package should be allowed to be on the machine or not. If it evaluates to false the package will be uninstalled from the machine.
By adding the detect condition to the install condition your basically making it never true that the package can be installed on the machine and stay on the machine. :)

WIX uninstall doesn't remove site on Windows server 2008 R2

I have installer which setups web site. Installer is implemented using WIX 3.5. The components installing site are in listing below:
<DirectoryRef Id="TARGETDIR">
<Directory Id="WWWROOT">
</Directory>
</DirectoryRef>
<Property Id="WWWROOT" Value="C:\inetpub\wwwroot">
<RegistrySearch Id="FindInetPubFolder" Root="HKLM" Key="SOFTWARE\Microsoft\InetStp" Name="PathWWWRoot" Type="directory" />
</Property>
<Component Id="CC_AppPoolConfigure" Guid="YOURGUID-9558-4CAE-A928-EACD27D69A0D" KeyPath="yes" Permanent="no">
<iis:WebAppPool Id="CC_AppPool" Name="[SITE_APP_POOL]" ManagedRuntimeVersion="v4.0" ManagedPipelineMode="integrated" />
</Component>
<Component Id="CC_Iis6SiteConfigure" Guid="YOURGUID-13E2-4980-A55A-E37E3E06FB67" KeyPath="yes" Permanent="no">
<Condition><![CDATA[Installed OR (IISMAJORVERSION AND (IISMAJORVERSION = "#6"))]]></Condition>
<iis:WebSite Id="CC_WebSite_IIS6" Description="[SITE_NAME]"
AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
Directory="WWWROOT" ConnectionTimeout="360" SiteId="[SITE_ID]">
<iis:WebVirtualDir Id="CC_Site_IIS6_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]">
<iis:WebApplication Id="CC_IIS6_WebApp" Name="[SITE_APP_NAME]" WebAppPool="CC_AppPool" >
<iis:WebApplicationExtension Verbs="GET,HEAD,POST" CheckPath="no" Script="yes" Executable="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" />
</iis:WebApplication>
<iis:WebDirProperties Id="CC_Site_IIS6_Properties" WindowsAuthentication="yes" AnonymousAccess="yes"/>
</iis:WebVirtualDir>
<iis:WebAddress Id="CC_Site_IIS6_Header_Bindings" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
</Component>
<Component Id="CC_IIS6_Config_Extentions" Guid="YOURGUID-009A-4545-8D4D-EC5437D7332F" KeyPath="yes" Permanent="yes">
<Condition><![CDATA[IISMAJORVERSION AND (IISMAJORVERSION = "#6")]]></Condition>
<iis:WebServiceExtension Id="CC_ExtensionASP4" Group="ASP.NET v4.0.30319" Allow="yes" File="[FRAMEWORKROOT]v4.0.30319\aspnet_isapi.dll" Description="ASP.NET v4.0.30319"/>
</Component>
<Component Id="CC_Iis7Site" Guid="YOURGUID-1738-476A-945F-A97721F5ECFC" KeyPath="yes" Permanent="no">
<Condition><![CDATA[IISMAJORVERSION AND (IISMAJORVERSION >= "#7")]]></Condition>
<iis:WebSite Id="CC_WebSite_IIS7" Description="[SITE_NAME]"
AutoStart="yes" StartOnInstall="yes" ConfigureIfExists="yes"
Directory="WWWROOT" ConnectionTimeout="360" SiteId="[SITE_ID]">
<iis:WebVirtualDir Id="CC_Site_IIS7_VDir" Directory="SITE_INSTALLDIR" Alias="[SITE_VIRT_DIR]">
<iis:WebApplication Id="CC_IIS7_WebApp" Name="[SITE_APP_NAME]" WebAppPool="CC_AppPool"></iis:WebApplication>
<iis:WebDirProperties Id="CC_Site_IIS7_Properties" WindowsAuthentication="yes" AnonymousAccess="yes"/>
</iis:WebVirtualDir>
<iis:WebAddress Id="CC_Site_IIS7_Header_Binding" Port="[SITE_PORT]" Header="[SITE_HEADER]" />
</iis:WebSite>
</Component>
As you can see, site needs to be installed on IIS 6, IIS 7 and IIS 7.5. Installation is fine on all listed environments. Installer performs per-machine installation. I use deffered custom actions for enabling required IIS components etc, so installer first is runned without admin permissions and asks for them when button "Install" is clicked.
But there is a problem uninstalling product using the same installer file which was used to install it - Site and virtual directory left on IIS. It only occurs on Windows Server 2008 R2 (IIS 7.5) when UAC is enabled and only when uninstalling through running installer file and selecting option "Remove" in first dialog. I tested this on few environments (Windows Server 2003, 2003 R2, 2008 x86, 2008 x64, 2008 R2) and it looks like 2008 R2 is the only environment where the issue is present. Other investigations shown that disabling UAC solves the problem. Uninstalling product through control panel or running the same msi from command line with uninstall parameter doesn't have this issue too. So there is very narrow case where issue is present, but it is still important.
I'm almost sure that the problem is because of UAC restrictions: maybe installer tries to uninstall site before UAC dialog is shown to give permissions. But I can't understand how can I fix it. Any help will be appreciated.
If you have better approach to installing site on so various environments, I would be happy to hear it too - my invented wheel probably isn't the best =).
If you need uninstall log, it is here:
We had the same issue and solved it by changing properties that contains Web site and application names to Secure="yes". In your case, make sure that:
<Property Id="SITE_NAME" Secure="yes">
<Property Id="SITE_APP_NAME" Secure="yes">

Resources