MCPcopy Create free account
hub / github.com/WinDurango/WinDurango / GetSystemOSVersion

Function GetSystemOSVersion

projects/WinDurango.KernelX/src/kernelx.cpp:11–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9EXTERN_C CONSOLE_TYPE __stdcall GetConsoleType()
10{
11 return CONSOLE_TYPE_XBOX_ONE;
12}
13
14EXTERN_C VOID __stdcall GetSystemOSVersion(LPSYSTEMOSVERSIONINFO lpVersionInformation)
15{
16 DWORD FileVersionSize = GetFileVersionInfoSizeW(L".\\EmbeddedXvd\\Windows\\System32\\combase.dll", NULL);
17 if (!FileVersionSize)
18 {
19 MessageBoxW(nullptr,
20 L"Couldn't get the combase version info size! Make sure you have EmbeddedXvd in the game "
21 L"root/Mount folder.",
22 L"Error!", MB_OK);
23 }
24
25 BYTE *Data = new BYTE[FileVersionSize];
26 BOOL ret = GetFileVersionInfoW(L".\\EmbeddedXvd\\Windows\\System32\\combase.dll", NULL, FileVersionSize, Data);
27 if (!ret)
28 {
29 MessageBoxW(
30 nullptr,
31 L"Couldn't get the combase version info! Make sure you have EmbeddedXvd in the game root/Mount folder.",
32 L"Error!", MB_OK);
33 delete[] Data;
34 }
35
36 VS_FIXEDFILEINFO *pFixedFileInfo{};
37 UINT Length = 0;
38
39 VerQueryValueW(Data, L"\\", (LPVOID *)&pFixedFileInfo, &Length);
40 if (!pFixedFileInfo)
41 {
42 MessageBoxW(
43 nullptr,
44 L"Couldn't get the combase version value! Make sure you have EmbeddedXvd in the game root/Mount folder.",
45 L"Error!", MB_OK);
46 delete[] Data;
47 }
48
49 DWORD major = HIWORD(pFixedFileInfo->dwProductVersionMS);
50 DWORD minor = LOWORD(pFixedFileInfo->dwProductVersionMS);
51 DWORD build = HIWORD(pFixedFileInfo->dwProductVersionLS);
52 DWORD revision = LOWORD(pFixedFileInfo->dwProductVersionLS);
53
54 lpVersionInformation->MajorVersion = (BYTE)major;
55 lpVersionInformation->MinorVersion = (BYTE)minor;
56 lpVersionInformation->BuildNumber = (WORD)build;
57 lpVersionInformation->Revision = (WORD)revision;
58 delete[] Data;
59}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected