Correct behaviour of DEL key back to deleting the current character.
[wine] / include / ntddk.h
1 /*
2  * this file defines interfaces mainly exposed to device drivers and
3  * native nt dlls
4  *
5  * Copyright (C) the Wine project
6  *
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.
11  *
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.
16  *
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
20  */
21
22 #ifndef __WINE_NTDDK_H
23 #define __WINE_NTDDK_H
24
25 #include "ntdef.h"
26 #include "winnt.h"
27 #include "winreg.h"
28 #include "winbase.h"    /* FIXME: should be taken out sometimes */
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /****************** 
35  * asynchronous I/O 
36  */
37 #undef Status   /* conflict with X11-includes*/
38
39 typedef struct _IO_STATUS_BLOCK 
40 {
41         union {
42           NTSTATUS Status;
43           PVOID Pointer;
44         } DUMMYUNIONNAME;
45         ULONG_PTR Information;
46 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;    
47
48 typedef VOID (NTAPI *PIO_APC_ROUTINE) ( PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved );
49
50 /*
51         registry 
52  */
53
54  /* key information */
55 typedef struct _KEY_BASIC_INFORMATION {
56         LARGE_INTEGER   LastWriteTime;
57         ULONG           TitleIndex;
58         ULONG           NameLength;
59         WCHAR           Name[1];
60 } KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
61
62 typedef struct _KEY_NODE_INFORMATION 
63 {
64         LARGE_INTEGER   LastWriteTime;
65         ULONG           TitleIndex;
66         ULONG           ClassOffset;
67         ULONG           ClassLength;
68         ULONG           NameLength;
69         WCHAR           Name[1];
70 /*      Class[1]; */
71 } KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
72
73 typedef struct _KEY_FULL_INFORMATION 
74 {
75         LARGE_INTEGER   LastWriteTime;
76         ULONG           TitleIndex;
77         ULONG           ClassOffset;
78         ULONG           ClassLength;
79         ULONG           SubKeys;
80         ULONG           MaxNameLen;
81         ULONG           MaxClassLen;
82         ULONG           Values;
83         ULONG           MaxValueNameLen;
84         ULONG           MaxValueDataLen;
85         WCHAR           Class[1];
86 } KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
87
88 typedef enum _KEY_INFORMATION_CLASS 
89 {
90         KeyBasicInformation,
91         KeyNodeInformation,
92         KeyFullInformation
93 } KEY_INFORMATION_CLASS;
94
95 typedef struct _KEY_VALUE_ENTRY 
96 {
97         PUNICODE_STRING ValueName;
98         ULONG           DataLength;
99         ULONG           DataOffset;
100         ULONG           Type;
101 } KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
102
103 /* value information */
104 typedef struct _KEY_VALUE_BASIC_INFORMATION 
105 {
106         ULONG   TitleIndex;
107         ULONG   Type;
108         ULONG   NameLength;
109         WCHAR   Name[1];
110 } KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
111
112 typedef struct _KEY_VALUE_FULL_INFORMATION 
113 {
114         ULONG   TitleIndex;
115         ULONG   Type;
116         ULONG   DataOffset;
117         ULONG   DataLength;
118         ULONG   NameLength;
119         WCHAR   Name[1];
120 /*      UCHAR   Data[1];*/
121 } KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
122
123 typedef struct _KEY_VALUE_PARTIAL_INFORMATION 
124 {
125         ULONG   TitleIndex;
126         ULONG   Type;
127         ULONG   DataLength;
128         UCHAR   Data[1];
129 } KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
130
131 typedef enum _KEY_VALUE_INFORMATION_CLASS 
132 {
133         KeyValueBasicInformation,
134         KeyValueFullInformation,
135         KeyValuePartialInformation,
136         KeyValueFullInformationAlign64,
137         KeyValuePartialInformationAlign64
138 } KEY_VALUE_INFORMATION_CLASS;
139
140 NTSTATUS WINAPI RtlFormatCurrentUserKeyPath(
141         PUNICODE_STRING KeyPath);
142
143 /*      thread information */
144
145 typedef enum _THREADINFOCLASS 
146 {       ThreadBasicInformation,
147         ThreadTimes,
148         ThreadPriority,
149         ThreadBasePriority,
150         ThreadAffinityMask,
151         ThreadImpersonationToken,
152         ThreadDescriptorTableEntry,
153         ThreadEnableAlignmentFaultFixup,
154         ThreadEventPair_Reusable,
155         ThreadQuerySetWin32StartAddress,
156         ThreadZeroTlsCell,
157         ThreadPerformanceCount,
158         ThreadAmILastThread,
159         ThreadIdealProcessor,
160         ThreadPriorityBoost,
161         ThreadSetTlsArrayAddress,
162         ThreadIsIoPending,
163         MaxThreadInfoClass
164 } THREADINFOCLASS;
165
166 typedef struct {
167 /* This is used by NtQuerySystemInformation */
168         FILETIME ftCreationTime;
169         DWORD dwUnknown1;
170         DWORD dwStartAddress;
171         DWORD dwOwningPID;
172         DWORD dwThreadID;
173         DWORD dwCurrentPriority;
174         DWORD dwBasePriority;
175         DWORD dwContextSwitches;
176         DWORD dwThreadState;
177         DWORD dwWaitReason;
178         DWORD dwUnknown2[5];
179 } THREADINFO, *PTHREADINFO;
180
181 /*      file information */
182
183 typedef enum _FILE_INFORMATION_CLASS {
184         FileDirectoryInformation = 1,
185         FileFullDirectoryInformation,
186         FileBothDirectoryInformation,
187         FileBasicInformation,
188         FileStandardInformation,
189         FileInternalInformation,
190         FileEaInformation,
191         FileAccessInformation,
192         FileNameInformation,
193         FileRenameInformation,
194         FileLinkInformation,
195         FileNamesInformation,
196         FileDispositionInformation,
197         FilePositionInformation,
198         FileFullEaInformation,
199         FileModeInformation,
200         FileAlignmentInformation,
201         FileAllInformation,
202         FileAllocationInformation,
203         FileEndOfFileInformation,
204         FileAlternateNameInformation,
205         FileStreamInformation,
206         FilePipeInformation,
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;
222
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;
234
235 typedef enum _SECTION_INHERIT 
236 {
237         ViewShare = 1,
238         ViewUnmap = 2
239
240 } SECTION_INHERIT;
241  
242 /*      object information */
243
244 typedef enum _OBJECT_INFORMATION_CLASS
245 {
246         DunnoTheConstants1
247
248 } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
249
250
251 /*      system information */
252
253 typedef enum SYSTEM_INFORMATION_CLASS
254 {       SystemBasicInformation = 0,
255         Unknown1,
256         SystemPerformanceInformation,
257         SystemTimeInformation,
258         Unknown4,
259         SystemProcessInformation,
260         Unknown6,
261         Unknown7,
262         Unknown8,
263         Unknown9,
264         Unknown10,
265         SystemDriverInformation,
266         Unknown12,
267         Unknown13,
268         Unknown14,
269         Unknown15,
270         SystemHandleList,
271         Unknown17,
272         Unknown18,
273         Unknown19,
274         Unknown20,
275         SystemCacheInformation
276 } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
277
278 typedef struct {
279 /* System Information Class 0x00 */
280         DWORD dwUnknown1;
281         ULONG uKeMaximumIncrement;
282         ULONG uPageSize;
283         ULONG uMmNumberOfPhysicalPages;
284         ULONG uMmLowestPhysicalPage;
285         ULONG uMmHighestPhysicalPage;
286         ULONG uAllocationGranularity;
287         PVOID pLowestUserAddress;
288         PVOID pMmHighestUserAddress;
289         ULONG uKeActiveProcessors;
290         BYTE bKeNumberProcessors;
291         BYTE bUnknown2;
292         WORD wUnknown3;
293 } SYSTEM_BASIC_INFORMATION;
294
295 typedef struct {
296 /* System Information Class 0x02 */
297         LARGE_INTEGER liIdleTime;
298         DWORD dwSpare[76];
299 } SYSTEM_PERFORMANCE_INFORMATION;
300
301 typedef struct {
302 /* System Information Class 0x03 */
303         LARGE_INTEGER liKeBootTime;
304         LARGE_INTEGER liKeSystemTime;
305         LARGE_INTEGER liExpTimeZoneBias;
306         ULONG uCurrentTimeZoneId;
307         DWORD dwReserved;
308 } SYSTEM_TIME_INFORMATION;
309
310 typedef struct {
311 /* System Information Class 0x05 */
312         DWORD dwOffset;
313         DWORD dwThreadCount;
314         DWORD dwUnknown1[6];
315         FILETIME ftCreationTime;
316         DWORD dwUnknown2[5];
317         WCHAR* pszProcessName;
318         DWORD dwBasePriority;
319         DWORD dwProcessID;
320         DWORD dwParentProcessID;
321         DWORD dwHandleCount;
322         DWORD dwUnknown3;
323         DWORD dwUnknown4;
324         DWORD dwVirtualBytesPeak;
325         DWORD dwVirtualBytes;
326         DWORD dwPageFaults;
327         DWORD dwWorkingSetPeak;
328         DWORD dwWorkingSet;
329         DWORD dwUnknown5;
330         DWORD dwPagedPool;
331         DWORD dwUnknown6;
332         DWORD dwNonPagedPool;
333         DWORD dwPageFileBytesPeak;
334         DWORD dwPrivateBytes;
335         DWORD dwPageFileBytes;
336         DWORD dwUnknown7[4];
337         THREADINFO ti[0];
338 } SYSTEM_PROCESS_INFORMATION;
339
340 typedef struct {
341 /* System Information Class 0x0b */
342         PVOID pvAddress;
343         DWORD dwUnknown1;
344         DWORD dwUnknown2;
345         DWORD dwEntryIndex;
346         DWORD dwUnknown3;
347         char szName[MAX_PATH + 1];
348 } SYSTEM_DRIVER_INFORMATION;
349
350 typedef struct {
351 /* System Information Class 0x10 */
352         USHORT dwPID;
353         USHORT dwCreatorBackTraceIndex;
354         BYTE bObjectType;
355         BYTE bHandleAttributes;
356         USHORT usHandleOffset;
357         DWORD dwKeObject;
358         ULONG ulGrantedAccess;
359 } HANDLEINFO, *PHANDLEINFO;
360
361 typedef struct {
362 /* System Information Class 0x15 */
363         ULONG CurrentSize;
364         ULONG PeakSize;
365         ULONG PageFaultCount;
366         ULONG MinimumWorkingSet;
367         ULONG MaximumWorkingSet;
368         ULONG unused[4];
369 } SYSTEM_CACHE_INFORMATION;
370
371 /* reading coffee grounds... */
372 typedef struct _THREAD_INFO
373 {       DWORD   Unknown1[6];
374         DWORD   ThreadID;
375         DWORD   Unknown2[3];
376         DWORD   Status;
377         DWORD   WaitReason;
378         DWORD   Unknown3[4];
379 } THREAD_INFO, PTHREAD_INFO;
380
381 typedef struct _VM_COUNTERS_
382 {       ULONG PeakVirtualSize;
383         ULONG VirtualSize;
384         ULONG PageFaultCount;
385         ULONG PeakWorkingSetSize;
386         ULONG WorkingSetSize;
387         ULONG QuotaPeakPagedPoolUsage;
388         ULONG QuotaPagedPoolUsage;
389         ULONG QuotaPeakNonPagedPoolUsage;
390         ULONG QuotaNonPagedPoolUsage;
391         ULONG PagefileUsage;
392         ULONG PeakPagefileUsage;
393 } VM_COUNTERS, *PVM_COUNTERS;
394
395 /* process information */
396
397 typedef struct _PROCESS_INFO
398 {       DWORD           Offset;         /* 00 offset to next PROCESS_INFO ok*/
399         DWORD           ThreadCount;    /* 04 number of ThreadInfo member ok */
400         DWORD           Unknown1[6];
401         FILETIME        CreationTime;   /* 20 */
402         DWORD           Unknown2[5];
403         PWCHAR          ProcessName;    /* 3c ok */
404         DWORD           BasePriority;
405         DWORD           ProcessID;      /* 44 ok*/
406         DWORD           ParentProcessID;
407         DWORD           HandleCount;
408         DWORD           Unknown3[2];    /* 50 */
409         ULONG           PeakVirtualSize;
410         ULONG           VirtualSize;
411         ULONG           PageFaultCount;
412         ULONG           PeakWorkingSetSize;
413         ULONG           WorkingSetSize;
414         ULONG           QuotaPeakPagedPoolUsage;
415         ULONG           QuotaPagedPoolUsage;
416         ULONG           QuotaPeakNonPagedPoolUsage;
417         ULONG           QuotaNonPagedPoolUsage;
418         ULONG           PagefileUsage;
419         ULONG           PeakPagefileUsage;
420         DWORD           PrivateBytes;
421         DWORD           Unknown6[4];
422         THREAD_INFO     ati[ANYSIZE_ARRAY];     /* 94 size=0x40*/
423 } PROCESS_INFO, PPROCESS_INFO;
424
425 NTSTATUS WINAPI NtQuerySystemInformation(
426         IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
427         OUT PVOID SystemInformation,
428         IN ULONG Length,
429         OUT PULONG ResultLength);
430
431 /*
432  *      system configuration
433  */
434
435
436 typedef struct _SYSTEM_TIME_ADJUSTMENT
437 {
438         ULONG   TimeAdjustment;
439         BOOLEAN TimeAdjustmentDisabled;
440
441 } SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT;
442
443 typedef struct _SYSTEM_CONFIGURATION_INFO 
444 {
445         union 
446         { ULONG OemId;
447           struct 
448           { WORD        ProcessorArchitecture;
449             WORD        Reserved;
450           } tag1;
451         } tag2;
452         ULONG   PageSize;
453         PVOID   MinimumApplicationAddress;
454         PVOID   MaximumApplicationAddress;
455         ULONG   ActiveProcessorMask;
456         ULONG   NumberOfProcessors;
457         ULONG   ProcessorType;
458         ULONG   AllocationGranularity;
459         WORD    ProcessorLevel;
460         WORD    ProcessorRevision;
461
462 } SYSTEM_CONFIGURATION_INFO, *PSYSTEM_CONFIGURATION_INFO;
463
464
465 /*
466  *      NtQueryProcessInformation
467  */
468
469 /* parameter ProcessInformationClass */
470
471 typedef enum _PROCESSINFOCLASS 
472 {       ProcessBasicInformation,
473         ProcessQuotaLimits,
474         ProcessIoCounters,
475         ProcessVmCounters,
476         ProcessTimes,
477         ProcessBasePriority,
478         ProcessRaisePriority,
479         ProcessDebugPort,
480         ProcessExceptionPort,
481         ProcessAccessToken,
482         ProcessLdtInformation,
483         ProcessLdtSize,
484         ProcessDefaultHardErrorMode,
485         ProcessIoPortHandlers,
486         ProcessPooledUsageAndLimits,
487         ProcessWorkingSetWatch,
488         ProcessUserModeIOPL,
489         ProcessEnableAlignmentFaultFixup,
490         ProcessPriorityClass,
491         ProcessWx86Information,
492         ProcessHandleCount,
493         ProcessAffinityMask,
494         ProcessPriorityBoost,
495         ProcessDeviceMap,
496         ProcessSessionInformation,
497         ProcessForegroundInformation,
498         ProcessWow64Information,
499         MaxProcessInfoClass
500 } PROCESSINFOCLASS;
501
502 /* parameter ProcessInformation (depending on ProcessInformationClass) */
503
504 typedef struct _PROCESS_BASIC_INFORMATION 
505 {       DWORD   ExitStatus;
506         DWORD   PebBaseAddress;
507         DWORD   AffinityMask;
508         DWORD   BasePriority;
509         ULONG   UniqueProcessId;
510         ULONG   InheritedFromUniqueProcessId;
511 } PROCESS_BASIC_INFORMATION;
512
513 NTSTATUS WINAPI NtQueryInformationProcess(
514         IN HANDLE ProcessHandle,
515         IN PROCESSINFOCLASS ProcessInformationClass,
516         OUT PVOID ProcessInformation,
517         IN ULONG ProcessInformationLength,
518         OUT PULONG ReturnLength);
519
520 #define NtCurrentProcess() ( (HANDLE) -1 )
521
522 /*
523  *      timer
524  */
525
526 typedef enum _TIMER_TYPE 
527 {
528         NotificationTimer,
529         SynchronizationTimer
530
531 } TIMER_TYPE;
532
533 /*      token functions */
534  
535 NTSTATUS WINAPI NtOpenProcessToken(
536         HANDLE ProcessHandle,
537         DWORD DesiredAccess, 
538         HANDLE *TokenHandle);
539         
540 NTSTATUS WINAPI NtOpenThreadToken(
541         HANDLE ThreadHandle,
542         DWORD DesiredAccess, 
543         BOOLEAN OpenAsSelf,
544         HANDLE *TokenHandle);
545
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);
553
554 NTSTATUS WINAPI NtQueryInformationToken(
555         HANDLE token,
556         DWORD tokeninfoclass, 
557         LPVOID tokeninfo,
558         DWORD tokeninfolength,
559         LPDWORD retlen );
560
561 /*      sid functions */
562
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,
570         PSID *pSid );
571         
572 BOOL WINAPI RtlInitializeSid(
573         PSID pSid,
574         PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
575         BYTE nSubAuthorityCount);
576         
577 DWORD WINAPI RtlFreeSid(
578         PSID pSid);
579
580 BOOL WINAPI RtlEqualSid(
581         PSID pSid1,
582         PSID pSid2 );
583         
584 DWORD WINAPI RtlLengthRequiredSid(
585         DWORD nrofsubauths);
586
587 DWORD WINAPI RtlLengthSid(
588         PSID sid);
589
590 LPDWORD WINAPI RtlSubAuthoritySid(
591         PSID PSID,
592         DWORD nr);
593
594 LPBYTE WINAPI RtlSubAuthorityCountSid(
595         PSID pSid);
596
597 DWORD WINAPI RtlCopySid(
598         DWORD len,
599         PSID to,
600         PSID from);
601         
602 BOOL WINAPI RtlValidSid(
603         PSID pSid);
604
605 BOOL WINAPI RtlEqualPrefixSid(
606         PSID pSid1,
607         PSID pSid2);
608
609 PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid(
610         PSID pSid );
611
612 /*      security descriptor functions */
613
614 NTSTATUS WINAPI RtlCreateSecurityDescriptor(
615         PSECURITY_DESCRIPTOR lpsd,
616         DWORD rev);
617
618 NTSTATUS WINAPI RtlValidSecurityDescriptor(
619         PSECURITY_DESCRIPTOR SecurityDescriptor);
620
621 ULONG WINAPI RtlLengthSecurityDescriptor(
622         PSECURITY_DESCRIPTOR SecurityDescriptor);
623
624 NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(
625         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
626         OUT PBOOLEAN lpbDaclPresent,
627         OUT PACL *pDacl,
628         OUT PBOOLEAN lpbDaclDefaulted);
629
630 NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
631         PSECURITY_DESCRIPTOR lpsd,
632         BOOLEAN daclpresent,
633         PACL dacl,
634         BOOLEAN dacldefaulted );
635
636 NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(
637         IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
638         OUT PBOOLEAN lpbSaclPresent,
639         OUT PACL *pSacl,
640         OUT PBOOLEAN lpbSaclDefaulted);
641
642 NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (
643         PSECURITY_DESCRIPTOR lpsd,
644         BOOLEAN saclpresent,
645         PACL sacl,
646         BOOLEAN sacldefaulted);
647
648 NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
649         PSECURITY_DESCRIPTOR SecurityDescriptor,
650         PSID *Owner,
651         PBOOLEAN OwnerDefaulted);
652
653 NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
654         PSECURITY_DESCRIPTOR lpsd,
655         PSID owner,
656         BOOLEAN ownerdefaulted);
657
658 NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
659         PSECURITY_DESCRIPTOR lpsd,
660         PSID group,
661         BOOLEAN groupdefaulted);
662
663 NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
664         PSECURITY_DESCRIPTOR SecurityDescriptor,
665         PSID *Group,
666         PBOOLEAN GroupDefaulted);
667
668 NTSTATUS WINAPI RtlMakeSelfRelativeSD(
669         IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
670         IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
671         IN OUT LPDWORD lpdwBufferLength);
672
673 NTSTATUS WINAPI RtlGetControlSecurityDescriptor(
674         PSECURITY_DESCRIPTOR  pSecurityDescriptor,
675         PSECURITY_DESCRIPTOR_CONTROL pControl,
676         LPDWORD lpdwRevision);
677
678 /*      acl functions */
679
680 NTSTATUS WINAPI RtlCreateAcl(
681         PACL acl,
682         DWORD size,
683         DWORD rev);
684
685 BOOLEAN WINAPI RtlFirstFreeAce(
686         PACL acl,
687         PACE_HEADER *x);
688
689 NTSTATUS WINAPI RtlAddAce(
690         PACL acl,
691         DWORD rev,
692         DWORD xnrofaces,
693         PACE_HEADER acestart,
694         DWORD acelen);
695         
696 BOOL WINAPI RtlAddAccessAllowedAce(
697         IN OUT PACL pAcl,
698         IN DWORD dwAceRevision,
699         IN DWORD AccessMask,
700         IN PSID pSid);
701
702 BOOL WINAPI AddAccessAllowedAceEx(
703         IN OUT PACL pAcl,
704         IN DWORD dwAceRevision,
705         IN DWORD AceFlags,
706         IN DWORD AccessMask,
707         IN PSID pSid);
708
709 DWORD WINAPI RtlGetAce(
710         PACL pAcl,
711         DWORD dwAceIndex,
712         LPVOID *pAce );
713
714 /*      string functions */
715
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);
756
757 DWORD WINAPI RtlIsTextUnicode(
758         LPVOID buf,
759         DWORD len,
760         DWORD *pf);
761
762 INT __cdecl wcstol(LPCWSTR,LPWSTR*,INT);
763 int __cdecl swprintf(LPWSTR,LPCWSTR,...);
764
765 /*      resource functions */
766
767 typedef struct _RTL_RWLOCK {
768         CRITICAL_SECTION        rtlCS;
769         HANDLE          hSharedReleaseSemaphore;
770         UINT                    uSharedWaiters;
771         HANDLE          hExclusiveReleaseSemaphore;
772         UINT                    uExclusiveWaiters;
773         INT                     iNumberActive;
774         HANDLE          hOwningThreadId;
775         DWORD                   dwTimeoutBoost;
776         PVOID                   pDebugInfo;
777 } RTL_RWLOCK, *LPRTL_RWLOCK;
778
779 VOID   WINAPI RtlInitializeResource(
780         LPRTL_RWLOCK);
781         
782 VOID   WINAPI RtlDeleteResource(
783         LPRTL_RWLOCK);
784         
785 BYTE   WINAPI RtlAcquireResourceExclusive(
786         LPRTL_RWLOCK, BYTE fWait);
787         
788 BYTE   WINAPI RtlAcquireResourceShared(
789         LPRTL_RWLOCK, BYTE fWait);
790         
791 VOID   WINAPI RtlReleaseResource(
792         LPRTL_RWLOCK);
793         
794 VOID   WINAPI RtlDumpResource(
795         LPRTL_RWLOCK);
796
797 /*      time functions */
798
799 typedef struct _TIME_FIELDS 
800 {   CSHORT Year;
801     CSHORT Month;
802     CSHORT Day;
803     CSHORT Hour;
804     CSHORT Minute;
805     CSHORT Second;
806     CSHORT Milliseconds;
807     CSHORT Weekday;
808 } TIME_FIELDS;
809
810 typedef TIME_FIELDS *PTIME_FIELDS;
811
812 VOID WINAPI RtlSystemTimeToLocalTime(
813         IN  PLARGE_INTEGER SystemTime,
814         OUT PLARGE_INTEGER LocalTime);
815
816 VOID WINAPI RtlTimeToTimeFields(
817         PLARGE_INTEGER liTime,
818         PTIME_FIELDS TimeFields);
819
820 BOOLEAN WINAPI RtlTimeFieldsToTime(
821         PTIME_FIELDS tfTimeFields,
822         PLARGE_INTEGER Time);
823         
824 VOID WINAPI RtlTimeToElapsedTimeFields(
825         PLARGE_INTEGER liTime,
826         PTIME_FIELDS TimeFields);
827         
828 void    WINAPI NtQuerySystemTime( LARGE_INTEGER *time );
829
830 BOOLEAN WINAPI RtlTimeToSecondsSince1980( const FILETIME *time, LPDWORD res );
831 BOOLEAN WINAPI RtlTimeToSecondsSince1970( const FILETIME *time, LPDWORD res );
832 void    WINAPI RtlSecondsSince1970ToTime( DWORD time, FILETIME *res );
833 void    WINAPI RtlSecondsSince1980ToTime( DWORD time, FILETIME *res );
834
835 /*      heap functions */
836
837 /* Data structure for heap definition. This includes various
838    sizing parameters and callback routines, which, if left NULL,
839    result in default behavior */
840
841 typedef struct
842 {       ULONG   Length;         /* = sizeof(RTL_HEAP_DEFINITION) */
843         ULONG   Unknown[11];
844 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
845
846 HANDLE    WINAPI RtlCreateHeap(ULONG,PVOID,ULONG,ULONG,PVOID,PRTL_HEAP_DEFINITION);
847 HANDLE    WINAPI RtlDestroyHeap(HANDLE);
848 PVOID     WINAPI RtlAllocateHeap(HANDLE,ULONG,ULONG);
849 BOOLEAN   WINAPI RtlFreeHeap(HANDLE,ULONG,PVOID);
850 PVOID     WINAPI RtlReAllocateHeap(HANDLE,ULONG,PVOID,ULONG);
851 ULONG     WINAPI RtlCompactHeap(HANDLE,ULONG);
852 BOOLEAN   WINAPI RtlLockHeap(HANDLE);
853 BOOLEAN   WINAPI RtlUnlockHeap(HANDLE);
854 ULONG     WINAPI RtlSizeHeap(HANDLE,ULONG,PVOID);
855 BOOLEAN   WINAPI RtlValidateHeap(HANDLE,ULONG,PCVOID);
856 ULONG     WINAPI RtlGetProcessHeaps(ULONG,HANDLE*);
857 NTSTATUS  WINAPI RtlWalkHeap(HANDLE,PVOID);
858
859 /*      exception */
860
861 void WINAPI NtRaiseException(
862         PEXCEPTION_RECORD,PCONTEXT,BOOL);
863
864 void WINAPI RtlRaiseException(
865         PEXCEPTION_RECORD);
866
867 void WINAPI RtlRaiseStatus(
868         NTSTATUS);
869
870 void WINAPI RtlUnwind(
871         PEXCEPTION_FRAME,
872         LPVOID,
873         PEXCEPTION_RECORD,DWORD);
874
875 /*      process environment block  */
876 VOID WINAPI RtlAcquirePebLock(void);
877 VOID WINAPI RtlReleasePebLock(void);
878
879 /*      mathematics */
880 LONGLONG  WINAPI RtlConvertLongToLargeInteger( LONG a );
881 LONGLONG  WINAPI RtlEnlargedIntegerMultiply( INT a, INT b );
882 LONGLONG  WINAPI RtlExtendedMagicDivide( LONGLONG a, LONGLONG b, INT shift );
883 LONGLONG  WINAPI RtlExtendedIntegerMultiply( LONGLONG a, INT b );
884 LONGLONG  WINAPI RtlExtendedLargeIntegerDivide( LONGLONG a, INT b, INT *rem );
885 LONGLONG  WINAPI RtlLargeIntegerAdd( LONGLONG a, LONGLONG b );
886 LONGLONG  WINAPI RtlLargeIntegerArithmeticShift( LONGLONG a, INT count );
887 LONGLONG  WINAPI RtlLargeIntegerNegate( LONGLONG a );
888 LONGLONG  WINAPI RtlLargeIntegerShiftLeft( LONGLONG a, INT count );
889 LONGLONG  WINAPI RtlLargeIntegerShiftRight( LONGLONG a, INT count );
890 LONGLONG  WINAPI RtlLargeIntegerSubtract( LONGLONG a, LONGLONG b );
891 ULONGLONG WINAPI RtlEnlargedUnsignedMultiply( UINT a, UINT b );
892 UINT      WINAPI RtlEnlargedUnsignedDivide( ULONGLONG a, UINT b, UINT *remptr );
893 ULONGLONG WINAPI RtlConvertUlongToLargeInteger( ULONG a );
894 ULONGLONG WINAPI RtlLargeIntegerDivide( ULONGLONG a, ULONGLONG b, ULONGLONG *rem );
895
896 /*      environment */
897 DWORD WINAPI RtlCreateEnvironment(
898         DWORD x1,
899         DWORD x2);
900
901 DWORD WINAPI RtlDestroyEnvironment(
902         DWORD x);
903
904 DWORD WINAPI RtlQueryEnvironmentVariable_U(
905         DWORD x1,
906         PUNICODE_STRING key,
907         PUNICODE_STRING val) ;
908
909 DWORD WINAPI RtlSetEnvironmentVariable(
910         DWORD x1,
911         PUNICODE_STRING key,
912         PUNICODE_STRING val);
913
914 /*      object security */
915
916 DWORD WINAPI RtlNewSecurityObject(
917         DWORD x1,
918         DWORD x2,
919         DWORD x3,
920         DWORD x4,
921         DWORD x5,
922         DWORD x6);
923
924 DWORD WINAPI RtlDeleteSecurityObject(
925         DWORD x1);
926         
927 NTSTATUS WINAPI 
928 NtQuerySecurityObject(
929         IN HANDLE Object,
930         IN SECURITY_INFORMATION RequestedInformation,
931         OUT PSECURITY_DESCRIPTOR pSecurityDesriptor,
932         IN ULONG Length,
933         OUT PULONG ResultLength);
934
935 NTSTATUS WINAPI
936 NtSetSecurityObject(
937         IN HANDLE Handle,
938         IN SECURITY_INFORMATION SecurityInformation,
939         IN PSECURITY_DESCRIPTOR SecurityDescriptor);
940
941 /*      registry functions */
942
943 NTSTATUS    WINAPI NtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,
944                                const UNICODE_STRING*,ULONG,PULONG);
945 NTSTATUS    WINAPI NtDeleteKey(HANDLE);
946 NTSTATUS    WINAPI NtDeleteValueKey(HANDLE,const UNICODE_STRING*);
947 NTSTATUS    WINAPI NtOpenKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*);
948 NTSTATUS    WINAPI NtQueryKey(HANDLE,KEY_INFORMATION_CLASS,void*,DWORD,DWORD*);
949 NTSTATUS    WINAPI NtSetValueKey(HANDLE,const UNICODE_STRING*,ULONG,ULONG,const void*,ULONG);
950 NTSTATUS    WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void*,DWORD,DWORD*);
951 NTSTATUS    WINAPI NtQueryValueKey(HANDLE,const UNICODE_STRING*,KEY_VALUE_INFORMATION_CLASS,
952                                    void*,DWORD,DWORD*);
953 NTSTATUS    WINAPI NtLoadKey(const OBJECT_ATTRIBUTES*,const OBJECT_ATTRIBUTES*);
954
955
956 NTSTATUS WINAPI NtEnumerateValueKey(
957         HANDLE KeyHandle,
958         ULONG Index,
959         KEY_VALUE_INFORMATION_CLASS KeyInformationClass,
960         PVOID KeyInformation,
961         ULONG Length,
962         PULONG ResultLength);
963
964 NTSTATUS WINAPI NtFlushKey(HANDLE KeyHandle);
965
966 NTSTATUS WINAPI NtNotifyChangeKey(
967         IN HANDLE KeyHandle,
968         IN HANDLE Event,
969         IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
970         IN PVOID ApcContext OPTIONAL,
971         OUT PIO_STATUS_BLOCK IoStatusBlock,
972         IN ULONG CompletionFilter,
973         IN BOOLEAN Asynchroneous,
974         OUT PVOID ChangeBuffer,
975         IN ULONG Length,
976         IN BOOLEAN WatchSubtree);
977
978 NTSTATUS WINAPI NtQueryMultipleValueKey(
979         HANDLE KeyHandle,
980         PVALENTW ListOfValuesToQuery,
981         ULONG NumberOfItems,
982         PVOID MultipleValueInformation,
983         ULONG Length,
984         PULONG  ReturnLength);
985
986 NTSTATUS WINAPI NtReplaceKey(
987         IN POBJECT_ATTRIBUTES ObjectAttributes,
988         IN HANDLE Key,
989         IN POBJECT_ATTRIBUTES ReplacedObjectAttributes);
990
991 NTSTATUS WINAPI NtRestoreKey(
992         HANDLE KeyHandle,
993         HANDLE FileHandle,
994         ULONG RestoreFlags);
995
996 NTSTATUS WINAPI NtSaveKey(
997         IN HANDLE KeyHandle,
998         IN HANDLE FileHandle);
999
1000 NTSTATUS WINAPI NtSetInformationKey(
1001         IN HANDLE KeyHandle,
1002         IN const int KeyInformationClass,
1003         IN PVOID KeyInformation,
1004         IN ULONG KeyInformationLength);
1005
1006 NTSTATUS WINAPI NtUnloadKey(
1007         IN HANDLE KeyHandle);
1008
1009 NTSTATUS WINAPI NtClose(
1010         HANDLE Handle);
1011
1012 NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code );
1013 NTSTATUS WINAPI NtTerminateThread( HANDLE handle, LONG exit_code );
1014
1015 NTSTATUS WINAPI NtClearEvent(HANDLE);
1016 NTSTATUS WINAPI NtCreateEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *,BOOLEAN,BOOLEAN);
1017 NTSTATUS WINAPI NtCreateSemaphore(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,ULONG);
1018 NTSTATUS WINAPI NtOpenEvent(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES *attr);
1019 NTSTATUS WINAPI NtPulseEvent(HANDLE,PULONG);
1020 NTSTATUS WINAPI NtReleaseSemaphore(HANDLE,ULONG,PULONG);
1021 NTSTATUS WINAPI NtResetEvent(HANDLE,PULONG);
1022 NTSTATUS WINAPI NtSetEvent(HANDLE,PULONG);
1023
1024 NTSTATUS WINAPI RtlInitializeCriticalSection( RTL_CRITICAL_SECTION *crit );
1025 NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount( RTL_CRITICAL_SECTION *crit, DWORD spincount );
1026 NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit );
1027 NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit );
1028 NTSTATUS WINAPI RtlpUnWaitCriticalSection( RTL_CRITICAL_SECTION *crit );
1029 NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit );
1030 BOOL     WINAPI RtlTryEnterCriticalSection( RTL_CRITICAL_SECTION *crit );
1031 NTSTATUS WINAPI RtlLeaveCriticalSection( RTL_CRITICAL_SECTION *crit );
1032
1033 /* string functions */
1034 extern LPSTR _strlwr( LPSTR str );
1035 extern LPSTR _strupr( LPSTR str );
1036
1037 /*      misc */
1038
1039 #if defined(__i386__) && defined(__GNUC__)
1040 static inline void WINAPI DbgBreakPoint(void) { __asm__ __volatile__("int3"); }
1041 static inline void WINAPI DbgUserBreakPoint(void) { __asm__ __volatile__("int3"); }
1042 #else  /* __i386__ && __GNUC__ */
1043 void WINAPI DbgBreakPoint(void);
1044 void WINAPI DbgUserBreakPoint(void);
1045 #endif  /* __i386__ && __GNUC__ */
1046 void WINAPIV DbgPrint(LPCSTR fmt, ...);
1047
1048 DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
1049 DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4);
1050 LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x);
1051 DWORD WINAPI RtlNtStatusToDosError(DWORD error);
1052 BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type);
1053 PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule);
1054
1055 DWORD WINAPI RtlOpenCurrentUser(
1056         IN ACCESS_MASK DesiredAccess,
1057         OUT PHANDLE KeyHandle);
1058
1059 BOOLEAN WINAPI RtlDosPathNameToNtPathName_U( LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3);
1060 BOOL WINAPI RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
1061
1062 NTSTATUS WINAPI 
1063 NtAccessCheck(
1064         IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1065         IN HANDLE ClientToken,
1066         IN ACCESS_MASK DesiredAccess,
1067         IN PGENERIC_MAPPING GenericMapping,
1068         OUT PPRIVILEGE_SET PrivilegeSet,
1069         OUT PULONG ReturnLength,
1070         OUT PULONG GrantedAccess,
1071         OUT PBOOLEAN AccessStatus);
1072
1073 #ifdef __cplusplus
1074 }
1075 #endif
1076
1077 #endif