2 * this file defines interfaces mainly exposed to device drivers and
5 * Copyright (C) the Wine project
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __WINE_NTDDK_H
23 #define __WINE_NTDDK_H
28 #include "winbase.h" /* FIXME: should be taken out sometimes */
37 #undef Status /* conflict with X11-includes*/
39 typedef struct _IO_STATUS_BLOCK
45 ULONG_PTR Information
;
46 } IO_STATUS_BLOCK
, *PIO_STATUS_BLOCK
;
48 typedef VOID (NTAPI
*PIO_APC_ROUTINE
) ( PVOID ApcContext
, PIO_STATUS_BLOCK IoStatusBlock
, ULONG Reserved
);
55 typedef struct _KEY_BASIC_INFORMATION
{
56 LARGE_INTEGER LastWriteTime
;
60 } KEY_BASIC_INFORMATION
, *PKEY_BASIC_INFORMATION
;
62 typedef struct _KEY_NODE_INFORMATION
64 LARGE_INTEGER LastWriteTime
;
71 } KEY_NODE_INFORMATION
, *PKEY_NODE_INFORMATION
;
73 typedef struct _KEY_FULL_INFORMATION
75 LARGE_INTEGER LastWriteTime
;
83 ULONG MaxValueNameLen
;
84 ULONG MaxValueDataLen
;
86 } KEY_FULL_INFORMATION
, *PKEY_FULL_INFORMATION
;
88 typedef enum _KEY_INFORMATION_CLASS
93 } KEY_INFORMATION_CLASS
;
95 typedef struct _KEY_VALUE_ENTRY
97 PUNICODE_STRING ValueName
;
101 } KEY_VALUE_ENTRY
, *PKEY_VALUE_ENTRY
;
103 /* value information */
104 typedef struct _KEY_VALUE_BASIC_INFORMATION
110 } KEY_VALUE_BASIC_INFORMATION
, *PKEY_VALUE_BASIC_INFORMATION
;
112 typedef struct _KEY_VALUE_FULL_INFORMATION
121 } KEY_VALUE_FULL_INFORMATION
, *PKEY_VALUE_FULL_INFORMATION
;
123 typedef struct _KEY_VALUE_PARTIAL_INFORMATION
129 } KEY_VALUE_PARTIAL_INFORMATION
, *PKEY_VALUE_PARTIAL_INFORMATION
;
131 typedef enum _KEY_VALUE_INFORMATION_CLASS
133 KeyValueBasicInformation
,
134 KeyValueFullInformation
,
135 KeyValuePartialInformation
,
136 KeyValueFullInformationAlign64
,
137 KeyValuePartialInformationAlign64
138 } KEY_VALUE_INFORMATION_CLASS
;
140 NTSTATUS WINAPI
RtlFormatCurrentUserKeyPath(
141 PUNICODE_STRING KeyPath
);
143 /* thread information */
145 typedef enum _THREADINFOCLASS
146 { ThreadBasicInformation
,
151 ThreadImpersonationToken
,
152 ThreadDescriptorTableEntry
,
153 ThreadEnableAlignmentFaultFixup
,
154 ThreadEventPair_Reusable
,
155 ThreadQuerySetWin32StartAddress
,
157 ThreadPerformanceCount
,
159 ThreadIdealProcessor
,
161 ThreadSetTlsArrayAddress
,
167 /* This is used by NtQuerySystemInformation */
168 FILETIME ftCreationTime
;
170 DWORD dwStartAddress
;
173 DWORD dwCurrentPriority
;
174 DWORD dwBasePriority
;
175 DWORD dwContextSwitches
;
179 } THREADINFO
, *PTHREADINFO
;
181 /* file information */
183 typedef enum _FILE_INFORMATION_CLASS
{
184 FileDirectoryInformation
= 1,
185 FileFullDirectoryInformation
,
186 FileBothDirectoryInformation
,
187 FileBasicInformation
,
188 FileStandardInformation
,
189 FileInternalInformation
,
191 FileAccessInformation
,
193 FileRenameInformation
,
195 FileNamesInformation
,
196 FileDispositionInformation
,
197 FilePositionInformation
,
198 FileFullEaInformation
,
200 FileAlignmentInformation
,
202 FileAllocationInformation
,
203 FileEndOfFileInformation
,
204 FileAlternateNameInformation
,
205 FileStreamInformation
,
207 FilePipeLocalInformation
,
208 FilePipeRemoteInformation
,
209 FileMailslotQueryInformation
,
210 FileMailslotSetInformation
,
211 FileCompressionInformation
,
212 FileObjectIdInformation
,
213 FileCompletionInformation
,
214 FileMoveClusterInformation
,
215 FileQuotaInformation
,
216 FileReparsePointInformation
,
217 FileNetworkOpenInformation
,
218 FileAttributeTagInformation
,
219 FileTrackingInformation
,
220 FileMaximumInformation
221 } FILE_INFORMATION_CLASS
, *PFILE_INFORMATION_CLASS
;
223 typedef enum _FSINFOCLASS
{
224 FileFsVolumeInformation
= 1,
225 FileFsLabelInformation
,
226 FileFsSizeInformation
,
227 FileFsDeviceInformation
,
228 FileFsAttributeInformation
,
229 FileFsControlInformation
,
230 FileFsFullSizeInformation
,
231 FileFsObjectIdInformation
,
232 FileFsMaximumInformation
233 } FS_INFORMATION_CLASS
, *PFS_INFORMATION_CLASS
;
235 typedef enum _SECTION_INHERIT
242 /* object information */
244 typedef enum _OBJECT_INFORMATION_CLASS
248 } OBJECT_INFORMATION_CLASS
, *POBJECT_INFORMATION_CLASS
;
251 /* system information */
253 typedef enum SYSTEM_INFORMATION_CLASS
254 { SystemBasicInformation
= 0,
256 SystemPerformanceInformation
,
257 SystemTimeInformation
,
259 SystemProcessInformation
,
265 SystemDriverInformation
,
275 SystemCacheInformation
276 } SYSTEM_INFORMATION_CLASS
, *PSYSTEM_INFORMATION_CLASS
;
279 /* System Information Class 0x00 */
281 ULONG uKeMaximumIncrement
;
283 ULONG uMmNumberOfPhysicalPages
;
284 ULONG uMmLowestPhysicalPage
;
285 ULONG uMmHighestPhysicalPage
;
286 ULONG uAllocationGranularity
;
287 PVOID pLowestUserAddress
;
288 PVOID pMmHighestUserAddress
;
289 ULONG uKeActiveProcessors
;
290 BYTE bKeNumberProcessors
;
293 } SYSTEM_BASIC_INFORMATION
;
296 /* System Information Class 0x02 */
297 LARGE_INTEGER liIdleTime
;
299 } SYSTEM_PERFORMANCE_INFORMATION
;
302 /* System Information Class 0x03 */
303 LARGE_INTEGER liKeBootTime
;
304 LARGE_INTEGER liKeSystemTime
;
305 LARGE_INTEGER liExpTimeZoneBias
;
306 ULONG uCurrentTimeZoneId
;
308 } SYSTEM_TIME_INFORMATION
;
311 /* System Information Class 0x05 */
315 FILETIME ftCreationTime
;
317 WCHAR
* pszProcessName
;
318 DWORD dwBasePriority
;
320 DWORD dwParentProcessID
;
324 DWORD dwVirtualBytesPeak
;
325 DWORD dwVirtualBytes
;
327 DWORD dwWorkingSetPeak
;
332 DWORD dwNonPagedPool
;
333 DWORD dwPageFileBytesPeak
;
334 DWORD dwPrivateBytes
;
335 DWORD dwPageFileBytes
;
338 } SYSTEM_PROCESS_INFORMATION
;
341 /* System Information Class 0x0b */
347 char szName
[MAX_PATH
+ 1];
348 } SYSTEM_DRIVER_INFORMATION
;
351 /* System Information Class 0x10 */
353 USHORT dwCreatorBackTraceIndex
;
355 BYTE bHandleAttributes
;
356 USHORT usHandleOffset
;
358 ULONG ulGrantedAccess
;
359 } HANDLEINFO
, *PHANDLEINFO
;
362 /* System Information Class 0x15 */
365 ULONG PageFaultCount
;
366 ULONG MinimumWorkingSet
;
367 ULONG MaximumWorkingSet
;
369 } SYSTEM_CACHE_INFORMATION
;
371 /* reading coffee grounds... */
372 typedef struct _THREAD_INFO
379 } THREAD_INFO
, PTHREAD_INFO
;
381 typedef struct _VM_COUNTERS_
382 { ULONG PeakVirtualSize
;
384 ULONG PageFaultCount
;
385 ULONG PeakWorkingSetSize
;
386 ULONG WorkingSetSize
;
387 ULONG QuotaPeakPagedPoolUsage
;
388 ULONG QuotaPagedPoolUsage
;
389 ULONG QuotaPeakNonPagedPoolUsage
;
390 ULONG QuotaNonPagedPoolUsage
;
392 ULONG PeakPagefileUsage
;
393 } VM_COUNTERS
, *PVM_COUNTERS
;
395 /* process information */
397 typedef struct _PROCESS_INFO
398 { DWORD Offset
; /* 00 offset to next PROCESS_INFO ok*/
399 DWORD ThreadCount
; /* 04 number of ThreadInfo member ok */
401 FILETIME CreationTime
; /* 20 */
403 PWCHAR ProcessName
; /* 3c ok */
405 DWORD ProcessID
; /* 44 ok*/
406 DWORD ParentProcessID
;
408 DWORD Unknown3
[2]; /* 50 */
409 ULONG PeakVirtualSize
;
411 ULONG PageFaultCount
;
412 ULONG PeakWorkingSetSize
;
413 ULONG WorkingSetSize
;
414 ULONG QuotaPeakPagedPoolUsage
;
415 ULONG QuotaPagedPoolUsage
;
416 ULONG QuotaPeakNonPagedPoolUsage
;
417 ULONG QuotaNonPagedPoolUsage
;
419 ULONG PeakPagefileUsage
;
422 THREAD_INFO ati
[ANYSIZE_ARRAY
]; /* 94 size=0x40*/
423 } PROCESS_INFO
, PPROCESS_INFO
;
425 NTSTATUS WINAPI
NtQuerySystemInformation(
426 IN SYSTEM_INFORMATION_CLASS SystemInformationClass
,
427 OUT PVOID SystemInformation
,
429 OUT PULONG ResultLength
);
432 * system configuration
436 typedef struct _SYSTEM_TIME_ADJUSTMENT
438 ULONG TimeAdjustment
;
439 BOOLEAN TimeAdjustmentDisabled
;
441 } SYSTEM_TIME_ADJUSTMENT
, *PSYSTEM_TIME_ADJUSTMENT
;
443 typedef struct _SYSTEM_CONFIGURATION_INFO
448 { WORD ProcessorArchitecture
;
453 PVOID MinimumApplicationAddress
;
454 PVOID MaximumApplicationAddress
;
455 ULONG ActiveProcessorMask
;
456 ULONG NumberOfProcessors
;
458 ULONG AllocationGranularity
;
460 WORD ProcessorRevision
;
462 } SYSTEM_CONFIGURATION_INFO
, *PSYSTEM_CONFIGURATION_INFO
;
466 * NtQueryProcessInformation
469 /* parameter ProcessInformationClass */
471 typedef enum _PROCESSINFOCLASS
472 { ProcessBasicInformation
,
478 ProcessRaisePriority
,
480 ProcessExceptionPort
,
482 ProcessLdtInformation
,
484 ProcessDefaultHardErrorMode
,
485 ProcessIoPortHandlers
,
486 ProcessPooledUsageAndLimits
,
487 ProcessWorkingSetWatch
,
489 ProcessEnableAlignmentFaultFixup
,
490 ProcessPriorityClass
,
491 ProcessWx86Information
,
494 ProcessPriorityBoost
,
496 ProcessSessionInformation
,
497 ProcessForegroundInformation
,
498 ProcessWow64Information
,
502 /* parameter ProcessInformation (depending on ProcessInformationClass) */
504 typedef struct _PROCESS_BASIC_INFORMATION
506 DWORD PebBaseAddress
;
509 ULONG UniqueProcessId
;
510 ULONG InheritedFromUniqueProcessId
;
511 } PROCESS_BASIC_INFORMATION
;
513 NTSTATUS WINAPI
NtQueryInformationProcess(
514 IN HANDLE ProcessHandle
,
515 IN PROCESSINFOCLASS ProcessInformationClass
,
516 OUT PVOID ProcessInformation
,
517 IN ULONG ProcessInformationLength
,
518 OUT PULONG ReturnLength
);
520 #define NtCurrentProcess() ( (HANDLE) -1 )
526 typedef enum _TIMER_TYPE
533 /* token functions */
535 NTSTATUS WINAPI
NtOpenProcessToken(
536 HANDLE ProcessHandle
,
538 HANDLE
*TokenHandle
);
540 NTSTATUS WINAPI
NtOpenThreadToken(
544 HANDLE
*TokenHandle
);
546 NTSTATUS WINAPI
NtAdjustPrivilegesToken(
547 IN HANDLE TokenHandle
,
548 IN BOOLEAN DisableAllPrivileges
,
549 IN PTOKEN_PRIVILEGES NewState
,
550 IN DWORD BufferLength
,
551 OUT PTOKEN_PRIVILEGES PreviousState
,
552 OUT PDWORD ReturnLength
);
554 NTSTATUS WINAPI
NtQueryInformationToken(
556 DWORD tokeninfoclass
,
558 DWORD tokeninfolength
,
563 BOOLEAN WINAPI
RtlAllocateAndInitializeSid (
564 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
565 BYTE nSubAuthorityCount
,
566 DWORD nSubAuthority0
, DWORD nSubAuthority1
,
567 DWORD nSubAuthority2
, DWORD nSubAuthority3
,
568 DWORD nSubAuthority4
, DWORD nSubAuthority5
,
569 DWORD nSubAuthority6
, DWORD nSubAuthority7
,
572 BOOL WINAPI
RtlInitializeSid(
574 PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority
,
575 BYTE nSubAuthorityCount
);
577 DWORD WINAPI
RtlFreeSid(
580 BOOL WINAPI
RtlEqualSid(
584 DWORD WINAPI
RtlLengthRequiredSid(
587 DWORD WINAPI
RtlLengthSid(
590 LPDWORD WINAPI
RtlSubAuthoritySid(
594 LPBYTE WINAPI
RtlSubAuthorityCountSid(
597 DWORD WINAPI
RtlCopySid(
602 BOOL WINAPI
RtlValidSid(
605 BOOL WINAPI
RtlEqualPrefixSid(
609 PSID_IDENTIFIER_AUTHORITY WINAPI
RtlIdentifierAuthoritySid(
612 /* security descriptor functions */
614 NTSTATUS WINAPI
RtlCreateSecurityDescriptor(
615 PSECURITY_DESCRIPTOR lpsd
,
618 NTSTATUS WINAPI
RtlValidSecurityDescriptor(
619 PSECURITY_DESCRIPTOR SecurityDescriptor
);
621 ULONG WINAPI
RtlLengthSecurityDescriptor(
622 PSECURITY_DESCRIPTOR SecurityDescriptor
);
624 NTSTATUS WINAPI
RtlGetDaclSecurityDescriptor(
625 IN PSECURITY_DESCRIPTOR pSecurityDescriptor
,
626 OUT PBOOLEAN lpbDaclPresent
,
628 OUT PBOOLEAN lpbDaclDefaulted
);
630 NTSTATUS WINAPI
RtlSetDaclSecurityDescriptor (
631 PSECURITY_DESCRIPTOR lpsd
,
634 BOOLEAN dacldefaulted
);
636 NTSTATUS WINAPI
RtlGetSaclSecurityDescriptor(
637 IN PSECURITY_DESCRIPTOR pSecurityDescriptor
,
638 OUT PBOOLEAN lpbSaclPresent
,
640 OUT PBOOLEAN lpbSaclDefaulted
);
642 NTSTATUS WINAPI
RtlSetSaclSecurityDescriptor (
643 PSECURITY_DESCRIPTOR lpsd
,
646 BOOLEAN sacldefaulted
);
648 NTSTATUS WINAPI
RtlGetOwnerSecurityDescriptor(
649 PSECURITY_DESCRIPTOR SecurityDescriptor
,
651 PBOOLEAN OwnerDefaulted
);
653 NTSTATUS WINAPI
RtlSetOwnerSecurityDescriptor(
654 PSECURITY_DESCRIPTOR lpsd
,
656 BOOLEAN ownerdefaulted
);
658 NTSTATUS WINAPI
RtlSetGroupSecurityDescriptor (
659 PSECURITY_DESCRIPTOR lpsd
,
661 BOOLEAN groupdefaulted
);
663 NTSTATUS WINAPI
RtlGetGroupSecurityDescriptor(
664 PSECURITY_DESCRIPTOR SecurityDescriptor
,
666 PBOOLEAN GroupDefaulted
);
668 NTSTATUS WINAPI
RtlMakeSelfRelativeSD(
669 IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor
,
670 IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor
,
671 IN OUT LPDWORD lpdwBufferLength
);
673 NTSTATUS WINAPI
RtlGetControlSecurityDescriptor(
674 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
675 PSECURITY_DESCRIPTOR_CONTROL pControl
,
676 LPDWORD lpdwRevision
);
680 NTSTATUS WINAPI
RtlCreateAcl(
685 BOOLEAN WINAPI
RtlFirstFreeAce(
689 NTSTATUS WINAPI
RtlAddAce(
693 PACE_HEADER acestart
,
696 BOOL WINAPI
RtlAddAccessAllowedAce(
698 IN DWORD dwAceRevision
,
702 BOOL WINAPI
AddAccessAllowedAceEx(
704 IN DWORD dwAceRevision
,
709 DWORD WINAPI
RtlGetAce(
714 /* string functions */
716 DWORD WINAPI
RtlAnsiStringToUnicodeSize(const STRING
*);
717 NTSTATUS WINAPI
RtlAnsiStringToUnicodeString(UNICODE_STRING
*,const STRING
*,BOOLEAN
);
718 NTSTATUS WINAPI
RtlAppendAsciizToString(STRING
*,LPCSTR
);
719 NTSTATUS WINAPI
RtlAppendStringToString(STRING
*,const STRING
*);
720 NTSTATUS WINAPI
RtlAppendUnicodeStringToString(UNICODE_STRING
*,const UNICODE_STRING
*);
721 NTSTATUS WINAPI
RtlAppendUnicodeToString(UNICODE_STRING
*,LPCWSTR
);
722 LONG WINAPI
RtlCompareString(const STRING
*,const STRING
*,BOOLEAN
);
723 LONG WINAPI
RtlCompareUnicodeString(const UNICODE_STRING
*,const UNICODE_STRING
*,BOOLEAN
);
724 void WINAPI
RtlCopyString(STRING
*,const STRING
*);
725 void WINAPI
RtlCopyUnicodeString(UNICODE_STRING
*,const UNICODE_STRING
*);
726 BOOLEAN WINAPI
RtlCreateUnicodeString(PUNICODE_STRING
,LPCWSTR
);
727 BOOLEAN WINAPI
RtlCreateUnicodeStringFromAsciiz(PUNICODE_STRING
,LPCSTR
);
728 void WINAPI
RtlEraseUnicodeString(UNICODE_STRING
*);
729 BOOLEAN WINAPI
RtlEqualString(const STRING
*,const STRING
*,BOOLEAN
);
730 BOOLEAN WINAPI
RtlEqualUnicodeString(const UNICODE_STRING
*,const UNICODE_STRING
*,BOOLEAN
);
731 void WINAPI
RtlFreeAnsiString(PSTRING
);
732 void WINAPI
RtlFreeOemString(PSTRING
);
733 void WINAPI
RtlFreeUnicodeString(PUNICODE_STRING
);
734 void WINAPI
RtlInitAnsiString(PSTRING
,LPCSTR
);
735 void WINAPI
RtlInitString(PSTRING
,LPCSTR
);
736 void WINAPI
RtlInitUnicodeString(PUNICODE_STRING
,LPCWSTR
);
737 NTSTATUS WINAPI
RtlMultiByteToUnicodeN(LPWSTR
,DWORD
,LPDWORD
,LPCSTR
,DWORD
);
738 NTSTATUS WINAPI
RtlMultiByteToUnicodeSize(DWORD
*,LPCSTR
,UINT
);
739 UINT WINAPI
RtlOemStringToUnicodeSize(const STRING
*);
740 NTSTATUS WINAPI
RtlOemStringToUnicodeString(UNICODE_STRING
*,const STRING
*,BOOLEAN
);
741 NTSTATUS WINAPI
RtlOemToUnicodeN(LPWSTR
,DWORD
,LPDWORD
,LPCSTR
,DWORD
);
742 BOOLEAN WINAPI
RtlPrefixString(const STRING
*,const STRING
*,BOOLEAN
);
743 BOOLEAN WINAPI
RtlPrefixUnicodeString(const UNICODE_STRING
*,const UNICODE_STRING
*,BOOLEAN
);
744 DWORD WINAPI
RtlUnicodeStringToAnsiSize(const UNICODE_STRING
*);
745 NTSTATUS WINAPI
RtlUnicodeStringToAnsiString(STRING
*,const UNICODE_STRING
*,BOOLEAN
);
746 DWORD WINAPI
RtlUnicodeStringToOemSize(const UNICODE_STRING
*);
747 NTSTATUS WINAPI
RtlUnicodeStringToOemString(STRING
*,const UNICODE_STRING
*,BOOLEAN
);
748 NTSTATUS WINAPI
RtlUnicodeToMultiByteN(LPSTR
,DWORD
,LPDWORD
,LPCWSTR
,DWORD
);
749 NTSTATUS WINAPI
RtlUnicodeToMultiByteSize(DWORD
*,LPCWSTR
,UINT
);
750 NTSTATUS WINAPI
RtlUnicodeToOemN(LPSTR
,DWORD
,LPDWORD
,LPCWSTR
,DWORD
);
751 NTSTATUS WINAPI
RtlUpcaseUnicodeString(UNICODE_STRING
*,const UNICODE_STRING
*,BOOLEAN
);
752 NTSTATUS WINAPI
RtlUpcaseUnicodeStringToAnsiString(STRING
*,const UNICODE_STRING
*,BOOLEAN
);
753 NTSTATUS WINAPI
RtlUpcaseUnicodeStringToOemString(STRING
*,const UNICODE_STRING
*,BOOLEAN
);
754 NTSTATUS WINAPI
RtlUpcaseUnicodeToMultiByteN(LPSTR
,DWORD
,LPDWORD
,LPCWSTR
,DWORD
);
755 NTSTATUS WINAPI
RtlUpcaseUnicodeToOemN(LPSTR
,DWORD
,LPDWORD
,LPCWSTR
,DWORD
);
757 DWORD WINAPI
RtlIsTextUnicode(
762 /* resource functions */
764 typedef struct _RTL_RWLOCK
{
765 CRITICAL_SECTION rtlCS
;
766 HANDLE hSharedReleaseSemaphore
;
768 HANDLE hExclusiveReleaseSemaphore
;
769 UINT uExclusiveWaiters
;
771 HANDLE hOwningThreadId
;
772 DWORD dwTimeoutBoost
;
774 } RTL_RWLOCK
, *LPRTL_RWLOCK
;
776 VOID WINAPI
RtlInitializeResource(
779 VOID WINAPI
RtlDeleteResource(
782 BYTE WINAPI
RtlAcquireResourceExclusive(
783 LPRTL_RWLOCK
, BYTE fWait
);
785 BYTE WINAPI
RtlAcquireResourceShared(
786 LPRTL_RWLOCK
, BYTE fWait
);
788 VOID WINAPI
RtlReleaseResource(
791 VOID WINAPI
RtlDumpResource(
796 typedef struct _TIME_FIELDS
807 typedef TIME_FIELDS
*PTIME_FIELDS
;
809 VOID WINAPI
RtlSystemTimeToLocalTime(
810 IN PLARGE_INTEGER SystemTime
,
811 OUT PLARGE_INTEGER LocalTime
);
813 VOID WINAPI
RtlTimeToTimeFields(
814 PLARGE_INTEGER liTime
,
815 PTIME_FIELDS TimeFields
);
817 BOOLEAN WINAPI
RtlTimeFieldsToTime(
818 PTIME_FIELDS tfTimeFields
,
819 PLARGE_INTEGER Time
);
821 VOID WINAPI
RtlTimeToElapsedTimeFields(
822 PLARGE_INTEGER liTime
,
823 PTIME_FIELDS TimeFields
);
825 void WINAPI
NtQuerySystemTime( LARGE_INTEGER
*time
);
827 BOOLEAN WINAPI
RtlTimeToSecondsSince1980( const FILETIME
*time
, LPDWORD res
);
828 BOOLEAN WINAPI
RtlTimeToSecondsSince1970( const FILETIME
*time
, LPDWORD res
);
829 void WINAPI
RtlSecondsSince1970ToTime( DWORD time
, FILETIME
*res
);
830 void WINAPI
RtlSecondsSince1980ToTime( DWORD time
, FILETIME
*res
);
834 /* Data structure for heap definition. This includes various
835 sizing parameters and callback routines, which, if left NULL,
836 result in default behavior */
839 { ULONG Length
; /* = sizeof(RTL_HEAP_DEFINITION) */
841 } RTL_HEAP_DEFINITION
, *PRTL_HEAP_DEFINITION
;
843 HANDLE WINAPI
RtlCreateHeap(ULONG
,PVOID
,ULONG
,ULONG
,PVOID
,PRTL_HEAP_DEFINITION
);
844 HANDLE WINAPI
RtlDestroyHeap(HANDLE
);
845 PVOID WINAPI
RtlAllocateHeap(HANDLE
,ULONG
,ULONG
);
846 BOOLEAN WINAPI
RtlFreeHeap(HANDLE
,ULONG
,PVOID
);
847 PVOID WINAPI
RtlReAllocateHeap(HANDLE
,ULONG
,PVOID
,ULONG
);
848 ULONG WINAPI
RtlCompactHeap(HANDLE
,ULONG
);
849 BOOLEAN WINAPI
RtlLockHeap(HANDLE
);
850 BOOLEAN WINAPI
RtlUnlockHeap(HANDLE
);
851 ULONG WINAPI
RtlSizeHeap(HANDLE
,ULONG
,PVOID
);
852 BOOLEAN WINAPI
RtlValidateHeap(HANDLE
,ULONG
,PCVOID
);
853 ULONG WINAPI
RtlGetProcessHeaps(ULONG
,HANDLE
*);
854 NTSTATUS WINAPI
RtlWalkHeap(HANDLE
,PVOID
);
858 void WINAPI
NtRaiseException(
859 PEXCEPTION_RECORD
,PCONTEXT
,BOOL
);
861 void WINAPI
RtlRaiseException(
864 void WINAPI
RtlRaiseStatus(
867 void WINAPI
RtlUnwind(
870 PEXCEPTION_RECORD
,DWORD
);
872 /* process environment block */
873 VOID WINAPI
RtlAcquirePebLock(void);
874 VOID WINAPI
RtlReleasePebLock(void);
877 LONGLONG WINAPI
RtlConvertLongToLargeInteger( LONG a
);
878 LONGLONG WINAPI
RtlEnlargedIntegerMultiply( INT a
, INT b
);
879 LONGLONG WINAPI
RtlExtendedMagicDivide( LONGLONG a
, LONGLONG b
, INT shift
);
880 LONGLONG WINAPI
RtlExtendedIntegerMultiply( LONGLONG a
, INT b
);
881 LONGLONG WINAPI
RtlExtendedLargeIntegerDivide( LONGLONG a
, INT b
, INT
*rem
);
882 LONGLONG WINAPI
RtlLargeIntegerAdd( LONGLONG a
, LONGLONG b
);
883 LONGLONG WINAPI
RtlLargeIntegerArithmeticShift( LONGLONG a
, INT count
);
884 LONGLONG WINAPI
RtlLargeIntegerNegate( LONGLONG a
);
885 LONGLONG WINAPI
RtlLargeIntegerShiftLeft( LONGLONG a
, INT count
);
886 LONGLONG WINAPI
RtlLargeIntegerShiftRight( LONGLONG a
, INT count
);
887 LONGLONG WINAPI
RtlLargeIntegerSubtract( LONGLONG a
, LONGLONG b
);
888 ULONGLONG WINAPI
RtlEnlargedUnsignedMultiply( UINT a
, UINT b
);
889 UINT WINAPI
RtlEnlargedUnsignedDivide( ULONGLONG a
, UINT b
, UINT
*remptr
);
890 ULONGLONG WINAPI
RtlConvertUlongToLargeInteger( ULONG a
);
891 ULONGLONG WINAPI
RtlLargeIntegerDivide( ULONGLONG a
, ULONGLONG b
, ULONGLONG
*rem
);
894 DWORD WINAPI
RtlCreateEnvironment(
898 DWORD WINAPI
RtlDestroyEnvironment(
901 DWORD WINAPI
RtlQueryEnvironmentVariable_U(
904 PUNICODE_STRING val
) ;
906 DWORD WINAPI
RtlSetEnvironmentVariable(
909 PUNICODE_STRING val
);
911 /* object security */
913 DWORD WINAPI
RtlNewSecurityObject(
921 DWORD WINAPI
RtlDeleteSecurityObject(
925 NtQuerySecurityObject(
927 IN SECURITY_INFORMATION RequestedInformation
,
928 OUT PSECURITY_DESCRIPTOR pSecurityDesriptor
,
930 OUT PULONG ResultLength
);
935 IN SECURITY_INFORMATION SecurityInformation
,
936 IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
938 /* registry functions */
940 NTSTATUS WINAPI
NtCreateKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,
941 const UNICODE_STRING
*,ULONG
,PULONG
);
942 NTSTATUS WINAPI
NtDeleteKey(HANDLE
);
943 NTSTATUS WINAPI
NtDeleteValueKey(HANDLE
,const UNICODE_STRING
*);
944 NTSTATUS WINAPI
NtOpenKey(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*);
945 NTSTATUS WINAPI
NtQueryKey(HANDLE
,KEY_INFORMATION_CLASS
,void*,DWORD
,DWORD
*);
946 NTSTATUS WINAPI
NtSetValueKey(HANDLE
,const UNICODE_STRING
*,ULONG
,ULONG
,const void*,ULONG
);
947 NTSTATUS WINAPI
NtEnumerateKey(HANDLE
,ULONG
,KEY_INFORMATION_CLASS
,void*,DWORD
,DWORD
*);
948 NTSTATUS WINAPI
NtQueryValueKey(HANDLE
,const UNICODE_STRING
*,KEY_VALUE_INFORMATION_CLASS
,
950 NTSTATUS WINAPI
NtLoadKey(const OBJECT_ATTRIBUTES
*,const OBJECT_ATTRIBUTES
*);
953 NTSTATUS WINAPI
NtEnumerateValueKey(
956 KEY_VALUE_INFORMATION_CLASS KeyInformationClass
,
957 PVOID KeyInformation
,
959 PULONG ResultLength
);
961 NTSTATUS WINAPI
NtFlushKey(HANDLE KeyHandle
);
963 NTSTATUS WINAPI
NtNotifyChangeKey(
966 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL
,
967 IN PVOID ApcContext OPTIONAL
,
968 OUT PIO_STATUS_BLOCK IoStatusBlock
,
969 IN ULONG CompletionFilter
,
970 IN BOOLEAN Asynchroneous
,
971 OUT PVOID ChangeBuffer
,
973 IN BOOLEAN WatchSubtree
);
975 NTSTATUS WINAPI
NtQueryMultipleValueKey(
977 PVALENTW ListOfValuesToQuery
,
979 PVOID MultipleValueInformation
,
981 PULONG ReturnLength
);
983 NTSTATUS WINAPI
NtReplaceKey(
984 IN POBJECT_ATTRIBUTES ObjectAttributes
,
986 IN POBJECT_ATTRIBUTES ReplacedObjectAttributes
);
988 NTSTATUS WINAPI
NtRestoreKey(
993 NTSTATUS WINAPI
NtSaveKey(
995 IN HANDLE FileHandle
);
997 NTSTATUS WINAPI
NtSetInformationKey(
999 IN
const int KeyInformationClass
,
1000 IN PVOID KeyInformation
,
1001 IN ULONG KeyInformationLength
);
1003 NTSTATUS WINAPI
NtUnloadKey(
1004 IN HANDLE KeyHandle
);
1006 NTSTATUS WINAPI
NtClose(
1009 NTSTATUS WINAPI
NtTerminateProcess( HANDLE handle
, LONG exit_code
);
1010 NTSTATUS WINAPI
NtTerminateThread( HANDLE handle
, LONG exit_code
);
1012 NTSTATUS WINAPI
NtClearEvent(HANDLE
);
1013 NTSTATUS WINAPI
NtCreateEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,BOOLEAN
,BOOLEAN
);
1014 NTSTATUS WINAPI
NtCreateSemaphore(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*,ULONG
,ULONG
);
1015 NTSTATUS WINAPI
NtOpenEvent(PHANDLE
,ACCESS_MASK
,const OBJECT_ATTRIBUTES
*attr
);
1016 NTSTATUS WINAPI
NtPulseEvent(HANDLE
,PULONG
);
1017 NTSTATUS WINAPI
NtReleaseSemaphore(HANDLE
,ULONG
,PULONG
);
1018 NTSTATUS WINAPI
NtResetEvent(HANDLE
,PULONG
);
1019 NTSTATUS WINAPI
NtSetEvent(HANDLE
,PULONG
);
1021 NTSTATUS WINAPI
RtlInitializeCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1022 NTSTATUS WINAPI
RtlInitializeCriticalSectionAndSpinCount( RTL_CRITICAL_SECTION
*crit
, DWORD spincount
);
1023 NTSTATUS WINAPI
RtlDeleteCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1024 NTSTATUS WINAPI
RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1025 NTSTATUS WINAPI
RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1026 NTSTATUS WINAPI
RtlEnterCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1027 BOOL WINAPI
RtlTryEnterCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1028 NTSTATUS WINAPI
RtlLeaveCriticalSection( RTL_CRITICAL_SECTION
*crit
);
1030 /* file functions */
1032 /* flags for NtCreateFile and NtOpenFile */
1033 #define FILE_DIRECTORY_FLAG 0x00000001
1034 #define FILE_WRITE_THROUGH 0x00000002
1035 #define FILE_SEQUENTIAL_ONLY 0x00000004
1036 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
1037 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
1038 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
1039 #define FILE_NON_DIRECTORY_FILE 0x00000040
1040 #define FILE_CREATE_TREE_CONNECTION 0x00000080
1042 /* status for NtCreateFile or NtOpenFile */
1043 #define FILE_SUPERSEDED 0x00000000
1044 #define FILE_OPENED 0x00000001
1045 #define FILE_CREATED 0x00000002
1046 #define FILE_OVERWRITTEN 0x00000003
1047 #define FILE_EXISTS 0x00000004
1048 #define FILE_DOES_NOT_EXIST 0x00000005
1050 NTSTATUS WINAPI
NtCreateFile(PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
, PIO_STATUS_BLOCK
, PLARGE_INTEGER
, ULONG
, ULONG
, ULONG
, ULONG
, PVOID
, ULONG
);
1051 NTSTATUS WINAPI
NtOpenFile(PHANDLE
, ACCESS_MASK
, POBJECT_ATTRIBUTES
, PIO_STATUS_BLOCK
, ULONG
, ULONG
);
1052 NTSTATUS WINAPI
NtReadFile(HANDLE
, HANDLE
, PIO_APC_ROUTINE
, PVOID
, PIO_STATUS_BLOCK
, PVOID
, ULONG
, PLARGE_INTEGER
, PULONG
);
1055 /* string functions */
1056 extern LPSTR
_strlwr( LPSTR str
);
1057 extern LPSTR
_strupr( LPSTR str
);
1061 #if defined(__i386__) && defined(__GNUC__)
1062 static inline void WINAPI
DbgBreakPoint(void) { __asm__
__volatile__("int3"); }
1063 static inline void WINAPI
DbgUserBreakPoint(void) { __asm__
__volatile__("int3"); }
1064 #else /* __i386__ && __GNUC__ */
1065 void WINAPI
DbgBreakPoint(void);
1066 void WINAPI
DbgUserBreakPoint(void);
1067 #endif /* __i386__ && __GNUC__ */
1068 void WINAPIV
DbgPrint(LPCSTR fmt
, ...);
1070 DWORD WINAPI
RtlAdjustPrivilege(DWORD x1
,DWORD x2
,DWORD x3
,DWORD x4
);
1071 DWORD WINAPI
RtlIntegerToChar(DWORD x1
,DWORD x2
,DWORD x3
,DWORD x4
);
1072 LPVOID WINAPI
RtlNormalizeProcessParams(LPVOID x
);
1073 DWORD WINAPI
RtlNtStatusToDosError(DWORD error
);
1074 BOOLEAN WINAPI
RtlGetNtProductType(LPDWORD type
);
1075 PIMAGE_NT_HEADERS WINAPI
RtlImageNtHeader(HMODULE hModule
);
1076 PIMAGE_SECTION_HEADER WINAPI
RtlImageRvaToSection( const IMAGE_NT_HEADERS
*, HMODULE
, DWORD
);
1077 PVOID WINAPI
RtlImageDirectoryEntryToData( HMODULE module
, BOOL image
, WORD dir
, ULONG
*size
);
1078 PVOID WINAPI
RtlImageRvaToVa( const IMAGE_NT_HEADERS
*, HMODULE
, DWORD
, IMAGE_SECTION_HEADER
**);
1080 DWORD WINAPI
RtlOpenCurrentUser(
1081 IN ACCESS_MASK DesiredAccess
,
1082 OUT PHANDLE KeyHandle
);
1084 BOOLEAN WINAPI
RtlDosPathNameToNtPathName_U( LPWSTR from
,PUNICODE_STRING us
,DWORD x2
,DWORD x3
);
1085 BOOL WINAPI
RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
1089 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1090 IN HANDLE ClientToken
,
1091 IN ACCESS_MASK DesiredAccess
,
1092 IN PGENERIC_MAPPING GenericMapping
,
1093 OUT PPRIVILEGE_SET PrivilegeSet
,
1094 OUT PULONG ReturnLength
,
1095 OUT PULONG GrantedAccess
,
1096 OUT PBOOLEAN AccessStatus
);
1098 /* bitmap functions */
1100 /* Bitmap data type */
1101 typedef struct tagRTL_BITMAP
1103 ULONG SizeOfBitMap
; /* Number of bits in the bitmap */
1104 LPBYTE BitMapBuffer
; /* Bitmap data, assumed sized to a DWORD boundary */
1105 } RTL_BITMAP
, *PRTL_BITMAP
;
1107 typedef const RTL_BITMAP
* PCRTL_BITMAP
;
1109 /* Bit run data type */
1110 typedef struct tagRTL_BITMAP_RUN
1112 ULONG StartOfRun
; /* Bit position at which run starts - FIXME: Name? */
1113 ULONG SizeOfRun
; /* Size of the run in bits - FIXME: Name? */
1114 } RTL_BITMAP_RUN
, *PRTL_BITMAP_RUN
;
1116 typedef const RTL_BITMAP_RUN
* PCRTL_BITMAP_RUN
;
1118 /* Bitmap functions */
1119 VOID WINAPI
RtlInitializeBitMap(PRTL_BITMAP
,LPBYTE
,ULONG
);
1120 VOID WINAPI
RtlSetAllBits(PRTL_BITMAP
);
1121 VOID WINAPI
RtlClearAllBits(PRTL_BITMAP
);
1122 VOID WINAPI
RtlSetBits(PRTL_BITMAP
,ULONG
,ULONG
);
1123 VOID WINAPI
RtlClearBits(PRTL_BITMAP
,ULONG
,ULONG
);
1124 ULONG WINAPI
RtlFindSetBits(PCRTL_BITMAP
,ULONG
,ULONG
);
1125 ULONG WINAPI
RtlFindClearBits(PCRTL_BITMAP
,ULONG
,ULONG
);
1126 ULONG WINAPI
RtlFindSetBitsAndClear(PRTL_BITMAP
,ULONG
,ULONG
);
1127 ULONG WINAPI
RtlFindClearBitsAndSet(PRTL_BITMAP
,ULONG
,ULONG
);
1128 ULONG WINAPI
RtlNumberOfSetBits(PCRTL_BITMAP
);
1129 ULONG WINAPI
RtlNumberOfClearBits(PCRTL_BITMAP
);
1130 ULONG WINAPI
RtlFindSetRuns(PCRTL_BITMAP
,PRTL_BITMAP_RUN
,ULONG
,BOOLEAN
);
1131 ULONG WINAPI
RtlFindClearRuns(PCRTL_BITMAP
,PRTL_BITMAP_RUN
,ULONG
,BOOLEAN
);
1132 ULONG WINAPI
RtlFindLongestRunSet(PCRTL_BITMAP
,PULONG
);
1133 ULONG WINAPI
RtlFindLongestRunClear(PCRTL_BITMAP
,PULONG
);
1134 BOOLEAN WINAPI
RtlAreBitsSet(PCRTL_BITMAP
,ULONG
,ULONG
);
1135 BOOLEAN WINAPI
RtlAreBitsClear(PCRTL_BITMAP
,ULONG
,ULONG
);
1136 ULONG WINAPI
RtlFindLastBackwardRunSet(PCRTL_BITMAP
,ULONG
,PULONG
);
1137 ULONG WINAPI
RtlFindLastBackwardRunClear(PCRTL_BITMAP
,ULONG
,PULONG
);
1138 ULONG WINAPI
RtlFindNextForwardRunSet(PCRTL_BITMAP
,ULONG
,PULONG
);
1139 ULONG WINAPI
RtlFindNextForwardRunClear(PCRTL_BITMAP
,ULONG
,PULONG
);
1140 CCHAR WINAPI
RtlFindMostSignificantBit(ULONGLONG
);
1141 CCHAR WINAPI
RtlFindLeastSignificantBit(ULONGLONG
);
1143 /* Inline the trivial calls */
1144 #define RtlInitializeBitMap(p,b,s) \
1146 PRTL_BITMAP _p = (p); \
1147 _p->SizeOfBitMap = (s); \
1148 _p->BitMapBuffer = (b); \
1151 #define RtlSetAllBits(p) \
1153 PRTL_BITMAP _p = (p); \
1154 memset(_p->BitMapBuffer,0xff,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1157 #define RtlClearAllBits(p) \
1159 PRTL_BITMAP _p = (p);\
1160 memset(_p->BitMapBuffer,0,((_p->SizeOfBitMap + 31) & 0xffffffe0) >> 3); \
1163 inline static BOOLEAN
RtlCheckBit(PCRTL_BITMAP lpBits
, ULONG ulBit
)
1165 if (lpBits
&& ulBit
< lpBits
->SizeOfBitMap
&&
1166 lpBits
->BitMapBuffer
[ulBit
>> 3] & (1 << (ulBit
& 7)))
1172 #define RtlStoreUlong(p,v) do { ULONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1173 #define RtlRetrieveUlong(p,s) memcpy((p), (s), sizeof(ULONG))
1175 #define RtlStoreUlonglong(p,v) do { ULONGLONG _v = (v); memcpy((p), &_v, sizeof(_v)); } while (0)
1176 #define RtlRetrieveUlonglong(p,s) memcpy((p), (s), sizeof(ULONGLONG))