1
0
forked from 0ad/0ad

check all file names known to belong to a GPU's drivers instead of trying to rule out 32/64 bit variants

fixes #737

This was SVN commit r8990.
This commit is contained in:
janwas 2011-02-26 17:10:09 +00:00
parent 4f8dc9c777
commit 567a698628
2 changed files with 13 additions and 28 deletions

View File

@ -102,8 +102,11 @@ void wdll_ver_Append(const fs::wpath& pathname, std::wstring& list)
if(ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)) != INFO::OK)
{
WinScopedDisableWow64Redirection s;
// if this still fails, we'll at least write the default "unknown" version.
(void)ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString));
// still failed; avoid polluting list with DLLs that don't exist
// (requiring callers to check for their existence beforehand would be
// onerous and unreliable)
if(ReadVersionString(modulePathname, versionString, ARRAY_SIZE(versionString)) != INFO::OK)
return;
}
if(!list.empty())

View File

@ -170,42 +170,24 @@ static LibError AppendDriverVersionsFromRegistry(std::wstring& versionList)
}
static wchar_t* DllName()
static LibError AppendDriverVersionsFromKnownFiles(std::wstring& versionList)
{
if(!wcsncmp(gfx_card, L"NVIDIA", 6))
{
if(wutil_IsWow64())
{
#if ARCH_AMD64
return L"nvoglv64.dll";
#else
return L"nvoglv32.dll";
#endif
}
else
return L"nvoglnt.dll";
wdll_ver_Append(L"nvoglv64.dll", versionList);
wdll_ver_Append(L"nvoglv32.dll", versionList);
wdll_ver_Append(L"nvoglnt.dll", versionList);
}
else if(!wcsncmp(gfx_card, L"ATI", 3))
{
return L"atioglxx.dll";
wdll_ver_Append(L"atioglxx.dll", versionList);
}
else if(!wcsncmp(gfx_card, L"Intel", 5))
{
return L"igxpdv32.dll";
wdll_ver_Append(L"igxpdv32.dll", versionList);
}
else
{
return 0; // unknown
}
}
static LibError AppendDriverVersionsFromDLL(std::wstring& versionList)
{
const wchar_t* dllName = DllName();
if(!dllName)
WARN_RETURN(ERR::NOT_IMPLEMENTED);
wdll_ver_Append(dllName, versionList);
return INFO::CANNOT_HANDLE;
return INFO::OK;
}
@ -217,7 +199,7 @@ LibError win_get_gfx_info()
std::wstring versionList;
if(AppendDriverVersionsFromRegistry(versionList) != INFO::OK) // (fails on Windows 7)
{
if(AppendDriverVersionsFromDLL(versionList) != INFO::OK)
if(AppendDriverVersionsFromKnownFiles(versionList) != INFO::OK)
versionList = L"(unknown)";
}
wcscpy_s(gfx_drv_ver, GFX_DRV_VER_LEN, versionList.c_str());