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