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