27 #include "precompiled.h"
36 #pragma comment(lib, "advapi32.lib") // registry
60 wchar_t dllName[MAX_PATH+1];
63 const wchar_t*
key = L
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers";
66 if(RegOpenKeyExW(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkDrivers) != 0)
70 for(
DWORD i = 0; ; i++)
72 wchar_t driverName[32];
74 const LONG err = RegEnumKeyExW(hkDrivers, i, driverName, &driverNameLength, 0, 0, 0, 0);
75 if(err == ERROR_NO_MORE_ITEMS)
79 RegCloseKey(hkDrivers);
84 ENSURE(err == ERROR_SUCCESS);
87 if(RegOpenKeyExW(hkDrivers, driverName, 0, KEY_QUERY_VALUE, &hkDriver) == 0)
90 if(RegQueryValueExW(hkDriver, L
"Dll", 0, 0, (LPBYTE)dllName, &dllNameLength) == 0)
93 RegCloseKey(hkDriver);
100 for(
DWORD i = 0; ; i++)
106 const DWORD err = RegEnumValueW(hkDrivers, i, name, &nameLength, 0, &type, (LPBYTE)dllName, &dllNameLength);
107 if(err == ERROR_NO_MORE_ITEMS)
109 ENSURE(err == ERROR_SUCCESS);
114 RegCloseKey(hkDrivers);
144 wchar_t* pos = cardName;
145 for(WmiInstances::iterator it = instances.begin(); it != instances.end(); ++it)
147 if((*it)[L
"Availability"].intVal == 8)
149 const int ret =
swprintf_s(pos, numChars-(pos-cardName), L
"%ls; ", (*it)[L
"Caption"].bstrVal);
175 DEVMODE
dm = {
sizeof(
dm) };
177 if(!EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &dm))
181 const DWORD expectedFlags = DM_PELSWIDTH|DM_PELSHEIGHT|DM_BITSPERPEL|DM_DISPLAYFREQUENCY|DM_DISPLAYFLAGS;
182 ENSURE((dm.dmFields & expectedFlags) == expectedFlags);
185 *xres = (int)dm.dmPelsWidth;
187 *yres = (int)dm.dmPelsHeight;
189 *bpp = (int)dm.dmBitsPerPel;
191 *freq = (int)dm.dmDisplayFrequency;
200 const HDC hDC = GetDC(0);
201 width_mm = GetDeviceCaps(hDC, HORZSIZE);
202 height_mm = GetDeviceCaps(hDC, VERTSIZE);
LIB_API Status GetVideoMode(int *xres, int *yres, int *bpp, int *freq)
(useful for choosing a new video mode)
int swprintf_s(wchar_t *buf, size_t max_chars, const wchar_t *fmt,...) WPRINTF_ARGS(3)
std::vector< WmiInstance > WmiInstances
const Status NOT_SUPPORTED
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
void wdll_ver_Append(const OsPath &pathname, VersionList &list)
Read DLL version information and append it to a string.
Status wgfx_CardName(wchar_t *cardName, size_t numChars)
Status wmi_GetClassInstances(const wchar_t *className, WmiInstances &instances)
get all instances of the requested class.
i64 Status
Error handling system.
LIB_API Status GetMonitorSize(int &width_mm, int &height_mm)
(useful for determining aspect ratio)
static Status AppendDriverVersionsFromRegistry(VersionList &versionList)
#define WARN_RETURN(status)
std::wstring wgfx_DriverInfo()
static void AppendDriverVersionsFromKnownFiles(VersionList &versionList)
#define RETURN_STATUS_IF_ERR(expression)