GetFullPathName: get "drive" value too for absolute paths.
[wine] / include / ntddk.h
1 /*
2         this file defines interfaces mainly exposed to device drivers and
3         native nt dll's
4
5 */
6 #ifndef __WINE_NTDDK_H
7 #define __WINE_NTDDK_H
8
9 #include "ntdef.h"
10 #include "winnt.h"
11 #include "winreg.h"
12 #include "winbase.h"    /* fixme: should be taken out sometimes */
13
14 #include "pshpack1.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /****************** 
21  * asynchronous I/O 
22  */
23 #undef Status   /* conflict with X11-includes*/
24
25 typedef struct _IO_STATUS_BLOCK 
26 {
27         union {
28           NTSTATUS Status;
29           PVOID Pointer;
30         } DUMMYUNIONNAME;
31         ULONG_PTR Information;
32 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;    
33
34 typedef VOID NTAPI (*PIO_APC_ROUTINE) ( PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved );
35
36 /*
37         registry 
38  */
39
40  /* key information */
41 typedef struct _KEY_BASIC_INFORMATION {
42         FILETIME        LastWriteTime;
43         ULONG           TitleIndex;
44         ULONG           NameLength;
45         WCHAR           Name[1];
46 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
47
48 typedef struct _KEY_NODE_INFORMATION 
49 {
50         FILETIME        LastWriteTime;
51         ULONG           TitleIndex;
52         ULONG           ClassOffset;
53         ULONG           ClassLength;
54         ULONG           NameLength;
55         WCHAR           Name[1];
56 /*      Class[1]; */
57 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
58
59 typedef struct _KEY_FULL_INFORMATION 
60 {
61         FILETIME        LastWriteTime;
62         ULONG           TitleIndex;
63         ULONG           ClassOffset;
64         ULONG           ClassLength;
65         ULONG           SubKeys;
66         ULONG           MaxNameLen;
67         ULONG           MaxClassLen;
68         ULONG           Values;
69         ULONG           MaxValueNameLen;
70         ULONG           MaxValueDataLen;
71         WCHAR           Class[1];
72 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
73
74 typedef enum _KEY_INFORMATION_CLASS 
75 {
76         KeyBasicInformation,
77         KeyNodeInformation,
78         KeyFullInformation
79 } KEY_INFORMATION_CLASS;
80
81 typedef struct _KEY_VALUE_ENTRY 
82 {
83         PUNICODE_STRING ValueName;
84         ULONG           DataLength;
85         ULONG           DataOffset;
86         ULONG           Type;
87 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
88
89 /* value information */
90 typedef struct _KEY_VALUE_BASIC_INFORMATION 
91 {
92         ULONG   TitleIndex;
93         ULONG   Type;
94         ULONG   NameLength;
95         WCHAR   Name[1];
96 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
97
98 typedef struct _KEY_VALUE_FULL_INFORMATION 
99 {
100         ULONG   TitleIndex;
101         ULONG   Type;
102         ULONG   DataOffset;
103         ULONG   DataLength;
104         ULONG   NameLength;
105         WCHAR   Name[1];
106 /*      UCHAR   Data[1];*/
107 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
108
109 typedef struct _KEY_VALUE_PARTIAL_INFORMATION 
110 {
111         ULONG   TitleIndex;
112         ULONG   Type;
113         ULONG   DataLength;
114         UCHAR   Data[1];
115 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
116
117 typedef enum _KEY_VALUE_INFORMATION_CLASS 
118 {
119         KeyValueBasicInformation,
120         KeyValueFullInformation,
121         KeyValuePartialInformation,
122         KeyValueFullInformationAlign64,
123         KeyValuePartialInformationAlign64
124 } KEY_VALUE_INFORMATION_CLASS;
125
126 NTSTATUS WINAPI RtlFormatCurrentUserKeyPath(
127         PUNICODE_STRING KeyPath);
128
129 /*      thread information */
130
131 typedef enum _THREADINFOCLASS 
132 {       ThreadBasicInformation,
133         ThreadTimes,
134         ThreadPriority,
135         ThreadBasePriority,
136         ThreadAffinityMask,
137         ThreadImpersonationToken,
138         ThreadDescriptorTableEntry,
139         ThreadEnableAlignmentFaultFixup,
140         ThreadEventPair_Reusable,
141         ThreadQuerySetWin32StartAddress,
142         ThreadZeroTlsCell,
143         ThreadPerformanceCount,
144         ThreadAmILastThread,
145         ThreadIdealProcessor,
146         ThreadPriorityBoost,
147         ThreadSetTlsArrayAddress,
148         ThreadIsIoPending,
149         MaxThreadInfoClass
150 } THREADINFOCLASS;
151
152 /*      file information */
153
154 typedef enum _FILE_INFORMATION_CLASS {
155         FileDirectoryInformation = 1,
156         FileFullDirectoryInformation,
157         FileBothDirectoryInformation,
158         FileBasicInformation,
159         FileStandardInformation,
160         FileInternalInformation,
161         FileEaInformation,
162         FileAccessInformation,
163         FileNameInformation,
164         FileRenameInformation,
165         FileLinkInformation,
166         FileNamesInformation,
167         FileDispositionInformation,
168         FilePositionInformation,
169         FileFullEaInformation,
170         FileModeInformation,
171         FileAlignmentInformation,
172         FileAllInformation,
173         FileAllocationInformation,
174         FileEndOfFileInformation,
175         FileAlternateNameInformation,
176         FileStreamInformation,
177         FilePipeInformation,
178         FilePipeLocalInformation,
179         FilePipeRemoteInformation,
180         FileMailslotQueryInformation,
181         FileMailslotSetInformation,
182         FileCompressionInformation,
183         FileObjectIdInformation,
184         FileCompletionInformation,
185         FileMoveClusterInformation,
186         FileQuotaInformation,
187         FileReparsePointInformation,
188         FileNetworkOpenInformation,
189         FileAttributeTagInformation,
190         FileTrackingInformation,
191         FileMaximumInformation
192 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
193
194 typedef enum _FSINFOCLASS {
195         FileFsVolumeInformation = 1,
196         FileFsLabelInformation,
197         FileFsSizeInformation,
198         FileFsDeviceInformation,
199         FileFsAttributeInformation,
200         FileFsControlInformation,
201         FileFsFullSizeInformation,
202         FileFsObjectIdInformation,
203         FileFsMaximumInformation
204 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
205
206 typedef enum _SECTION_INHERIT 
207 {
208         ViewShare = 1,
209         ViewUnmap = 2
210
211 } SECTION_INHERIT;
212  
213 /*      object information */
214
215 typedef enum _OBJECT_INFORMATION_CLASS
216 {
217         DunnoTheConstants1
218
219 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
220
221
222 /*      system information */
223
224 typedef enum SYSTEM_INFORMATION_CLASS
225 {       Unknown1 = 1,
226         Unknown2,
227         Unknown3,
228         Unknown4,
229         SystemPerformanceInformation
230 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
231
232 /* reading coffee grounds... */
233 typedef struct _THREAD_INFO
234 {       DWORD   Unknown1[6];
235         DWORD   ThreadID;
236         DWORD   Unknown2[3];
237         DWORD   Status;
238         DWORD   WaitReason;
239         DWORD   Unknown3[4];
240 } THREAD_INFO, PTHREAD_INFO;
241
242 typedef struct _VM_COUNTERS_
243 {       ULONG PeakVirtualSize;
244         ULONG VirtualSize;
245         ULONG PageFaultCount;
246         ULONG PeakWorkingSetSize;
247         ULONG WorkingSetSize;
248         ULONG QuotaPeakPagedPoolUsage;
249         ULONG QuotaPagedPoolUsage;
250         ULONG QuotaPeakNonPagedPoolUsage;
251         ULONG QuotaNonPagedPoolUsage;
252         ULONG PagefileUsage;
253         ULONG PeakPagefileUsage;
254 } VM_COUNTERS, *PVM_COUNTERS;
255
256 /* process information */
257
258 typedef struct _PROCESS_INFO
259 {       DWORD           Offset;         /* 00 offset to next PROCESS_INFO ok*/
260         DWORD           ThreadCount;    /* 04 number of ThreadInfo member ok */
261         DWORD           Unknown1[6];
262         FILETIME        CreationTime;   /* 20 */
263         DWORD           Unknown2[5];
264         PWCHAR          ProcessName;    /* 3c ok */
265         DWORD           BasePriority;
266         DWORD           ProcessID;      /* 44 ok*/
267         DWORD           ParentProcessID;
268         DWORD           HandleCount;
269         DWORD           Unknown3[2];    /* 50 */
270         ULONG           PeakVirtualSize;
271         ULONG           VirtualSize;
272         ULONG           PageFaultCount;
273         ULONG           PeakWorkingSetSize;
274         ULONG           WorkingSetSize;
275         ULONG           QuotaPeakPagedPoolUsage;
276         ULONG           QuotaPagedPoolUsage;
277         ULONG           QuotaPeakNonPagedPoolUsage;
278         ULONG           QuotaNonPagedPoolUsage;
279         ULONG           PagefileUsage;
280         ULONG           PeakPagefileUsage;
281         DWORD           PrivateBytes;
282         DWORD           Unknown6[4];
283         THREAD_INFO     ati[ANYSIZE_ARRAY];     /* 94 size=0x40*/
284 } PROCESS_INFO, PPROCESS_INFO;
285
286 NTSTATUS WINAPI NtQuerySystemInformation(
287         IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
288         OUT PVOID SystemInformation,
289         IN ULONG Length,
290         OUT PULONG ResultLength);
291
292 /*
293  *      system configuration
294  */
295
296
297 typedef struct _SYSTEM_TIME_ADJUSTMENT
298 {
299         ULONG   TimeAdjustment;
300         BOOLEAN TimeAdjustmentDisabled;
301
302 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
303
304 typedef struct _SYSTEM_CONFIGURATION_INFO 
305 {
306         union 
307         { ULONG OemId;
308           struct 
309           { WORD        ProcessorArchitecture;
310             WORD        Reserved;
311           } tag1;
312         } tag2;
313         ULONG   PageSize;
314         PVOID   MinimumApplicationAddress;
315         PVOID   MaximumApplicationAddress;
316         ULONG   ActiveProcessorMask;
317         ULONG   NumberOfProcessors;
318         ULONG   ProcessorType;
319         ULONG   AllocationGranularity;
320         WORD    ProcessorLevel;
321         WORD    ProcessorRevision;
322
323 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
324
325
326 typedef struct _SYSTEM_CACHE_INFORMATION 
327 {
328         ULONG   CurrentSize;
329         ULONG   PeakSize;
330         ULONG   PageFaultCount;
331         ULONG   MinimumWorkingSet;
332         ULONG   MaximumWorkingSet;
333         ULONG   Unused[4];
334
335 } SYSTEM_CACHE_INFORMATION;
336
337 /*
338  *      NtQueryProcessInformation
339  */
340
341 /* parameter ProcessInformationClass */
342
343 typedef enum _PROCESSINFOCLASS 
344 {       ProcessBasicInformation,
345         ProcessQuotaLimits,
346         ProcessIoCounters,
347         ProcessVmCounters,
348         ProcessTimes,
349         ProcessBasePriority,
350         ProcessRaisePriority,
351         ProcessDebugPort,
352         ProcessExceptionPort,
353         ProcessAccessToken,
354         ProcessLdtInformation,
355         ProcessLdtSize,
356         ProcessDefaultHardErrorMode,
357         ProcessIoPortHandlers,
358         ProcessPooledUsageAndLimits,
359         ProcessWorkingSetWatch,
360         ProcessUserModeIOPL,
361         ProcessEnableAlignmentFaultFixup,
362         ProcessPriorityClass,
363         ProcessWx86Information,
364         ProcessHandleCount,
365         ProcessAffinityMask,
366         ProcessPriorityBoost,
367         ProcessDeviceMap,
368         ProcessSessionInformation,
369         ProcessForegroundInformation,
370         ProcessWow64Information,
371         MaxProcessInfoClass
372 } PROCESSINFOCLASS;
373
374 /* parameter ProcessInformation (depending on ProcessInformationClass) */
375
376 typedef struct _PROCESS_BASIC_INFORMATION 
377 {       DWORD   ExitStatus;
378         DWORD   PebBaseAddress;
379         DWORD   AffinityMask;
380         DWORD   BasePriority;
381         ULONG   UniqueProcessId;
382         ULONG   InheritedFromUniqueProcessId;
383 } PROCESS_BASIC_INFORMATION;
384
385 NTSTATUS WINAPI NtQueryInformationProcess(
386         IN HANDLE ProcessHandle,
387         IN PROCESSINFOCLASS ProcessInformationClass,
388         OUT PVOID ProcessInformation,
389         IN ULONG ProcessInformationLength,
390         OUT PULONG ReturnLength);
391
392 #define NtCurrentProcess() ( (HANDLE) -1 )
393
394 /*
395  *      timer
396  */
397
398 typedef enum _TIMER_TYPE 
399 {
400         NotificationTimer,
401         SynchronizationTimer
402
403 } TIMER_TYPE;
404
405 /*      token functions */
406  
407 NTSTATUS WINAPI NtOpenProcessToken(
408         HANDLE ProcessHandle,
409         DWORD DesiredAccess, 
410         HANDLE *TokenHandle);
411         
412 NTSTATUS WINAPI NtOpenThreadToken(
413         HANDLE ThreadHandle,
414         DWORD DesiredAccess, 
415         BOOLEAN OpenAsSelf,
416         HANDLE *TokenHandle);
417
418 NTSTATUS WINAPI NtAdjustPrivilegesToken(
419         IN HANDLE TokenHandle,
420         IN BOOLEAN DisableAllPrivileges,
421         IN PTOKEN_PRIVILEGES NewState,
422         IN DWORD BufferLength,
423         OUT PTOKEN_PRIVILEGES PreviousState,
424         OUT PDWORD ReturnLength);
425
426 NTSTATUS WINAPI NtQueryInformationToken(
427         HANDLE token,
428         DWORD tokeninfoclass, 
429         LPVOID tokeninfo,
430         DWORD tokeninfolength,
431         LPDWORD retlen );
432
433 /*      sid functions */
434
435 BOOLEAN WINAPI RtlAllocateAndInitializeSid (
436         PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
437         BYTE nSubAuthorityCount,
438         DWORD nSubAuthority0, DWORD nSubAuthority1,
439         DWORD nSubAuthority2, DWORD nSubAuthority3,
440         DWORD nSubAuthority4, DWORD nSubAuthority5,
441         DWORD nSubAuthority6, DWORD nSubAuthority7,
442         PSID *pSid );
443         
444 BOOL WINAPI RtlInitializeSid(
445         PSID pSid,
446         PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
447         BYTE nSubAuthorityCount);
448         
449 DWORD WINAPI RtlFreeSid(
450         PSID pSid);
451
452 BOOL WINAPI RtlEqualSid(
453         PSID pSid1,
454         PSID pSid2 );
455         
456 DWORD WINAPI RtlLengthRequiredSid(
457         DWORD nrofsubauths);
458
459 DWORD WINAPI RtlLengthSid(
460         PSID sid);
461
462 LPDWORD WINAPI RtlSubAuthoritySid(
463         PSID PSID,
464         DWORD nr);
465
466 LPBYTE WINAPI RtlSubAuthorityCountSid(
467         PSID pSid);
468
469 DWORD WINAPI RtlCopySid(
470         DWORD len,
471         PSID to,
472         PSID from);
473         
474 BOOL WINAPI RtlValidSid(
475         PSID pSid);
476
477 BOOL WINAPI RtlEqualPrefixSid(
478         PSID pSid1,
479         PSID pSid2);
480
481 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(
482         PSID pSid );
483
484 /*      security descriptor functions */
485
486 NTSTATUS WINAPI RtlCreateSecurityDescriptor(
487         PSECURITY_DESCRIPTOR lpsd,
488         DWORD rev);
489
490 NTSTATUS WINAPI RtlValidSecurityDescriptor(
491         PSECURITY_DESCRIPTOR SecurityDescriptor);
492
493 ULONG WINAPI RtlLengthSecurityDescriptor(
494         PSECURITY_DESCRIPTOR SecurityDescriptor);
495
496 NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(
497         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
498         OUT PBOOLEAN lpbDaclPresent,
499         OUT PACL *pDacl,
500         OUT PBOOLEAN lpbDaclDefaulted);
501
502 NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
503         PSECURITY_DESCRIPTOR lpsd,
504         BOOLEAN daclpresent,
505         PACL dacl,
506         BOOLEAN dacldefaulted );
507
508 NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(
509         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
510         OUT PBOOLEAN lpbSaclPresent,
511         OUT PACL *pSacl,
512         OUT PBOOLEAN lpbSaclDefaulted);
513
514 NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (
515         PSECURITY_DESCRIPTOR lpsd,
516         BOOLEAN saclpresent,
517         PACL sacl,
518         BOOLEAN sacldefaulted);
519
520 NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
521         PSECURITY_DESCRIPTOR SecurityDescriptor,
522         PSID *Owner,
523         PBOOLEAN OwnerDefaulted);
524
525 NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
526         PSECURITY_DESCRIPTOR lpsd,
527         PSID owner,
528         BOOLEAN ownerdefaulted);
529
530 NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
531         PSECURITY_DESCRIPTOR lpsd,
532         PSID group,
533         BOOLEAN groupdefaulted);
534
535 NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
536         PSECURITY_DESCRIPTOR SecurityDescriptor,
537         PSID *Group,
538         PBOOLEAN GroupDefaulted);
539
540 NTSTATUS WINAPI RtlMakeSelfRelativeSD(
541         IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
542         IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
543         IN OUT LPDWORD lpdwBufferLength);
544
545 NTSTATUS WINAPI RtlGetControlSecurityDescriptor(
546         PSECURITY_DESCRIPTOR  pSecurityDescriptor,
547         PSECURITY_DESCRIPTOR_CONTROL pControl,
548         LPDWORD lpdwRevision);
549
550 /*      acl functions */
551
552 NTSTATUS WINAPI RtlCreateAcl(
553         PACL acl,
554         DWORD size,
555         DWORD rev);
556
557 BOOLEAN WINAPI RtlFirstFreeAce(
558         PACL acl,
559         PACE_HEADER *x);
560
561 NTSTATUS WINAPI RtlAddAce(
562         PACL acl,
563         DWORD rev,
564         DWORD xnrofaces,
565         PACE_HEADER acestart,
566         DWORD acelen);
567         
568 BOOL WINAPI RtlAddAccessAllowedAce(
569         IN OUT PACL pAcl,
570         IN DWORD dwAceRevision,
571         IN DWORD AccessMask,
572         IN PSID pSid);
573
574 BOOL WINAPI AddAccessAllowedAceEx(
575         IN OUT PACL pAcl,
576         IN DWORD dwAceRevision,
577         IN DWORD AceFlags,
578         IN DWORD AccessMask,
579         IN PSID pSid);
580
581 DWORD WINAPI RtlGetAce(
582         PACL pAcl,
583         DWORD dwAceIndex,
584         LPVOID *pAce );
585
586 /*      string functions */
587
588 WCHAR CDECL NTDLL_towupper(WCHAR code);
589 WCHAR CDECL NTDLL_towlower(WCHAR code);
590
591 VOID WINAPI RtlInitAnsiString(
592         PANSI_STRING target,
593         LPCSTR source);
594         
595 VOID WINAPI RtlInitString(
596         PSTRING target,
597         LPCSTR source);
598         
599 VOID WINAPI RtlInitUnicodeString(
600         PUNICODE_STRING target,
601         LPCWSTR source);
602         
603 VOID WINAPI RtlFreeUnicodeString(
604         PUNICODE_STRING str);
605         
606 VOID WINAPI RtlFreeAnsiString(
607         PANSI_STRING AnsiString);
608
609 NTSTATUS WINAPI RtlAnsiStringToUnicodeString(
610         PUNICODE_STRING uni,
611         PANSI_STRING ansi,
612         BOOLEAN doalloc);
613
614 NTSTATUS WINAPI RtlOemStringToUnicodeString(
615         PUNICODE_STRING uni,
616         PSTRING ansi,
617         BOOLEAN doalloc);
618         
619 NTSTATUS WINAPI RtlMultiByteToUnicodeN(
620         LPWSTR unistr,
621         DWORD unilen,
622         LPDWORD reslen,
623         LPSTR oemstr,
624         DWORD oemlen);
625         
626 NTSTATUS WINAPI RtlOemToUnicodeN(
627         LPWSTR unistr,
628         DWORD unilen,
629         LPDWORD reslen,
630         LPSTR oemstr,
631         DWORD oemlen);
632         
633 NTSTATUS WINAPI RtlUnicodeToOemN(
634         LPSTR oemstr,
635         DWORD oemlen,
636         LPDWORD reslen,
637         LPWSTR unistr,
638         DWORD unilen);
639
640 NTSTATUS WINAPI RtlUnicodeStringToOemString(
641         PANSI_STRING oem,
642         PUNICODE_STRING uni,
643         BOOLEAN alloc);
644
645 NTSTATUS WINAPI RtlUnicodeStringToAnsiString(
646         PANSI_STRING oem,
647         PUNICODE_STRING uni,
648         BOOLEAN alloc);
649
650 BOOLEAN WINAPI RtlEqualUnicodeString(
651         PUNICODE_STRING s1,
652         PUNICODE_STRING s2,
653         BOOLEAN x);
654
655 DWORD WINAPI RtlUpcaseUnicodeString(
656         PUNICODE_STRING dest,
657         PUNICODE_STRING src,
658         BOOLEAN doalloc);
659
660 UINT WINAPI RtlxOemStringToUnicodeSize(
661         PSTRING str);
662
663 UINT WINAPI RtlxAnsiStringToUnicodeSize(
664         PANSI_STRING str);
665
666 DWORD WINAPI RtlIsTextUnicode(
667         LPVOID buf,
668         DWORD len,
669         DWORD *pf);
670
671 NTSTATUS WINAPI RtlCompareUnicodeString(
672         PUNICODE_STRING String1,
673         PUNICODE_STRING String2,
674         BOOLEAN CaseInSensitive);
675
676 /*      resource functions */
677
678 typedef struct _RTL_RWLOCK {
679         CRITICAL_SECTION        rtlCS;
680         HANDLE          hSharedReleaseSemaphore;
681         UINT                    uSharedWaiters;
682         HANDLE          hExclusiveReleaseSemaphore;
683         UINT                    uExclusiveWaiters;
684         INT                     iNumberActive;
685         HANDLE          hOwningThreadId;
686         DWORD                   dwTimeoutBoost;
687         PVOID                   pDebugInfo;
688 } RTL_RWLOCK, *LPRTL_RWLOCK;
689
690 VOID   WINAPI RtlInitializeResource(
691         LPRTL_RWLOCK);
692         
693 VOID   WINAPI RtlDeleteResource(
694         LPRTL_RWLOCK);
695         
696 BYTE   WINAPI RtlAcquireResourceExclusive(
697         LPRTL_RWLOCK, BYTE fWait);
698         
699 BYTE   WINAPI RtlAcquireResourceShared(
700         LPRTL_RWLOCK, BYTE fWait);
701         
702 VOID   WINAPI RtlReleaseResource(
703         LPRTL_RWLOCK);
704         
705 VOID   WINAPI RtlDumpResource(
706         LPRTL_RWLOCK);
707
708 /*      time functions */
709
710 typedef struct _TIME_FIELDS 
711 {   CSHORT Year;
712     CSHORT Month;
713     CSHORT Day;
714     CSHORT Hour;
715     CSHORT Minute;
716     CSHORT Second;
717     CSHORT Milliseconds;
718     CSHORT Weekday;
719 } TIME_FIELDS;
720
721 typedef TIME_FIELDS *PTIME_FIELDS;
722
723 VOID WINAPI RtlSystemTimeToLocalTime(
724         IN  PLARGE_INTEGER SystemTime,
725         OUT PLARGE_INTEGER LocalTime);
726
727 VOID WINAPI RtlTimeToTimeFields(
728         PLARGE_INTEGER liTime,
729         PTIME_FIELDS TimeFields);
730
731 BOOLEAN WINAPI RtlTimeFieldsToTime(
732         PTIME_FIELDS tfTimeFields,
733         PLARGE_INTEGER Time);
734         
735 VOID WINAPI RtlTimeToElapsedTimeFields(
736         PLARGE_INTEGER liTime,
737         PTIME_FIELDS TimeFields);
738         
739 BOOLEAN WINAPI RtlTimeToSecondsSince1980(
740         LPFILETIME ft,
741         LPDWORD timeret);
742
743 BOOLEAN WINAPI RtlTimeToSecondsSince1970(
744         LPFILETIME ft,
745         LPDWORD timeret);
746
747 /*      heap functions */
748
749 /* Data structure for heap definition. This includes various
750    sizing parameters and callback routines, which, if left NULL,
751    result in default behavior */
752
753 typedef struct
754 {       ULONG   Length;         /* = sizeof(RTL_HEAP_DEFINITION) */
755         ULONG   Unknown[11];
756 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
757
758 HANDLE WINAPI RtlCreateHeap(
759         ULONG Flags,
760         PVOID BaseAddress,
761         ULONG SizeToReserve,
762         ULONG SizeToCommit,
763         PVOID Unknown,
764         PRTL_HEAP_DEFINITION Definition);
765
766 PVOID WINAPI RtlAllocateHeap(
767         HANDLE Heap,
768         ULONG Flags,
769         ULONG Size);
770
771
772 BOOLEAN WINAPI RtlFreeHeap(
773         HANDLE Heap,
774         ULONG Flags,
775         PVOID Address);
776
777 /*      exception */
778
779 void WINAPI NtRaiseException(
780         PEXCEPTION_RECORD,PCONTEXT,BOOL);
781
782 void WINAPI RtlRaiseException(
783         PEXCEPTION_RECORD);
784
785 void WINAPI RtlRaiseStatus(
786         NTSTATUS);
787
788 void WINAPI RtlUnwind(
789         PEXCEPTION_FRAME,
790         LPVOID,
791         PEXCEPTION_RECORD,DWORD);
792
793 /*      process environment block  */
794 VOID WINAPI RtlAcquirePebLock(void);
795 VOID WINAPI RtlReleasePebLock(void);
796
797 /*      mathematics */
798 INT WINAPI RtlExtendedLargeIntegerDivide(
799         LARGE_INTEGER dividend,
800         DWORD divisor,
801         LPDWORD rest);
802
803 LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(
804         LARGE_INTEGER factor1,
805         INT factor2);
806
807 /*      environment */
808 DWORD WINAPI RtlCreateEnvironment(
809         DWORD x1,
810         DWORD x2);
811
812 DWORD WINAPI RtlDestroyEnvironment(
813         DWORD x);
814
815 DWORD WINAPI RtlQueryEnvironmentVariable_U(
816         DWORD x1,
817         PUNICODE_STRING key,
818         PUNICODE_STRING val) ;
819
820 DWORD WINAPI RtlSetEnvironmentVariable(
821         DWORD x1,
822         PUNICODE_STRING key,
823         PUNICODE_STRING val);
824
825 /*      object security */
826
827 DWORD WINAPI RtlNewSecurityObject(
828         DWORD x1,
829         DWORD x2,
830         DWORD x3,
831         DWORD x4,
832         DWORD x5,
833         DWORD x6);
834
835 DWORD WINAPI RtlDeleteSecurityObject(
836         DWORD x1);
837         
838 NTSTATUS WINAPI 
839 NtQuerySecurityObject(
840         IN HANDLE Object,
841         IN SECURITY_INFORMATION RequestedInformation,
842         OUT PSECURITY_DESCRIPTOR pSecurityDesriptor,
843         IN ULONG Length,
844         OUT PULONG ResultLength);
845
846 NTSTATUS WINAPI
847 NtSetSecurityObject(
848         IN HANDLE Handle,
849         IN SECURITY_INFORMATION SecurityInformation,
850         IN PSECURITY_DESCRIPTOR SecurityDescriptor);
851
852 /*      registry functions */
853
854 NTSTATUS WINAPI NtCreateKey(
855         PHANDLE KeyHandle,
856         ACCESS_MASK DesiredAccess,
857         POBJECT_ATTRIBUTES ObjectAttributes,
858         ULONG TitleIndex,
859         PUNICODE_STRING Class,
860         ULONG CreateOptions,
861         PULONG Disposition);
862
863 NTSTATUS WINAPI NtOpenKey(
864         PHANDLE KeyHandle,
865         ACCESS_MASK DesiredAccess,
866         POBJECT_ATTRIBUTES ObjectAttributes);
867
868 NTSTATUS WINAPI NtDeleteKey(HANDLE KeyHandle);
869
870 NTSTATUS WINAPI NtDeleteValueKey(
871         IN HANDLE KeyHandle,
872         IN PUNICODE_STRING ValueName);
873
874 NTSTATUS WINAPI NtEnumerateKey(
875         HANDLE KeyHandle,
876         ULONG Index,
877         KEY_INFORMATION_CLASS KeyInformationClass,
878         PVOID KeyInformation,
879         ULONG Length,
880         PULONG ResultLength);
881
882 NTSTATUS WINAPI NtQueryKey(
883         HANDLE KeyHandle,
884         KEY_INFORMATION_CLASS KeyInformationClass,
885         PVOID KeyInformation,
886         ULONG Length,
887         PULONG ResultLength);
888
889 NTSTATUS WINAPI NtEnumerateValueKey(
890         HANDLE KeyHandle,
891         ULONG Index,
892         KEY_VALUE_INFORMATION_CLASS KeyInformationClass,
893         PVOID KeyInformation,
894         ULONG Length,
895         PULONG ResultLength);
896
897 NTSTATUS WINAPI NtFlushKey(HANDLE KeyHandle);
898
899 NTSTATUS WINAPI NtLoadKey(
900         PHANDLE KeyHandle,
901         POBJECT_ATTRIBUTES ObjectAttributes);
902
903 NTSTATUS WINAPI NtNotifyChangeKey(
904         IN HANDLE KeyHandle,
905         IN HANDLE Event,
906         IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
907         IN PVOID ApcContext OPTIONAL,
908         OUT PIO_STATUS_BLOCK IoStatusBlock,
909         IN ULONG CompletionFilter,
910         IN BOOLEAN Asynchroneous,
911         OUT PVOID ChangeBuffer,
912         IN ULONG Length,
913         IN BOOLEAN WatchSubtree);
914
915 NTSTATUS WINAPI NtQueryMultipleValueKey(
916         HANDLE KeyHandle,
917         PVALENTW ListOfValuesToQuery,
918         ULONG NumberOfItems,
919         PVOID MultipleValueInformation,
920         ULONG Length,
921         PULONG  ReturnLength);
922
923 NTSTATUS WINAPI NtQueryValueKey(
924         IN HANDLE KeyHandle,
925         IN PUNICODE_STRING ValueName,
926         IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
927         OUT PVOID KeyValueInformation,
928         IN ULONG Length,
929         OUT PULONG ResultLength);
930
931 NTSTATUS WINAPI NtReplaceKey(
932         IN POBJECT_ATTRIBUTES ObjectAttributes,
933         IN HANDLE Key,
934         IN POBJECT_ATTRIBUTES ReplacedObjectAttributes);
935
936 NTSTATUS WINAPI NtRestoreKey(
937         HANDLE KeyHandle,
938         HANDLE FileHandle,
939         ULONG RestoreFlags);
940
941 NTSTATUS WINAPI NtSaveKey(
942         IN HANDLE KeyHandle,
943         IN HANDLE FileHandle);
944
945 NTSTATUS WINAPI NtSetInformationKey(
946         IN HANDLE KeyHandle,
947         IN const int KeyInformationClass,
948         IN PVOID KeyInformation,
949         IN ULONG KeyInformationLength);
950
951 NTSTATUS WINAPI NtSetValueKey(
952         HANDLE KeyHandle,
953         PUNICODE_STRING ValueName,
954         ULONG TitleIndex,
955         ULONG Type,
956         PVOID Data,
957         ULONG DataSize);
958
959 NTSTATUS WINAPI NtUnloadKey(
960         IN HANDLE KeyHandle);
961
962 NTSTATUS WINAPI NtClose(
963         HANDLE Handle);
964
965 /*      misc */
966
967 #if defined(__i386__) && defined(__GNUC__)
968 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
969 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
970 #else  /* __i386__ && __GNUC__ */
971 void WINAPI DbgBreakPoint(void);
972 void WINAPI DbgUserBreakPoint(void);
973 #endif  /* __i386__ && __GNUC__ */
974 void WINAPIV DbgPrint(LPCSTR fmt, ...);
975
976 DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
977 DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
978 LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x);
979 DWORD WINAPI RtlNtStatusToDosError(DWORD error);
980 BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type);
981
982 DWORD WINAPI RtlOpenCurrentUser(
983         IN ACCESS_MASK DesiredAccess,
984         OUT PHANDLE KeyHandle);
985
986 BOOLEAN WINAPI RtlDosPathNameToNtPathName_U( LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3);
987 BOOL WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
988
989 NTSTATUS WINAPI 
990 NtAccessCheck(
991         IN PSECURITY_DESCRIPTOR SecurityDescriptor,
992         IN HANDLE ClientToken,
993         IN ACCESS_MASK DesiredAccess,
994         IN PGENERIC_MAPPING GenericMapping,
995         OUT PPRIVILEGE_SET PrivilegeSet,
996         OUT PULONG ReturnLength,
997         OUT PULONG GrantedAccess,
998         OUT PBOOLEAN AccessStatus);
999
1000 #ifdef __cplusplus
1001 }
1002 #endif
1003
1004 #include "poppack.h"
1005
1006 #endif