MsiUseFeature utility extended with installed language check

This commit is contained in:
Simon Rozman 2016-09-07 14:02:50 +02:00
parent 24576d43ea
commit 4369e9e999
4 changed files with 30 additions and 3 deletions

View File

@ -52,6 +52,26 @@ static int MsiUseFeature()
return 2;
}
if (nArgs > 2) {
reg_key key;
if (!key.open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\") _T(VENDOR_NAME_STR) _T("\\") _T(PRODUCT_NAME_STR), 0, KEY_READ)) {
OutputDebugStr(_T("Product registry key cannot be opened (error %u).\n"), GetLastError());
return 3;
}
wstring lang;
LSTATUS s = RegQueryStringValue(key, _T("Language"), lang);
if (s != ERROR_SUCCESS) {
OutputDebugStr(_T("Error reading registry value (error %u).\n"), s);
return 3;
}
if (_wcsicmp(pwcArglist[2], lang.c_str()) != 0) {
OutputDebugStr(_T("Different language (%ls, %ls).\n"), pwcArglist[2], lang.c_str());
return 3;
}
}
return 0;
}

View File

@ -100,6 +100,11 @@
<ItemGroup>
<ResourceCompile Include="MsiUseFeature.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -3,15 +3,17 @@ Checks the installation state of the given feature of G
##Usage
```
MsiUseFeature <feature name>
MsiUseFeature <feature name> [language]
```
- `feature name` - The name of the feature to check (i.e. "featEAPTTLS"; see Feature table of product MSI file)
- `language` - The user preferred language of the product
Note: The MSI product code changes on every release. Therefore, `MsiUseFeature` utility with identical version should be used.
Return codes:
- -1 = Invalid parameters
- 0 = Success
- 1 = The product is not installed or feature state is unknown
- 1 = The product is not installed, or feature state is unknown
- 2 = The feature is not installed locally
- 3 = The installed user preferred language is different

@ -1 +1 @@
Subproject commit 3948924124385430fd86e5c986d2f2c7c20f0c86
Subproject commit 983bcbf9a2b0d9429b32aabf09efcbef9b73eef2