MsiUseFeature utility extended with installed language check

This commit is contained in:
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;
}