1 /* ntdll.h. Contains ntdll specific stuff not defined elsewhere.
3 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
11 #ifndef STATUS_INVALID_INFO_CLASS
12 /* Some w32api header file defines this so we need to conditionalize this
13 define to avoid warnings. */
14 #define STATUS_INVALID_INFO_CLASS ((NTSTATUS) 0xc0000003)
16 #define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
17 #define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xc000000d)
18 #define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xc000000f)
19 #define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xc0000010)
20 #define STATUS_END_OF_FILE ((NTSTATUS) 0xc0000011)
21 #define STATUS_NO_MEDIA_IN_DEVICE ((NTSTATUS) 0xc0000013)
22 #define STATUS_ACCESS_DENIED ((NTSTATUS) 0xc0000022)
23 #define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xc0000023)
24 #define STATUS_OBJECT_NAME_INVALID ((NTSTATUS) 0xc0000033)
25 #define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS) 0xc0000034)
26 #define STATUS_OBJECT_PATH_NOT_FOUND ((NTSTATUS) 0xc000003A)
27 #define STATUS_SHARING_VIOLATION ((NTSTATUS) 0xc0000043)
28 #define STATUS_DELETE_PENDING ((NTSTATUS) 0xc0000056)
29 #define STATUS_DISK_FULL ((NTSTATUS) 0xc000007f)
30 #define STATUS_WORKING_SET_QUOTA ((NTSTATUS) 0xc00000a1)
31 #define STATUS_NOT_SUPPORTED ((NTSTATUS) 0xc00000bb)
32 #define STATUS_DIRECTORY_NOT_EMPTY ((NTSTATUS) 0xc0000101)
33 #define STATUS_NOT_ALL_ASSIGNED ((NTSTATUS) 0x00000106)
34 #define STATUS_INVALID_LEVEL ((NTSTATUS) 0xc0000148)
35 #define STATUS_BUFFER_OVERFLOW ((NTSTATUS) 0x80000005)
36 #define STATUS_NO_MORE_FILES ((NTSTATUS) 0x80000006)
37 #define PDI_MODULES 0x01
38 #define PDI_HEAPS 0x04
39 #define LDRP_IMAGE_DLL 0x00000004
40 #define WSLE_PAGE_READONLY 0x001
41 #define WSLE_PAGE_EXECUTE 0x002
42 #define WSLE_PAGE_EXECUTE_READ 0x003
43 #define WSLE_PAGE_READWRITE 0x004
44 #define WSLE_PAGE_WRITECOPY 0x005
45 #define WSLE_PAGE_EXECUTE_READWRITE 0x006
46 #define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
47 #define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
48 #define WSLE_PAGE_SHAREABLE 0x100
50 #define FILE_SUPERSEDED 0
52 #define FILE_CREATED 2
53 #define FILE_OVERWRITTEN 3
55 #define FILE_DOES_NOT_EXIST 5
57 #define FILE_WRITE_TO_END_OF_FILE (-1LL)
58 #define FILE_USE_FILE_POINTER_POSITION (-2LL)
60 /* Device Characteristics. */
61 #define FILE_REMOVABLE_MEDIA 0x00000001
62 #define FILE_READ_ONLY_DEVICE 0x00000002
63 #define FILE_FLOPPY_DISKETTE 0x00000004
64 #define FILE_WRITE_ONCE_MEDIA 0x00000008
65 #define FILE_REMOTE_DEVICE 0x00000010
66 #define FILE_DEVICE_IS_MOUNTED 0x00000020
67 #define FILE_VIRTUAL_VOLUME 0x00000040
68 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
69 #define FILE_DEVICE_SECURE_OPEN 0x00000100
71 typedef enum _FILE_INFORMATION_CLASS
73 FileDirectoryInformation
= 1,
74 FileFullDirectoryInformation
, // 2
75 FileBothDirectoryInformation
, // 3
76 FileBasicInformation
, // 4 wdm
77 FileStandardInformation
, // 5 wdm
78 FileInternalInformation
, // 6
79 FileEaInformation
, // 7
80 FileAccessInformation
, // 8
81 FileNameInformation
, // 9
82 FileRenameInformation
, // 10
83 FileLinkInformation
, // 11
84 FileNamesInformation
, // 12
85 FileDispositionInformation
, // 13
86 FilePositionInformation
, // 14 wdm
87 FileFullEaInformation
, // 15
88 FileModeInformation
, // 16
89 FileAlignmentInformation
, // 17
90 FileAllInformation
, // 18
91 FileAllocationInformation
, // 19
92 FileEndOfFileInformation
, // 20 wdm
93 FileAlternateNameInformation
, // 21
94 FileStreamInformation
, // 22
95 FilePipeInformation
, // 23
96 FilePipeLocalInformation
, // 24
97 FilePipeRemoteInformation
, // 25
98 FileMailslotQueryInformation
, // 26
99 FileMailslotSetInformation
, // 27
100 FileCompressionInformation
, // 28
101 FileObjectIdInformation
, // 29
102 FileCompletionInformation
, // 30
103 FileMoveClusterInformation
, // 31
104 FileQuotaInformation
, // 32
105 FileReparsePointInformation
, // 33
106 FileNetworkOpenInformation
, // 34
107 FileAttributeTagInformation
, // 35
108 FileTrackingInformation
, // 36
109 FileIdBothDirectoryInformation
, // 37
110 FileIdFullDirectoryInformation
, // 38
111 FileValidDataLengthInformation
, // 39
112 FileShortNameInformation
, // 40
113 FileMaximumInformation
114 } FILE_INFORMATION_CLASS
, *PFILE_INFORMATION_CLASS
;
116 typedef struct _FILE_NAMES_INFORMATION
118 ULONG NextEntryOffset
;
120 ULONG FileNameLength
;
122 } FILE_NAMES_INFORMATION
, *PFILE_NAMES_INFORMATION
;
124 typedef struct _FILE_DIRECTORY_INFORMATION
{
125 ULONG NextEntryOffset
;
127 LARGE_INTEGER CreationTime
;
128 LARGE_INTEGER LastAccessTime
;
129 LARGE_INTEGER LastWriteTime
;
130 LARGE_INTEGER ChangeTime
;
131 LARGE_INTEGER EndOfFile
;
132 LARGE_INTEGER AllocationSize
;
133 ULONG FileAttributes
;
134 ULONG FileNameLength
;
136 } FILE_DIRECTORY_INFORMATION
, *PFILE_DIRECTORY_INFORMATION
;
138 typedef struct _FILE_BOTH_DIR_INFORMATION
140 ULONG NextEntryOffset
;
142 LARGE_INTEGER CreationTime
;
143 LARGE_INTEGER LastAccessTime
;
144 LARGE_INTEGER LastWriteTime
;
145 LARGE_INTEGER ChangeTime
;
146 LARGE_INTEGER EndOfFile
;
147 LARGE_INTEGER AllocationSize
;
148 ULONG FileAttributes
;
149 ULONG FileNameLength
;
151 CCHAR ShortNameLength
;
154 } FILE_BOTH_DIR_INFORMATION
, *PFILE_BOTH_DIR_INFORMATION
;
156 typedef struct _FILE_ID_BOTH_DIR_INFORMATION
158 ULONG NextEntryOffset
;
160 LARGE_INTEGER CreationTime
;
161 LARGE_INTEGER LastAccessTime
;
162 LARGE_INTEGER LastWriteTime
;
163 LARGE_INTEGER ChangeTime
;
164 LARGE_INTEGER EndOfFile
;
165 LARGE_INTEGER AllocationSize
;
166 ULONG FileAttributes
;
167 ULONG FileNameLength
;
169 CCHAR ShortNameLength
;
171 LARGE_INTEGER FileId
;
173 } FILE_ID_BOTH_DIR_INFORMATION
, *PFILE_ID_BOTH_DIR_INFORMATION
;
176 #define AT_EXTENDABLE_FILE 0x00002000
177 #define AT_ROUND_TO_PAGE 0x40000000
179 #define LOCK_VM_IN_WSL 1
180 #define LOCK_VM_IN_RAM 2
182 #define DIRECTORY_QUERY 1
184 typedef ULONG KAFFINITY
;
186 typedef enum _SYSTEM_INFORMATION_CLASS
188 SystemBasicInformation
= 0,
189 SystemPerformanceInformation
= 2,
190 SystemTimeOfDayInformation
= 3,
191 SystemProcessesAndThreadsInformation
= 5,
192 SystemProcessorTimes
= 8,
193 SystemPagefileInformation
= 18,
194 /* There are a lot more of these... */
195 } SYSTEM_INFORMATION_CLASS
;
197 typedef struct _SYSTEM_BASIC_INFORMATION
200 ULONG MaximumIncrement
;
201 ULONG PhysicalPageSize
;
202 ULONG NumberOfPhysicalPages
;
203 ULONG LowestPhysicalPage
;
204 ULONG HighestPhysicalPage
;
205 ULONG AllocationGranularity
;
206 ULONG LowestUserAddress
;
207 ULONG HighestUserAddress
;
208 ULONG ActiveProcessors
;
209 UCHAR NumberProcessors
;
210 } SYSTEM_BASIC_INFORMATION
, *PSYSTEM_BASIC_INFORMATION
;
212 typedef struct _SYSTEM_PAGEFILE_INFORMATION
214 ULONG NextEntryOffset
;
218 UNICODE_STRING FileName
;
219 } SYSTEM_PAGEFILE_INFORMATION
, *PSYSTEM_PAGEFILE_INFORMATION
;
221 typedef struct __attribute__ ((aligned (8))) _SYSTEM_PROCESSOR_TIMES
223 LARGE_INTEGER IdleTime
;
224 LARGE_INTEGER KernelTime
;
225 LARGE_INTEGER UserTime
;
226 LARGE_INTEGER DpcTime
;
227 LARGE_INTEGER InterruptTime
;
228 ULONG InterruptCount
;
229 } SYSTEM_PROCESSOR_TIMES
, *PSYSTEM_PROCESSOR_TIMES
;
231 typedef LONG KPRIORITY
;
232 typedef struct _VM_COUNTERS
234 ULONG PeakVirtualSize
;
236 ULONG PageFaultCount
;
237 ULONG PeakWorkingSetSize
;
238 ULONG WorkingSetSize
;
239 ULONG QuotaPeakPagedPoolUsage
;
240 ULONG QuotaPagedPoolUsage
;
241 ULONG QuotaPeakNonPagedPoolUsage
;
242 ULONG QuotaNonPagedPoolUsage
;
244 ULONG PeakPagefileUsage
;
245 } VM_COUNTERS
, *PVM_COUNTERS
;
247 typedef struct _CLIENT_ID
249 HANDLE UniqueProcess
;
251 } CLIENT_ID
, *PCLIENT_ID
;
297 typedef struct _SYSTEM_THREADS
299 LARGE_INTEGER KernelTime
;
300 LARGE_INTEGER UserTime
;
301 LARGE_INTEGER CreateTime
;
306 KPRIORITY BasePriority
;
307 ULONG ContextSwitchCount
;
309 KWAIT_REASON WaitReason
;
311 } SYSTEM_THREADS
, *PSYSTEM_THREADS
;
313 typedef struct _SYSTEM_PROCESSES
315 ULONG NextEntryDelta
;
318 LARGE_INTEGER CreateTime
;
319 LARGE_INTEGER UserTime
;
320 LARGE_INTEGER KernelTime
;
321 UNICODE_STRING ProcessName
;
322 KPRIORITY BasePriority
;
324 ULONG InheritedFromProcessId
;
327 VM_COUNTERS VmCounters
;
328 IO_COUNTERS IoCounters
;
329 SYSTEM_THREADS Threads
[1];
330 } SYSTEM_PROCESSES
, *PSYSTEM_PROCESSES
;
332 typedef struct _IO_STATUS_BLOCK
336 } IO_STATUS_BLOCK
, *PIO_STATUS_BLOCK
;
338 typedef struct _SYSTEM_PERFORMANCE_INFORMATION
340 LARGE_INTEGER IdleTime
;
341 LARGE_INTEGER ReadTransferCount
;
342 LARGE_INTEGER WriteTransferCount
;
343 LARGE_INTEGER OtherTransferCount
;
344 ULONG ReadOperationCount
;
345 ULONG WriteOperationCount
;
346 ULONG OtherOperationCount
;
347 ULONG AvailablePages
;
348 ULONG TotalCommittedPages
;
349 ULONG TotalCommitLimit
;
350 ULONG PeakCommitment
;
352 ULONG WriteCopyFaults
;
353 ULONG TransitionFaults
;
355 ULONG DemandZeroFaults
;
359 ULONG PagefilePagesWritten
;
360 ULONG PagefilePageWriteIos
;
361 ULONG MappedFilePagesWritten
;
362 ULONG MappedFilePageWriteIos
;
363 ULONG PagedPoolUsage
;
364 ULONG NonPagedPoolUsage
;
365 ULONG PagedPoolAllocs
;
366 ULONG PagedPoolFrees
;
367 ULONG NonPagedPoolAllocs
;
368 ULONG NonPagedPoolFrees
;
369 ULONG TotalFreeSystemPtes
;
370 ULONG SystemCodePage
;
371 ULONG TotalSystemDriverPages
;
372 ULONG TotalSystemCodePages
;
373 ULONG SmallNonPagedLookasideListAllocateHits
;
374 ULONG SmallPagedLookasideListAllocateHits
;
376 ULONG MmSystemCachePage
;
378 ULONG SystemDriverPage
;
379 ULONG FastReadNoWait
;
381 ULONG FastReadResourceMiss
;
382 ULONG FastReadNotPossible
;
383 ULONG FastMdlReadNoWait
;
384 ULONG FastMdlReadWait
;
385 ULONG FastMdlReadResourceMiss
;
386 ULONG FastMdlReadNotPossible
;
389 ULONG MapDataNoWaitMiss
;
390 ULONG MapDataWaitMiss
;
391 ULONG PinMappedDataCount
;
394 ULONG PinReadNoWaitMiss
;
395 ULONG PinReadWaitMiss
;
396 ULONG CopyReadNoWait
;
398 ULONG CopyReadNoWaitMiss
;
399 ULONG CopyReadWaitMiss
;
402 ULONG MdlReadNoWaitMiss
;
403 ULONG MdlReadWaitMiss
;
406 ULONG LazyWritePages
;
409 ULONG ContextSwitches
;
410 ULONG FirstLevelTbFills
;
411 ULONG SecondLevelTbFills
;
413 } SYSTEM_PERFORMANCE_INFORMATION
, *PSYSTEM_PERFORMANCE_INFORMATION
;
415 typedef struct __attribute__ ((aligned(8))) _SYSTEM_TIME_OF_DAY_INFORMATION
417 LARGE_INTEGER BootTime
;
418 LARGE_INTEGER CurrentTime
;
419 LARGE_INTEGER TimeZoneBias
;
420 ULONG CurrentTimeZoneId
;
421 } SYSTEM_TIME_OF_DAY_INFORMATION
, *PSYSTEM_TIME_OF_DAY_INFORMATION
;
423 typedef enum _PROCESSINFOCLASS
425 ProcessBasicInformation
= 0,
426 ProcessQuotaLimits
= 1,
427 ProcessVmCounters
= 3,
431 typedef struct _DEBUG_BUFFER
433 HANDLE SectionHandle
;
435 PVOID RemoteSectionBase
;
436 ULONG SectionBaseDelta
;
437 HANDLE EventPairHandle
;
439 HANDLE RemoteThreadHandle
;
444 PVOID ModuleInformation
;
445 PVOID BackTraceInformation
;
446 PVOID HeapInformation
;
447 PVOID LockInformation
;
449 } DEBUG_BUFFER
, *PDEBUG_BUFFER
;
451 typedef struct _DEBUG_HEAP_INFORMATION
464 } DEBUG_HEAP_INFORMATION
, *PDEBUG_HEAP_INFORMATION
;
466 typedef struct _DEBUG_MODULE_INFORMATION
475 USHORT ModuleNameOffset
;
477 } DEBUG_MODULE_INFORMATION
, *PDEBUG_MODULE_INFORMATION
;
479 typedef struct _KERNEL_USER_TIMES
481 LARGE_INTEGER CreateTime
;
482 LARGE_INTEGER ExitTime
;
483 LARGE_INTEGER KernelTime
;
484 LARGE_INTEGER UserTime
;
485 } KERNEL_USER_TIMES
, *PKERNEL_USER_TIMES
;
487 typedef struct _RTL_USER_PROCESS_PARAMETERS
489 ULONG AllocationSize
;
498 UNICODE_STRING CurrentDirectoryName
;
499 HANDLE CurrentDirectoryHandle
;
500 UNICODE_STRING DllPath
;
501 UNICODE_STRING ImagePathName
;
502 UNICODE_STRING CommandLine
;
510 ULONG dwFillAttribute
;
513 UNICODE_STRING WindowTitle
;
514 UNICODE_STRING DesktopInfo
;
515 UNICODE_STRING ShellInfo
;
516 UNICODE_STRING RuntimeInfo
;
517 } RTL_USER_PROCESS_PARAMETERS
, *PRTL_USER_PROCESS_PARAMETERS
;
525 PRTL_USER_PROCESS_PARAMETERS ProcessParameters
;
530 /* Simplifed definition, just to get the PEB pointer. */
535 /* A lot more follows... */
538 typedef struct _PROCESS_BASIC_INFORMATION
542 KAFFINITY AffinityMask
;
543 KPRIORITY BasePriority
;
544 ULONG UniqueProcessId
;
545 ULONG InheritedFromUniqueProcessId
;
546 } PROCESS_BASIC_INFORMATION
, *PPROCESS_BASIC_INFORMATION
;
548 typedef enum _MEMORY_INFORMATION_CLASS
550 MemoryBasicInformation
,
551 MemoryWorkingSetList
,
553 MemoryBasicVlmInformation
554 } MEMORY_INFORMATION_CLASS
;
556 typedef struct _MEMORY_WORKING_SET_LIST
559 ULONG WorkingSetList
[1];
560 } MEMORY_WORKING_SET_LIST
, *PMEMORY_WORKING_SET_LIST
;
562 typedef struct _FILE_BASIC_INFORMATION
{
563 LARGE_INTEGER CreationTime
;
564 LARGE_INTEGER LastAccessTime
;
565 LARGE_INTEGER LastWriteTime
;
566 LARGE_INTEGER ChangeTime
;
567 ULONG FileAttributes
;
568 } FILE_BASIC_INFORMATION
, *PFILE_BASIC_INFORMATION
;
570 typedef struct _FILE_STANDARD_INFORMATION
{
571 LARGE_INTEGER AllocationSize
;
572 LARGE_INTEGER EndOfFile
;
574 BOOLEAN DeletePending
;
576 } FILE_STANDARD_INFORMATION
, *PFILE_STANDARD_INFORMATION
;
578 typedef struct _FILE_NETWORK_OPEN_INFORMATION
{
579 LARGE_INTEGER CreationTime
;
580 LARGE_INTEGER LastAccessTime
;
581 LARGE_INTEGER LastWriteTime
;
582 LARGE_INTEGER ChangeTime
;
583 LARGE_INTEGER AllocationSize
;
584 LARGE_INTEGER EndOfFile
;
585 ULONG FileAttributes
;
586 } FILE_NETWORK_OPEN_INFORMATION
, *PFILE_NETWORK_OPEN_INFORMATION
;
588 typedef struct _FILE_INTERNAL_INFORMATION
{
589 LARGE_INTEGER FileId
;
590 } FILE_INTERNAL_INFORMATION
, *PFILE_INTERNAL_INFORMATION
;
592 typedef struct _FILE_EA_INFORMATION
{
594 } FILE_EA_INFORMATION
, *PFILE_EA_INFORMATION
;
596 typedef struct _FILE_ACCESS_INFORMATION
{
597 ACCESS_MASK AccessFlags
;
598 } FILE_ACCESS_INFORMATION
, *PFILE_ACCESS_INFORMATION
;
600 typedef struct _FILE_DISPOSITION_INFORMATION
{
602 } FILE_DISPOSITION_INFORMATION
, *PFILE_DISPOSITION_INFORMATION
;
604 typedef struct _FILE_POSITION_INFORMATION
{
605 LARGE_INTEGER CurrentByteOffset
;
606 } FILE_POSITION_INFORMATION
, *PFILE_POSITION_INFORMATION
;
608 typedef struct _FILE_END_OF_FILE_INFORMATION
{
609 LARGE_INTEGER EndOfFile
;
610 } FILE_END_OF_FILE_INFORMATION
, *PFILE_END_OF_FILE_INFORMATION
;
612 typedef struct _FILE_MODE_INFORMATION
{
614 } FILE_MODE_INFORMATION
, *PFILE_MODE_INFORMATION
;
616 typedef struct _FILE_ALIGNMENT_INFORMATION
{
617 ULONG AlignmentRequirement
;
618 } FILE_ALIGNMENT_INFORMATION
;
620 typedef struct _FILE_NAME_INFORMATION
{
621 ULONG FileNameLength
;
623 } FILE_NAME_INFORMATION
, *PFILE_NAME_INFORMATION
;
625 typedef struct _FILE_LINK_INFORMATION
{
626 BOOLEAN ReplaceIfExists
;
627 HANDLE RootDirectory
;
628 ULONG FileNameLength
;
630 } FILE_LINK_INFORMATION
, *PFILE_LINK_INFORMATION
;
632 typedef struct _FILE_RENAME_INFORMATION
{
633 BOOLEAN ReplaceIfExists
;
634 HANDLE RootDirectory
;
635 ULONG FileNameLength
;
637 } FILE_RENAME_INFORMATION
, *PFILE_RENAME_INFORMATION
;
639 typedef struct _FILE_ALL_INFORMATION
{
640 FILE_BASIC_INFORMATION BasicInformation
;
641 FILE_STANDARD_INFORMATION StandardInformation
;
642 FILE_INTERNAL_INFORMATION InternalInformation
;
643 FILE_EA_INFORMATION EaInformation
;
644 FILE_ACCESS_INFORMATION AccessInformation
;
645 FILE_POSITION_INFORMATION PositionInformation
;
646 FILE_MODE_INFORMATION ModeInformation
;
647 FILE_ALIGNMENT_INFORMATION AlignmentInformation
;
648 FILE_NAME_INFORMATION NameInformation
;
649 } FILE_ALL_INFORMATION
, *PFILE_ALL_INFORMATION
;
651 typedef struct _FILE_PIPE_LOCAL_INFORMATION
654 ULONG NamedPipeConfiguration
;
655 ULONG MaximumInstances
;
656 ULONG CurrentInstances
;
658 ULONG ReadDataAvailable
;
660 ULONG WriteQuotaAvailable
;
661 ULONG NamedPipeState
;
663 } FILE_PIPE_LOCAL_INFORMATION
, *PFILE_PIPE_LOCAL_INFORMATION
;
665 typedef struct _FILE_COMPRESSION_INFORMATION
667 LARGE_INTEGER CompressedFileSize
;
668 USHORT CompressionFormat
;
669 UCHAR CompressionUnitShift
;
673 } FILE_COMPRESSION_INFORMATION
, *PFILE_COMPRESSION_INFORMATION
;
675 typedef struct _FILE_FS_DEVICE_INFORMATION
678 ULONG Characteristics
;
679 } FILE_FS_DEVICE_INFORMATION
, *PFILE_FS_DEVICE_INFORMATION
;
681 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
683 ULONG FileSystemAttributes
;
684 ULONG MaximumComponentNameLength
;
685 ULONG FileSystemNameLength
;
686 WCHAR FileSystemName
[1];
687 } FILE_FS_ATTRIBUTE_INFORMATION
, *PFILE_FS_ATTRIBUTE_INFORMATION
;
689 typedef struct _FILE_FS_VOLUME_INFORMATION
691 LARGE_INTEGER VolumeCreationTime
;
692 ULONG VolumeSerialNumber
;
693 ULONG VolumeLabelLength
;
694 BOOLEAN SupportsObjects
;
695 WCHAR VolumeLabel
[1];
696 } FILE_FS_VOLUME_INFORMATION
, *PFILE_FS_VOLUME_INFORMATION
;
698 typedef struct _FILE_FS_SIZE_INFORMATION
700 LARGE_INTEGER TotalAllocationUnits
;
701 LARGE_INTEGER AvailableAllocationUnits
;
702 ULONG SectorsPerAllocationUnit
;
703 ULONG BytesPerSector
;
704 } FILE_FS_SIZE_INFORMATION
, *PFILE_FS_SIZE_INFORMATION
;
706 typedef struct _FILE_FS_FULL_SIZE_INFORMATION
708 LARGE_INTEGER TotalAllocationUnits
;
709 LARGE_INTEGER CallerAvailableAllocationUnits
;
710 LARGE_INTEGER ActualAvailableAllocationUnits
;
711 ULONG SectorsPerAllocationUnit
;
712 ULONG BytesPerSector
;
713 } FILE_FS_FULL_SIZE_INFORMATION
, *PFILE_FS_FULL_SIZE_INFORMATION
;
715 typedef enum _FSINFOCLASS
{
716 FileFsVolumeInformation
= 1,
717 FileFsLabelInformation
,
718 FileFsSizeInformation
,
719 FileFsDeviceInformation
,
720 FileFsAttributeInformation
,
721 FileFsControlInformation
,
722 FileFsFullSizeInformation
,
723 FileFsObjectIdInformation
,
724 FileFsDriverPathInformation
,
725 FileFsMaximumInformation
726 } FS_INFORMATION_CLASS
, *PFS_INFORMATION_CLASS
;
728 typedef enum _OBJECT_INFORMATION_CLASS
730 ObjectBasicInformation
= 0,
731 ObjectNameInformation
= 1,
732 ObjectHandleInformation
= 4
734 } OBJECT_INFORMATION_CLASS
;
736 typedef struct _OBJECT_NAME_INFORMATION
739 } OBJECT_NAME_INFORMATION
;
741 typedef struct _DIRECTORY_BASIC_INFORMATION
743 UNICODE_STRING ObjectName
;
744 UNICODE_STRING ObjectTypeName
;
745 } DIRECTORY_BASIC_INFORMATION
, *PDIRECTORY_BASIC_INFORMATION
;
747 typedef struct _FILE_GET_EA_INFORMATION
749 ULONG NextEntryOffset
;
752 } FILE_GET_EA_INFORMATION
, *PFILE_GET_EA_INFORMATION
;
755 typedef struct _FILE_FULL_EA_INFORMATION
757 ULONG NextEntryOffset
;
760 USHORT EaValueLength
;
762 } FILE_FULL_EA_INFORMATION
, *PFILE_FULL_EA_INFORMATION
;
764 typedef struct _FILE_MAILSLOT_SET_INFORMATION
766 LARGE_INTEGER ReadTimeout
;
767 } FILE_MAILSLOT_SET_INFORMATION
, *PFILE_MAILSLOT_SET_INFORMATION
;
769 typedef VOID
NTAPI (*PIO_APC_ROUTINE
)(PVOID
, PIO_STATUS_BLOCK
, ULONG
);
771 /* Function declarations for ntdll.dll. These don't appear in any
772 standard Win32 header. */
775 NTSTATUS NTAPI
NtAdjustPrivilegesToken (HANDLE
, BOOLEAN
, PTOKEN_PRIVILEGES
,
776 ULONG
, PTOKEN_PRIVILEGES
, PULONG
);
777 NTSTATUS NTAPI
NtClose (HANDLE
);
778 NTSTATUS NTAPI
NtCreateFile (PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
,
779 PIO_STATUS_BLOCK
, PLARGE_INTEGER
, ULONG
, ULONG
,
780 ULONG
, ULONG
, PVOID
, ULONG
);
781 NTSTATUS NTAPI
NtCreateMailslotFile(PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
,
782 PIO_STATUS_BLOCK
, ULONG
, ULONG
, ULONG
,
784 NTSTATUS NTAPI
NtCreateSection (PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
,
785 PLARGE_INTEGER
, ULONG
, ULONG
, HANDLE
);
786 NTSTATUS NTAPI
NtCreateToken (PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
,
787 TOKEN_TYPE
, PLUID
, PLARGE_INTEGER
, PTOKEN_USER
,
788 PTOKEN_GROUPS
, PTOKEN_PRIVILEGES
, PTOKEN_OWNER
,
789 PTOKEN_PRIMARY_GROUP
, PTOKEN_DEFAULT_DACL
,
791 NTSTATUS NTAPI
NtFsControlFile (HANDLE
, HANDLE
, PIO_APC_ROUTINE
, PVOID
,
792 PIO_STATUS_BLOCK
, ULONG
, PVOID
, ULONG
,
794 NTSTATUS NTAPI
NtLockVirtualMemory (HANDLE
, PVOID
*, ULONG
*, ULONG
);
795 NTSTATUS NTAPI
NtMapViewOfSection (HANDLE
, HANDLE
, PVOID
*, ULONG
, ULONG
,
796 PLARGE_INTEGER
, PULONG
, SECTION_INHERIT
,
798 NTSTATUS NTAPI
NtNotifyChangeDirectoryFile (HANDLE
, HANDLE
, PIO_APC_ROUTINE
,
799 PVOID
, PIO_STATUS_BLOCK
,
800 PFILE_NOTIFY_INFORMATION
, ULONG
,
802 NTSTATUS NTAPI
NtOpenDirectoryObject (PHANDLE
, ACCESS_MASK
,
804 NTSTATUS NTAPI
NtOpenFile (PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
,
805 PIO_STATUS_BLOCK
, ULONG
, ULONG
);
806 NTSTATUS NTAPI
NtOpenSection (PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
);
807 /* WARNING! Don't rely on the timestamp information returned by
808 NtQueryAttributesFile. Only the DOS file attribute info is reliable. */
809 NTSTATUS NTAPI
NtQueryAttributesFile (POBJECT_ATTRIBUTES
,
810 PFILE_BASIC_INFORMATION
);
811 NTSTATUS NTAPI
NtQueryDirectoryFile(HANDLE
, HANDLE
, PVOID
, PVOID
,
812 PIO_STATUS_BLOCK
, PVOID
, ULONG
,
813 FILE_INFORMATION_CLASS
, BOOLEAN
,
814 PUNICODE_STRING
, BOOLEAN
);
815 NTSTATUS NTAPI
NtQueryDirectoryObject (HANDLE
, PVOID
, ULONG
, BOOLEAN
,
816 BOOLEAN
, PULONG
, PULONG
);
817 NTSTATUS NTAPI
NtQueryEaFile (HANDLE
, PIO_STATUS_BLOCK
, PVOID
, ULONG
,
818 BOOLEAN
, PVOID
, ULONG
, PULONG
, BOOLEAN
);
819 NTSTATUS NTAPI
NtQueryFullAttributesFile (POBJECT_ATTRIBUTES
,
820 PFILE_NETWORK_OPEN_INFORMATION
);
821 NTSTATUS NTAPI
NtQueryInformationFile (HANDLE
, PIO_STATUS_BLOCK
, PVOID
,
822 ULONG
, FILE_INFORMATION_CLASS
);
823 NTSTATUS NTAPI
NtQueryInformationProcess (HANDLE
, PROCESSINFOCLASS
,
824 PVOID
, ULONG
, PULONG
);
825 NTSTATUS NTAPI
NtQueryObject (HANDLE
, OBJECT_INFORMATION_CLASS
, VOID
*,
827 NTSTATUS NTAPI
NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS
,
828 PVOID
, ULONG
, PULONG
);
829 NTSTATUS NTAPI
NtQuerySecurityObject (HANDLE
, SECURITY_INFORMATION
,
830 PSECURITY_DESCRIPTOR
, ULONG
, PULONG
);
831 NTSTATUS NTAPI
NtQueryVirtualMemory (HANDLE
, PVOID
, MEMORY_INFORMATION_CLASS
,
832 PVOID
, ULONG
, PULONG
);
833 NTSTATUS NTAPI
NtQueryVolumeInformationFile (HANDLE
, IO_STATUS_BLOCK
*,
835 FS_INFORMATION_CLASS
);
836 NTSTATUS NTAPI
NtReadFile (HANDLE
, HANDLE
, PIO_APC_ROUTINE
, PVOID
,
837 PIO_STATUS_BLOCK
, PVOID
, ULONG
, PLARGE_INTEGER
,
839 NTSTATUS NTAPI
NtSetEaFile (HANDLE
, PIO_STATUS_BLOCK
, PVOID
, ULONG
);
840 NTSTATUS NTAPI
NtSetInformationFile (HANDLE
, PIO_STATUS_BLOCK
, PVOID
, ULONG
,
841 FILE_INFORMATION_CLASS
);
842 NTSTATUS NTAPI
NtSetSecurityObject (HANDLE
, SECURITY_INFORMATION
,
843 PSECURITY_DESCRIPTOR
);
844 NTSTATUS NTAPI
NtUnlockVirtualMemory (HANDLE
, PVOID
*, ULONG
*, ULONG
);
845 NTSTATUS NTAPI
NtUnmapViewOfSection (HANDLE
, PVOID
);
846 NTSTATUS NTAPI
NtWriteFile (HANDLE
, HANDLE
, PIO_APC_ROUTINE
, PVOID
,
847 PIO_STATUS_BLOCK
, PVOID
, ULONG
, PLARGE_INTEGER
,
849 NTSTATUS NTAPI
RtlAppendUnicodeToString (PUNICODE_STRING
, PCWSTR
);
850 NTSTATUS NTAPI
RtlAppendUnicodeStringToString (PUNICODE_STRING
,
852 VOID NTAPI
RtlAcquirePebLock ();
853 NTSTATUS NTAPI
RtlAnsiStringToUnicodeString (PUNICODE_STRING
, PANSI_STRING
,
855 LONG NTAPI
RtlCompareUnicodeString (PUNICODE_STRING
, PUNICODE_STRING
,
857 NTSTATUS NTAPI
RtlConvertSidToUnicodeString (PUNICODE_STRING
, PSID
, BOOLEAN
);
858 VOID NTAPI
RtlCopyUnicodeString (PUNICODE_STRING
, PUNICODE_STRING
);
859 BOOLEAN NTAPI
RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING
, PCSTR
);
860 NTSTATUS NTAPI
RtlDowncaseUnicodeString (PUNICODE_STRING
, PUNICODE_STRING
,
862 BOOLEAN NTAPI
RtlEqualUnicodeString (PUNICODE_STRING
, PUNICODE_STRING
,
864 VOID NTAPI
RtlFreeAnsiString (PANSI_STRING
);
865 VOID NTAPI
RtlFreeOemString (POEM_STRING
);
866 VOID NTAPI
RtlFreeUnicodeString (PUNICODE_STRING
);
867 VOID NTAPI
RtlInitEmptyUnicodeString (PUNICODE_STRING
, PCWSTR
, USHORT
);
868 VOID NTAPI
RtlInitUnicodeString (PUNICODE_STRING
, PCWSTR
);
869 NTSTATUS NTAPI
RtlIntegerToUnicodeString (ULONG
, ULONG
, PUNICODE_STRING
);
870 ULONG NTAPI
RtlIsDosDeviceName_U (PCWSTR
);
871 ULONG NTAPI
RtlNtStatusToDosError (NTSTATUS
);
872 NTSTATUS NTAPI
RtlOemStringToUnicodeString (PUNICODE_STRING
, POEM_STRING
,
874 BOOLEAN NTAPI
RtlPrefixUnicodeString (PUNICODE_STRING
, PUNICODE_STRING
,
876 VOID NTAPI
RtlReleasePebLock ();
877 VOID NTAPI
RtlSecondsSince1970ToTime (ULONG
, PLARGE_INTEGER
);
878 NTSTATUS NTAPI
RtlUnicodeStringToAnsiString (PANSI_STRING
, PUNICODE_STRING
,
880 NTSTATUS NTAPI
RtlUnicodeStringToOemString (PANSI_STRING
, PUNICODE_STRING
,
882 WCHAR NTAPI
RtlUpcaseUnicodeChar (WCHAR
);
883 NTSTATUS NTAPI
RtlUpcaseUnicodeString (PUNICODE_STRING
, PUNICODE_STRING
,
886 /* A few Rtl functions are either actually macros, or they just don't
887 exist even though they would be a big help. We implement them here,
888 partly as inline functions. */
890 /* RtlInitEmptyUnicodeString is defined as a macro in wdm.h, but that file
891 is missing entirely in w32api. */
893 VOID NTAPI
RtlInitEmptyUnicodeString(PUNICODE_STRING dest
, PCWSTR buf
,
897 dest
->MaximumLength
= len
;
898 dest
->Buffer
= (PWSTR
) buf
;
900 /* Like RtlInitEmptyUnicodeString, but initialize Length to len, too.
901 This is for instance useful when creating a UNICODE_STRING from an
902 NtQueryInformationFile info buffer, where the length of the filename
903 is known, but you can't rely on the string being 0-terminated.
904 If you know it's 0-terminated, just use RtlInitUnicodeString(). */
906 VOID NTAPI
RtlInitCountedUnicodeString (PUNICODE_STRING dest
, PCWSTR buf
,
909 dest
->Length
= dest
->MaximumLength
= len
;
910 dest
->Buffer
= (PWSTR
) buf
;
912 /* Split path into dirname and basename part. This function does not
913 copy anything! It just initializes the dirname and basename
914 UNICODE_STRINGs so that their Buffer members point to the right spot
915 into path's Buffer, and the Length (and MaximumLength) members are set
916 to match the dirname part and the basename part.
917 Note that dirname's Length is set so that it also includes the trailing
918 backslash. If you don't need it, just subtract sizeof(WCHAR) from
921 VOID NTAPI
RtlSplitUnicodePath (PUNICODE_STRING path
, PUNICODE_STRING dirname
,
922 PUNICODE_STRING basename
)
924 USHORT len
= path
->Length
/ sizeof (WCHAR
);
925 while (len
> 0 && path
->Buffer
[--len
] != L
'\\')
929 RtlInitCountedUnicodeString (dirname
, path
->Buffer
, len
* sizeof (WCHAR
));
931 RtlInitCountedUnicodeString (basename
, &path
->Buffer
[len
],
932 path
->Length
- len
* sizeof (WCHAR
));
934 /* Check if prefix is a prefix of path. */
936 BOOLEAN NTAPI
RtlEqualUnicodePathPrefix (PUNICODE_STRING path
, PCWSTR prefix
,
937 BOOLEAN caseinsensitive
)
939 UNICODE_STRING p
, pref
;
941 RtlInitUnicodeString (&pref
, prefix
);
942 RtlInitCountedUnicodeString (&p
, path
->Buffer
,
943 pref
.Length
< path
->Length
944 ? pref
.Length
: path
->Length
);
945 return RtlEqualUnicodeString (&p
, &pref
, caseinsensitive
);
947 /* Check if sufffix is a sufffix of path. */
949 BOOL NTAPI
RtlEqualUnicodePathSuffix (PUNICODE_STRING path
, PCWSTR suffix
,
950 BOOLEAN caseinsensitive
)
952 UNICODE_STRING p
, suf
;
954 RtlInitUnicodeString (&suf
, suffix
);
955 if (suf
.Length
< path
->Length
)
956 RtlInitCountedUnicodeString (&p
, (PWCHAR
) ((PBYTE
) path
->Buffer
957 + path
->Length
- suf
.Length
),
960 RtlInitCountedUnicodeString (&p
, path
->Buffer
, path
->Length
);
961 return RtlEqualUnicodeString (&p
, &suf
, caseinsensitive
);
963 /* Implemented in strfuncs.cc. Create a Hex UNICODE_STRING from a given
964 64 bit integer value. If append is TRUE, append the hex string,
965 otherwise overwrite dest. Returns either STATUS_SUCCESS, or
966 STATUS_BUFFER_OVERFLOW, if the unicode buffer is too small (hasn't
967 room for 16 WCHARs). */
968 NTSTATUS NTAPI
RtlInt64ToHexUnicodeString (ULONGLONG value
,
969 PUNICODE_STRING dest
,