[英]Change the installation based on the OS language in Wix Installer
I have been using Wix installer to create the installer and the installer register a port during the installation (using netsh.exe). 我一直在使用Wix安装程序来创建安装程序,安装程序在安装期间注册了一个端口(使用netsh.exe)。 Everything is working fine.
一切都很好。 But then I tried to install the application on a Windows 7 OS which is French...the installer could not register the port because the netsh command was written for en-US.
但后来我尝试在法语的Windows 7操作系统上安装该应用程序...安装程序无法注册该端口,因为netsh命令是为en-US编写的。 The following command works fine on en-US machine:
以下命令在en-US机器上正常工作:
netsh.exe http add urlacl url=http: //+:6700/Demo101/ user=\\users but fails on fr-FR OS. netsh.exe http添加urlacl url = http:// +:6700 / Demo101 / user = \\ users但在fr-FR OS上失败。
For fr-FR I needed to run 对于fr-FR我需要跑
netsh.exe http add urlacl url=http: //+:6700/Demo101/ user=\\utilisateurs netsh.exe http add urlacl url = http:// +:6700 / Demo101 / user = \\ utilisateurs
I made the following changes in Wix project: 我在Wix项目中做了以下更改:
<?define langLocale = [OSINSTALLEDLOCALE]?>
<?if $(var.langLocale) = "00000409"?>
<!-- Firewall exception -->
<CustomAction Id="ListenerServiceAddReservation"
Execute="deferred"
Impersonate="no"
Directory="INSTALLLOCATION"
ExeCommand="[SystemFolder]netsh.exe http add urlacl url=http://+:6700/Demo101/ user=\users"
Return="asyncWait" />
<?else?>
<CustomAction Id="ListenerServiceAddReservation"
Execute="deferred"
Impersonate="no"
Directory="INSTALLLOCATION"
ExeCommand="[SystemFolder]netsh.exe http add urlacl url= http://+:6700/Demo101/ user=\utilisateurs"
Return="asyncWait" />
<?endif?>
But this is not working becuase it does not get the value "00000409" and always goes to else condition which is for French and machine is in en-US. 但是这不起作用,因为它没有得到值“00000409”并且总是进入法国和机器在en-US的其他条件。
Any help please? 有什么帮助吗?
Use localized Wix Properties (Custom actions) to resolve correct name, see doc: http://wixtoolset.org/documentation/manual/v3/customactions/osinfo.html (site is down right now so i can't confirm the correct link) or google WixQueryOsWellKnownSID 使用本地化的Wix属性(自定义操作)来解析正确的名称,请参阅doc: http : //wixtoolset.org/documentation/manual/v3/customactions/osinfo.html (网站现在已关闭,因此我无法确认正确的链接)或谷歌WixQueryOsWellKnownSID
In you example i assume you are referring to "users" group so to get it working add a PropertyRef 在您的示例中,我假设您指的是“用户”组,以便让它工作添加PropertyRef
<PropertyRef Id="WIX_ACCOUNT_USERS"/>
Then in your Custom Action use [WIX_ACCOUNT_USERS]
property which will resolve to correct group name for built-in Windows users and groups. 然后在自定义操作中使用
[WIX_ACCOUNT_USERS]
属性,该属性将解析以更正内置Windows用户和组的组名。
<CustomAction Id="ListenerServiceAddReservation"
Execute="deferred"
Impersonate="no"
Directory="INSTALLLOCATION"
ExeCommand="[SystemFolder]netsh.exe http add urlacl url=http://+:6700/Demo101/ user=[WIX_ACCOUNT_USERS]"
Return="asyncWait" />
With this you won't need to have different Custom Action for different locale. 有了这个,您将不需要为不同的区域设置具有不同的自定义操作。
The <?if?>
and <?else?>
statements are preprocessor stuff, they are resolved at compile time. <?if?>
和<?else?>
语句是预处理程序的东西,它们在编译时解析。 That won't work. 那不行。 The key here is that the SIDs for built-in users and groups are constant, so you need to use S-1-5-32-545 .
这里的关键是内置用户和组的SID是不变的,因此您需要使用S-1-5-32-545 。
In WiX v3.10/v4.0 and later, you can use the WixHttpExtension : 在WiX v3.10 / v4.0及更高版本中,您可以使用WixHttpExtension :
<http:UrlReservation Url="http://+:6700/Demo101/">
<http:UrlAce SecurityPrincipal="*S-1-5-32-545" Rights="register" />
</http:UrlReservation>
Using netsh: 使用netsh:
netsh.exe http add urlacl url= http://+:6700/Demo101/ sddl= "O:BAG:BAD:(A;;GX;;;S-1-5-32-545)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.