| ... | ... | @@ -23,23 +23,88 @@ const FILE_BASIC_INFORMATION = windows.FILE_BASIC_INFORMATION; |
| 23 | 23 | const SIZE_T = windows.SIZE_T; |
| 24 | 24 | const CURDIR = windows.CURDIR; |
| 25 | 25 | |
| 26 | | pub extern "NtDll" fn RtlGetVersion( |
| 26 | pub const THREADINFOCLASS = enum(c_int) { |
| 27 | ThreadBasicInformation, |
| 28 | ThreadTimes, |
| 29 | ThreadPriority, |
| 30 | ThreadBasePriority, |
| 31 | ThreadAffinityMask, |
| 32 | ThreadImpersonationToken, |
| 33 | ThreadDescriptorTableEntry, |
| 34 | ThreadEnableAlignmentFaultFixup, |
| 35 | ThreadEventPair_Reusable, |
| 36 | ThreadQuerySetWin32StartAddress, |
| 37 | ThreadZeroTlsCell, |
| 38 | ThreadPerformanceCount, |
| 39 | ThreadAmILastThread, |
| 40 | ThreadIdealProcessor, |
| 41 | ThreadPriorityBoost, |
| 42 | ThreadSetTlsArrayAddress, |
| 43 | ThreadIsIoPending, |
| 44 | // Windows 2000+ from here |
| 45 | ThreadHideFromDebugger, |
| 46 | // Windows XP+ from here |
| 47 | ThreadBreakOnTermination, |
| 48 | ThreadSwitchLegacyState, |
| 49 | ThreadIsTerminated, |
| 50 | // Windows Vista+ from here |
| 51 | ThreadLastSystemCall, |
| 52 | ThreadIoPriority, |
| 53 | ThreadCycleTime, |
| 54 | ThreadPagePriority, |
| 55 | ThreadActualBasePriority, |
| 56 | ThreadTebInformation, |
| 57 | ThreadCSwitchMon, |
| 58 | // Windows 7+ from here |
| 59 | ThreadCSwitchPmu, |
| 60 | ThreadWow64Context, |
| 61 | ThreadGroupInformation, |
| 62 | ThreadUmsInformation, |
| 63 | ThreadCounterProfiling, |
| 64 | ThreadIdealProcessorEx, |
| 65 | // Windows 8+ from here |
| 66 | ThreadCpuAccountingInformation, |
| 67 | // Windows 8.1+ from here |
| 68 | ThreadSuspendCount, |
| 69 | // Windows 10+ from here |
| 70 | ThreadHeterogeneousCpuPolicy, |
| 71 | ThreadContainerId, |
| 72 | ThreadNameInformation, |
| 73 | ThreadSelectedCpuSets, |
| 74 | ThreadSystemThreadInformation, |
| 75 | ThreadActualGroupAffinity, |
| 76 | }; |
| 77 | pub extern "ntdll" fn NtQueryInformationThread( |
| 78 | ThreadHandle: HANDLE, |
| 79 | ThreadInformationClass: THREADINFOCLASS, |
| 80 | ThreadInformation: *anyopaque, |
| 81 | ThreadInformationLength: ULONG, |
| 82 | ReturnLength: ?*ULONG, |
| 83 | ) callconv(WINAPI) NTSTATUS; |
| 84 | pub extern "ntdll" fn NtSetInformationThread( |
| 85 | ThreadHandle: HANDLE, |
| 86 | ThreadInformationClass: THREADINFOCLASS, |
| 87 | ThreadInformation: *const anyopaque, |
| 88 | ThreadInformationLength: ULONG, |
| 89 | ) callconv(WINAPI) NTSTATUS; |
| 90 | |
| 91 | pub extern "ntdll" fn RtlGetVersion( |
| 27 | 92 | lpVersionInformation: *RTL_OSVERSIONINFOW, |
| 28 | 93 | ) callconv(WINAPI) NTSTATUS; |
| 29 | | pub extern "NtDll" fn RtlCaptureStackBackTrace( |
| 94 | pub extern "ntdll" fn RtlCaptureStackBackTrace( |
| 30 | 95 | FramesToSkip: DWORD, |
| 31 | 96 | FramesToCapture: DWORD, |
| 32 | 97 | BackTrace: **anyopaque, |
| 33 | 98 | BackTraceHash: ?*DWORD, |
| 34 | 99 | ) callconv(WINAPI) WORD; |
| 35 | | pub extern "NtDll" fn NtQueryInformationFile( |
| 100 | pub extern "ntdll" fn NtQueryInformationFile( |
| 36 | 101 | FileHandle: HANDLE, |
| 37 | 102 | IoStatusBlock: *IO_STATUS_BLOCK, |
| 38 | 103 | FileInformation: *anyopaque, |
| 39 | 104 | Length: ULONG, |
| 40 | 105 | FileInformationClass: FILE_INFORMATION_CLASS, |
| 41 | 106 | ) callconv(WINAPI) NTSTATUS; |
| 42 | | pub extern "NtDll" fn NtSetInformationFile( |
| 107 | pub extern "ntdll" fn NtSetInformationFile( |
| 43 | 108 | FileHandle: HANDLE, |
| 44 | 109 | IoStatusBlock: *IO_STATUS_BLOCK, |
| 45 | 110 | FileInformation: PVOID, |
| ... | ... | @@ -47,12 +112,12 @@ pub extern "NtDll" fn NtSetInformationFile( |
| 47 | 112 | FileInformationClass: FILE_INFORMATION_CLASS, |
| 48 | 113 | ) callconv(WINAPI) NTSTATUS; |
| 49 | 114 | |
| 50 | | pub extern "NtDll" fn NtQueryAttributesFile( |
| 115 | pub extern "ntdll" fn NtQueryAttributesFile( |
| 51 | 116 | ObjectAttributes: *OBJECT_ATTRIBUTES, |
| 52 | 117 | FileAttributes: *FILE_BASIC_INFORMATION, |
| 53 | 118 | ) callconv(WINAPI) NTSTATUS; |
| 54 | 119 | |
| 55 | | pub extern "NtDll" fn NtCreateFile( |
| 120 | pub extern "ntdll" fn NtCreateFile( |
| 56 | 121 | FileHandle: *HANDLE, |
| 57 | 122 | DesiredAccess: ACCESS_MASK, |
| 58 | 123 | ObjectAttributes: *OBJECT_ATTRIBUTES, |
| ... | ... | @@ -65,7 +130,7 @@ pub extern "NtDll" fn NtCreateFile( |
| 65 | 130 | EaBuffer: ?*anyopaque, |
| 66 | 131 | EaLength: ULONG, |
| 67 | 132 | ) callconv(WINAPI) NTSTATUS; |
| 68 | | pub extern "NtDll" fn NtDeviceIoControlFile( |
| 133 | pub extern "ntdll" fn NtDeviceIoControlFile( |
| 69 | 134 | FileHandle: HANDLE, |
| 70 | 135 | Event: ?HANDLE, |
| 71 | 136 | ApcRoutine: ?IO_APC_ROUTINE, |
| ... | ... | @@ -77,7 +142,7 @@ pub extern "NtDll" fn NtDeviceIoControlFile( |
| 77 | 142 | OutputBuffer: ?PVOID, |
| 78 | 143 | OutputBufferLength: ULONG, |
| 79 | 144 | ) callconv(WINAPI) NTSTATUS; |
| 80 | | pub extern "NtDll" fn NtFsControlFile( |
| 145 | pub extern "ntdll" fn NtFsControlFile( |
| 81 | 146 | FileHandle: HANDLE, |
| 82 | 147 | Event: ?HANDLE, |
| 83 | 148 | ApcRoutine: ?IO_APC_ROUTINE, |
| ... | ... | @@ -89,16 +154,16 @@ pub extern "NtDll" fn NtFsControlFile( |
| 89 | 154 | OutputBuffer: ?PVOID, |
| 90 | 155 | OutputBufferLength: ULONG, |
| 91 | 156 | ) callconv(WINAPI) NTSTATUS; |
| 92 | | pub extern "NtDll" fn NtClose(Handle: HANDLE) callconv(WINAPI) NTSTATUS; |
| 93 | | pub extern "NtDll" fn RtlDosPathNameToNtPathName_U( |
| 157 | pub extern "ntdll" fn NtClose(Handle: HANDLE) callconv(WINAPI) NTSTATUS; |
| 158 | pub extern "ntdll" fn RtlDosPathNameToNtPathName_U( |
| 94 | 159 | DosPathName: [*:0]const u16, |
| 95 | 160 | NtPathName: *UNICODE_STRING, |
| 96 | 161 | NtFileNamePart: ?*?[*:0]const u16, |
| 97 | 162 | DirectoryInfo: ?*CURDIR, |
| 98 | 163 | ) callconv(WINAPI) BOOL; |
| 99 | | pub extern "NtDll" fn RtlFreeUnicodeString(UnicodeString: *UNICODE_STRING) callconv(WINAPI) void; |
| 164 | pub extern "ntdll" fn RtlFreeUnicodeString(UnicodeString: *UNICODE_STRING) callconv(WINAPI) void; |
| 100 | 165 | |
| 101 | | pub extern "NtDll" fn NtQueryDirectoryFile( |
| 166 | pub extern "ntdll" fn NtQueryDirectoryFile( |
| 102 | 167 | FileHandle: HANDLE, |
| 103 | 168 | Event: ?HANDLE, |
| 104 | 169 | ApcRoutine: ?IO_APC_ROUTINE, |
| ... | ... | @@ -112,30 +177,30 @@ pub extern "NtDll" fn NtQueryDirectoryFile( |
| 112 | 177 | RestartScan: BOOLEAN, |
| 113 | 178 | ) callconv(WINAPI) NTSTATUS; |
| 114 | 179 | |
| 115 | | pub extern "NtDll" fn NtCreateKeyedEvent( |
| 180 | pub extern "ntdll" fn NtCreateKeyedEvent( |
| 116 | 181 | KeyedEventHandle: *HANDLE, |
| 117 | 182 | DesiredAccess: ACCESS_MASK, |
| 118 | 183 | ObjectAttributes: ?PVOID, |
| 119 | 184 | Flags: ULONG, |
| 120 | 185 | ) callconv(WINAPI) NTSTATUS; |
| 121 | 186 | |
| 122 | | pub extern "NtDll" fn NtReleaseKeyedEvent( |
| 187 | pub extern "ntdll" fn NtReleaseKeyedEvent( |
| 123 | 188 | EventHandle: ?HANDLE, |
| 124 | 189 | Key: ?*const anyopaque, |
| 125 | 190 | Alertable: BOOLEAN, |
| 126 | 191 | Timeout: ?*const LARGE_INTEGER, |
| 127 | 192 | ) callconv(WINAPI) NTSTATUS; |
| 128 | 193 | |
| 129 | | pub extern "NtDll" fn NtWaitForKeyedEvent( |
| 194 | pub extern "ntdll" fn NtWaitForKeyedEvent( |
| 130 | 195 | EventHandle: ?HANDLE, |
| 131 | 196 | Key: ?*const anyopaque, |
| 132 | 197 | Alertable: BOOLEAN, |
| 133 | 198 | Timeout: ?*const LARGE_INTEGER, |
| 134 | 199 | ) callconv(WINAPI) NTSTATUS; |
| 135 | 200 | |
| 136 | | pub extern "NtDll" fn RtlSetCurrentDirectory_U(PathName: *UNICODE_STRING) callconv(WINAPI) NTSTATUS; |
| 201 | pub extern "ntdll" fn RtlSetCurrentDirectory_U(PathName: *UNICODE_STRING) callconv(WINAPI) NTSTATUS; |
| 137 | 202 | |
| 138 | | pub extern "NtDll" fn NtQueryObject( |
| 203 | pub extern "ntdll" fn NtQueryObject( |
| 139 | 204 | Handle: HANDLE, |
| 140 | 205 | ObjectInformationClass: OBJECT_INFORMATION_CLASS, |
| 141 | 206 | ObjectInformation: PVOID, |
| ... | ... | @@ -143,22 +208,22 @@ pub extern "NtDll" fn NtQueryObject( |
| 143 | 208 | ReturnLength: ?*ULONG, |
| 144 | 209 | ) callconv(WINAPI) NTSTATUS; |
| 145 | 210 | |
| 146 | | pub extern "NtDll" fn RtlWakeAddressAll( |
| 211 | pub extern "ntdll" fn RtlWakeAddressAll( |
| 147 | 212 | Address: ?*const anyopaque, |
| 148 | 213 | ) callconv(WINAPI) void; |
| 149 | 214 | |
| 150 | | pub extern "NtDll" fn RtlWakeAddressSingle( |
| 215 | pub extern "ntdll" fn RtlWakeAddressSingle( |
| 151 | 216 | Address: ?*const anyopaque, |
| 152 | 217 | ) callconv(WINAPI) void; |
| 153 | 218 | |
| 154 | | pub extern "NtDll" fn RtlWaitOnAddress( |
| 219 | pub extern "ntdll" fn RtlWaitOnAddress( |
| 155 | 220 | Address: ?*const anyopaque, |
| 156 | 221 | CompareAddress: ?*const anyopaque, |
| 157 | 222 | AddressSize: SIZE_T, |
| 158 | 223 | Timeout: ?*const LARGE_INTEGER, |
| 159 | 224 | ) callconv(WINAPI) NTSTATUS; |
| 160 | 225 | |
| 161 | | pub extern "NtDll" fn NtLockFile( |
| 226 | pub extern "ntdll" fn NtLockFile( |
| 162 | 227 | FileHandle: HANDLE, |
| 163 | 228 | Event: ?HANDLE, |
| 164 | 229 | ApcRoutine: ?*IO_APC_ROUTINE, |
| ... | ... | @@ -171,7 +236,7 @@ pub extern "NtDll" fn NtLockFile( |
| 171 | 236 | ExclusiveLock: BOOLEAN, |
| 172 | 237 | ) callconv(WINAPI) NTSTATUS; |
| 173 | 238 | |
| 174 | | pub extern "NtDll" fn NtUnlockFile( |
| 239 | pub extern "ntdll" fn NtUnlockFile( |
| 175 | 240 | FileHandle: HANDLE, |
| 176 | 241 | IoStatusBlock: *IO_STATUS_BLOCK, |
| 177 | 242 | ByteOffset: *const LARGE_INTEGER, |