MCPcopy Create free account
hub / github.com/JHRobotics/softgpu / version_win

Function version_win

windrv.c:340–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340void version_win(version_t *v)
341{
342 memset(v, 0, sizeof(version_t));
343
344 HANDLE h = GetModuleHandleA("kernel32.dll");
345 if(h)
346 {
347 GetVersionFunc GetVersionPtr = (GetVersionFunc)GetProcAddress(h, "GetVersion");
348 DWORD dwVersion = 0;
349
350 if(GetVersionPtr != NULL)
351 {
352 dwVersion = GetVersionPtr();
353 v->major = (int)(LOBYTE(LOWORD(dwVersion)));
354 v->minor = (int)(HIBYTE(LOWORD(dwVersion)));
355
356 if (dwVersion < 0x80000000)
357 {
358 v->build = (int)(HIWORD(dwVersion));
359 }
360
361 if(v->major == 4 && !version_is_nt())
362 {
363 version_t vreg;
364 static char vbuf[32];
365 if(registryRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\VersionNumber", vbuf, sizeof(vbuf)))
366 {
367 version_parse(vbuf, &vreg);
368 if(vreg.major == v->major
369 && vreg.minor == v->minor)
370 {
371 v->patch = vreg.patch;
372 }
373 }
374 }
375
376 return;
377 }
378 }
379
380 /* windows >= 8.1 doesn't have this GetVersion */
381 v->major = 8;
382 v->minor = 1;
383}
384
385/*
386* NT function tip from: https://stackoverflow.com/a/57130

Callers 1

softgpu_sysinfoFunction · 0.85

Calls 3

version_is_ntFunction · 0.85
registryReadFunction · 0.85
version_parseFunction · 0.85

Tested by

no test coverage detected