BOOL Explorerplusplus::VerifyLanguageVersion(const TCHAR *szLanguageModule) const { TCHAR szImageName[MAX_PATH]; DWORD dwpvProcessLS; DWORD dwpvProcessMS; DWORD dwpvLanguageLS; DWORD dwpvLanguageMS; DWORD dwRet; BOOL bSuccess1; BOOL bSuccess2; dwRet = GetProcessImageName(GetCurrentProcessId(), szImageName, SIZEOF_ARRAY(szImageName)); if(dwRet != 0) { bSuccess1 = GetFileProductVersion(szImageName, &dwpvProcessLS, &dwpvProcessMS); bSuccess2 = GetFileProductVersion(szLanguageModule, &dwpvLanguageLS, &dwpvLanguageMS); if(bSuccess1 && bSuccess2) { /* For the version of the language DLL to match the version of the executable, the major version, minor version and micro version must match. The build version is ignored. */ if(HIWORD(dwpvLanguageMS) == HIWORD(dwpvProcessMS) && LOWORD(dwpvLanguageMS) == LOWORD(dwpvProcessMS) && HIWORD(dwpvLanguageLS) == HIWORD(dwpvProcessLS)) { return TRUE; } } } return FALSE; }
void TestGetFileProductVersion(const TCHAR *szFile, DWORD dwExpectedLS, DWORD dwExpectedMS) { TCHAR szDLL[MAX_PATH]; GetTestResourceFilePath(szFile, szDLL, SIZEOF_ARRAY(szDLL)); DWORD dwProductVersionLS; DWORD dwProductVersionMS; BOOL bRet = GetFileProductVersion(szDLL, &dwProductVersionLS, &dwProductVersionMS); ASSERT_EQ(TRUE, bRet); EXPECT_EQ(dwExpectedLS, dwProductVersionLS); EXPECT_EQ(dwExpectedMS, dwProductVersionMS); }
UnicodeString TConfiguration::GetFileProductVersion() const { return GetFileProductVersion(L""); }
//--------------------------------------------------------------------------- UnicodeString __fastcall TConfiguration::GetProductVersion() { return GetFileProductVersion(L""); }