add VideoDriverInfo
This commit is contained in:
@@ -2,17 +2,10 @@
|
||||
#include "DebugInfoHunt.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "VideoDriverInfo.h"
|
||||
#include "../../archutils/Win32/GotoURL.h"
|
||||
|
||||
|
||||
struct VideoDriverInfo
|
||||
{
|
||||
CString sProvider;
|
||||
CString sDescription;
|
||||
CString sVersion;
|
||||
CString sDate;
|
||||
CString sDeviceID;
|
||||
};
|
||||
|
||||
|
||||
void LogVideoDriverInfo( VideoDriverInfo info )
|
||||
@@ -25,90 +18,6 @@ void LogVideoDriverInfo( VideoDriverInfo info )
|
||||
LOG->Info("%-15s:\t%s", "DeviceID", info.sDeviceID.c_str());
|
||||
}
|
||||
|
||||
CString GetRegValue( HKEY hKey, CString sName )
|
||||
{
|
||||
char szBuffer[MAX_PATH];
|
||||
DWORD nSize = sizeof(szBuffer)-1;
|
||||
if( RegQueryValueEx(hKey, sName, NULL, NULL, (LPBYTE)szBuffer, &nSize) == ERROR_SUCCESS )
|
||||
return szBuffer;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GetVideoDriverInfo9x( int iIndex, VideoDriverInfo& infoOut )
|
||||
{
|
||||
HKEY hkey;
|
||||
CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Services\\Class\\Display\\%04d",iIndex);
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
infoOut.sDate = GetRegValue( hkey, "DriverDate");
|
||||
infoOut.sDescription = GetRegValue( hkey, "DriverDesc");
|
||||
infoOut.sDeviceID = GetRegValue( hkey, "MatchingDeviceId");
|
||||
infoOut.sProvider = GetRegValue( hkey, "ProviderName");
|
||||
infoOut.sVersion = GetRegValue( hkey, "Ver");
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool GetVideoDriverInfo2k( int iIndex, VideoDriverInfo& infoOut )
|
||||
{
|
||||
HKEY hkey;
|
||||
CString sKey = ssprintf("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E968-E325-11CE-BFC1-08002BE10318}\\%04d",iIndex);
|
||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, sKey, &hkey) != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
infoOut.sDate = GetRegValue( hkey, "DriverDate");
|
||||
infoOut.sDescription = GetRegValue( hkey, "DriverDesc");
|
||||
infoOut.sDeviceID = GetRegValue( hkey, "MatchingDeviceId");
|
||||
infoOut.sProvider = GetRegValue( hkey, "ProviderName");
|
||||
infoOut.sVersion = GetRegValue( hkey, "DriverVersion");
|
||||
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
CString GetPrimaryVideoName9xAnd2k() // this will not work on 95 and NT b/c of EnumDisplayDevices
|
||||
{
|
||||
|
||||
typedef BOOL (WINAPI* pfnEnumDisplayDevices)(PVOID,DWORD,PDISPLAY_DEVICE,DWORD);
|
||||
pfnEnumDisplayDevices EnumDisplayDevices;
|
||||
HINSTANCE hInstUser32;
|
||||
|
||||
hInstUser32 = LoadLibrary("User32.DLL");
|
||||
if( !hInstUser32 )
|
||||
return "";
|
||||
|
||||
// VC6 don't have a stub to static link with, so link dynamically.
|
||||
EnumDisplayDevices = (pfnEnumDisplayDevices)GetProcAddress(hInstUser32,"EnumDisplayDevicesA");
|
||||
if( EnumDisplayDevices == NULL )
|
||||
{
|
||||
FreeLibrary(hInstUser32);
|
||||
return "";
|
||||
}
|
||||
|
||||
CString sPrimaryDeviceName;
|
||||
for( DWORD i=0; true; i++ )
|
||||
{
|
||||
DISPLAY_DEVICE dd;
|
||||
ZERO( dd );
|
||||
dd.cb = sizeof(dd);
|
||||
if( !EnumDisplayDevices(NULL, i, &dd, 0) )
|
||||
break;
|
||||
if( dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE )
|
||||
{
|
||||
sPrimaryDeviceName = (char*)dd.DeviceString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hInstUser32);
|
||||
return sPrimaryDeviceName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -121,15 +30,10 @@ static void GetDisplayDriverDebugInfo()
|
||||
else
|
||||
LOG->Info( "Primary display driver: %s", sPrimaryDeviceName.c_str() );
|
||||
|
||||
OSVERSIONINFO version;
|
||||
version.dwOSVersionInfoSize=sizeof(version);
|
||||
GetVersionEx(&version);
|
||||
bool bIsWin9x = version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS;
|
||||
|
||||
for( int i=0; true; i++ )
|
||||
{
|
||||
VideoDriverInfo info;
|
||||
if( ! (bIsWin9x ? GetVideoDriverInfo9x : GetVideoDriverInfo2k)(i,info) )
|
||||
if( !GetVideoDriverInfo(i, info) )
|
||||
break;
|
||||
|
||||
if( sPrimaryDeviceName == "" ) // failed to get primary disaply name (NT4)
|
||||
|
||||
Reference in New Issue
Block a user