MsiUseFeature utility extended with installed language check
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user