| #include <windows.h> |
| #include <nt.h> |
| |
| long int __stdcall RtlGetVersion(RTL_OSVERSIONINFO *VersionInformation) { |
| PROCESS_BASIC_INFORMATION pbi; |
| long int r = NtQueryInformationProcess((void *)-1, ProcessBasicInformation, &pbi, sizeof pbi, NULL); |
| if(r < 0) return r; |
| PEB *peb = pbi.PebBaseAddress; |
| VersionInformation->dwMajorVersion = peb->OSMajorVersion; |
| VersionInformation->dwMinorVersion = peb->OSMinorVersion; |
| VersionInformation->dwBuildNumber = peb->OSBuildNumber; |
| VersionInformation->dwPlatformId = peb->OSPlatformId; |
| return 0; |
| } |