Skip to content

Instantly share code, notes, and snippets.

@myfreeer
Created August 10, 2018 06:51
Show Gist options
  • Save myfreeer/2179898828fe8bc062bb51722a80514f to your computer and use it in GitHub Desktop.
Save myfreeer/2179898828fe8bc062bb51722a80514f to your computer and use it in GitHub Desktop.
header for RtlGetVersion, RtlVerifyVersionInfo, and RtlGetNtVersionNumbers in user mode
// Compiles with -lntdll
#pragma once
#ifndef __RTL_VERSION_H__
#define __RTL_VERSION_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#ifdef _MSC_VER
// not tested yet
#pragma comment(lib, "ntdll")
#endif // _MSC_VER
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
typedef _Success_(return >= 0) LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
NTSYSAPI NTSTATUS NTAPI RtlGetVersion(
_Out_ PRTL_OSVERSIONINFOEXW lpVersionInformation
);
NTSYSAPI NTSTATUS NTAPI RtlVerifyVersionInfo(
_In_ PRTL_OSVERSIONINFOEXW VersionInfo,
_In_ ULONG TypeMask,
_In_ ULONGLONG ConditionMask
);
// rev
NTSYSAPI VOID NTAPI RtlGetNtVersionNumbers(
_Out_opt_ PULONG NtMajorVersion,
_Out_opt_ PULONG NtMinorVersion,
_Out_opt_ PULONG NtBuildNumber
);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __RTL_VERSION_H__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment