1 #ifndef __CROSS_VERSION_LIB_NT__H__ 2 #define __CROSS_VERSION_LIB_NT__H__ 3 4 extern "C" { 5 6 #pragma pack(push, 8) 7 8 #if !defined(NT_INCLUDED) 9 #include <ntddk.h> // various NT definitions 10 #endif 11 12 #include <stddef.h> 13 #include <string.h> 14 #include <stdarg.h> 15 #include <stdio.h> 16 #include "ntddk_ex.h" 17 18 #include "rwlock.h" 19 20 #ifdef CROSS_NT_INTERNAL 21 #include "ilock.h" 22 #endif //CROSS_NT_INTERNAL 23 24 #include "misc.h" 25 #include "tools.h" 26 27 #pragma pack(pop) 28 29 extern "C" 30 NTSTATUS 31 CrNtInit( 32 IN PDRIVER_OBJECT DriverObject, 33 IN PUNICODE_STRING RegistryPath 34 ); 35 36 extern "C" 37 ULONG 38 CrNtGetCPUGen(); 39 40 extern "C" 41 PVOID 42 CrNtGetModuleBase( 43 IN PCHAR pModuleName 44 ); 45 46 extern "C" 47 PVOID 48 CrNtFindModuleBaseByPtr( 49 IN PVOID ptrInSection, 50 IN PCHAR ptrExportedName 51 ); 52 53 extern "C" 54 PVOID 55 CrNtGetProcAddress( 56 PVOID ModuleBase, 57 PCHAR pFunctionName 58 ); 59 60 typedef BOOLEAN (__stdcall *ptrCrNtPsGetVersion)( 61 PULONG MajorVersion OPTIONAL, 62 PULONG MinorVersion OPTIONAL, 63 PULONG BuildNumber OPTIONAL, 64 PUNICODE_STRING CSDVersion OPTIONAL 65 ); 66 67 extern "C" 68 ptrCrNtPsGetVersion CrNtPsGetVersion; 69 70 typedef NTSTATUS (__stdcall *ptrCrNtNtQuerySystemInformation)( 71 IN SYSTEM_INFORMATION_CLASS SystemInfoClass, 72 OUT PVOID SystemInfoBuffer, 73 IN ULONG SystemInfoBufferSize, 74 OUT PULONG BytesReturned OPTIONAL 75 ); 76 77 extern "C" 78 ptrCrNtNtQuerySystemInformation CrNtNtQuerySystemInformation; 79 80 extern "C" 81 PVOID 82 CrNtSkipImportStub( 83 PVOID p 84 ); 85 86 extern "C" { 87 88 extern ULONG MajorVersion; 89 extern ULONG MinorVersion; 90 extern ULONG BuildNumber; 91 extern ULONG SPVersion; 92 93 extern HANDLE g_hNtosKrnl; 94 extern HANDLE g_hHal; 95 96 extern PCHAR g_KeNumberProcessors; 97 98 }; 99 100 #define WinVer_Is351 (MajorVersion==0x03) 101 #define WinVer_IsNT (MajorVersion==0x04) 102 #define WinVer_Is2k (MajorVersion==0x05 && MinorVersion==0x00) 103 #define WinVer_IsXP (MajorVersion==0x05 && MinorVersion==0x01) 104 #define WinVer_IsXPp (MajorVersion==0x05 && MinorVersion>=0x01) 105 #define WinVer_IsdNET (MajorVersion==0x05 && MinorVersion==0x02) 106 #define WinVer_IsdNETp ((MajorVersion==0x05 && MinorVersion>=0x02) || (MajorVersion>0x05)) 107 #define WinVer_IsVista (MajorVersion==0x06 && MinorVersion==0x00) 108 109 #define WinVer_Id() ((MajorVersion << 8) | MinorVersion) 110 111 #define WinVer_351 (0x0351) 112 #define WinVer_NT (0x0400) 113 #define WinVer_ROS (0x0401) 114 #define WinVer_2k (0x0500) 115 #define WinVer_XP (0x0501) 116 #define WinVer_dNET (0x0502) 117 #define WinVer_Vista (0x0600) 118 119 #ifdef _DEBUG 120 121 // NT3.51 doesn't export strlen() and strcmp() 122 // The same time, Release build doesn't depend no these functions since they are inlined 123 124 size_t __cdecl CrNtstrlen ( 125 const char * str 126 ); 127 128 int __cdecl CrNtstrcmp ( 129 const char * src, 130 const char * dst 131 ); 132 133 #define strlen CrNtstrlen 134 #define strcmp CrNtstrcmp 135 136 #endif //_DEBUG 137 138 #define CROSSNT_DECL_API 139 140 #include "CrNtDecl.h" 141 #include "CrNtStubs.h" 142 143 #undef CROSSNT_DECL_API 144 145 }; // end extern "C" 146 147 #endif //__CROSS_VERSION_LIB_NT__H__