| 1 | /* $Id: ntstuff.h 2852 2016-08-31 20:46:34Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | * Definitions, types, prototypes and globals for NT.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | * Copyright (c) 2005-2013 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
|
|---|
| 8 | *
|
|---|
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
|---|
| 10 | * copy of this software and associated documentation files (the "Software"),
|
|---|
| 11 | * to deal in the Software without restriction, including without limitation
|
|---|
| 12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|---|
| 13 | * and/or sell copies of the Software, and to permit persons to whom the
|
|---|
| 14 | * Software is furnished to do so, subject to the following conditions:
|
|---|
| 15 | *
|
|---|
| 16 | * The above copyright notice and this permission notice shall be included
|
|---|
| 17 | * in all copies or substantial portions of the Software.
|
|---|
| 18 | *
|
|---|
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|---|
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|---|
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|---|
| 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|---|
| 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|---|
| 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|---|
| 25 | * IN THE SOFTWARE.
|
|---|
| 26 | *
|
|---|
| 27 | * Alternatively, the content of this file may be used under the terms of the
|
|---|
| 28 | * GPL version 2 or later, or LGPL version 2.1 or later.
|
|---|
| 29 | */
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | #ifndef ___nt_ntstuff_h
|
|---|
| 33 | #define ___nt_ntstuff_h
|
|---|
| 34 |
|
|---|
| 35 | #define timeval timeval_Windows
|
|---|
| 36 | #define WIN32_NO_STATUS
|
|---|
| 37 | #include <Windows.h>
|
|---|
| 38 | #undef WIN32_NO_STATUS
|
|---|
| 39 | #include <ntstatus.h>
|
|---|
| 40 | #undef timeval
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | /** @defgroup grp_nt_ntstuff NT Stuff
|
|---|
| 44 | * @{ */
|
|---|
| 45 |
|
|---|
| 46 | typedef LONG MY_NTSTATUS;
|
|---|
| 47 | typedef ULONG MY_ACCESS_MASK;
|
|---|
| 48 |
|
|---|
| 49 | typedef struct MY_IO_STATUS_BLOCK
|
|---|
| 50 | {
|
|---|
| 51 | union
|
|---|
| 52 | {
|
|---|
| 53 | MY_NTSTATUS Status;
|
|---|
| 54 | PVOID Pointer;
|
|---|
| 55 | } u;
|
|---|
| 56 | ULONG_PTR Information;
|
|---|
| 57 | } MY_IO_STATUS_BLOCK;
|
|---|
| 58 |
|
|---|
| 59 | typedef VOID WINAPI MY_IO_APC_ROUTINE(PVOID, MY_IO_STATUS_BLOCK *, ULONG);
|
|---|
| 60 |
|
|---|
| 61 | typedef struct MY_UNICODE_STRING
|
|---|
| 62 | {
|
|---|
| 63 | USHORT Length;
|
|---|
| 64 | USHORT MaximumLength;
|
|---|
| 65 | PWSTR Buffer;
|
|---|
| 66 | } MY_UNICODE_STRING;
|
|---|
| 67 |
|
|---|
| 68 | typedef struct MY_STRING
|
|---|
| 69 | {
|
|---|
| 70 | USHORT Length;
|
|---|
| 71 | USHORT MaximumLength;
|
|---|
| 72 | PCHAR Buffer;
|
|---|
| 73 | } MY_STRING;
|
|---|
| 74 | typedef MY_STRING MY_ANSI_STRING;
|
|---|
| 75 |
|
|---|
| 76 | typedef struct MY_OBJECT_ATTRIBUTES
|
|---|
| 77 | {
|
|---|
| 78 | ULONG Length;
|
|---|
| 79 | HANDLE RootDirectory;
|
|---|
| 80 | MY_UNICODE_STRING *ObjectName;
|
|---|
| 81 | ULONG Attributes;
|
|---|
| 82 | PVOID SecurityDescriptor;
|
|---|
| 83 | PVOID SecurityQualityOfService;
|
|---|
| 84 | } MY_OBJECT_ATTRIBUTES;
|
|---|
| 85 |
|
|---|
| 86 | #define MyInitializeObjectAttributes(a_pAttr, a_pName, a_fAttribs, a_hRoot, a_pSecDesc) \
|
|---|
| 87 | do { \
|
|---|
| 88 | (a_pAttr)->Length = sizeof(MY_OBJECT_ATTRIBUTES); \
|
|---|
| 89 | (a_pAttr)->RootDirectory = (a_hRoot); \
|
|---|
| 90 | (a_pAttr)->Attributes = (a_fAttribs); \
|
|---|
| 91 | (a_pAttr)->ObjectName = (a_pName); \
|
|---|
| 92 | (a_pAttr)->SecurityDescriptor = (a_pSecDesc); \
|
|---|
| 93 | (a_pAttr)->SecurityQualityOfService = NULL; \
|
|---|
| 94 | } while (0)
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | typedef struct MY_FILE_BASIC_INFORMATION
|
|---|
| 99 | {
|
|---|
| 100 | LARGE_INTEGER CreationTime;
|
|---|
| 101 | LARGE_INTEGER LastAccessTime;
|
|---|
| 102 | LARGE_INTEGER LastWriteTime;
|
|---|
| 103 | LARGE_INTEGER ChangeTime;
|
|---|
| 104 | ULONG FileAttributes;
|
|---|
| 105 | } MY_FILE_BASIC_INFORMATION;
|
|---|
| 106 |
|
|---|
| 107 | typedef struct MY_FILE_STANDARD_INFORMATION
|
|---|
| 108 | {
|
|---|
| 109 | LARGE_INTEGER AllocationSize;
|
|---|
| 110 | LARGE_INTEGER EndOfFile;
|
|---|
| 111 | ULONG NumberOfLinks;
|
|---|
| 112 | BOOLEAN DeletePending;
|
|---|
| 113 | BOOLEAN Directory;
|
|---|
| 114 | } MY_FILE_STANDARD_INFORMATION;
|
|---|
| 115 |
|
|---|
| 116 | typedef struct MY_FILE_INTERNAL_INFORMATION
|
|---|
| 117 | {
|
|---|
| 118 | LARGE_INTEGER IndexNumber;
|
|---|
| 119 | } MY_FILE_INTERNAL_INFORMATION;
|
|---|
| 120 |
|
|---|
| 121 | typedef struct MY_FILE_EA_INFORMATION
|
|---|
| 122 | {
|
|---|
| 123 | ULONG EaSize;
|
|---|
| 124 | } MY_FILE_EA_INFORMATION;
|
|---|
| 125 |
|
|---|
| 126 | typedef struct MY_FILE_ACCESS_INFORMATION
|
|---|
| 127 | {
|
|---|
| 128 | ACCESS_MASK AccessFlags;
|
|---|
| 129 | } MY_FILE_ACCESS_INFORMATION;
|
|---|
| 130 |
|
|---|
| 131 | typedef struct MY_FILE_POSITION_INFORMATION
|
|---|
| 132 | {
|
|---|
| 133 | LARGE_INTEGER CurrentByteOffset;
|
|---|
| 134 | } MY_FILE_POSITION_INFORMATION;
|
|---|
| 135 |
|
|---|
| 136 | typedef struct MY_FILE_MODE_INFORMATION
|
|---|
| 137 | {
|
|---|
| 138 | ULONG Mode;
|
|---|
| 139 | } MY_FILE_MODE_INFORMATION;
|
|---|
| 140 |
|
|---|
| 141 | typedef struct MY_FILE_ALIGNMENT_INFORMATION
|
|---|
| 142 | {
|
|---|
| 143 | ULONG AlignmentRequirement;
|
|---|
| 144 | } MY_FILE_ALIGNMENT_INFORMATION;
|
|---|
| 145 |
|
|---|
| 146 | typedef struct MY_FILE_NAME_INFORMATION
|
|---|
| 147 | {
|
|---|
| 148 | ULONG FileNameLength;
|
|---|
| 149 | WCHAR FileName[1];
|
|---|
| 150 | } MY_FILE_NAME_INFORMATION;
|
|---|
| 151 |
|
|---|
| 152 | typedef struct MY_FILE_ALL_INFORMATION
|
|---|
| 153 | {
|
|---|
| 154 | MY_FILE_BASIC_INFORMATION BasicInformation;
|
|---|
| 155 | MY_FILE_STANDARD_INFORMATION StandardInformation;
|
|---|
| 156 | MY_FILE_INTERNAL_INFORMATION InternalInformation;
|
|---|
| 157 | MY_FILE_EA_INFORMATION EaInformation;
|
|---|
| 158 | MY_FILE_ACCESS_INFORMATION AccessInformation;
|
|---|
| 159 | MY_FILE_POSITION_INFORMATION PositionInformation;
|
|---|
| 160 | MY_FILE_MODE_INFORMATION ModeInformation;
|
|---|
| 161 | MY_FILE_ALIGNMENT_INFORMATION AlignmentInformation;
|
|---|
| 162 | MY_FILE_NAME_INFORMATION NameInformation;
|
|---|
| 163 | } MY_FILE_ALL_INFORMATION;
|
|---|
| 164 |
|
|---|
| 165 | typedef struct MY_FILE_ATTRIBUTE_TAG_INFORMATION
|
|---|
| 166 | {
|
|---|
| 167 | ULONG FileAttributes;
|
|---|
| 168 | ULONG ReparseTag;
|
|---|
| 169 | } MY_FILE_ATTRIBUTE_TAG_INFORMATION;
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 | typedef struct MY_FILE_NAMES_INFORMATION
|
|---|
| 173 | {
|
|---|
| 174 | ULONG NextEntryOffset;
|
|---|
| 175 | ULONG FileIndex;
|
|---|
| 176 | ULONG FileNameLength;
|
|---|
| 177 | WCHAR FileName[1];
|
|---|
| 178 | } MY_FILE_NAMES_INFORMATION;
|
|---|
| 179 | /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */
|
|---|
| 180 | #define MIN_SIZEOF_MY_FILE_NAMES_INFORMATION (4 + 4 + 4)
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 | typedef struct MY_FILE_ID_FULL_DIR_INFORMATION
|
|---|
| 184 | {
|
|---|
| 185 | ULONG NextEntryOffset;
|
|---|
| 186 | ULONG FileIndex;
|
|---|
| 187 | LARGE_INTEGER CreationTime;
|
|---|
| 188 | LARGE_INTEGER LastAccessTime;
|
|---|
| 189 | LARGE_INTEGER LastWriteTime;
|
|---|
| 190 | LARGE_INTEGER ChangeTime;
|
|---|
| 191 | LARGE_INTEGER EndOfFile;
|
|---|
| 192 | LARGE_INTEGER AllocationSize;
|
|---|
| 193 | ULONG FileAttributes;
|
|---|
| 194 | ULONG FileNameLength;
|
|---|
| 195 | ULONG EaSize;
|
|---|
| 196 | LARGE_INTEGER FileId;
|
|---|
| 197 | WCHAR FileName[1];
|
|---|
| 198 | } MY_FILE_ID_FULL_DIR_INFORMATION;
|
|---|
| 199 | /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */
|
|---|
| 200 | #define MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION ( (size_t)&((MY_FILE_ID_FULL_DIR_INFORMATION *)0)->FileName )
|
|---|
| 201 |
|
|---|
| 202 | typedef struct MY_FILE_BOTH_DIR_INFORMATION
|
|---|
| 203 | {
|
|---|
| 204 | ULONG NextEntryOffset;
|
|---|
| 205 | ULONG FileIndex;
|
|---|
| 206 | LARGE_INTEGER CreationTime;
|
|---|
| 207 | LARGE_INTEGER LastAccessTime;
|
|---|
| 208 | LARGE_INTEGER LastWriteTime;
|
|---|
| 209 | LARGE_INTEGER ChangeTime;
|
|---|
| 210 | LARGE_INTEGER EndOfFile;
|
|---|
| 211 | LARGE_INTEGER AllocationSize;
|
|---|
| 212 | ULONG FileAttributes;
|
|---|
| 213 | ULONG FileNameLength;
|
|---|
| 214 | ULONG EaSize;
|
|---|
| 215 | CCHAR ShortNameLength;
|
|---|
| 216 | WCHAR ShortName[12];
|
|---|
| 217 | WCHAR FileName[1];
|
|---|
| 218 | } MY_FILE_BOTH_DIR_INFORMATION;
|
|---|
| 219 | /** The sizeof(MY_FILE_BOTH_DIR_INFORMATION) without the FileName. */
|
|---|
| 220 | #define MIN_SIZEOF_MY_FILE_BOTH_DIR_INFORMATION ( (size_t)&((MY_FILE_BOTH_DIR_INFORMATION *)0)->FileName )
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | typedef struct MY_FILE_ID_BOTH_DIR_INFORMATION
|
|---|
| 224 | {
|
|---|
| 225 | ULONG NextEntryOffset;
|
|---|
| 226 | ULONG FileIndex;
|
|---|
| 227 | LARGE_INTEGER CreationTime;
|
|---|
| 228 | LARGE_INTEGER LastAccessTime;
|
|---|
| 229 | LARGE_INTEGER LastWriteTime;
|
|---|
| 230 | LARGE_INTEGER ChangeTime;
|
|---|
| 231 | LARGE_INTEGER EndOfFile;
|
|---|
| 232 | LARGE_INTEGER AllocationSize;
|
|---|
| 233 | ULONG FileAttributes;
|
|---|
| 234 | ULONG FileNameLength;
|
|---|
| 235 | ULONG EaSize;
|
|---|
| 236 | CCHAR ShortNameLength;
|
|---|
| 237 | WCHAR ShortName[12];
|
|---|
| 238 | LARGE_INTEGER FileId;
|
|---|
| 239 | WCHAR FileName[1];
|
|---|
| 240 | } MY_FILE_ID_BOTH_DIR_INFORMATION;
|
|---|
| 241 | /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */
|
|---|
| 242 | #define MIN_SIZEOF_MY_FILE_ID_BOTH_DIR_INFORMATION ( (size_t)&((MY_FILE_ID_BOTH_DIR_INFORMATION *)0)->FileName )
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 | typedef struct MY_FILE_DISPOSITION_INFORMATION
|
|---|
| 246 | {
|
|---|
| 247 | BOOLEAN DeleteFile;
|
|---|
| 248 | } MY_FILE_DISPOSITION_INFORMATION;
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 | typedef enum MY_FILE_INFORMATION_CLASS
|
|---|
| 252 | {
|
|---|
| 253 | MyFileDirectoryInformation = 1,
|
|---|
| 254 | MyFileFullDirectoryInformation, /* = 2 */
|
|---|
| 255 | MyFileBothDirectoryInformation, /* = 3 */
|
|---|
| 256 | MyFileBasicInformation, /* = 4 */
|
|---|
| 257 | MyFileStandardInformation, /* = 5 */
|
|---|
| 258 | MyFileInternalInformation, /* = 6 */
|
|---|
| 259 | MyFileEaInformation, /* = 7 */
|
|---|
| 260 | MyFileAccessInformation, /* = 8 */
|
|---|
| 261 | MyFileNameInformation, /* = 9 */
|
|---|
| 262 | MyFileRenameInformation, /* = 10 */
|
|---|
| 263 | MyFileLinkInformation, /* = 11 */
|
|---|
| 264 | MyFileNamesInformation, /* = 12 */
|
|---|
| 265 | MyFileDispositionInformation, /* = 13 */
|
|---|
| 266 | MyFilePositionInformation, /* = 14 */
|
|---|
| 267 | MyFileFullEaInformation, /* = 15 */
|
|---|
| 268 | MyFileModeInformation, /* = 16 */
|
|---|
| 269 | MyFileAlignmentInformation, /* = 17 */
|
|---|
| 270 | MyFileAllInformation, /* = 18 */
|
|---|
| 271 | MyFileAllocationInformation, /* = 19 */
|
|---|
| 272 | MyFileEndOfFileInformation, /* = 20 */
|
|---|
| 273 | MyFileAlternateNameInformation, /* = 21 */
|
|---|
| 274 | MyFileStreamInformation, /* = 22 */
|
|---|
| 275 | MyFilePipeInformation, /* = 23 */
|
|---|
| 276 | MyFilePipeLocalInformation, /* = 24 */
|
|---|
| 277 | MyFilePipeRemoteInformation, /* = 25 */
|
|---|
| 278 | MyFileMailslotQueryInformation, /* = 26 */
|
|---|
| 279 | MyFileMailslotSetInformation, /* = 27 */
|
|---|
| 280 | MyFileCompressionInformation, /* = 28 */
|
|---|
| 281 | MyFileObjectIdInformation, /* = 29 */
|
|---|
| 282 | MyFileCompletionInformation, /* = 30 */
|
|---|
| 283 | MyFileMoveClusterInformation, /* = 31 */
|
|---|
| 284 | MyFileQuotaInformation, /* = 32 */
|
|---|
| 285 | MyFileReparsePointInformation, /* = 33 */
|
|---|
| 286 | MyFileNetworkOpenInformation, /* = 34 */
|
|---|
| 287 | MyFileAttributeTagInformation, /* = 35 */
|
|---|
| 288 | MyFileTrackingInformation, /* = 36 */
|
|---|
| 289 | MyFileIdBothDirectoryInformation, /* = 37 */
|
|---|
| 290 | MyFileIdFullDirectoryInformation, /* = 38 */
|
|---|
| 291 | MyFileValidDataLengthInformation, /* = 39 */
|
|---|
| 292 | MyFileShortNameInformation, /* = 40 */
|
|---|
| 293 | MyFileIoCompletionNotificationInformation, /* = 41 */
|
|---|
| 294 | MyFileIoStatusBlockRangeInformation, /* = 42 */
|
|---|
| 295 | MyFileIoPriorityHintInformation, /* = 43 */
|
|---|
| 296 | MyFileSfioReserveInformation, /* = 44 */
|
|---|
| 297 | MyFileSfioVolumeInformation, /* = 45 */
|
|---|
| 298 | MyFileHardLinkInformation, /* = 46 */
|
|---|
| 299 | MyFileProcessIdsUsingFileInformation, /* = 47 */
|
|---|
| 300 | MyFileNormalizedNameInformation, /* = 48 */
|
|---|
| 301 | MyFileNetworkPhysicalNameInformation, /* = 49 */
|
|---|
| 302 | MyFileIdGlobalTxDirectoryInformation, /* = 50 */
|
|---|
| 303 | MyFileIsRemoteDeviceInformation, /* = 51 */
|
|---|
| 304 | MyFileAttributeCacheInformation, /* = 52 */
|
|---|
| 305 | MyFileNumaNodeInformation, /* = 53 */
|
|---|
| 306 | MyFileStandardLinkInformation, /* = 54 */
|
|---|
| 307 | MyFileRemoteProtocolInformation, /* = 55 */
|
|---|
| 308 | MyFileMaximumInformation
|
|---|
| 309 | } MY_FILE_INFORMATION_CLASS;
|
|---|
| 310 |
|
|---|
| 311 |
|
|---|
| 312 | typedef struct MY_FILE_FS_VOLUME_INFORMATION
|
|---|
| 313 | {
|
|---|
| 314 | LARGE_INTEGER VolumeCreationTime;
|
|---|
| 315 | ULONG VolumeSerialNumber;
|
|---|
| 316 | ULONG VolumeLabelLength;
|
|---|
| 317 | BOOLEAN SupportsObjects;
|
|---|
| 318 | WCHAR VolumeLabel[1];
|
|---|
| 319 | } MY_FILE_FS_VOLUME_INFORMATION;
|
|---|
| 320 |
|
|---|
| 321 | typedef struct _MY_FILE_FS_ATTRIBUTE_INFORMATION
|
|---|
| 322 | {
|
|---|
| 323 | ULONG FileSystemAttributes;
|
|---|
| 324 | LONG MaximumComponentNameLength;
|
|---|
| 325 | ULONG FileSystemNameLength;
|
|---|
| 326 | WCHAR FileSystemName[1];
|
|---|
| 327 | } MY_FILE_FS_ATTRIBUTE_INFORMATION;
|
|---|
| 328 |
|
|---|
| 329 | typedef enum MY_FSINFOCLASS
|
|---|
| 330 | {
|
|---|
| 331 | MyFileFsVolumeInformation = 1,
|
|---|
| 332 | MyFileFsLabelInformation, /* = 2 */
|
|---|
| 333 | MyFileFsSizeInformation, /* = 3 */
|
|---|
| 334 | MyFileFsDeviceInformation, /* = 4 */
|
|---|
| 335 | MyFileFsAttributeInformation, /* = 5 */
|
|---|
| 336 | MyFileFsControlInformation, /* = 6 */
|
|---|
| 337 | MyFileFsFullSizeInformation, /* = 7 */
|
|---|
| 338 | MyFileFsObjectIdInformation, /* = 8 */
|
|---|
| 339 | MyFileFsDriverPathInformation, /* = 9 */
|
|---|
| 340 | MyFileFsVolumeFlagsInformation, /* = 10 */
|
|---|
| 341 | MyFileFsMaximumInformation
|
|---|
| 342 | } MY_FS_INFORMATION_CLASS;
|
|---|
| 343 |
|
|---|
| 344 |
|
|---|
| 345 | typedef struct MY_RTLP_CURDIR_REF
|
|---|
| 346 | {
|
|---|
| 347 | LONG RefCount;
|
|---|
| 348 | HANDLE Handle;
|
|---|
| 349 | } MY_RTLP_CURDIR_REF;
|
|---|
| 350 |
|
|---|
| 351 | typedef struct MY_RTL_RELATIVE_NAME_U
|
|---|
| 352 | {
|
|---|
| 353 | MY_UNICODE_STRING RelativeName;
|
|---|
| 354 | HANDLE ContainingDirectory;
|
|---|
| 355 | MY_RTLP_CURDIR_REF CurDirRef;
|
|---|
| 356 | } MY_RTL_RELATIVE_NAME_U;
|
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 | #ifndef OBJ_INHERIT
|
|---|
| 360 | # define OBJ_INHERIT 0x00000002U
|
|---|
| 361 | # define OBJ_PERMANENT 0x00000010U
|
|---|
| 362 | # define OBJ_EXCLUSIVE 0x00000020U
|
|---|
| 363 | # define OBJ_CASE_INSENSITIVE 0x00000040U
|
|---|
| 364 | # define OBJ_OPENIF 0x00000080U
|
|---|
| 365 | # define OBJ_OPENLINK 0x00000100U
|
|---|
| 366 | # define OBJ_KERNEL_HANDLE 0x00000200U
|
|---|
| 367 | # define OBJ_FORCE_ACCESS_CHECK 0x00000400U
|
|---|
| 368 | # define OBJ_VALID_ATTRIBUTES 0x000007f2U
|
|---|
| 369 | #endif
|
|---|
| 370 |
|
|---|
| 371 | #ifndef FILE_OPEN
|
|---|
| 372 | # define FILE_SUPERSEDE 0x00000000U
|
|---|
| 373 | # define FILE_OPEN 0x00000001U
|
|---|
| 374 | # define FILE_CREATE 0x00000002U
|
|---|
| 375 | # define FILE_OPEN_IF 0x00000003U
|
|---|
| 376 | # define FILE_OVERWRITE 0x00000004U
|
|---|
| 377 | # define FILE_OVERWRITE_IF 0x00000005U
|
|---|
| 378 | # define FILE_MAXIMUM_DISPOSITION 0x00000005U
|
|---|
| 379 | #endif
|
|---|
| 380 |
|
|---|
| 381 | #ifndef FILE_DIRECTORY_FILE
|
|---|
| 382 | # define FILE_DIRECTORY_FILE 0x00000001U
|
|---|
| 383 | # define FILE_WRITE_THROUGH 0x00000002U
|
|---|
| 384 | # define FILE_SEQUENTIAL_ONLY 0x00000004U
|
|---|
| 385 | # define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008U
|
|---|
| 386 | # define FILE_SYNCHRONOUS_IO_ALERT 0x00000010U
|
|---|
| 387 | # define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020U
|
|---|
| 388 | # define FILE_NON_DIRECTORY_FILE 0x00000040U
|
|---|
| 389 | # define FILE_CREATE_TREE_CONNECTION 0x00000080U
|
|---|
| 390 | # define FILE_COMPLETE_IF_OPLOCKED 0x00000100U
|
|---|
| 391 | # define FILE_NO_EA_KNOWLEDGE 0x00000200U
|
|---|
| 392 | # define FILE_OPEN_REMOTE_INSTANCE 0x00000400U
|
|---|
| 393 | # define FILE_RANDOM_ACCESS 0x00000800U
|
|---|
| 394 | # define FILE_DELETE_ON_CLOSE 0x00001000U
|
|---|
| 395 | # define FILE_OPEN_BY_FILE_ID 0x00002000U
|
|---|
| 396 | # define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000U
|
|---|
| 397 | # define FILE_NO_COMPRESSION 0x00008000U
|
|---|
| 398 | # define FILE_RESERVE_OPFILTER 0x00100000U
|
|---|
| 399 | # define FILE_OPEN_REPARSE_POINT 0x00200000U
|
|---|
| 400 | # define FILE_OPEN_NO_RECALL 0x00400000U
|
|---|
| 401 | # define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000U
|
|---|
| 402 | #endif
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 | /** @name NT status codes and associated macros.
|
|---|
| 406 | * @{ */
|
|---|
| 407 | #define MY_NT_SUCCESS(a_ntRc) ((MY_NTSTATUS)(a_ntRc) >= 0)
|
|---|
| 408 | #define MY_NT_FAILURE(a_ntRc) ((MY_NTSTATUS)(a_ntRc) < 0)
|
|---|
| 409 | #define MY_STATUS_NO_MORE_FILES ((MY_NTSTATUS)0x80000006)
|
|---|
| 410 | #define MY_STATUS_OBJECT_NAME_INVALID ((MY_NTSTATUS)0xc0000033)
|
|---|
| 411 | #define MY_STATUS_OBJECT_NAME_NOT_FOUND ((MY_NTSTATUS)0xc0000034)
|
|---|
| 412 | #define MY_STATUS_OBJECT_PATH_INVALID ((MY_NTSTATUS)0xc0000039)
|
|---|
| 413 | #define MY_STATUS_OBJECT_PATH_NOT_FOUND ((MY_NTSTATUS)0xc000003a)
|
|---|
| 414 | #define MY_STATUS_OBJECT_PATH_SYNTAX_BAD ((MY_NTSTATUS)0xc000003b)
|
|---|
| 415 | /** @} */
|
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 | /*******************************************************************************
|
|---|
| 419 | * Global Variables *
|
|---|
| 420 | *******************************************************************************/
|
|---|
| 421 | extern MY_NTSTATUS (WINAPI * g_pfnNtClose)(HANDLE);
|
|---|
| 422 | extern MY_NTSTATUS (WINAPI * g_pfnNtCreateFile)(PHANDLE, MY_ACCESS_MASK, MY_OBJECT_ATTRIBUTES *, MY_IO_STATUS_BLOCK *,
|
|---|
| 423 | PLARGE_INTEGER, ULONG, ULONG, ULONG, ULONG, PVOID, ULONG);
|
|---|
| 424 | extern MY_NTSTATUS (WINAPI * g_pfnNtDeleteFile)(MY_OBJECT_ATTRIBUTES *);
|
|---|
| 425 | extern MY_NTSTATUS (WINAPI * g_pfnNtQueryInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *,
|
|---|
| 426 | PVOID, LONG, MY_FILE_INFORMATION_CLASS);
|
|---|
| 427 | extern MY_NTSTATUS (WINAPI * g_pfnNtQueryVolumeInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *,
|
|---|
| 428 | PVOID, LONG, MY_FS_INFORMATION_CLASS);
|
|---|
| 429 | extern MY_NTSTATUS (WINAPI * g_pfnNtQueryDirectoryFile)(HANDLE, HANDLE, MY_IO_APC_ROUTINE *, PVOID, MY_IO_STATUS_BLOCK *,
|
|---|
| 430 | PVOID, ULONG, MY_FILE_INFORMATION_CLASS, BOOLEAN,
|
|---|
| 431 | MY_UNICODE_STRING *, BOOLEAN);
|
|---|
| 432 | extern MY_NTSTATUS (WINAPI * g_pfnNtSetInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS);
|
|---|
| 433 | extern BOOLEAN (WINAPI * g_pfnRtlDosPathNameToNtPathName_U)(PCWSTR, MY_UNICODE_STRING *, PCWSTR *, MY_RTL_RELATIVE_NAME_U *);
|
|---|
| 434 | extern MY_NTSTATUS (WINAPI * g_pfnRtlAnsiStringToUnicodeString)(MY_UNICODE_STRING *, MY_ANSI_STRING const *, BOOLEAN);
|
|---|
| 435 | extern BOOLEAN (WINAPI * g_pfnRtlEqualUnicodeString)(MY_UNICODE_STRING const *pUniStr1, MY_UNICODE_STRING const *pUniStr2,
|
|---|
| 436 | BOOLEAN fCaseInsensitive);
|
|---|
| 437 | extern BOOLEAN (WINAPI * g_pfnRtlEqualString)(MY_ANSI_STRING const *pAnsiStr1, MY_ANSI_STRING const *pAnsiStr2,
|
|---|
| 438 | BOOLEAN fCaseInsensitive);
|
|---|
| 439 | extern UCHAR (WINAPI * g_pfnRtlUpperChar)(UCHAR uch);
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 | /** @} */
|
|---|
| 443 |
|
|---|
| 444 | #endif
|
|---|
| 445 |
|
|---|