patch by Skywing: made existing eventpair code more efficient and added support for...
[reactos.git] / reactos / include / ntos / zw.h
1
2 /* $Id: zw.h,v 1.17 2003/09/10 06:12:21 vizzini Exp $
3 *
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS kernel
6 * PURPOSE: System call definitions
7 * FILE: include/ddk/zw.h
8 * REVISION HISTORY:
9 * ??/??/??: First few functions (David Welch)
10 * ??/??/??: Complete implementation by Ariadne
11 * 13/07/98: Reorganised things a bit (David Welch)
12 * 04/08/98: Added some documentation (Ariadne)
13 * 14/08/98: Added type TIME and change variable type from [1] to [0]
14 * 14/09/98: Added for each Nt call a corresponding Zw Call
15 * 09/08/03: Added ThreadEventPair routines
16 */
17
18 #ifndef __DDK_ZW_H
19 #define __DDK_ZW_H
20
21 #include <ntos/security.h>
22 #include <ntos/zwtypes.h>
23 #include <napi/npipe.h>
24
25 #ifndef _RTLGETPROCESSHEAP_DEFINED_
26 #define _RTLGETPROCESSHEAP_DEFINED_
27 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
28 #endif
29
30 // semaphore information
31
32 typedef enum _SEMAPHORE_INFORMATION_CLASS
33 {
34 SemaphoreBasicInformation = 0
35 } SEMAPHORE_INFORMATION_CLASS;
36
37 typedef struct _SEMAPHORE_BASIC_INFORMATION
38 {
39 LONG CurrentCount;
40 LONG MaximumCount;
41 } SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
42
43 // event information
44
45 typedef enum _EVENT_INFORMATION_CLASS
46 {
47 EventBasicInformation = 0
48 } EVENT_INFORMATION_CLASS;
49
50 typedef struct _EVENT_BASIC_INFORMATION
51 {
52 EVENT_TYPE EventType;
53 LONG EventState;
54 } EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
55
56 //#define LCID ULONG
57 //#define SECURITY_INFORMATION ULONG
58 //typedef ULONG SECURITY_INFORMATION;
59
60 /*
61 * FUNCTION: Adjusts the groups in an access token
62 * ARGUMENTS:
63 * TokenHandle = Specifies the access token
64 * ResetToDefault = If true the NewState parameter is ignored and the groups are set to
65 * their default state, if false the groups specified in
66 * NewState are set.
67 * NewState =
68 * BufferLength = Specifies the size of the buffer for the PreviousState.
69 * PreviousState =
70 * ReturnLength = Bytes written in PreviousState buffer.
71 * REMARKS: The arguments map to the win32 AdjustTokenGroups
72 * RETURNS: Status
73 */
74
75 NTSTATUS
76 STDCALL
77 NtAdjustGroupsToken(
78 IN HANDLE TokenHandle,
79 IN BOOLEAN ResetToDefault,
80 IN PTOKEN_GROUPS NewState,
81 IN ULONG BufferLength,
82 OUT PTOKEN_GROUPS PreviousState OPTIONAL,
83 OUT PULONG ReturnLength
84 );
85
86 NTSTATUS
87 STDCALL
88 ZwAdjustGroupsToken(
89 IN HANDLE TokenHandle,
90 IN BOOLEAN ResetToDefault,
91 IN PTOKEN_GROUPS NewState,
92 IN ULONG BufferLength,
93 OUT PTOKEN_GROUPS PreviousState,
94 OUT PULONG ReturnLength
95 );
96
97
98 /*
99 * FUNCTION:
100 *
101 * ARGUMENTS:
102 * TokenHandle = Handle to the access token
103 * DisableAllPrivileges = The resulting suspend count.
104 NewState =
105 BufferLength =
106 PreviousState =
107 ReturnLength =
108 * REMARK:
109 * The arguments map to the win32 AdjustTokenPrivileges
110 * RETURNS: Status
111 */
112
113 NTSTATUS
114 STDCALL
115 NtAdjustPrivilegesToken(
116 IN HANDLE TokenHandle,
117 IN BOOLEAN DisableAllPrivileges,
118 IN PTOKEN_PRIVILEGES NewState,
119 IN ULONG BufferLength,
120 OUT PTOKEN_PRIVILEGES PreviousState,
121 OUT PULONG ReturnLength
122 );
123
124 NTSTATUS
125 STDCALL
126 ZwAdjustPrivilegesToken(
127 IN HANDLE TokenHandle,
128 IN BOOLEAN DisableAllPrivileges,
129 IN PTOKEN_PRIVILEGES NewState,
130 IN ULONG BufferLength,
131 OUT PTOKEN_PRIVILEGES PreviousState,
132 OUT PULONG ReturnLength
133 );
134
135
136 /*
137 * FUNCTION: Decrements a thread's suspend count and places it in an alerted
138 * state.
139 * ARGUMENTS:
140 * ThreadHandle = Handle to the thread that should be resumed
141 * SuspendCount = The resulting suspend count.
142 * REMARK:
143 * A thread is resumed if its suspend count is 0
144 * RETURNS: Status
145 */
146 NTSTATUS
147 STDCALL
148 NtAlertResumeThread(
149 IN HANDLE ThreadHandle,
150 OUT PULONG SuspendCount
151 );
152
153 NTSTATUS
154 STDCALL
155 ZwAlertResumeThread(
156 IN HANDLE ThreadHandle,
157 OUT PULONG SuspendCount
158 );
159
160 /*
161 * FUNCTION: Puts the thread in a alerted state
162 * ARGUMENTS:
163 * ThreadHandle = Handle to the thread that should be alerted
164 * RETURNS: Status
165 */
166 NTSTATUS
167 STDCALL
168 NtAlertThread(
169 IN HANDLE ThreadHandle
170 );
171
172 NTSTATUS
173 STDCALL
174 ZwAlertThread(
175 IN HANDLE ThreadHandle
176 );
177
178
179 /*
180 * FUNCTION: Allocates a locally unique id
181 * ARGUMENTS:
182 * LocallyUniqueId = Locally unique number
183 * RETURNS: Status
184 */
185 NTSTATUS
186 STDCALL
187 NtAllocateLocallyUniqueId(
188 OUT LUID *LocallyUniqueId
189 );
190
191 NTSTATUS
192 STDCALL
193 ZwAllocateLocallyUniqueId(
194 OUT PLUID Luid
195 );
196
197 /*
198 * FUNCTION: Allocates a block of virtual memory in the process address space
199 * ARGUMENTS:
200 * ProcessHandle = The handle of the process which owns the virtual memory
201 * BaseAddress = A pointer to the virtual memory allocated. If you supply a non zero
202 * value the system will try to allocate the memory at the address supplied. It rounds
203 * it down to a multiple if the page size.
204 * ZeroBits = (OPTIONAL) You can specify the number of high order bits that must be zero, ensuring that
205 * the memory will be allocated at a address below a certain value.
206 * RegionSize = The number of bytes to allocate
207 * AllocationType = Indicates the type of virtual memory you like to allocated,
208 * can be one of the values : MEM_COMMIT, MEM_RESERVE, MEM_RESET, MEM_TOP_DOWN
209 * Protect = Indicates the protection type of the pages allocated, can be a combination of
210 * PAGE_READONLY, PAGE_READWRITE, PAGE_EXECUTE_READ,
211 * PAGE_EXECUTE_READWRITE, PAGE_GUARD, PAGE_NOACCESS, PAGE_NOACCESS
212 * REMARKS:
213 * This function maps to the win32 VirtualAllocEx. Virtual memory is process based so the
214 * protocol starts with a ProcessHandle. I splitted the functionality of obtaining the actual address and specifying
215 * the start address in two parameters ( BaseAddress and StartAddress ) The NumberOfBytesAllocated specify the range
216 * and the AllocationType and ProctectionType map to the other two parameters.
217 * RETURNS: Status
218 */
219 NTSTATUS
220 STDCALL
221 NtAllocateVirtualMemory (
222 IN HANDLE ProcessHandle,
223 IN OUT PVOID *BaseAddress,
224 IN ULONG ZeroBits,
225 IN OUT PULONG RegionSize,
226 IN ULONG AllocationType,
227 IN ULONG Protect
228 );
229
230 NTSTATUS
231 STDCALL
232 ZwAllocateVirtualMemory (
233 IN HANDLE ProcessHandle,
234 IN OUT PVOID *BaseAddress,
235 IN ULONG ZeroBits,
236 IN OUT PULONG RegionSize,
237 IN ULONG AllocationType,
238 IN ULONG Protect);
239
240 /*
241 * FUNCTION: Returns from a callback into user mode
242 * ARGUMENTS:
243 * RETURN Status
244 */
245 //FIXME: this function might need 3 parameters
246 NTSTATUS STDCALL NtCallbackReturn(PVOID Result,
247 ULONG ResultLength,
248 NTSTATUS Status);
249
250 NTSTATUS STDCALL ZwCallbackReturn(PVOID Result,
251 ULONG ResultLength,
252 NTSTATUS Status);
253
254 /*
255 * FUNCTION: Cancels a IO request
256 * ARGUMENTS:
257 * FileHandle = Handle to the file
258 * IoStatusBlock =
259 *
260 * REMARKS:
261 * This function maps to the win32 CancelIo.
262 * RETURNS: Status
263 */
264 NTSTATUS
265 STDCALL
266 NtCancelIoFile(
267 IN HANDLE FileHandle,
268 OUT PIO_STATUS_BLOCK IoStatusBlock
269 );
270
271 NTSTATUS
272 STDCALL
273 ZwCancelIoFile(
274 IN HANDLE FileHandle,
275 OUT PIO_STATUS_BLOCK IoStatusBlock
276 );
277
278 /*
279 * FUNCTION: Sets the status of the event back to non-signaled
280 * ARGUMENTS:
281 * EventHandle = Handle to the event
282 * REMARKS:
283 * This function maps to win32 function ResetEvent.
284 * RETURcNS: Status
285 */
286
287 NTSTATUS
288 STDCALL
289 NtClearEvent(
290 IN HANDLE EventHandle
291 );
292
293 NTSTATUS
294 STDCALL
295 ZwClearEvent(
296 IN HANDLE EventHandle
297 );
298
299 /*
300 * FUNCTION: Closes an object handle
301 * ARGUMENTS:
302 * Handle = Handle to the object
303 * REMARKS:
304 * This function maps to the win32 function CloseHandle.
305 * RETURNS: Status
306 */
307
308 NTSTATUS
309 STDCALL
310 NtClose(
311 IN HANDLE Handle
312 );
313
314 NTSTATUS
315 STDCALL
316 ZwClose(
317 IN HANDLE Handle
318 );
319
320 /*
321 * FUNCTION: Generates an audit message when a handle to an object is dereferenced
322 * ARGUMENTS:
323 * SubsystemName =
324 HandleId = Handle to the object
325 GenerateOnClose =
326 * REMARKS:
327 * This function maps to the win32 function ObjectCloseAuditAlarm.
328 * RETURNS: Status
329 */
330
331 NTSTATUS
332 STDCALL
333 NtCloseObjectAuditAlarm(
334 IN PUNICODE_STRING SubsystemName,
335 IN PVOID HandleId,
336 IN BOOLEAN GenerateOnClose
337 );
338
339 NTSTATUS
340 STDCALL
341 ZwCloseObjectAuditAlarm(
342 IN PUNICODE_STRING SubsystemName,
343 IN PVOID HandleId,
344 IN BOOLEAN GenerateOnClose
345 );
346
347 /*
348 * FUNCTION: Creates a directory object
349 * ARGUMENTS:
350 * DirectoryHandle (OUT) = Caller supplied storage for the resulting handle
351 * DesiredAccess = Specifies access to the directory
352 * ObjectAttribute = Initialized attributes for the object
353 * REMARKS: This function maps to the win32 CreateDirectory. A directory is like a file so it needs a
354 * handle, a access mask and a OBJECT_ATTRIBUTES structure to map the path name and the SECURITY_ATTRIBUTES.
355 * RETURNS: Status
356 */
357
358 NTSTATUS
359 STDCALL
360 NtCreateDirectoryObject(
361 OUT PHANDLE DirectoryHandle,
362 IN ACCESS_MASK DesiredAccess,
363 IN POBJECT_ATTRIBUTES ObjectAttributes
364 );
365
366 NTSTATUS
367 STDCALL
368 ZwCreateDirectoryObject(
369 OUT PHANDLE DirectoryHandle,
370 IN ACCESS_MASK DesiredAccess,
371 IN POBJECT_ATTRIBUTES ObjectAttributes
372 );
373
374 /*
375 * FUNCTION: Creates an event object
376 * ARGUMENTS:
377 * EventHandle (OUT) = Caller supplied storage for the resulting handle
378 * DesiredAccess = Specifies access to the event
379 * ObjectAttribute = Initialized attributes for the object
380 * ManualReset = manual-reset or auto-reset if true you have to reset the state of the event manually
381 * using NtResetEvent/NtClearEvent. if false the system will reset the event to a non-signalled state
382 * automatically after the system has rescheduled a thread waiting on the event.
383 * InitialState = specifies the initial state of the event to be signaled ( TRUE ) or non-signalled (FALSE).
384 * REMARKS: This function maps to the win32 CreateEvent. Demanding a out variable of type HANDLE,
385 * a access mask and a OBJECT_ATTRIBUTES structure mapping to the SECURITY_ATTRIBUTES. ManualReset and InitialState are
386 * both parameters aswell ( possibly the order is reversed ).
387 * RETURNS: Status
388 */
389
390 NTSTATUS
391 STDCALL
392 NtCreateEvent(
393 OUT PHANDLE EventHandle,
394 IN ACCESS_MASK DesiredAccess,
395 IN POBJECT_ATTRIBUTES ObjectAttributes,
396 IN BOOLEAN ManualReset,
397 IN BOOLEAN InitialState
398 );
399
400 NTSTATUS
401 STDCALL
402 ZwCreateEvent(
403 OUT PHANDLE EventHandle,
404 IN ACCESS_MASK DesiredAccess,
405 IN POBJECT_ATTRIBUTES ObjectAttributes,
406 IN BOOLEAN ManualReset,
407 IN BOOLEAN InitialState
408 );
409
410 /*
411 * FUNCTION: Creates an eventpair object
412 * ARGUMENTS:
413 * EventPairHandle (OUT) = Caller supplied storage for the resulting handle
414 * DesiredAccess = Specifies access to the event
415 * ObjectAttribute = Initialized attributes for the object
416 */
417
418 NTSTATUS
419 STDCALL
420 NtCreateEventPair(
421 OUT PHANDLE EventPairHandle,
422 IN ACCESS_MASK DesiredAccess,
423 IN POBJECT_ATTRIBUTES ObjectAttributes
424 );
425
426 NTSTATUS
427 STDCALL
428 ZwCreateEventPair(
429 OUT PHANDLE EventPairHandle,
430 IN ACCESS_MASK DesiredAccess,
431 IN POBJECT_ATTRIBUTES ObjectAttributes
432 );
433
434
435 /*
436 * FUNCTION: Creates or opens a file, directory or device object.
437 * ARGUMENTS:
438 * FileHandle (OUT) = Caller supplied storage for the resulting handle
439 * DesiredAccess = Specifies the allowed or desired access to the file can
440 * be a combination of DELETE | FILE_READ_DATA ..
441 * ObjectAttribute = Initialized attributes for the object, contains the rootdirectory and the filename
442 * IoStatusBlock (OUT) = Caller supplied storage for the resulting status information, indicating if the
443 * the file is created and opened or allready existed and is just opened.
444 * FileAttributes = file attributes can be a combination of FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN ...
445 * ShareAccess = can be a combination of the following: FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
446 * CreateDisposition = specifies what the behavior of the system if the file allready exists.
447 * CreateOptions = specifies the behavior of the system on file creation.
448 * EaBuffer (OPTIONAL) = Extended Attributes buffer, applies only to files and directories.
449 * EaLength = Extended Attributes buffer size, applies only to files and directories.
450 * REMARKS: This function maps to the win32 CreateFile.
451 * RETURNS: Status
452 */
453
454 NTSTATUS
455 STDCALL
456 NtCreateFile(
457 OUT PHANDLE FileHandle,
458 IN ACCESS_MASK DesiredAccess,
459 IN POBJECT_ATTRIBUTES ObjectAttributes,
460 OUT PIO_STATUS_BLOCK IoStatusBlock,
461 IN PLARGE_INTEGER AllocationSize OPTIONAL,
462 IN ULONG FileAttributes,
463 IN ULONG ShareAccess,
464 IN ULONG CreateDisposition,
465 IN ULONG CreateOptions,
466 IN PVOID EaBuffer OPTIONAL,
467 IN ULONG EaLength
468 );
469
470 NTSTATUS
471 STDCALL
472 ZwCreateFile(
473 OUT PHANDLE FileHandle,
474 IN ACCESS_MASK DesiredAccess,
475 IN POBJECT_ATTRIBUTES ObjectAttributes,
476 OUT PIO_STATUS_BLOCK IoStatusBlock,
477 IN PLARGE_INTEGER AllocationSize OPTIONAL,
478 IN ULONG FileAttributes,
479 IN ULONG ShareAccess,
480 IN ULONG CreateDisposition,
481 IN ULONG CreateOptions,
482 IN PVOID EaBuffer OPTIONAL,
483 IN ULONG EaLength
484 );
485
486 /*
487 * FUNCTION: Creates or opens a file, directory or device object.
488 * ARGUMENTS:
489 * CompletionPort (OUT) = Caller supplied storage for the resulting handle
490 * DesiredAccess = Specifies the allowed or desired access to the port
491 * IoStatusBlock =
492 * NumberOfConcurrentThreads =
493 * REMARKS: This function maps to the win32 CreateIoCompletionPort
494 * RETURNS:
495 * Status
496 */
497
498 NTSTATUS
499 STDCALL
500 NtCreateIoCompletion(
501 OUT PHANDLE IoCompletionHandle,
502 IN ACCESS_MASK DesiredAccess,
503 IN POBJECT_ATTRIBUTES ObjectAttributes,
504 IN ULONG NumberOfConcurrentThreads
505 );
506
507 NTSTATUS
508 STDCALL
509 ZwCreateIoCompletion(
510 OUT PHANDLE IoCompletionHandle,
511 IN ACCESS_MASK DesiredAccess,
512 IN POBJECT_ATTRIBUTES ObjectAttributes,
513 IN ULONG NumberOfConcurrentThreads
514 );
515
516 /*
517 * FUNCTION: Creates a registry key
518 * ARGUMENTS:
519 * KeyHandle (OUT) = Caller supplied storage for the resulting handle
520 * DesiredAccess = Specifies the allowed or desired access to the key
521 * It can have a combination of the following values:
522 * KEY_READ | KEY_WRITE | KEY_EXECUTE | KEY_ALL_ACCESS
523 * or
524 * KEY_QUERY_VALUE The values of the key can be queried.
525 * KEY_SET_VALUE The values of the key can be modified.
526 * KEY_CREATE_SUB_KEYS The key may contain subkeys.
527 * KEY_ENUMERATE_SUB_KEYS Subkeys can be queried.
528 * KEY_NOTIFY
529 * KEY_CREATE_LINK A symbolic link to the key can be created.
530 * ObjectAttributes = The name of the key may be specified directly in the name field
531 * of object attributes or relative to a key in rootdirectory.
532 * TitleIndex = Might specify the position in the sequential order of subkeys.
533 * Class = Specifies the kind of data, for example REG_SZ for string data. [ ??? ]
534 * CreateOptions = Specifies additional options with which the key is created
535 * REG_OPTION_VOLATILE The key is not preserved across boots.
536 * REG_OPTION_NON_VOLATILE The key is preserved accross boots.
537 * REG_OPTION_CREATE_LINK The key is a symbolic link to another key.
538 * REG_OPTION_BACKUP_RESTORE Key is being opened or created for backup/restore operations.
539 * Disposition = Indicates if the call to NtCreateKey resulted in the creation of a key it
540 * can have the following values: REG_CREATED_NEW_KEY | REG_OPENED_EXISTING_KEY
541 * RETURNS:
542 * Status
543 */
544
545 NTSTATUS STDCALL
546 NtCreateKey(OUT PHANDLE KeyHandle,
547 IN ACCESS_MASK DesiredAccess,
548 IN POBJECT_ATTRIBUTES ObjectAttributes,
549 IN ULONG TitleIndex,
550 IN PUNICODE_STRING Class OPTIONAL,
551 IN ULONG CreateOptions,
552 IN PULONG Disposition OPTIONAL);
553
554 NTSTATUS STDCALL
555 ZwCreateKey(OUT PHANDLE KeyHandle,
556 IN ACCESS_MASK DesiredAccess,
557 IN POBJECT_ATTRIBUTES ObjectAttributes,
558 IN ULONG TitleIndex,
559 IN PUNICODE_STRING Class OPTIONAL,
560 IN ULONG CreateOptions,
561 IN PULONG Disposition OPTIONAL);
562
563 /*
564 * FUNCTION: Creates a mail slot file
565 * ARGUMENTS:
566 * MailSlotFileHandle (OUT) = Caller supplied storage for the resulting handle
567 * DesiredAccess = Specifies the allowed or desired access to the file
568 * ObjectAttributes = Contains the name of the mailslotfile.
569 * IoStatusBlock =
570 * FileAttributes =
571 * ShareAccess =
572 * MaxMessageSize =
573 * TimeOut =
574 *
575 * REMARKS: This funciton maps to the win32 function CreateMailSlot
576 * RETURNS:
577 * Status
578 */
579
580 NTSTATUS
581 STDCALL
582 NtCreateMailslotFile(
583 OUT PHANDLE MailSlotFileHandle,
584 IN ACCESS_MASK DesiredAccess,
585 IN POBJECT_ATTRIBUTES ObjectAttributes,
586 OUT PIO_STATUS_BLOCK IoStatusBlock,
587 IN ULONG FileAttributes,
588 IN ULONG ShareAccess,
589 IN ULONG MaxMessageSize,
590 IN PLARGE_INTEGER TimeOut
591 );
592
593 NTSTATUS
594 STDCALL
595 ZwCreateMailslotFile(
596 OUT PHANDLE MailSlotFileHandle,
597 IN ACCESS_MASK DesiredAccess,
598 IN POBJECT_ATTRIBUTES ObjectAttributes,
599 OUT PIO_STATUS_BLOCK IoStatusBlock,
600 IN ULONG FileAttributes,
601 IN ULONG ShareAccess,
602 IN ULONG MaxMessageSize,
603 IN PLARGE_INTEGER TimeOut
604 );
605
606 /*
607 * FUNCTION: Creates or opens a mutex
608 * ARGUMENTS:
609 * MutantHandle (OUT) = Caller supplied storage for the resulting handle
610 * DesiredAccess = Specifies the allowed or desired access to the port
611 * ObjectAttributes = Contains the name of the mutex.
612 * InitialOwner = If true the calling thread acquires ownership
613 * of the mutex.
614 * REMARKS: This funciton maps to the win32 function CreateMutex
615 * RETURNS:
616 * Status
617 */
618 NTSTATUS
619 STDCALL
620 NtCreateMutant(
621 OUT PHANDLE MutantHandle,
622 IN ACCESS_MASK DesiredAccess,
623 IN POBJECT_ATTRIBUTES ObjectAttributes,
624 IN BOOLEAN InitialOwner
625 );
626
627 NTSTATUS
628 STDCALL
629 ZwCreateMutant(
630 OUT PHANDLE MutantHandle,
631 IN ACCESS_MASK DesiredAccess,
632 IN POBJECT_ATTRIBUTES ObjectAttributes,
633 IN BOOLEAN InitialOwner
634 );
635
636 /*
637 * FUNCTION: Creates a process.
638 * ARGUMENTS:
639 * ProcessHandle (OUT) = Caller supplied storage for the resulting handle
640 * DesiredAccess = Specifies the allowed or desired access to the process can
641 * be a combinate of STANDARD_RIGHTS_REQUIRED| ..
642 * ObjectAttribute = Initialized attributes for the object, contains the rootdirectory and the filename
643 * ParentProcess = Handle to the parent process.
644 * InheritObjectTable = Specifies to inherit the objects of the parent process if true.
645 * SectionHandle = Handle to a section object to back the image file
646 * DebugPort = Handle to a DebugPort if NULL the system default debug port will be used.
647 * ExceptionPort = Handle to a exception port.
648 * REMARKS:
649 * This function maps to the win32 CreateProcess.
650 * RETURNS: Status
651 */
652 NTSTATUS
653 STDCALL
654 NtCreateProcess(
655 OUT PHANDLE ProcessHandle,
656 IN ACCESS_MASK DesiredAccess,
657 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
658 IN HANDLE ParentProcess,
659 IN BOOLEAN InheritObjectTable,
660 IN HANDLE SectionHandle OPTIONAL,
661 IN HANDLE DebugPort OPTIONAL,
662 IN HANDLE ExceptionPort OPTIONAL
663 );
664
665 NTSTATUS
666 STDCALL
667 ZwCreateProcess(
668 OUT PHANDLE ProcessHandle,
669 IN ACCESS_MASK DesiredAccess,
670 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
671 IN HANDLE ParentProcess,
672 IN BOOLEAN InheritObjectTable,
673 IN HANDLE SectionHandle OPTIONAL,
674 IN HANDLE DebugPort OPTIONAL,
675 IN HANDLE ExceptionPort OPTIONAL
676 );
677
678 /*
679 * FUNCTION: Creates a section object.
680 * ARGUMENTS:
681 * SectionHandle (OUT) = Caller supplied storage for the resulting handle
682 * DesiredAccess = Specifies the desired access to the section can be a combination of STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_WRITE |
683 * SECTION_MAP_READ | SECTION_MAP_EXECUTE.
684 * ObjectAttribute = Initialized attributes for the object can be used to create a named section
685 * MaxiumSize = Maximizes the size of the memory section. Must be non-NULL for a page-file backed section.
686 * If value specified for a mapped file and the file is not large enough, file will be extended.
687 * SectionPageProtection = Can be a combination of PAGE_READONLY | PAGE_READWRITE | PAGE_WRITEONLY | PAGE_WRITECOPY.
688 * AllocationAttributes = can be a combination of SEC_IMAGE | SEC_RESERVE
689 * FileHanlde = Handle to a file to create a section mapped to a file instead of a memory backed section.
690 * RETURNS: Status
691 */
692
693 NTSTATUS
694 STDCALL
695 NtCreateSection(
696 OUT PHANDLE SectionHandle,
697 IN ACCESS_MASK DesiredAccess,
698 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
699 IN PLARGE_INTEGER MaximumSize OPTIONAL,
700 IN ULONG SectionPageProtection OPTIONAL,
701 IN ULONG AllocationAttributes,
702 IN HANDLE FileHandle OPTIONAL
703 );
704
705 NTSTATUS
706 STDCALL
707 ZwCreateSection(
708 OUT PHANDLE SectionHandle,
709 IN ACCESS_MASK DesiredAccess,
710 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
711 IN PLARGE_INTEGER MaximumSize OPTIONAL,
712 IN ULONG SectionPageProtection OPTIONAL,
713 IN ULONG AllocationAttributes,
714 IN HANDLE FileHandle OPTIONAL
715 );
716
717 /*
718 * FUNCTION: Creates a semaphore object for interprocess synchronization.
719 * ARGUMENTS:
720 * SemaphoreHandle (OUT) = Caller supplied storage for the resulting handle
721 * DesiredAccess = Specifies the allowed or desired access to the semaphore.
722 * ObjectAttribute = Initialized attributes for the object.
723 * InitialCount = Not necessary zero, might be smaller than zero.
724 * MaximumCount = Maxiumum count the semaphore can reach.
725 * RETURNS: Status
726 * REMARKS:
727 * The semaphore is set to signaled when its count is greater than zero, and non-signaled when its count is zero.
728 */
729
730 //FIXME: should a semaphore's initial count allowed to be smaller than zero ??
731 NTSTATUS
732 STDCALL
733 NtCreateSemaphore(
734 OUT PHANDLE SemaphoreHandle,
735 IN ACCESS_MASK DesiredAccess,
736 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
737 IN LONG InitialCount,
738 IN LONG MaximumCount
739 );
740
741 NTSTATUS
742 STDCALL
743 ZwCreateSemaphore(
744 OUT PHANDLE SemaphoreHandle,
745 IN ACCESS_MASK DesiredAccess,
746 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
747 IN LONG InitialCount,
748 IN LONG MaximumCount
749 );
750
751 /*
752 * FUNCTION: Creates a symbolic link object
753 * ARGUMENTS:
754 * SymbolicLinkHandle (OUT) = Caller supplied storage for the resulting handle
755 * DesiredAccess = Specifies the allowed or desired access to the thread.
756 * ObjectAttributes = Initialized attributes for the object.
757 * Name = Target name of the symbolic link
758 * RETURNS: Status
759 */
760 NTSTATUS
761 STDCALL
762 NtCreateSymbolicLinkObject(
763 OUT PHANDLE SymbolicLinkHandle,
764 IN ACCESS_MASK DesiredAccess,
765 IN POBJECT_ATTRIBUTES ObjectAttributes,
766 IN PUNICODE_STRING Name
767 );
768
769 NTSTATUS
770 STDCALL
771 ZwCreateSymbolicLinkObject(
772 OUT PHANDLE SymbolicLinkHandle,
773 IN ACCESS_MASK DesiredAccess,
774 IN POBJECT_ATTRIBUTES ObjectAttributes,
775 IN PUNICODE_STRING Name
776 );
777
778 /*
779 * FUNCTION: Creates a waitable timer.
780 * ARGUMENTS:
781 * TimerHandle (OUT) = Caller supplied storage for the resulting handle
782 * DesiredAccess = Specifies the allowed or desired access to the timer.
783 * ObjectAttributes = Initialized attributes for the object.
784 * TimerType = Specifies if the timer should be reset manually.
785 * REMARKS:
786 * This function maps to the win32 CreateWaitableTimer. lpTimerAttributes and lpTimerName map to
787 * corresponding fields in OBJECT_ATTRIBUTES structure.
788 * RETURNS: Status
789 */
790 NTSTATUS
791 STDCALL
792 NtCreateTimer(
793 OUT PHANDLE TimerHandle,
794 IN ACCESS_MASK DesiredAccess,
795 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
796 IN TIMER_TYPE TimerType
797 );
798
799 NTSTATUS
800 STDCALL
801 ZwCreateTimer(
802 OUT PHANDLE TimerHandle,
803 IN ACCESS_MASK DesiredAccess,
804 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
805 IN TIMER_TYPE TimerType
806 );
807
808 /*
809 * FUNCTION: Creates a token.
810 * ARGUMENTS:
811 * TokenHandle (OUT) = Caller supplied storage for the resulting handle
812 * DesiredAccess = Specifies the allowed or desired access to the process can
813 * be a combinate of STANDARD_RIGHTS_REQUIRED| ..
814 * ObjectAttribute = Initialized attributes for the object, contains the rootdirectory and the filename
815 * TokenType =
816 * AuthenticationId =
817 * ExpirationTime =
818 * TokenUser =
819 * TokenGroups =
820 * TokenPrivileges =
821 * TokenOwner =
822 * TokenPrimaryGroup =
823 * TokenDefaultDacl =
824 * TokenSource =
825 * REMARKS:
826 * This function does not map to a win32 function
827 * RETURNS: Status
828 */
829
830 NTSTATUS
831 STDCALL
832 NtCreateToken(
833 OUT PHANDLE TokenHandle,
834 IN ACCESS_MASK DesiredAccess,
835 IN POBJECT_ATTRIBUTES ObjectAttributes,
836 IN TOKEN_TYPE TokenType,
837 IN PLUID AuthenticationId,
838 IN PLARGE_INTEGER ExpirationTime,
839 IN PTOKEN_USER TokenUser,
840 IN PTOKEN_GROUPS TokenGroups,
841 IN PTOKEN_PRIVILEGES TokenPrivileges,
842 IN PTOKEN_OWNER TokenOwner,
843 IN PTOKEN_PRIMARY_GROUP TokenPrimaryGroup,
844 IN PTOKEN_DEFAULT_DACL TokenDefaultDacl,
845 IN PTOKEN_SOURCE TokenSource
846 );
847
848 NTSTATUS
849 STDCALL
850 ZwCreateToken(
851 OUT PHANDLE TokenHandle,
852 IN ACCESS_MASK DesiredAccess,
853 IN POBJECT_ATTRIBUTES ObjectAttributes,
854 IN TOKEN_TYPE TokenType,
855 IN PLUID AuthenticationId,
856 IN PLARGE_INTEGER ExpirationTime,
857 IN PTOKEN_USER TokenUser,
858 IN PTOKEN_GROUPS TokenGroups,
859 IN PTOKEN_PRIVILEGES TokenPrivileges,
860 IN PTOKEN_OWNER TokenOwner,
861 IN PTOKEN_PRIMARY_GROUP TokenPrimaryGroup,
862 IN PTOKEN_DEFAULT_DACL TokenDefaultDacl,
863 IN PTOKEN_SOURCE TokenSource
864 );
865
866 /*
867 * FUNCTION: Returns the callers thread TEB.
868 * RETURNS: The resulting teb.
869 */
870 #if 0
871 NT_TEB *
872 STDCALL
873 NtCurrentTeb(VOID
874 );
875 #endif
876
877 /*
878 * FUNCTION: Deletes an atom from the global atom table
879 * ARGUMENTS:
880 * Atom = Identifies the atom to delete
881 * REMARKS:
882 * The function maps to the win32 GlobalDeleteAtom
883 * RETURNS: Status
884 */
885 NTSTATUS
886 STDCALL
887 NtDeleteAtom(
888 IN RTL_ATOM Atom
889 );
890
891 NTSTATUS
892 STDCALL
893 ZwDeleteAtom(
894 IN RTL_ATOM Atom
895 );
896
897 /*
898 * FUNCTION: Deletes a file or a directory
899 * ARGUMENTS:
900 * ObjectAttributes = Name of the file which should be deleted
901 * REMARKS:
902 * This system call is functionally equivalent to NtSetInformationFile
903 * setting the disposition information.
904 * The function maps to the win32 DeleteFile.
905 * RETURNS: Status
906 */
907 NTSTATUS
908 STDCALL
909 NtDeleteFile(
910 IN POBJECT_ATTRIBUTES ObjectAttributes
911 );
912
913 NTSTATUS
914 STDCALL
915 ZwDeleteFile(
916 IN POBJECT_ATTRIBUTES ObjectAttributes
917 );
918
919 /*
920 * FUNCTION: Deletes a registry key
921 * ARGUMENTS:
922 * KeyHandle = Handle of the key
923 * RETURNS: Status
924 */
925 NTSTATUS
926 STDCALL
927 NtDeleteKey(
928 IN HANDLE KeyHandle
929 );
930 NTSTATUS
931 STDCALL
932 ZwDeleteKey(
933 IN HANDLE KeyHandle
934 );
935
936 /*
937 * FUNCTION: Generates a audit message when an object is deleted
938 * ARGUMENTS:
939 * SubsystemName = Spefies the name of the subsystem can be 'WIN32' or 'DEBUG'
940 * HandleId= Handle to an audit object
941 * GenerateOnClose = Value returned by NtAccessCheckAndAuditAlarm
942 * REMARKS: This function maps to the win32 ObjectCloseAuditAlarm
943 * RETURNS: Status
944 */
945
946 NTSTATUS
947 STDCALL
948 NtDeleteObjectAuditAlarm (
949 IN PUNICODE_STRING SubsystemName,
950 IN PVOID HandleId,
951 IN BOOLEAN GenerateOnClose
952 );
953
954 NTSTATUS
955 STDCALL
956 ZwDeleteObjectAuditAlarm (
957 IN PUNICODE_STRING SubsystemName,
958 IN PVOID HandleId,
959 IN BOOLEAN GenerateOnClose
960 );
961
962
963 /*
964 * FUNCTION: Deletes a value from a registry key
965 * ARGUMENTS:
966 * KeyHandle = Handle of the key
967 * ValueName = Name of the value to delete
968 * RETURNS: Status
969 */
970
971 NTSTATUS
972 STDCALL
973 NtDeleteValueKey(
974 IN HANDLE KeyHandle,
975 IN PUNICODE_STRING ValueName
976 );
977
978 NTSTATUS
979 STDCALL
980 ZwDeleteValueKey(
981 IN HANDLE KeyHandle,
982 IN PUNICODE_STRING ValueName
983 );
984 /*
985 * FUNCTION: Sends IOCTL to the io sub system
986 * ARGUMENTS:
987 * DeviceHandle = Points to the handle that is created by NtCreateFile
988 * Event = Event to synchronize on STATUS_PENDING
989 * ApcRoutine = Asynchroneous procedure callback
990 * ApcContext = Callback context.
991 * IoStatusBlock = Caller should supply storage for extra information..
992 * IoControlCode = Contains the IO Control command. This is an
993 * index to the structures in InputBuffer and OutputBuffer.
994 * InputBuffer = Caller should supply storage for input buffer if IOTL expects one.
995 * InputBufferSize = Size of the input bufffer
996 * OutputBuffer = Caller should supply storage for output buffer if IOTL expects one.
997 * OutputBufferSize = Size of the input bufffer
998 * RETURNS: Status
999 */
1000
1001 NTSTATUS
1002 STDCALL
1003 NtDeviceIoControlFile(
1004 IN HANDLE DeviceHandle,
1005 IN HANDLE Event OPTIONAL,
1006 IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
1007 IN PVOID UserApcContext OPTIONAL,
1008 OUT PIO_STATUS_BLOCK IoStatusBlock,
1009 IN ULONG IoControlCode,
1010 IN PVOID InputBuffer,
1011 IN ULONG InputBufferSize,
1012 OUT PVOID OutputBuffer,
1013 IN ULONG OutputBufferSize
1014 );
1015
1016 NTSTATUS
1017 STDCALL
1018 ZwDeviceIoControlFile(
1019 IN HANDLE DeviceHandle,
1020 IN HANDLE Event OPTIONAL,
1021 IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
1022 IN PVOID UserApcContext OPTIONAL,
1023 OUT PIO_STATUS_BLOCK IoStatusBlock,
1024 IN ULONG IoControlCode,
1025 IN PVOID InputBuffer,
1026 IN ULONG InputBufferSize,
1027 OUT PVOID OutputBuffer,
1028 IN ULONG OutputBufferSize
1029 );
1030 /*
1031 * FUNCTION: Displays a string on the blue screen
1032 * ARGUMENTS:
1033 * DisplayString = The string to display
1034 * RETURNS: Status
1035 */
1036
1037 NTSTATUS
1038 STDCALL
1039 NtDisplayString(
1040 IN PUNICODE_STRING DisplayString
1041 );
1042
1043 NTSTATUS
1044 STDCALL
1045 ZwDisplayString(
1046 IN PUNICODE_STRING DisplayString
1047 );
1048
1049 /*
1050 * FUNCTION: Returns information about the subkeys of an open key
1051 * ARGUMENTS:
1052 * KeyHandle = Handle of the key whose subkeys are to enumerated
1053 * Index = zero based index of the subkey for which information is
1054 * request
1055 * KeyInformationClass = Type of information returned
1056 * KeyInformation (OUT) = Caller allocated buffer for the information
1057 * about the key
1058 * Length = Length in bytes of the KeyInformation buffer
1059 * ResultLength (OUT) = Caller allocated storage which holds
1060 * the number of bytes of information retrieved
1061 * on return
1062 * RETURNS: Status
1063 */
1064 NTSTATUS
1065 STDCALL
1066 NtEnumerateKey(
1067 IN HANDLE KeyHandle,
1068 IN ULONG Index,
1069 IN KEY_INFORMATION_CLASS KeyInformationClass,
1070 OUT PVOID KeyInformation,
1071 IN ULONG Length,
1072 OUT PULONG ResultLength
1073 );
1074
1075 NTSTATUS
1076 STDCALL
1077 ZwEnumerateKey(
1078 IN HANDLE KeyHandle,
1079 IN ULONG Index,
1080 IN KEY_INFORMATION_CLASS KeyInformationClass,
1081 OUT PVOID KeyInformation,
1082 IN ULONG Length,
1083 OUT PULONG ResultLength
1084 );
1085 /*
1086 * FUNCTION: Returns information about the value entries of an open key
1087 * ARGUMENTS:
1088 * KeyHandle = Handle of the key whose value entries are to enumerated
1089 * Index = zero based index of the subkey for which information is
1090 * request
1091 * KeyInformationClass = Type of information returned
1092 * KeyInformation (OUT) = Caller allocated buffer for the information
1093 * about the key
1094 * Length = Length in bytes of the KeyInformation buffer
1095 * ResultLength (OUT) = Caller allocated storage which holds
1096 * the number of bytes of information retrieved
1097 * on return
1098 * RETURNS: Status
1099 */
1100 NTSTATUS
1101 STDCALL
1102 NtEnumerateValueKey(
1103 IN HANDLE KeyHandle,
1104 IN ULONG Index,
1105 IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
1106 OUT PVOID KeyValueInformation,
1107 IN ULONG Length,
1108 OUT PULONG ResultLength
1109 );
1110
1111 NTSTATUS
1112 STDCALL
1113 ZwEnumerateValueKey(
1114 IN HANDLE KeyHandle,
1115 IN ULONG Index,
1116 IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
1117 OUT PVOID KeyValueInformation,
1118 IN ULONG Length,
1119 OUT PULONG ResultLength
1120 );
1121
1122 /*
1123 * FUNCTION: Flushes chached file data to disk
1124 * ARGUMENTS:
1125 * FileHandle = Points to the file
1126 * IoStatusBlock = Caller must supply storage to receive the result of the flush
1127 * buffers operation. The information field is set to number of bytes
1128 * flushed to disk.
1129 * RETURNS: Status
1130 * REMARKS:
1131 * This funciton maps to the win32 FlushFileBuffers
1132 */
1133 NTSTATUS
1134 STDCALL
1135 NtFlushBuffersFile(
1136 IN HANDLE FileHandle,
1137 OUT PIO_STATUS_BLOCK IoStatusBlock
1138 );
1139
1140 NTSTATUS
1141 STDCALL
1142 ZwFlushBuffersFile(
1143 IN HANDLE FileHandle,
1144 OUT PIO_STATUS_BLOCK IoStatusBlock
1145 );
1146
1147 /*
1148 * FUNCTION: Flushes a registry key to disk
1149 * ARGUMENTS:
1150 * KeyHandle = Points to the registry key handle
1151 * RETURNS: Status
1152 * REMARKS:
1153 * This funciton maps to the win32 RegFlushKey.
1154 */
1155 NTSTATUS
1156 STDCALL
1157 NtFlushKey(
1158 IN HANDLE KeyHandle
1159 );
1160
1161 NTSTATUS
1162 STDCALL
1163 ZwFlushKey(
1164 IN HANDLE KeyHandle
1165 );
1166
1167 /*
1168 * FUNCTION: Flushes the dirty pages to file
1169 * RETURNS: Status
1170 * FIXME: Not sure this does (how is the file specified)
1171 */
1172 NTSTATUS STDCALL NtFlushWriteBuffer(VOID);
1173 NTSTATUS STDCALL ZwFlushWriteBuffer(VOID);
1174
1175 /*
1176 * FUNCTION: Frees a range of virtual memory
1177 * ARGUMENTS:
1178 * ProcessHandle = Points to the process that allocated the virtual
1179 * memory
1180 * BaseAddress = Points to the memory address, rounded down to a
1181 * multiple of the pagesize
1182 * RegionSize = Limits the range to free, rounded up to a multiple of
1183 * the paging size
1184 * FreeType = Can be one of the values: MEM_DECOMMIT, or MEM_RELEASE
1185 * RETURNS: Status
1186 */
1187 NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
1188 IN PVOID *BaseAddress,
1189 IN PULONG RegionSize,
1190 IN ULONG FreeType);
1191 NTSTATUS STDCALL ZwFreeVirtualMemory(IN HANDLE ProcessHandle,
1192 IN PVOID *BaseAddress,
1193 IN PULONG RegionSize,
1194 IN ULONG FreeType);
1195
1196 /*
1197 * FUNCTION: Sends FSCTL to the filesystem
1198 * ARGUMENTS:
1199 * DeviceHandle = Points to the handle that is created by NtCreateFile
1200 * Event = Event to synchronize on STATUS_PENDING
1201 * ApcRoutine =
1202 * ApcContext =
1203 * IoStatusBlock = Caller should supply storage for
1204 * IoControlCode = Contains the File System Control command. This is an
1205 * index to the structures in InputBuffer and OutputBuffer.
1206 * FSCTL_GET_RETRIEVAL_POINTERS MAPPING_PAIR
1207 * FSCTL_GET_RETRIEVAL_POINTERS GET_RETRIEVAL_DESCRIPTOR
1208 * FSCTL_GET_VOLUME_BITMAP BITMAP_DESCRIPTOR
1209 * FSCTL_MOVE_FILE MOVEFILE_DESCRIPTOR
1210 *
1211 * InputBuffer = Caller should supply storage for input buffer if FCTL expects one.
1212 * InputBufferSize = Size of the input bufffer
1213 * OutputBuffer = Caller should supply storage for output buffer if FCTL expects one.
1214 * OutputBufferSize = Size of the input bufffer
1215 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PENDING | STATUS_ACCESS_DENIED | STATUS_INSUFFICIENT_RESOURCES |
1216 * STATUS_INVALID_PARAMETER | STATUS_INVALID_DEVICE_REQUEST ]
1217 */
1218 NTSTATUS
1219 STDCALL
1220 NtFsControlFile(
1221 IN HANDLE DeviceHandle,
1222 IN HANDLE Event OPTIONAL,
1223 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1224 IN PVOID ApcContext OPTIONAL,
1225 OUT PIO_STATUS_BLOCK IoStatusBlock,
1226 IN ULONG IoControlCode,
1227 IN PVOID InputBuffer,
1228 IN ULONG InputBufferSize,
1229 OUT PVOID OutputBuffer,
1230 IN ULONG OutputBufferSize
1231 );
1232
1233 NTSTATUS
1234 STDCALL
1235 ZwFsControlFile(
1236 IN HANDLE DeviceHandle,
1237 IN HANDLE Event OPTIONAL,
1238 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1239 IN PVOID ApcContext OPTIONAL,
1240 OUT PIO_STATUS_BLOCK IoStatusBlock,
1241 IN ULONG IoControlCode,
1242 IN PVOID InputBuffer,
1243 IN ULONG InputBufferSize,
1244 OUT PVOID OutputBuffer,
1245 IN ULONG OutputBufferSize
1246 );
1247
1248 /*
1249 * FUNCTION: Retrieves the processor context of a thread
1250 * ARGUMENTS:
1251 * ThreadHandle = Handle to a thread
1252 * Context (OUT) = Caller allocated storage for the processor context
1253 * RETURNS: Status
1254 */
1255
1256 NTSTATUS
1257 STDCALL
1258 NtGetContextThread(
1259 IN HANDLE ThreadHandle,
1260 OUT PCONTEXT Context
1261 );
1262
1263 NTSTATUS
1264 STDCALL
1265 ZwGetContextThread(
1266 IN HANDLE ThreadHandle,
1267 OUT PCONTEXT Context
1268 );
1269
1270 /*
1271 * FUNCTION: Sets a thread to impersonate another
1272 * ARGUMENTS:
1273 * ThreadHandle = Server thread that will impersonate a client.
1274 ThreadToImpersonate = Client thread that will be impersonated
1275 SecurityQualityOfService = Specifies the impersonation level.
1276 * RETURNS: Status
1277 */
1278
1279 NTSTATUS
1280 STDCALL
1281 NtImpersonateThread(
1282 IN HANDLE ThreadHandle,
1283 IN HANDLE ThreadToImpersonate,
1284 IN PSECURITY_QUALITY_OF_SERVICE SecurityQualityOfService
1285 );
1286
1287 NTSTATUS
1288 STDCALL
1289 ZwImpersonateThread(
1290 IN HANDLE ThreadHandle,
1291 IN HANDLE ThreadToImpersonate,
1292 IN PSECURITY_QUALITY_OF_SERVICE SecurityQualityOfService
1293 );
1294
1295 /*
1296 * FUNCTION: Initializes the registry.
1297 * ARGUMENTS:
1298 * SetUpBoot = This parameter is true for a setup boot.
1299 * RETURNS: Status
1300 */
1301 NTSTATUS
1302 STDCALL
1303 NtInitializeRegistry(
1304 BOOLEAN SetUpBoot
1305 );
1306 NTSTATUS
1307 STDCALL
1308 ZwInitializeRegistry(
1309 BOOLEAN SetUpBoot
1310 );
1311
1312 /*
1313 * FUNCTION: Loads a driver.
1314 * ARGUMENTS:
1315 * DriverServiceName = Name of the driver to load
1316 * RETURNS: Status
1317 */
1318 NTSTATUS
1319 STDCALL
1320 NtLoadDriver(
1321 IN PUNICODE_STRING DriverServiceName
1322 );
1323
1324 NTSTATUS
1325 STDCALL
1326 ZwLoadDriver(
1327 IN PUNICODE_STRING DriverServiceName
1328 );
1329
1330 /*
1331 * FUNCTION: Locks a range of bytes in a file.
1332 * ARGUMENTS:
1333 * FileHandle = Handle to the file
1334 * Event = Should be null if apc is specified.
1335 * ApcRoutine = Asynchroneous Procedure Callback
1336 * ApcContext = Argument to the callback
1337 * IoStatusBlock (OUT) = Caller should supply storage for a structure containing
1338 * the completion status and information about the requested lock operation.
1339 * ByteOffset = Offset
1340 * Length = Number of bytes to lock.
1341 * Key = Special value to give other threads the possibility to unlock the file
1342 by supplying the key in a call to NtUnlockFile.
1343 * FailImmediatedly = If false the request will block untill the lock is obtained.
1344 * ExclusiveLock = Specifies whether a exclusive or a shared lock is obtained.
1345 * REMARK:
1346 This procedure maps to the win32 procedure LockFileEx. STATUS_PENDING is returned if the lock could
1347 not be obtained immediately, the device queue is busy and the IRP is queued.
1348 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PENDING | STATUS_ACCESS_DENIED | STATUS_INSUFFICIENT_RESOURCES |
1349 STATUS_INVALID_PARAMETER | STATUS_INVALID_DEVICE_REQUEST | STATUS_LOCK_NOT_GRANTED ]
1350
1351 */
1352 NTSTATUS
1353 STDCALL
1354 NtLockFile(
1355 IN HANDLE FileHandle,
1356 IN HANDLE Event OPTIONAL,
1357 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1358 IN PVOID ApcContext OPTIONAL,
1359 OUT PIO_STATUS_BLOCK IoStatusBlock,
1360 IN PLARGE_INTEGER ByteOffset,
1361 IN PLARGE_INTEGER Length,
1362 IN PULONG Key,
1363 IN BOOLEAN FailImmediatedly,
1364 IN BOOLEAN ExclusiveLock
1365 );
1366
1367 NTSTATUS
1368 STDCALL
1369 ZwLockFile(
1370 IN HANDLE FileHandle,
1371 IN HANDLE Event OPTIONAL,
1372 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1373 IN PVOID ApcContext OPTIONAL,
1374 OUT PIO_STATUS_BLOCK IoStatusBlock,
1375 IN PLARGE_INTEGER ByteOffset,
1376 IN PLARGE_INTEGER Length,
1377 IN PULONG Key,
1378 IN BOOLEAN FailImmediatedly,
1379 IN BOOLEAN ExclusiveLock
1380 );
1381
1382 /*
1383 * FUNCTION: Makes temporary object that will be removed at next boot.
1384 * ARGUMENTS:
1385 * Handle = Handle to object
1386 * RETURNS: Status
1387 */
1388
1389 NTSTATUS
1390 STDCALL
1391 NtMakeTemporaryObject(
1392 IN HANDLE Handle
1393 );
1394
1395 NTSTATUS
1396 STDCALL
1397 ZwMakeTemporaryObject(
1398 IN HANDLE Handle
1399 );
1400 /*
1401 * FUNCTION: Maps a view of a section into the virtual address space of a
1402 * process
1403 * ARGUMENTS:
1404 * SectionHandle = Handle of the section
1405 * ProcessHandle = Handle of the process
1406 * BaseAddress = Desired base address (or NULL) on entry
1407 * Actual base address of the view on exit
1408 * ZeroBits = Number of high order address bits that must be zero
1409 * CommitSize = Size in bytes of the initially committed section of
1410 * the view
1411 * SectionOffset = Offset in bytes from the beginning of the section
1412 * to the beginning of the view
1413 * ViewSize = Desired length of map (or zero to map all) on entry
1414 * Actual length mapped on exit
1415 * InheritDisposition = Specified how the view is to be shared with
1416 * child processes
1417 * AllocateType = Type of allocation for the pages
1418 * Protect = Protection for the committed region of the view
1419 * RETURNS: Status
1420 */
1421 NTSTATUS
1422 STDCALL
1423 NtMapViewOfSection(
1424 IN HANDLE SectionHandle,
1425 IN HANDLE ProcessHandle,
1426 IN OUT PVOID *BaseAddress,
1427 IN ULONG ZeroBits,
1428 IN ULONG CommitSize,
1429 IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
1430 IN OUT PULONG ViewSize,
1431 IN SECTION_INHERIT InheritDisposition,
1432 IN ULONG AllocationType,
1433 IN ULONG AccessProtection
1434 );
1435
1436 NTSTATUS
1437 STDCALL
1438 ZwMapViewOfSection(
1439 IN HANDLE SectionHandle,
1440 IN HANDLE ProcessHandle,
1441 IN OUT PVOID *BaseAddress,
1442 IN ULONG ZeroBits,
1443 IN ULONG CommitSize,
1444 IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
1445 IN OUT PULONG ViewSize,
1446 IN SECTION_INHERIT InheritDisposition,
1447 IN ULONG AllocationType,
1448 IN ULONG AccessProtection
1449 );
1450
1451 /*
1452 * FUNCTION: Installs a notify for the change of a directory's contents
1453 * ARGUMENTS:
1454 * FileHandle = Handle to the directory
1455 Event =
1456 * ApcRoutine = Start address
1457 * ApcContext = Delimits the range of virtual memory
1458 * for which the new access protection holds
1459 * IoStatusBlock = The new access proctection for the pages
1460 * Buffer = Caller supplies storage for resulting information --> FILE_NOTIFY_INFORMATION
1461 * BufferSize = Size of the buffer
1462 CompletionFilter = Can be one of the following values:
1463 FILE_NOTIFY_CHANGE_FILE_NAME
1464 FILE_NOTIFY_CHANGE_DIR_NAME
1465 FILE_NOTIFY_CHANGE_NAME ( FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME )
1466 FILE_NOTIFY_CHANGE_ATTRIBUTES
1467 FILE_NOTIFY_CHANGE_SIZE
1468 FILE_NOTIFY_CHANGE_LAST_WRITE
1469 FILE_NOTIFY_CHANGE_LAST_ACCESS
1470 FILE_NOTIFY_CHANGE_CREATION ( change of creation timestamp )
1471 FILE_NOTIFY_CHANGE_EA
1472 FILE_NOTIFY_CHANGE_SECURITY
1473 FILE_NOTIFY_CHANGE_STREAM_NAME
1474 FILE_NOTIFY_CHANGE_STREAM_SIZE
1475 FILE_NOTIFY_CHANGE_STREAM_WRITE
1476 WatchTree = If true the notify will be installed recursively on the targetdirectory and all subdirectories.
1477 *
1478 * REMARKS:
1479 * The function maps to the win32 FindFirstChangeNotification, FindNextChangeNotification
1480 * RETURNS: Status
1481 */
1482 NTSTATUS
1483 STDCALL
1484 NtNotifyChangeDirectoryFile(
1485 IN HANDLE FileHandle,
1486 IN HANDLE Event OPTIONAL,
1487 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1488 IN PVOID ApcContext OPTIONAL,
1489 OUT PIO_STATUS_BLOCK IoStatusBlock,
1490 OUT PVOID Buffer,
1491 IN ULONG BufferSize,
1492 IN ULONG CompletionFilter,
1493 IN BOOLEAN WatchTree
1494 );
1495
1496 NTSTATUS
1497 STDCALL
1498 ZwNotifyChangeDirectoryFile(
1499 IN HANDLE FileHandle,
1500 IN HANDLE Event OPTIONAL,
1501 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1502 IN PVOID ApcContext OPTIONAL,
1503 OUT PIO_STATUS_BLOCK IoStatusBlock,
1504 OUT PVOID Buffer,
1505 IN ULONG BufferSize,
1506 IN ULONG CompletionFilter,
1507 IN BOOLEAN WatchTree
1508 );
1509
1510 /*
1511 * FUNCTION: Installs a notfication callback on registry changes
1512 * ARGUMENTS:
1513 KeyHandle = Handle to the registry key
1514 Event = Event that should be signalled on modification of the key
1515 ApcRoutine = Routine that should be called on modification of the key
1516 ApcContext = Argument to the ApcRoutine
1517 IoStatusBlock = ???
1518 CompletionFilter = Specifies the kind of notification the caller likes to receive.
1519 Can be a combination of the following values:
1520
1521 REG_NOTIFY_CHANGE_NAME
1522 REG_NOTIFY_CHANGE_ATTRIBUTES
1523 REG_NOTIFY_CHANGE_LAST_SET
1524 REG_NOTIFY_CHANGE_SECURITY
1525
1526
1527 Asynchroneous = If TRUE the changes are reported by signalling an event if false
1528 the function will not return before a change occurs.
1529 ChangeBuffer = Will return the old value
1530 Length = Size of the change buffer
1531 WatchSubtree = Indicates if the caller likes to receive a notification of changes in
1532 sub keys or not.
1533 * REMARKS: If the key is closed the event is signalled aswell.
1534 * RETURNS: Status
1535 */
1536
1537 NTSTATUS
1538 STDCALL
1539 NtNotifyChangeKey(
1540 IN HANDLE KeyHandle,
1541 IN HANDLE Event,
1542 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1543 IN PVOID ApcContext OPTIONAL,
1544 OUT PIO_STATUS_BLOCK IoStatusBlock,
1545 IN ULONG CompletionFilter,
1546 IN BOOLEAN Asynchroneous,
1547 OUT PVOID ChangeBuffer,
1548 IN ULONG Length,
1549 IN BOOLEAN WatchSubtree
1550 );
1551
1552 NTSTATUS
1553 STDCALL
1554 ZwNotifyChangeKey(
1555 IN HANDLE KeyHandle,
1556 IN HANDLE Event,
1557 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
1558 IN PVOID ApcContext OPTIONAL,
1559 OUT PIO_STATUS_BLOCK IoStatusBlock,
1560 IN ULONG CompletionFilter,
1561 IN BOOLEAN Asynchroneous,
1562 OUT PVOID ChangeBuffer,
1563 IN ULONG Length,
1564 IN BOOLEAN WatchSubtree
1565 );
1566
1567 /*
1568 * FUNCTION: Opens an existing directory object
1569 * ARGUMENTS:
1570 * FileHandle (OUT) = Caller supplied storage for the resulting handle
1571 * DesiredAccess = Requested access to the directory
1572 * ObjectAttributes = Initialized attributes for the object
1573 * RETURNS: Status
1574 */
1575
1576 NTSTATUS
1577 STDCALL
1578 NtOpenDirectoryObject(
1579 OUT PHANDLE FileHandle,
1580 IN ACCESS_MASK DesiredAccess,
1581 IN POBJECT_ATTRIBUTES ObjectAttributes
1582 );
1583 NTSTATUS
1584 STDCALL
1585 ZwOpenDirectoryObject(
1586 OUT PHANDLE FileHandle,
1587 IN ACCESS_MASK DesiredAccess,
1588 IN POBJECT_ATTRIBUTES ObjectAttributes
1589 );
1590
1591 /*
1592 * FUNCTION: Opens an existing event
1593 * ARGUMENTS:
1594 * EventHandle (OUT) = Caller supplied storage for the resulting handle
1595 * DesiredAccess = Requested access to the event
1596 * ObjectAttributes = Initialized attributes for the object
1597 * RETURNS: Status
1598 */
1599 NTSTATUS
1600 STDCALL
1601 NtOpenEvent(
1602 OUT PHANDLE EventHandle,
1603 IN ACCESS_MASK DesiredAccess,
1604 IN POBJECT_ATTRIBUTES ObjectAttributes
1605 );
1606
1607 NTSTATUS
1608 STDCALL
1609 ZwOpenEvent(
1610 OUT PHANDLE EventHandle,
1611 IN ACCESS_MASK DesiredAccess,
1612 IN POBJECT_ATTRIBUTES ObjectAttributes
1613 );
1614
1615 /*
1616 * FUNCTION: Opens an existing event pair
1617 * ARGUMENTS:
1618 * EventHandle (OUT) = Caller supplied storage for the resulting handle
1619 * DesiredAccess = Requested access to the event
1620 * ObjectAttributes = Initialized attributes for the object
1621 * RETURNS: Status
1622 */
1623
1624 NTSTATUS
1625 STDCALL
1626 NtOpenEventPair(
1627 OUT PHANDLE EventPairHandle,
1628 IN ACCESS_MASK DesiredAccess,
1629 IN POBJECT_ATTRIBUTES ObjectAttributes
1630 );
1631
1632 NTSTATUS
1633 STDCALL
1634 ZwOpenEventPair(
1635 OUT PHANDLE EventPairHandle,
1636 IN ACCESS_MASK DesiredAccess,
1637 IN POBJECT_ATTRIBUTES ObjectAttributes
1638 );
1639 /*
1640 * FUNCTION: Opens an existing file
1641 * ARGUMENTS:
1642 * FileHandle (OUT) = Caller supplied storage for the resulting handle
1643 * DesiredAccess = Requested access to the file
1644 * ObjectAttributes = Initialized attributes for the object
1645 * IoStatusBlock =
1646 * ShareAccess =
1647 * OpenOptions =
1648 * RETURNS: Status
1649 */
1650 NTSTATUS
1651 STDCALL
1652 NtOpenFile(
1653 OUT PHANDLE FileHandle,
1654 IN ACCESS_MASK DesiredAccess,
1655 IN POBJECT_ATTRIBUTES ObjectAttributes,
1656 OUT PIO_STATUS_BLOCK IoStatusBlock,
1657 IN ULONG ShareAccess,
1658 IN ULONG OpenOptions
1659 );
1660
1661 NTSTATUS
1662 STDCALL
1663 ZwOpenFile(
1664 OUT PHANDLE FileHandle,
1665 IN ACCESS_MASK DesiredAccess,
1666 IN POBJECT_ATTRIBUTES ObjectAttributes,
1667 OUT PIO_STATUS_BLOCK IoStatusBlock,
1668 IN ULONG ShareAccess,
1669 IN ULONG OpenOptions
1670 );
1671
1672 /*
1673 * FUNCTION: Opens an existing io completion object
1674 * ARGUMENTS:
1675 * CompletionPort (OUT) = Caller supplied storage for the resulting handle
1676 * DesiredAccess = Requested access to the io completion object
1677 * ObjectAttributes = Initialized attributes for the object
1678 * RETURNS: Status
1679 */
1680
1681 NTSTATUS
1682 STDCALL
1683 NtOpenIoCompletion(
1684 OUT PHANDLE CompetionPort,
1685 IN ACCESS_MASK DesiredAccess,
1686 IN POBJECT_ATTRIBUTES ObjectAttributes
1687 );
1688
1689 NTSTATUS
1690 STDCALL
1691 ZwOpenIoCompletion(
1692 OUT PHANDLE CompetionPort,
1693 IN ACCESS_MASK DesiredAccess,
1694 IN POBJECT_ATTRIBUTES ObjectAttributes
1695 );
1696
1697 /*
1698 * FUNCTION: Opens an existing key in the registry
1699 * ARGUMENTS:
1700 * KeyHandle (OUT) = Caller supplied storage for the resulting handle
1701 * DesiredAccess = Requested access to the key
1702 * ObjectAttributes = Initialized attributes for the object
1703 * RETURNS: Status
1704 */
1705 NTSTATUS
1706 STDCALL
1707 NtOpenKey(
1708 OUT PHANDLE KeyHandle,
1709 IN ACCESS_MASK DesiredAccess,
1710 IN POBJECT_ATTRIBUTES ObjectAttributes
1711 );
1712
1713 NTSTATUS
1714 STDCALL
1715 ZwOpenKey(
1716 OUT PHANDLE KeyHandle,
1717 IN ACCESS_MASK DesiredAccess,
1718 IN POBJECT_ATTRIBUTES ObjectAttributes
1719 );
1720 /*
1721 * FUNCTION: Opens an existing key in the registry
1722 * ARGUMENTS:
1723 * MutantHandle (OUT) = Caller supplied storage for the resulting handle
1724 * DesiredAccess = Requested access to the mutant
1725 * ObjectAttribute = Initialized attributes for the object
1726 * RETURNS: Status
1727 */
1728 NTSTATUS
1729 STDCALL
1730 NtOpenMutant(
1731 OUT PHANDLE MutantHandle,
1732 IN ACCESS_MASK DesiredAccess,
1733 IN POBJECT_ATTRIBUTES ObjectAttributes
1734 );
1735 NTSTATUS
1736 STDCALL
1737 ZwOpenMutant(
1738 OUT PHANDLE MutantHandle,
1739 IN ACCESS_MASK DesiredAccess,
1740 IN POBJECT_ATTRIBUTES ObjectAttributes
1741 );
1742
1743 /*
1744 * FUNCTION: Opens an existing process
1745 * ARGUMENTS:
1746 * ProcessHandle (OUT) = Caller supplied storage for the resulting handle
1747 * DesiredAccess = Requested access to the process
1748 * ObjectAttribute = Initialized attributes for the object
1749 * ClientId = Identifies the process id to open
1750 * RETURNS: Status
1751 */
1752 NTSTATUS
1753 STDCALL
1754 NtOpenProcess (
1755 OUT PHANDLE ProcessHandle,
1756 IN ACCESS_MASK DesiredAccess,
1757 IN POBJECT_ATTRIBUTES ObjectAttributes,
1758 IN PCLIENT_ID ClientId
1759 );
1760 NTSTATUS
1761 STDCALL
1762 ZwOpenProcess (
1763 OUT PHANDLE ProcessHandle,
1764 IN ACCESS_MASK DesiredAccess,
1765 IN POBJECT_ATTRIBUTES ObjectAttributes,
1766 IN PCLIENT_ID ClientId
1767 );
1768 /*
1769 * FUNCTION: Opens an existing process
1770 * ARGUMENTS:
1771 * ProcessHandle = Handle of the process of which owns the token
1772 * DesiredAccess = Requested access to the token
1773 * TokenHandle (OUT) = Caller supplies storage for the resulting token.
1774 * REMARKS:
1775 This function maps to the win32
1776 * RETURNS: Status
1777 */
1778
1779 NTSTATUS
1780 STDCALL
1781 NtOpenProcessToken(
1782 IN HANDLE ProcessHandle,
1783 IN ACCESS_MASK DesiredAccess,
1784 OUT PHANDLE TokenHandle
1785 );
1786
1787 NTSTATUS
1788 STDCALL
1789 ZwOpenProcessToken(
1790 IN HANDLE ProcessHandle,
1791 IN ACCESS_MASK DesiredAccess,
1792 OUT PHANDLE TokenHandle
1793 );
1794
1795 /*
1796 * FUNCTION: Opens an existing section object
1797 * ARGUMENTS:
1798 * KeyHandle (OUT) = Caller supplied storage for the resulting handle
1799 * DesiredAccess = Requested access to the key
1800 * ObjectAttribute = Initialized attributes for the object
1801 * RETURNS: Status
1802 */
1803
1804 NTSTATUS
1805 STDCALL
1806 NtOpenSection(
1807 OUT PHANDLE SectionHandle,
1808 IN ACCESS_MASK DesiredAccess,
1809 IN POBJECT_ATTRIBUTES ObjectAttributes
1810 );
1811 NTSTATUS
1812 STDCALL
1813 ZwOpenSection(
1814 OUT PHANDLE SectionHandle,
1815 IN ACCESS_MASK DesiredAccess,
1816 IN POBJECT_ATTRIBUTES ObjectAttributes
1817 );
1818 /*
1819 * FUNCTION: Opens an existing semaphore
1820 * ARGUMENTS:
1821 * SemaphoreHandle (OUT) = Caller supplied storage for the resulting handle
1822 * DesiredAccess = Requested access to the semaphore
1823 * ObjectAttribute = Initialized attributes for the object
1824 * RETURNS: Status
1825 */
1826 NTSTATUS
1827 STDCALL
1828 NtOpenSemaphore(
1829 IN HANDLE SemaphoreHandle,
1830 IN ACCESS_MASK DesiredAcces,
1831 IN POBJECT_ATTRIBUTES ObjectAttributes
1832 );
1833 NTSTATUS
1834 STDCALL
1835 ZwOpenSemaphore(
1836 IN HANDLE SemaphoreHandle,
1837 IN ACCESS_MASK DesiredAcces,
1838 IN POBJECT_ATTRIBUTES ObjectAttributes
1839 );
1840 /*
1841 * FUNCTION: Opens an existing symbolic link
1842 * ARGUMENTS:
1843 * SymbolicLinkHandle (OUT) = Caller supplied storage for the resulting handle
1844 * DesiredAccess = Requested access to the symbolic link
1845 * ObjectAttribute = Initialized attributes for the object
1846 * RETURNS: Status
1847 */
1848 NTSTATUS
1849 STDCALL
1850 NtOpenSymbolicLinkObject(
1851 OUT PHANDLE SymbolicLinkHandle,
1852 IN ACCESS_MASK DesiredAccess,
1853 IN POBJECT_ATTRIBUTES ObjectAttributes
1854 );
1855 NTSTATUS
1856 STDCALL
1857 ZwOpenSymbolicLinkObject(
1858 OUT PHANDLE SymbolicLinkHandle,
1859 IN ACCESS_MASK DesiredAccess,
1860 IN POBJECT_ATTRIBUTES ObjectAttributes
1861 );
1862 /*
1863 * FUNCTION: Opens an existing thread
1864 * ARGUMENTS:
1865 * ThreadHandle (OUT) = Caller supplied storage for the resulting handle
1866 * DesiredAccess = Requested access to the thread
1867 * ObjectAttribute = Initialized attributes for the object
1868 * ClientId = Identifies the thread to open.
1869 * RETURNS: Status
1870 */
1871 NTSTATUS
1872 STDCALL
1873 NtOpenThread(
1874 OUT PHANDLE ThreadHandle,
1875 IN ACCESS_MASK DesiredAccess,
1876 IN POBJECT_ATTRIBUTES ObjectAttributes,
1877 IN PCLIENT_ID ClientId
1878 );
1879 NTSTATUS
1880 STDCALL
1881 ZwOpenThread(
1882 OUT PHANDLE ThreadHandle,
1883 IN ACCESS_MASK DesiredAccess,
1884 IN POBJECT_ATTRIBUTES ObjectAttributes,
1885 IN PCLIENT_ID ClientId
1886 );
1887
1888 NTSTATUS
1889 STDCALL
1890 NtOpenThreadToken(
1891 IN HANDLE ThreadHandle,
1892 IN ACCESS_MASK DesiredAccess,
1893 IN BOOLEAN OpenAsSelf,
1894 OUT PHANDLE TokenHandle
1895 );
1896
1897 NTSTATUS
1898 STDCALL
1899 ZwOpenThreadToken(
1900 IN HANDLE ThreadHandle,
1901 IN ACCESS_MASK DesiredAccess,
1902 IN BOOLEAN OpenAsSelf,
1903 OUT PHANDLE TokenHandle
1904 );
1905 /*
1906 * FUNCTION: Opens an existing timer
1907 * ARGUMENTS:
1908 * TimerHandle (OUT) = Caller supplied storage for the resulting handle
1909 * DesiredAccess = Requested access to the timer
1910 * ObjectAttribute = Initialized attributes for the object
1911 * RETURNS: Status
1912 */
1913 NTSTATUS
1914 STDCALL
1915 NtOpenTimer(
1916 OUT PHANDLE TimerHandle,
1917 IN ACCESS_MASK DesiredAccess,
1918 IN POBJECT_ATTRIBUTES ObjectAttributes
1919 );
1920 NTSTATUS
1921 STDCALL
1922 ZwOpenTimer(
1923 OUT PHANDLE TimerHandle,
1924 IN ACCESS_MASK DesiredAccess,
1925 IN POBJECT_ATTRIBUTES ObjectAttributes
1926 );
1927
1928 /*
1929 * FUNCTION: Checks an access token for specific privileges
1930 * ARGUMENTS:
1931 * ClientToken = Handle to a access token structure
1932 * RequiredPrivileges = Specifies the requested privileges.
1933 * Result = Caller supplies storage for the result. If PRIVILEGE_SET_ALL_NECESSARY is
1934 set in the Control member of PRIVILEGES_SET Result
1935 will only be TRUE if all privileges are present in the access token.
1936 * RETURNS: Status
1937 */
1938
1939 NTSTATUS
1940 STDCALL
1941 NtPrivilegeCheck(
1942 IN HANDLE ClientToken,
1943 IN PPRIVILEGE_SET RequiredPrivileges,
1944 IN PBOOLEAN Result
1945 );
1946
1947 NTSTATUS
1948 STDCALL
1949 ZwPrivilegeCheck(
1950 IN HANDLE ClientToken,
1951 IN PPRIVILEGE_SET RequiredPrivileges,
1952 IN PBOOLEAN Result
1953 );
1954
1955 NTSTATUS
1956 STDCALL
1957 NtPrivilegedServiceAuditAlarm(
1958 IN PUNICODE_STRING SubsystemName,
1959 IN PUNICODE_STRING ServiceName,
1960 IN HANDLE ClientToken,
1961 IN PPRIVILEGE_SET Privileges,
1962 IN BOOLEAN AccessGranted
1963 );
1964
1965 NTSTATUS
1966 STDCALL
1967 ZwPrivilegedServiceAuditAlarm(
1968 IN PUNICODE_STRING SubsystemName,
1969 IN PUNICODE_STRING ServiceName,
1970 IN HANDLE ClientToken,
1971 IN PPRIVILEGE_SET Privileges,
1972 IN BOOLEAN AccessGranted
1973 );
1974
1975 NTSTATUS
1976 STDCALL
1977 NtPrivilegeObjectAuditAlarm(
1978 IN PUNICODE_STRING SubsystemName,
1979 IN PVOID HandleId,
1980 IN HANDLE ClientToken,
1981 IN ULONG DesiredAccess,
1982 IN PPRIVILEGE_SET Privileges,
1983 IN BOOLEAN AccessGranted
1984 );
1985
1986 NTSTATUS
1987 STDCALL
1988 ZwPrivilegeObjectAuditAlarm(
1989 IN PUNICODE_STRING SubsystemName,
1990 IN PVOID HandleId,
1991 IN HANDLE ClientToken,
1992 IN ULONG DesiredAccess,
1993 IN PPRIVILEGE_SET Privileges,
1994 IN BOOLEAN AccessGranted
1995 );
1996
1997 /*
1998 * FUNCTION: Entry point for native applications
1999 * ARGUMENTS:
2000 * Peb = Pointes to the Process Environment Block (PEB)
2001 * REMARKS:
2002 * Native applications should use this function instead of a main.
2003 * Calling proces should terminate itself.
2004 * RETURNS: Status
2005 */
2006 VOID STDCALL
2007 NtProcessStartup(
2008 IN PPEB Peb
2009 );
2010
2011
2012 /*
2013 * FUNCTION: Signals an event and resets it afterwards.
2014 * ARGUMENTS:
2015 * EventHandle = Handle to the event
2016 * PulseCount = Number of times the action is repeated
2017 * RETURNS: Status
2018 */
2019 NTSTATUS
2020 STDCALL
2021 NtPulseEvent(
2022 IN HANDLE EventHandle,
2023 IN PULONG PulseCount OPTIONAL
2024 );
2025
2026 NTSTATUS
2027 STDCALL
2028 ZwPulseEvent(
2029 IN HANDLE EventHandle,
2030 IN PULONG PulseCount OPTIONAL
2031 );
2032
2033 /*
2034 * FUNCTION: Queries the attributes of a file
2035 * ARGUMENTS:
2036 * ObjectAttributes = Initialized attributes for the object
2037 * Buffer = Caller supplies storage for the attributes
2038 * RETURNS: Status
2039 */
2040
2041 NTSTATUS STDCALL
2042 NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
2043 OUT PFILE_BASIC_INFORMATION FileInformation);
2044
2045 NTSTATUS STDCALL
2046 ZwQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
2047 OUT PFILE_BASIC_INFORMATION FileInformation);
2048
2049 /*
2050 * FUNCTION: Queries the default locale id
2051 * ARGUMENTS:
2052 * UserProfile = Type of locale id
2053 * TRUE: thread locale id
2054 * FALSE: system locale id
2055 * DefaultLocaleId = Caller supplies storage for the locale id
2056 * RETURNS: Status
2057 */
2058
2059 NTSTATUS
2060 STDCALL
2061 NtQueryDefaultLocale(
2062 IN BOOLEAN UserProfile,
2063 OUT PLCID DefaultLocaleId
2064 );
2065
2066 NTSTATUS
2067 STDCALL
2068 ZwQueryDefaultLocale(
2069 IN BOOLEAN UserProfile,
2070 OUT PLCID DefaultLocaleId
2071 );
2072
2073 /*
2074 * FUNCTION: Queries a directory file.
2075 * ARGUMENTS:
2076 * FileHandle = Handle to a directory file
2077 * EventHandle = Handle to the event signaled on completion
2078 * ApcRoutine = Asynchroneous procedure callback, called on completion
2079 * ApcContext = Argument to the apc.
2080 * IoStatusBlock = Caller supplies storage for extended status information.
2081 * FileInformation = Caller supplies storage for the resulting information.
2082 *
2083 * FileNameInformation FILE_NAMES_INFORMATION
2084 * FileDirectoryInformation FILE_DIRECTORY_INFORMATION
2085 * FileFullDirectoryInformation FILE_FULL_DIRECTORY_INFORMATION
2086 * FileBothDirectoryInformation FILE_BOTH_DIR_INFORMATION
2087 *
2088 * Length = Size of the storage supplied
2089 * FileInformationClass = Indicates the type of information requested.
2090 * ReturnSingleEntry = Specify true if caller only requests the first directory found.
2091 * FileName = Initial directory name to query, that may contain wild cards.
2092 * RestartScan = Number of times the action should be repeated
2093 * RETURNS: Status [ STATUS_SUCCESS, STATUS_ACCESS_DENIED, STATUS_INSUFFICIENT_RESOURCES,
2094 * STATUS_INVALID_PARAMETER, STATUS_INVALID_DEVICE_REQUEST, STATUS_BUFFER_OVERFLOW,
2095 * STATUS_INVALID_INFO_CLASS, STATUS_NO_SUCH_FILE, STATUS_NO_MORE_FILES ]
2096 */
2097
2098 NTSTATUS
2099 STDCALL
2100 NtQueryDirectoryFile(
2101 IN HANDLE FileHandle,
2102 IN HANDLE Event OPTIONAL,
2103 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
2104 IN PVOID ApcContext OPTIONAL,
2105 OUT PIO_STATUS_BLOCK IoStatusBlock,
2106 OUT PVOID FileInformation,
2107 IN ULONG Length,
2108 IN FILE_INFORMATION_CLASS FileInformationClass,
2109 IN BOOLEAN ReturnSingleEntry,
2110 IN PUNICODE_STRING FileName OPTIONAL,
2111 IN BOOLEAN RestartScan
2112 );
2113
2114 NTSTATUS
2115 STDCALL
2116 ZwQueryDirectoryFile(
2117 IN HANDLE FileHandle,
2118 IN HANDLE Event OPTIONAL,
2119 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
2120 IN PVOID ApcContext OPTIONAL,
2121 OUT PIO_STATUS_BLOCK IoStatusBlock,
2122 OUT PVOID FileInformation,
2123 IN ULONG Length,
2124 IN FILE_INFORMATION_CLASS FileInformationClass,
2125 IN BOOLEAN ReturnSingleEntry,
2126 IN PUNICODE_STRING FileName OPTIONAL,
2127 IN BOOLEAN RestartScan
2128 );
2129
2130 /*
2131 * FUNCTION: Queries the extended attributes of a file
2132 * ARGUMENTS:
2133 * FileHandle = Handle to the event
2134 * IoStatusBlock = Number of times the action is repeated
2135 * Buffer
2136 * Length
2137 * ReturnSingleEntry
2138 * EaList
2139 * EaListLength
2140 * EaIndex
2141 * RestartScan
2142 * RETURNS: Status
2143 */
2144
2145 NTSTATUS
2146 STDCALL
2147 NtQueryEaFile(
2148 IN HANDLE FileHandle,
2149 OUT PIO_STATUS_BLOCK IoStatusBlock,
2150 OUT PVOID Buffer,
2151 IN ULONG Length,
2152 IN BOOLEAN ReturnSingleEntry,
2153 IN PVOID EaList OPTIONAL,
2154 IN ULONG EaListLength,
2155 IN PULONG EaIndex OPTIONAL,
2156 IN BOOLEAN RestartScan
2157 );
2158
2159 NTSTATUS
2160 STDCALL
2161 ZwQueryEaFile(
2162 IN HANDLE FileHandle,
2163 OUT PIO_STATUS_BLOCK IoStatusBlock,
2164 OUT PVOID Buffer,
2165 IN ULONG Length,
2166 IN BOOLEAN ReturnSingleEntry,
2167 IN PVOID EaList OPTIONAL,
2168 IN ULONG EaListLength,
2169 IN PULONG EaIndex OPTIONAL,
2170 IN BOOLEAN RestartScan
2171 );
2172
2173 /*
2174 * FUNCTION: Queries an event
2175 * ARGUMENTS:
2176 * EventHandle = Handle to the event
2177 * EventInformationClass = Index of the information structure
2178
2179 EventBasicInformation EVENT_BASIC_INFORMATION
2180
2181 * EventInformation = Caller supplies storage for the information structure
2182 * EventInformationLength = Size of the information structure
2183 * ReturnLength = Data written
2184 * RETURNS: Status
2185 */
2186 NTSTATUS
2187 STDCALL
2188 NtQueryEvent(
2189 IN HANDLE EventHandle,
2190 IN EVENT_INFORMATION_CLASS EventInformationClass,
2191 OUT PVOID EventInformation,
2192 IN ULONG EventInformationLength,
2193 OUT PULONG ReturnLength
2194 );
2195 NTSTATUS
2196 STDCALL
2197 ZwQueryEvent(
2198 IN HANDLE EventHandle,
2199 IN EVENT_INFORMATION_CLASS EventInformationClass,
2200 OUT PVOID EventInformation,
2201 IN ULONG EventInformationLength,
2202 OUT PULONG ReturnLength
2203 );
2204
2205 NTSTATUS STDCALL
2206 NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
2207 OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation);
2208
2209 NTSTATUS STDCALL
2210 ZwQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
2211 OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation);
2212
2213 /*
2214 * FUNCTION: Queries the information of a file object.
2215 * ARGUMENTS:
2216 * FileHandle = Handle to the file object
2217 * IoStatusBlock = Caller supplies storage for extended information
2218 * on the current operation.
2219 * FileInformation = Storage for the new file information
2220 * Lenght = Size of the storage for the file information.
2221 * FileInformationClass = Indicates which file information is queried
2222
2223 FileDirectoryInformation FILE_DIRECTORY_INFORMATION
2224 FileFullDirectoryInformation FILE_FULL_DIRECTORY_INFORMATION
2225 FileBothDirectoryInformation FILE_BOTH_DIRECTORY_INFORMATION
2226 FileBasicInformation FILE_BASIC_INFORMATION
2227 FileStandardInformation FILE_STANDARD_INFORMATION
2228 FileInternalInformation FILE_INTERNAL_INFORMATION
2229 FileEaInformation FILE_EA_INFORMATION
2230 FileAccessInformation FILE_ACCESS_INFORMATION
2231 FileNameInformation FILE_NAME_INFORMATION
2232 FileRenameInformation FILE_RENAME_INFORMATION
2233 FileLinkInformation
2234 FileNamesInformation FILE_NAMES_INFORMATION
2235 FileDispositionInformation FILE_DISPOSITION_INFORMATION
2236 FilePositionInformation FILE_POSITION_INFORMATION
2237 FileFullEaInformation FILE_FULL_EA_INFORMATION
2238 FileModeInformation FILE_MODE_INFORMATION
2239 FileAlignmentInformation FILE_ALIGNMENT_INFORMATION
2240 FileAllInformation FILE_ALL_INFORMATION
2241
2242 FileEndOfFileInformation FILE_END_OF_FILE_INFORMATION
2243 FileAlternateNameInformation
2244 FileStreamInformation FILE_STREAM_INFORMATION
2245 FilePipeInformation
2246 FilePipeLocalInformation
2247 FilePipeRemoteInformation
2248 FileMailslotQueryInformation
2249 FileMailslotSetInformation
2250 FileCompressionInformation FILE_COMPRESSION_INFORMATION
2251 FileCopyOnWriteInformation
2252 FileCompletionInformation IO_COMPLETION_CONTEXT
2253 FileMoveClusterInformation
2254 FileOleClassIdInformation
2255 FileOleStateBitsInformation
2256 FileNetworkOpenInformation FILE_NETWORK_OPEN_INFORMATION
2257 FileObjectIdInformation
2258 FileOleAllInformation
2259 FileOleDirectoryInformation
2260 FileContentIndexInformation
2261 FileInheritContentIndexInformation
2262 FileOleInformation
2263 FileMaximumInformation
2264
2265 * REMARK:
2266 * This procedure maps to the win32 GetShortPathName, GetLongPathName,
2267 GetFullPathName, GetFileType, GetFileSize, GetFileTime functions.
2268 * RETURNS: Status
2269 */
2270 NTSTATUS
2271 STDCALL
2272 NtQueryInformationFile(
2273 IN HANDLE FileHandle,
2274 OUT PIO_STATUS_BLOCK IoStatusBlock,
2275 OUT PVOID FileInformation,
2276 IN ULONG Length,
2277 IN FILE_INFORMATION_CLASS FileInformationClass
2278 );
2279
2280 NTSTATUS
2281 STDCALL
2282 ZwQueryInformationFile(
2283 HANDLE FileHandle,
2284 PIO_STATUS_BLOCK IoStatusBlock,
2285 PVOID FileInformation,
2286 ULONG Length,
2287 FILE_INFORMATION_CLASS FileInformationClass
2288 );
2289
2290
2291 /*
2292 * FUNCTION: Queries the information of a thread object.
2293 * ARGUMENTS:
2294 * ThreadHandle = Handle to the thread object
2295 * ThreadInformationClass = Index to a certain information structure
2296
2297 ThreadBasicInformation THREAD_BASIC_INFORMATION
2298 ThreadTimes KERNEL_USER_TIMES
2299 ThreadPriority KPRIORITY
2300 ThreadBasePriority KPRIORITY
2301 ThreadAffinityMask KAFFINITY
2302 ThreadImpersonationToken
2303 ThreadDescriptorTableEntry
2304 ThreadEnableAlignmentFaultFixup
2305 ThreadEventPair
2306 ThreadQuerySetWin32StartAddress
2307 ThreadZeroTlsCell
2308 ThreadPerformanceCount
2309 ThreadAmILastThread BOOLEAN
2310 ThreadIdealProcessor ULONG
2311 ThreadPriorityBoost ULONG
2312 MaxThreadInfoClass
2313
2314
2315 * ThreadInformation = Caller supplies torage for the thread information
2316 * ThreadInformationLength = Size of the thread information structure
2317 * ReturnLength = Actual number of bytes written
2318
2319 * REMARK:
2320 * This procedure maps to the win32 GetThreadTimes, GetThreadPriority,
2321 GetThreadPriorityBoost functions.
2322 * RETURNS: Status
2323 */
2324
2325
2326 NTSTATUS
2327 STDCALL
2328 NtQueryInformationThread(
2329 IN HANDLE ThreadHandle,
2330 IN THREADINFOCLASS ThreadInformationClass,
2331 OUT PVOID ThreadInformation,
2332 IN ULONG ThreadInformationLength,
2333 OUT PULONG ReturnLength
2334 );
2335
2336
2337 NTSTATUS
2338 STDCALL
2339 NtQueryInformationToken(
2340 IN HANDLE TokenHandle,
2341 IN TOKEN_INFORMATION_CLASS TokenInformationClass,
2342 OUT PVOID TokenInformation,
2343 IN ULONG TokenInformationLength,
2344 OUT PULONG ReturnLength
2345 );
2346
2347 NTSTATUS
2348 STDCALL
2349 ZwQueryInformationToken(
2350 IN HANDLE TokenHandle,
2351 IN TOKEN_INFORMATION_CLASS TokenInformationClass,
2352 OUT PVOID TokenInformation,
2353 IN ULONG TokenInformationLength,
2354 OUT PULONG ReturnLength
2355 );
2356
2357 NTSTATUS
2358 STDCALL
2359 NtQueryIoCompletion(
2360 IN HANDLE IoCompletionHandle,
2361 IN IO_COMPLETION_INFORMATION_CLASS IoCompletionInformationClass,
2362 OUT PVOID IoCompletionInformation,
2363 IN ULONG IoCompletionInformationLength,
2364 OUT PULONG ResultLength OPTIONAL
2365 );
2366
2367 NTSTATUS
2368 STDCALL
2369 ZwQueryIoCompletion(
2370 IN HANDLE IoCompletionHandle,
2371 IN IO_COMPLETION_INFORMATION_CLASS IoCompletionInformationClass,
2372 OUT PVOID IoCompletionInformation,
2373 IN ULONG IoCompletionInformationLength,
2374 OUT PULONG ResultLength OPTIONAL
2375 );
2376
2377 /*
2378 * FUNCTION: Queries the information of a registry key object.
2379 * ARGUMENTS:
2380 KeyHandle = Handle to a registry key
2381 KeyInformationClass = Index to a certain information structure
2382 KeyInformation = Caller supplies storage for resulting information
2383 Length = Size of the supplied storage
2384 ResultLength = Bytes written
2385 */
2386 NTSTATUS
2387 STDCALL
2388 NtQueryKey(
2389 IN HANDLE KeyHandle,
2390 IN KEY_INFORMATION_CLASS KeyInformationClass,
2391 OUT PVOID KeyInformation,
2392 IN ULONG Length,
2393 OUT PULONG ResultLength
2394 );
2395
2396 NTSTATUS
2397 STDCALL
2398 ZwQueryKey(
2399 IN HANDLE KeyHandle,
2400 IN KEY_INFORMATION_CLASS KeyInformationClass,
2401 OUT PVOID KeyInformation,
2402 IN ULONG Length,
2403 OUT PULONG ResultLength
2404 );
2405
2406
2407 // draft
2408
2409 NTSTATUS
2410 STDCALL
2411 NtQueryMultipleValueKey(
2412 IN HANDLE KeyHandle,
2413 IN OUT PKEY_VALUE_ENTRY ValueList,
2414 IN ULONG NumberOfValues,
2415 OUT PVOID Buffer,
2416 IN OUT PULONG Length,
2417 OUT PULONG ReturnLength
2418 );
2419
2420 NTSTATUS
2421 STDCALL
2422 ZwQueryMultipleValueKey(
2423 IN HANDLE KeyHandle,
2424 IN OUT PKEY_VALUE_ENTRY ValueList,
2425 IN ULONG NumberOfValues,
2426 OUT PVOID Buffer,
2427 IN OUT PULONG Length,
2428 OUT PULONG ReturnLength
2429 );
2430
2431 /*
2432 * FUNCTION: Queries the information of a mutant object.
2433 * ARGUMENTS:
2434 MutantHandle = Handle to a mutant
2435 MutantInformationClass = Index to a certain information structure
2436 MutantInformation = Caller supplies storage for resulting information
2437 Length = Size of the supplied storage
2438 ResultLength = Bytes written
2439 */
2440 NTSTATUS
2441 STDCALL
2442 NtQueryMutant(
2443 IN HANDLE MutantHandle,
2444 IN CINT MutantInformationClass,
2445 OUT PVOID MutantInformation,
2446 IN ULONG Length,
2447 OUT PULONG ResultLength
2448 );
2449
2450 NTSTATUS
2451 STDCALL
2452 ZwQueryMutant(
2453 IN HANDLE MutantHandle,
2454 IN CINT MutantInformationClass,
2455 OUT PVOID MutantInformation,
2456 IN ULONG Length,
2457 OUT PULONG ResultLength
2458 );
2459
2460 /*
2461 * FUNCTION: Queries the system ( high-resolution ) performance counter.
2462 * ARGUMENTS:
2463 * Counter = Performance counter
2464 * Frequency = Performance frequency
2465 * REMARKS:
2466 This procedure queries a tick count faster than 10ms ( The resolution for Intel®-based CPUs is about 0.8 microseconds.)
2467 This procedure maps to the win32 QueryPerformanceCounter, QueryPerformanceFrequency
2468 * RETURNS: Status
2469 *
2470 */
2471 NTSTATUS
2472 STDCALL
2473 NtQueryPerformanceCounter(
2474 IN PLARGE_INTEGER Counter,
2475 IN PLARGE_INTEGER Frequency
2476 );
2477
2478 NTSTATUS
2479 STDCALL
2480 ZwQueryPerformanceCounter(
2481 IN PLARGE_INTEGER Counter,
2482 IN PLARGE_INTEGER Frequency
2483 );
2484
2485 /*
2486 * FUNCTION: Queries the information of a semaphore.
2487 * ARGUMENTS:
2488 * SemaphoreHandle = Handle to the semaphore object
2489 * SemaphoreInformationClass = Index to a certain information structure
2490
2491 SemaphoreBasicInformation SEMAPHORE_BASIC_INFORMATION
2492
2493 * SemaphoreInformation = Caller supplies storage for the semaphore information structure
2494 * Length = Size of the infomation structure
2495 */
2496 NTSTATUS
2497 STDCALL
2498 NtQuerySemaphore(
2499 IN HANDLE SemaphoreHandle,
2500 IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
2501 OUT PVOID SemaphoreInformation,
2502 IN ULONG Length,
2503 OUT PULONG ReturnLength
2504 );
2505
2506 NTSTATUS
2507 STDCALL
2508 ZwQuerySemaphore(
2509 IN HANDLE SemaphoreHandle,
2510 IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
2511 OUT PVOID SemaphoreInformation,
2512 IN ULONG Length,
2513 OUT PULONG ReturnLength
2514 );
2515
2516
2517 /*
2518 * FUNCTION: Queries the information of a symbolic link object.
2519 * ARGUMENTS:
2520 * SymbolicLinkHandle = Handle to the symbolic link object
2521 * LinkTarget = resolved name of link
2522 * DataWritten = size of the LinkName.
2523 * RETURNS: Status
2524 *
2525 */
2526 NTSTATUS
2527 STDCALL
2528 NtQuerySymbolicLinkObject(
2529 IN HANDLE SymLinkObjHandle,
2530 OUT PUNICODE_STRING LinkTarget,
2531 OUT PULONG DataWritten OPTIONAL
2532 );
2533
2534 NTSTATUS
2535 STDCALL
2536 ZwQuerySymbolicLinkObject(
2537 IN HANDLE SymLinkObjHandle,
2538 OUT PUNICODE_STRING LinkName,
2539 OUT PULONG DataWritten OPTIONAL
2540 );
2541
2542
2543 /*
2544 * FUNCTION: Queries a system environment variable.
2545 * ARGUMENTS:
2546 * Name = Name of the variable
2547 * Value (OUT) = value of the variable
2548 * Length = size of the buffer
2549 * ReturnLength = data written
2550 * RETURNS: Status
2551 *
2552 */
2553 NTSTATUS
2554 STDCALL
2555 NtQuerySystemEnvironmentValue(
2556 IN PUNICODE_STRING Name,
2557 OUT PVOID Value,
2558 ULONG Length,
2559 PULONG ReturnLength
2560 );
2561
2562 NTSTATUS
2563 STDCALL
2564 ZwQuerySystemEnvironmentValue(
2565 IN PUNICODE_STRING Name,
2566 OUT PVOID Value,
2567 ULONG Length,
2568 PULONG ReturnLength
2569 );
2570
2571
2572 /*
2573 * FUNCTION: Queries the system information.
2574 * ARGUMENTS:
2575 * SystemInformationClass = Index to a certain information structure
2576
2577 SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
2578 SystemCacheInformation SYSTEM_CACHE_INFORMATION
2579 SystemConfigurationInformation CONFIGURATION_INFORMATION
2580
2581 * SystemInformation = caller supplies storage for the information structure
2582 * Length = size of the structure
2583 ResultLength = Data written
2584 * RETURNS: Status
2585 *
2586 */
2587 NTSTATUS
2588 STDCALL
2589 NtQuerySystemInformation(
2590 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
2591 OUT PVOID SystemInformation,
2592 IN ULONG Length,
2593 OUT PULONG ResultLength
2594 );
2595
2596 NTSTATUS
2597 STDCALL
2598 ZwQuerySystemInformation(
2599 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
2600 OUT PVOID SystemInformation,
2601 IN ULONG Length,
2602 OUT PULONG ResultLength
2603 );
2604
2605 /*
2606 * FUNCTION: Queries information about a timer
2607 * ARGUMENTS:
2608 * TimerHandle = Handle to the timer
2609 TimerValueInformationClass = Index to a certain information structure
2610 TimerValueInformation = Caller supplies storage for the information structure
2611 Length = Size of the information structure
2612 ResultLength = Data written
2613 * RETURNS: Status
2614 *
2615 */
2616 NTSTATUS
2617 STDCALL
2618 NtQueryTimer(
2619 IN HANDLE TimerHandle,
2620 IN CINT TimerInformationClass,
2621 OUT PVOID TimerInformation,
2622 IN ULONG Length,
2623 OUT PULONG ResultLength
2624 );
2625 NTSTATUS
2626 STDCALL
2627 ZwQueryTimer(
2628 IN HANDLE TimerHandle,
2629 IN CINT TimerInformationClass,
2630 OUT PVOID TimerInformation,
2631 IN ULONG Length,
2632 OUT PULONG ResultLength
2633 );
2634
2635 /*
2636 * FUNCTION: Queries the timer resolution
2637 * ARGUMENTS:
2638 * MinimumResolution (OUT) = Caller should supply storage for the resulting time.
2639 Maximum Resolution (OUT) = Caller should supply storage for the resulting time.
2640 ActualResolution (OUT) = Caller should supply storage for the resulting time.
2641 * RETURNS: Status
2642 *
2643 */
2644
2645
2646 NTSTATUS
2647 STDCALL
2648 NtQueryTimerResolution (
2649 OUT PULONG MinimumResolution,
2650 OUT PULONG MaximumResolution,
2651 OUT PULONG ActualResolution
2652 );
2653
2654 NTSTATUS
2655 STDCALL
2656 ZwQueryTimerResolution (
2657 OUT PULONG MinimumResolution,
2658 OUT PULONG MaximumResolution,
2659 OUT PULONG ActualResolution
2660 );
2661
2662 /*
2663 * FUNCTION: Queries a registry key value
2664 * ARGUMENTS:
2665 * KeyHandle = Handle to the registry key
2666 ValueName = Name of the value in the registry key
2667 KeyValueInformationClass = Index to a certain information structure
2668
2669 KeyValueBasicInformation = KEY_VALUE_BASIC_INFORMATION
2670 KeyValueFullInformation = KEY_FULL_INFORMATION
2671 KeyValuePartialInformation = KEY_VALUE_PARTIAL_INFORMATION
2672
2673 KeyValueInformation = Caller supplies storage for the information structure
2674 Length = Size of the information structure
2675 ResultLength = Data written
2676 * RETURNS: Status
2677 *
2678 */
2679 NTSTATUS
2680 STDCALL
2681 NtQueryValueKey(
2682 IN HANDLE KeyHandle,
2683 IN PUNICODE_STRING ValueName,
2684 IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
2685 OUT PVOID KeyValueInformation,
2686 IN ULONG Length,
2687 OUT PULONG ResultLength
2688 );
2689
2690 NTSTATUS
2691 STDCALL
2692 ZwQueryValueKey(
2693 IN HANDLE KeyHandle,
2694 IN PUNICODE_STRING ValueName,
2695 IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
2696 OUT PVOID KeyValueInformation,
2697 IN ULONG Length,
2698 OUT PULONG ResultLength
2699 );
2700
2701 /*
2702 * FUNCTION: Queries the volume information
2703 * ARGUMENTS:
2704 * FileHandle = Handle to a file object on the target volume
2705 * IoStatusBlock = Caller should supply storage for additional status information
2706 * ReturnLength = DataWritten
2707 * FsInformation = Caller should supply storage for the information structure.
2708 * Length = Size of the information structure
2709 * FsInformationClass = Index to a information structure
2710
2711 FileFsVolumeInformation FILE_FS_VOLUME_INFORMATION
2712 FileFsLabelInformation FILE_FS_LABEL_INFORMATION
2713 FileFsSizeInformation FILE_FS_SIZE_INFORMATION
2714 FileFsDeviceInformation FILE_FS_DEVICE_INFORMATION
2715 FileFsAttributeInformation FILE_FS_ATTRIBUTE_INFORMATION
2716 FileFsControlInformation
2717 FileFsQuotaQueryInformation --
2718 FileFsQuotaSetInformation --
2719 FileFsMaximumInformation
2720
2721 * RETURNS: Status [ STATUS_SUCCESS | STATUS_INSUFFICIENT_RESOURCES | STATUS_INVALID_PARAMETER |
2722 STATUS_INVALID_DEVICE_REQUEST | STATUS_BUFFER_OVERFLOW ]
2723 *
2724 */
2725 NTSTATUS
2726 STDCALL
2727 NtQueryVolumeInformationFile(
2728 IN HANDLE FileHandle,
2729 OUT PIO_STATUS_BLOCK IoStatusBlock,
2730 OUT PVOID FsInformation,
2731 IN ULONG Length,
2732 IN FS_INFORMATION_CLASS FsInformationClass
2733 );
2734
2735 NTSTATUS
2736 STDCALL
2737 ZwQueryVolumeInformationFile(
2738 IN HANDLE FileHandle,
2739 OUT PIO_STATUS_BLOCK IoStatusBlock,
2740 OUT PVOID FsInformation,
2741 IN ULONG Length,
2742 IN FS_INFORMATION_CLASS FsInformationClass
2743 );
2744 // draft
2745 // FIXME: Should I specify if the apc is user or kernel mode somewhere ??
2746 /*
2747 * FUNCTION: Queues a (user) apc to a thread.
2748 * ARGUMENTS:
2749 ThreadHandle = Thread to which the apc is queued.
2750 ApcRoutine = Points to the apc routine
2751 NormalContext = Argument to Apc Routine
2752 * SystemArgument1 = Argument of the Apc Routine
2753 SystemArgument2 = Argument of the Apc Routine
2754 * REMARK: If the apc is queued against a thread of a different process than the calling thread
2755 the apc routine should be specified in the address space of the queued thread's process.
2756 * RETURNS: Status
2757 */
2758
2759 NTSTATUS
2760 STDCALL
2761 NtQueueApcThread(
2762 HANDLE ThreadHandle,
2763 PKNORMAL_ROUTINE ApcRoutine,
2764 PVOID NormalContext,
2765 PVOID SystemArgument1,
2766 PVOID SystemArgument2);
2767
2768 NTSTATUS
2769 STDCALL
2770 ZwQueueApcThread(
2771 HANDLE ThreadHandle,
2772 PKNORMAL_ROUTINE ApcRoutine,
2773 PVOID NormalContext,
2774 PVOID SystemArgument1,
2775 PVOID SystemArgument2);
2776
2777
2778 /*
2779 * FUNCTION: Raises an exception
2780 * ARGUMENTS:
2781 * ExceptionRecord = Structure specifying the exception
2782 * Context = Context in which the excpetion is raised
2783 * IsDebugger =
2784 * RETURNS: Status
2785 *
2786 */
2787
2788 NTSTATUS
2789 STDCALL
2790 NtRaiseException(
2791 IN PEXCEPTION_RECORD ExceptionRecord,
2792 IN PCONTEXT Context,
2793 IN BOOLEAN SearchFrames
2794 );
2795
2796 NTSTATUS
2797 STDCALL
2798 ZwRaiseException(
2799 IN PEXCEPTION_RECORD ExceptionRecord,
2800 IN PCONTEXT Context,
2801 IN BOOLEAN SearchFrames
2802 );
2803
2804 /*
2805 * FUNCTION: Read a file
2806 * ARGUMENTS:
2807 * FileHandle = Handle of a file to read
2808 * Event = This event is signalled when the read operation completes
2809 * UserApcRoutine = Call back , if supplied Event should be NULL
2810 * UserApcContext = Argument to the callback
2811 * IoStatusBlock = Caller should supply storage for additional status information
2812 * Buffer = Caller should supply storage to receive the information
2813 * BufferLength = Size of the buffer
2814 * ByteOffset = Offset to start reading the file
2815 * Key = If a range is lock a matching key will allow the read to continue.
2816 * RETURNS: Status
2817 *
2818 */
2819
2820 NTSTATUS
2821 STDCALL
2822 NtReadFile(
2823 IN HANDLE FileHandle,
2824 IN HANDLE Event OPTIONAL,
2825 IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
2826 IN PVOID UserApcContext OPTIONAL,
2827 OUT PIO_STATUS_BLOCK IoStatusBlock,
2828 OUT PVOID Buffer,
2829 IN ULONG BufferLength,
2830 IN PLARGE_INTEGER ByteOffset OPTIONAL,
2831 IN PULONG Key OPTIONAL
2832 );
2833
2834 NTSTATUS
2835 STDCALL
2836 ZwReadFile(
2837 IN HANDLE FileHandle,
2838 IN HANDLE Event OPTIONAL,
2839 IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
2840 IN PVOID UserApcContext OPTIONAL,
2841 OUT PIO_STATUS_BLOCK IoStatusBlock,
2842 OUT PVOID Buffer,
2843 IN ULONG BufferLength,
2844 IN PLARGE_INTEGER ByteOffset OPTIONAL,
2845 IN PULONG Key OPTIONAL
2846 );
2847 /*
2848 * FUNCTION: Read a file using scattered io
2849 * ARGUMENTS:
2850 FileHandle = Handle of a file to read
2851 Event = This event is signalled when the read operation completes
2852 * UserApcRoutine = Call back , if supplied Event should be NULL
2853 UserApcContext = Argument to the callback
2854 IoStatusBlock = Caller should supply storage for additional status information
2855 BufferDescription = Caller should supply storage to receive the information
2856 BufferLength = Size of the buffer
2857 ByteOffset = Offset to start reading the file
2858 Key = Key = If a range is lock a matching key will allow the read to continue.
2859 * RETURNS: Status
2860 *
2861 */
2862 NTSTATUS
2863 STDCALL
2864 NtReadFileScatter(
2865 IN HANDLE FileHandle,
2866 IN HANDLE Event OPTIONAL,
2867 IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
2868 IN PVOID UserApcContext OPTIONAL,
2869 OUT PIO_STATUS_BLOCK UserIoStatusBlock,
2870 IN FILE_SEGMENT_ELEMENT BufferDescription[],
2871 IN ULONG BufferLength,
2872 IN PLARGE_INTEGER ByteOffset,
2873 IN PULONG Key OPTIONAL
2874 );
2875
2876 NTSTATUS
2877 STDCALL
2878 ZwReadFileScatter(
2879 IN HANDLE FileHandle,
2880 IN HANDLE Event OPTIONAL,
2881 IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL,
2882 IN PVOID UserApcContext OPTIONAL,
2883 OUT PIO_STATUS_BLOCK UserIoStatusBlock,
2884 IN FILE_SEGMENT_ELEMENT BufferDescription[],
2885 IN ULONG BufferLength,
2886 IN PLARGE_INTEGER ByteOffset,
2887 IN PULONG Key OPTIONAL
2888 );
2889 /*
2890 * FUNCTION: Copies a range of virtual memory to a buffer
2891 * ARGUMENTS:
2892 * ProcessHandle = Specifies the process owning the virtual address space
2893 * BaseAddress = Points to the address of virtual memory to start the read
2894 * Buffer = Caller supplies storage to copy the virtual memory to.
2895 * NumberOfBytesToRead = Limits the range to read
2896 * NumberOfBytesRead = The actual number of bytes read.
2897 * RETURNS: Status
2898 */
2899
2900 NTSTATUS
2901 STDCALL
2902 NtReadVirtualMemory(
2903 IN HANDLE ProcessHandle,
2904 IN PVOID BaseAddress,
2905 OUT PVOID Buffer,
2906 IN ULONG NumberOfBytesToRead,
2907 OUT PULONG NumberOfBytesRead
2908 );
2909 NTSTATUS
2910 STDCALL
2911 ZwReadVirtualMemory(
2912 IN HANDLE ProcessHandle,
2913 IN PVOID BaseAddress,
2914 OUT PVOID Buffer,
2915 IN ULONG NumberOfBytesToRead,
2916 OUT PULONG NumberOfBytesRead
2917 );
2918
2919
2920 /*
2921 * FUNCTION: Debugger can register for thread termination
2922 * ARGUMENTS:
2923 * TerminationPort = Port on which the debugger likes to be notified.
2924 * RETURNS: Status
2925 */
2926 NTSTATUS
2927 STDCALL
2928 NtRegisterThreadTerminatePort(
2929 HANDLE TerminationPort
2930 );
2931 NTSTATUS
2932 STDCALL
2933 ZwRegisterThreadTerminatePort(
2934 HANDLE TerminationPort
2935 );
2936
2937 /*
2938 * FUNCTION: Releases a mutant
2939 * ARGUMENTS:
2940 * MutantHandle = Handle to the mutant
2941 * ReleaseCount =
2942 * RETURNS: Status
2943 */
2944 NTSTATUS
2945 STDCALL
2946 NtReleaseMutant(
2947 IN HANDLE MutantHandle,
2948 IN PULONG ReleaseCount OPTIONAL
2949 );
2950
2951 NTSTATUS
2952 STDCALL
2953 ZwReleaseMutant(
2954 IN HANDLE MutantHandle,
2955 IN PULONG ReleaseCount OPTIONAL
2956 );
2957
2958 /*
2959 * FUNCTION: Releases a semaphore
2960 * ARGUMENTS:
2961 * SemaphoreHandle = Handle to the semaphore object
2962 * ReleaseCount = Number to decrease the semaphore count
2963 * PreviousCount = Previous semaphore count
2964 * RETURNS: Status
2965 */
2966 NTSTATUS
2967 STDCALL
2968 NtReleaseSemaphore(
2969 IN HANDLE SemaphoreHandle,
2970 IN LONG ReleaseCount,
2971 OUT PLONG PreviousCount
2972 );
2973
2974 NTSTATUS
2975 STDCALL
2976 ZwReleaseSemaphore(
2977 IN HANDLE SemaphoreHandle,
2978 IN LONG ReleaseCount,
2979 OUT PLONG PreviousCount
2980 );
2981
2982 /*
2983 * FUNCTION: Removes an io completion
2984 * ARGUMENTS:
2985 * CompletionPort (OUT) = Caller supplied storage for the resulting handle
2986 * CompletionKey = Requested access to the key
2987 * IoStatusBlock = Caller provides storage for extended status information
2988 * CompletionStatus = Current status of the io operation.
2989 * WaitTime = Time to wait if ..
2990 * RETURNS: Status
2991 */
2992 NTSTATUS
2993 STDCALL
2994 NtRemoveIoCompletion(
2995 IN HANDLE IoCompletionHandle,
2996 OUT PULONG CompletionKey,
2997 OUT PULONG CompletionValue,
2998 OUT PIO_STATUS_BLOCK IoStatusBlock,
2999 IN PLARGE_INTEGER Timeout OPTIONAL
3000 );
3001
3002 NTSTATUS
3003 STDCALL
3004 ZwRemoveIoCompletion(
3005 IN HANDLE IoCompletionHandle,
3006 OUT PULONG CompletionKey,
3007 OUT PULONG CompletionValue,
3008 OUT PIO_STATUS_BLOCK IoStatusBlock,
3009 IN PLARGE_INTEGER Timeout OPTIONAL
3010 );
3011
3012 /*
3013 * FUNCTION: Replaces one registry key with another
3014 * ARGUMENTS:
3015 * ObjectAttributes = Specifies the attributes of the key
3016 * Key = Handle to the key
3017 * ReplacedObjectAttributes = The function returns the old object attributes
3018 * RETURNS: Status
3019 */
3020 NTSTATUS
3021 STDCALL
3022 NtReplaceKey(
3023 IN POBJECT_ATTRIBUTES ObjectAttributes,
3024 IN HANDLE Key,
3025 IN POBJECT_ATTRIBUTES ReplacedObjectAttributes
3026 );
3027 NTSTATUS
3028 STDCALL
3029 ZwReplaceKey(
3030 IN POBJECT_ATTRIBUTES ObjectAttributes,
3031 IN HANDLE Key,
3032 IN POBJECT_ATTRIBUTES ReplacedObjectAttributes
3033 );
3034
3035 /*
3036 * FUNCTION: Resets a event to a non signaled state
3037 * ARGUMENTS:
3038 * EventHandle = Handle to the event that should be reset
3039 * NumberOfWaitingThreads = The number of threads released.
3040 * RETURNS: Status
3041 */
3042 NTSTATUS
3043 STDCALL
3044 NtResetEvent(
3045 HANDLE EventHandle,
3046 PULONG NumberOfWaitingThreads OPTIONAL
3047 );
3048 NTSTATUS
3049 STDCALL
3050 ZwResetEvent(
3051 HANDLE EventHandle,
3052 PULONG NumberOfWaitingThreads OPTIONAL
3053 );
3054 //draft
3055 NTSTATUS
3056 STDCALL
3057 NtRestoreKey(
3058 HANDLE KeyHandle,
3059 HANDLE FileHandle,
3060 ULONG RestoreFlags
3061 );
3062
3063 NTSTATUS
3064 STDCALL
3065 ZwRestoreKey(
3066 HANDLE KeyHandle,
3067 HANDLE FileHandle,
3068 ULONG RestoreFlags
3069 );
3070 /*
3071 * FUNCTION: Decrements a thread's resume count
3072 * ARGUMENTS:
3073 * ThreadHandle = Handle to the thread that should be resumed
3074 * ResumeCount = The resulting resume count.
3075 * REMARK:
3076 * A thread is resumed if its suspend count is 0. This procedure maps to
3077 * the win32 ResumeThread function. ( documentation about the the suspend count can be found here aswell )
3078 * RETURNS: Status
3079 */
3080 NTSTATUS
3081 STDCALL
3082 NtResumeThread(
3083 IN HANDLE ThreadHandle,
3084 OUT PULONG SuspendCount
3085 );
3086 NTSTATUS
3087 STDCALL
3088 ZwResumeThread(
3089 IN HANDLE ThreadHandle,
3090 OUT PULONG SuspendCount
3091 );
3092 /*
3093 * FUNCTION: Writes the content of a registry key to ascii file
3094 * ARGUMENTS:
3095 * KeyHandle = Handle to the key
3096 * FileHandle = Handle of the file
3097 * REMARKS:
3098 This function maps to the Win32 RegSaveKey.
3099 * RETURNS: Status
3100 */
3101
3102 NTSTATUS
3103 STDCALL
3104 NtSaveKey(
3105 IN HANDLE KeyHandle,
3106 IN HANDLE FileHandle
3107 );
3108 NTSTATUS
3109 STDCALL
3110 ZwSaveKey(
3111 IN HANDLE KeyHandle,
3112 IN HANDLE FileHandle
3113 );
3114
3115 /*
3116 * FUNCTION: Sets the context of a specified thread.
3117 * ARGUMENTS:
3118 * ThreadHandle = Handle to the thread
3119 * Context = The processor context.
3120 * RETURNS: Status
3121 */
3122
3123 NTSTATUS
3124 STDCALL
3125 NtSetContextThread(
3126 IN HANDLE ThreadHandle,
3127 IN PCONTEXT Context
3128 );
3129 NTSTATUS
3130 STDCALL
3131 ZwSetContextThread(
3132 IN HANDLE ThreadHandle,
3133 IN PCONTEXT Context
3134 );
3135
3136 /*
3137 * FUNCTION: Sets the default locale id
3138 * ARGUMENTS:
3139 * UserProfile = Type of locale id
3140 * TRUE: thread locale id
3141 * FALSE: system locale id
3142 * DefaultLocaleId = Locale id
3143 * RETURNS: Status
3144 */
3145
3146 NTSTATUS
3147 STDCALL
3148 NtSetDefaultLocale(
3149 IN BOOLEAN UserProfile,
3150 IN LCID DefaultLocaleId
3151 );
3152
3153 NTSTATUS
3154 STDCALL
3155 ZwSetDefaultLocale(
3156 IN BOOLEAN UserProfile,
3157 IN LCID DefaultLocaleId
3158 );
3159
3160 /*
3161 * FUNCTION: Sets the default hard error port
3162 * ARGUMENTS:
3163 * PortHandle = Handle to the port
3164 * NOTE: The hard error port is used for first change exception handling
3165 * RETURNS: Status
3166 */
3167 NTSTATUS
3168 STDCALL
3169 NtSetDefaultHardErrorPort(
3170 IN HANDLE PortHandle
3171 );
3172 NTSTATUS
3173 STDCALL
3174 ZwSetDefaultHardErrorPort(
3175 IN HANDLE PortHandle
3176 );
3177
3178 /*
3179 * FUNCTION: Sets the extended attributes of a file.
3180 * ARGUMENTS:
3181 * FileHandle = Handle to the file
3182 * IoStatusBlock = Storage for a resulting status and information
3183 * on the current operation.
3184 * EaBuffer = Extended Attributes buffer.
3185 * EaBufferSize = Size of the extended attributes buffer
3186 * RETURNS: Status
3187 */
3188 NTSTATUS
3189 STDCALL
3190 NtSetEaFile(
3191 IN HANDLE FileHandle,
3192 IN PIO_STATUS_BLOCK IoStatusBlock,
3193 PVOID EaBuffer,
3194 ULONG EaBufferSize
3195 );
3196 NTSTATUS
3197 STDCALL
3198 ZwSetEaFile(
3199 IN HANDLE FileHandle,
3200 IN PIO_STATUS_BLOCK IoStatusBlock,
3201 PVOID EaBuffer,
3202 ULONG EaBufferSize
3203 );
3204
3205 //FIXME: should I return the event state ?
3206
3207 /*
3208 * FUNCTION: Sets the event to a signalled state.
3209 * ARGUMENTS:
3210 * EventHandle = Handle to the event
3211 * NumberOfThreadsReleased = The number of threads released
3212 * REMARK:
3213 * This procedure maps to the win32 SetEvent function.
3214 * RETURNS: Status
3215 */
3216
3217 NTSTATUS
3218 STDCALL
3219 NtSetEvent(
3220 IN HANDLE EventHandle,
3221 PULONG NumberOfThreadsReleased
3222 );
3223
3224 NTSTATUS
3225 STDCALL
3226 ZwSetEvent(
3227 IN HANDLE EventHandle,
3228 PULONG NumberOfThreadsReleased
3229 );
3230
3231 /*
3232 * FUNCTION: Sets the high part of an event pair
3233 * ARGUMENTS:
3234 EventPair = Handle to the event pair
3235 * RETURNS: Status
3236 */
3237
3238 NTSTATUS
3239 STDCALL
3240 NtSetHighEventPair(
3241 IN HANDLE EventPairHandle
3242 );
3243
3244 NTSTATUS
3245 STDCALL
3246 ZwSetHighEventPair(
3247 IN HANDLE EventPairHandle
3248 );
3249 /*
3250 * FUNCTION: Sets the high part of an event pair and wait for the low part
3251 * ARGUMENTS:
3252 EventPair = Handle to the event pair
3253 * RETURNS: Status
3254 */
3255 NTSTATUS
3256 STDCALL
3257 NtSetHighWaitLowEventPair(
3258 IN HANDLE EventPairHandle
3259 );
3260 NTSTATUS
3261 STDCALL
3262 ZwSetHighWaitLowEventPair(
3263 IN HANDLE EventPairHandle
3264 );
3265
3266 /*
3267 * FUNCTION: Sets the information of a file object.
3268 * ARGUMENTS:
3269 * FileHandle = Handle to the file object
3270 * IoStatusBlock = Caller supplies storage for extended information
3271 * on the current operation.
3272 * FileInformation = Storage for the new file information
3273 * Lenght = Size of the new file information.
3274 * FileInformationClass = Indicates to a certain information structure
3275
3276 FileNameInformation FILE_NAME_INFORMATION
3277 FileRenameInformation FILE_RENAME_INFORMATION
3278 FileStreamInformation FILE_STREAM_INFORMATION
3279 * FileCompletionInformation IO_COMPLETION_CONTEXT
3280
3281 * REMARK:
3282 * This procedure maps to the win32 SetEndOfFile, SetFileAttributes,
3283 * SetNamedPipeHandleState, SetMailslotInfo functions.
3284 * RETURNS: Status
3285 */
3286
3287
3288 NTSTATUS
3289 STDCALL
3290 NtSetInformationFile(
3291 IN HANDLE FileHandle,
3292 IN PIO_STATUS_BLOCK IoStatusBlock,
3293 IN PVOID FileInformation,
3294 IN ULONG Length,
3295 IN FILE_INFORMATION_CLASS FileInformationClass
3296 );
3297 NTSTATUS
3298 STDCALL
3299 ZwSetInformationFile(
3300 IN HANDLE FileHandle,
3301 IN PIO_STATUS_BLOCK IoStatusBlock,
3302 IN PVOID FileInformation,
3303 IN ULONG Length,
3304 IN FILE_INFORMATION_CLASS FileInformationClass
3305 );
3306
3307 /*
3308 * FUNCTION: Changes a set of thread specific parameters
3309 * ARGUMENTS:
3310 * ThreadHandle = Handle to the thread
3311 * ThreadInformationClass = Index to the set of parameters to change.
3312 * Can be one of the following values:
3313 *
3314 * ThreadBasicInformation THREAD_BASIC_INFORMATION
3315 * ThreadPriority KPRIORITY //???
3316 * ThreadBasePriority KPRIORITY
3317 * ThreadAffinityMask KAFFINITY //??
3318 * ThreadImpersonationToken ACCESS_TOKEN
3319 * ThreadIdealProcessor ULONG
3320 * ThreadPriorityBoost ULONG
3321 *
3322 * ThreadInformation = Caller supplies storage for parameters to set.
3323 * ThreadInformationLength = Size of the storage supplied
3324 * RETURNS: Status
3325 */
3326 NTSTATUS
3327 STDCALL
3328 NtSetInformationThread(
3329 IN HANDLE ThreadHandle,
3330 IN THREADINFOCLASS ThreadInformationClass,
3331 IN PVOID ThreadInformation,
3332 IN ULONG ThreadInformationLength
3333 );
3334 NTSTATUS
3335 STDCALL
3336 ZwSetInformationThread(
3337 IN HANDLE ThreadHandle,
3338 IN THREADINFOCLASS ThreadInformationClass,
3339 IN PVOID ThreadInformation,
3340 IN ULONG ThreadInformationLength
3341 );
3342
3343 /*
3344 * FUNCTION: Changes a set of token specific parameters
3345 * ARGUMENTS:
3346 * TokenHandle = Handle to the token
3347 * TokenInformationClass = Index to a certain information structure.
3348 * Can be one of the following values:
3349 *
3350 TokenUser TOKEN_USER
3351 TokenGroups TOKEN_GROUPS
3352 TokenPrivileges TOKEN_PRIVILEGES
3353 TokenOwner TOKEN_OWNER
3354 TokenPrimaryGroup TOKEN_PRIMARY_GROUP
3355 TokenDefaultDacl TOKEN_DEFAULT_DACL
3356 TokenSource TOKEN_SOURCE
3357 TokenType TOKEN_TYPE
3358 TokenImpersonationLevel TOKEN_IMPERSONATION_LEVEL
3359 TokenStatistics TOKEN_STATISTICS
3360 *
3361 * TokenInformation = Caller supplies storage for information structure.
3362 * TokenInformationLength = Size of the information structure
3363 * RETURNS: Status
3364 */
3365
3366 NTSTATUS
3367 STDCALL
3368 NtSetInformationToken(
3369 IN HANDLE TokenHandle,
3370 IN TOKEN_INFORMATION_CLASS TokenInformationClass,
3371 OUT PVOID TokenInformation,
3372 IN ULONG TokenInformationLength
3373 );
3374
3375 NTSTATUS
3376 STDCALL
3377 ZwSetInformationToken(
3378 IN HANDLE TokenHandle,
3379 IN TOKEN_INFORMATION_CLASS TokenInformationClass,
3380 OUT PVOID TokenInformation,
3381 IN ULONG TokenInformationLength
3382 );
3383
3384
3385 /*
3386 * FUNCTION: Sets an io completion
3387 * ARGUMENTS:
3388 * CompletionPort =
3389 * CompletionKey =
3390 * IoStatusBlock =
3391 * NumberOfBytesToTransfer =
3392 * NumberOfBytesTransferred =
3393 * RETURNS: Status
3394 */
3395 NTSTATUS
3396 STDCALL
3397 NtSetIoCompletion(
3398 IN HANDLE IoCompletionPortHandle,
3399 IN ULONG CompletionKey,
3400 IN ULONG CompletionValue,
3401 IN NTSTATUS CompletionStatus,
3402 IN ULONG CompletionInformation
3403 );
3404
3405 NTSTATUS
3406 STDCALL
3407 ZwSetIoCompletion(
3408 IN HANDLE IoCompletionPortHandle,
3409 IN ULONG CompletionKey,
3410 IN ULONG CompletionValue,
3411 IN NTSTATUS CompletionStatus,
3412 IN ULONG CompletionInformation
3413 );
3414
3415 /*
3416 * FUNCTION: Set properties for profiling
3417 * ARGUMENTS:
3418 * Interval =
3419 * ClockSource =
3420 * RETURNS: Status
3421 *
3422 */
3423
3424 NTSTATUS
3425 STDCALL
3426 NtSetIntervalProfile(
3427 ULONG Interval,
3428 KPROFILE_SOURCE ClockSource
3429 );
3430
3431 NTSTATUS
3432 STDCALL
3433 ZwSetIntervalProfile(
3434 ULONG Interval,
3435 KPROFILE_SOURCE ClockSource
3436 );
3437
3438
3439 /*
3440 * FUNCTION: Sets the low part of an event pair
3441 * ARGUMENTS:
3442 EventPair = Handle to the event pair
3443 * RETURNS: Status
3444 */
3445
3446 NTSTATUS
3447 STDCALL
3448 NtSetLowEventPair(
3449 HANDLE EventPair
3450 );
3451 NTSTATUS
3452 STDCALL
3453 ZwSetLowEventPair(
3454 HANDLE EventPair
3455 );
3456 /*
3457 * FUNCTION: Sets the low part of an event pair and wait for the high part
3458 * ARGUMENTS:
3459 EventPair = Handle to the event pair
3460 * RETURNS: Status
3461 */
3462 NTSTATUS
3463 STDCALL
3464 NtSetLowWaitHighEventPair(
3465 HANDLE EventPair
3466 );
3467 NTSTATUS
3468 STDCALL
3469 ZwSetLowWaitHighEventPair(
3470 HANDLE EventPair
3471 );
3472
3473 /* NtSetLowWaitHighThread effectively invokes NtSetLowWaitHighEventPair on the
3474 * event pair of the thread.
3475 */
3476 NTSTATUS
3477 STDCALL
3478 NtSetLowWaitHighThread(
3479 VOID
3480 );
3481 /* ZwSetLowWaitHighThread effectively invokes ZwSetLowWaitHighEventPair on the
3482 * event pair of the thread.
3483 */
3484 NTSTATUS
3485 STDCALL
3486 ZwSetLowWaitHighThread(
3487 VOID
3488 );
3489
3490 /* NtSetHighWaitLowThread effectively invokes NtSetHighWaitLowEventPair on the
3491 * event pair of the thread.
3492 */
3493 NTSTATUS
3494 STDCALL
3495 NtSetHighWaitLowThread(
3496 VOID
3497 );
3498
3499 /* ZwSetHighWaitLowThread effectively invokes ZwSetHighWaitLowEventPair on the
3500 * event pair of the thread.
3501 */
3502 NTSTATUS
3503 STDCALL
3504 ZwSetHighWaitLowThread(
3505 VOID
3506 );
3507
3508 NTSTATUS
3509 STDCALL
3510 NtSetSecurityObject(
3511 IN HANDLE Handle,
3512 IN SECURITY_INFORMATION SecurityInformation,
3513 IN PSECURITY_DESCRIPTOR SecurityDescriptor
3514 );
3515
3516 NTSTATUS
3517 STDCALL
3518 ZwSetSecurityObject(
3519 IN HANDLE Handle,
3520 IN SECURITY_INFORMATION SecurityInformation,
3521 IN PSECURITY_DESCRIPTOR SecurityDescriptor
3522 );
3523
3524
3525 /*
3526 * FUNCTION: Sets a system environment variable
3527 * ARGUMENTS:
3528 * ValueName = Name of the environment variable
3529 * Value = Value of the environment variable
3530 * RETURNS: Status
3531 */
3532 NTSTATUS
3533 STDCALL
3534 NtSetSystemEnvironmentValue(
3535 IN PUNICODE_STRING VariableName,
3536 IN PUNICODE_STRING Value
3537 );
3538 NTSTATUS
3539 STDCALL
3540 ZwSetSystemEnvironmentValue(
3541 IN PUNICODE_STRING VariableName,
3542 IN PUNICODE_STRING Value
3543 );
3544 /*
3545 * FUNCTION: Sets system parameters
3546 * ARGUMENTS:
3547 * SystemInformationClass = Index to a particular set of system parameters
3548 * Can be one of the following values:
3549 *
3550 * SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT
3551 *
3552 * SystemInformation = Structure containing the parameters.
3553 * SystemInformationLength = Size of the structure.
3554 * RETURNS: Status
3555 */
3556 NTSTATUS
3557 STDCALL
3558 NtSetSystemInformation(
3559 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
3560 IN PVOID SystemInformation,
3561 IN ULONG SystemInformationLength
3562 );
3563
3564 NTSTATUS
3565 STDCALL
3566 ZwSetSystemInformation(
3567 IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
3568 IN PVOID SystemInformation,
3569 IN ULONG SystemInformationLength
3570 );
3571
3572 /*
3573 * FUNCTION: Sets the system time
3574 * ARGUMENTS:
3575 * SystemTime = Old System time
3576 * NewSystemTime = New System time
3577 * RETURNS: Status
3578 */
3579 NTSTATUS
3580 STDCALL
3581 NtSetSystemTime(
3582 IN PLARGE_INTEGER SystemTime,
3583 IN PLARGE_INTEGER NewSystemTime OPTIONAL
3584 );
3585 NTSTATUS
3586 STDCALL
3587 ZwSetSystemTime(
3588 IN PLARGE_INTEGER SystemTime,
3589 IN PLARGE_INTEGER NewSystemTime OPTIONAL
3590 );
3591
3592 /*
3593 * FUNCTION: Sets the frequency of the system timer
3594 * ARGUMENTS:
3595 * RequestedResolution =
3596 * SetOrUnset =
3597 * ActualResolution =
3598 * RETURNS: Status
3599 */
3600 NTSTATUS
3601 STDCALL
3602 NtSetTimerResolution(
3603 IN ULONG RequestedResolution,
3604 IN BOOL SetOrUnset,
3605 OUT PULONG ActualResolution
3606 );
3607 NTSTATUS
3608 STDCALL
3609 ZwSetTimerResolution(
3610 IN ULONG RequestedResolution,
3611 IN BOOL SetOrUnset,
3612 OUT PULONG ActualResolution
3613 );
3614
3615 /*
3616 * FUNCTION: Sets the value of a registry key
3617 * ARGUMENTS:
3618 * KeyHandle = Handle to a registry key
3619 * ValueName = Name of the value entry to change
3620 * TitleIndex = pointer to a structure containing the new volume information
3621 * Type = Type of the registry key. Can be one of the values:
3622 * REG_BINARY Unspecified binary data
3623 * REG_DWORD A 32 bit value
3624 * REG_DWORD_LITTLE_ENDIAN Same as REG_DWORD
3625 * REG_DWORD_BIG_ENDIAN A 32 bit value whose least significant byte is at the highest address
3626 * REG_EXPAND_SZ A zero terminated wide character string with unexpanded environment variables ( "%PATH%" )
3627 * REG_LINK A zero terminated wide character string referring to a symbolic link.
3628 * REG_MULTI_SZ A series of zero-terminated strings including a additional trailing zero
3629 * REG_NONE Unspecified type
3630 * REG_SZ A wide character string ( zero terminated )
3631 * REG_RESOURCE_LIST ??
3632 * REG_RESOURCE_REQUIREMENTS_LIST ??
3633 * REG_FULL_RESOURCE_DESCRIPTOR ??
3634 * Data = Contains the data for the registry key.
3635 * DataSize = size of the data.
3636 * RETURNS: Status
3637 */
3638 NTSTATUS
3639 STDCALL
3640 NtSetValueKey(
3641 IN HANDLE KeyHandle,
3642 IN PUNICODE_STRING ValueName,
3643 IN ULONG TitleIndex OPTIONAL,
3644 IN ULONG Type,
3645 IN PVOID Data,
3646 IN ULONG DataSize
3647 );
3648 NTSTATUS
3649 STDCALL
3650 ZwSetValueKey(
3651 IN HANDLE KeyHandle,
3652 IN PUNICODE_STRING ValueName,
3653 IN ULONG TitleIndex OPTIONAL,
3654 IN ULONG Type,
3655 IN PVOID Data,
3656 IN ULONG DataSize
3657 );
3658
3659 /*
3660 * FUNCTION: Sets the volume information.
3661 * ARGUMENTS:
3662 * FileHandle = Handle to the file
3663 * IoStatusBlock = Caller should supply storage for additional status information
3664 * VolumeInformation = pointer to a structure containing the new volume information
3665 * Length = size of the structure.
3666 * VolumeInformationClass = specifies the particular volume information to set
3667 * RETURNS: Status
3668 */
3669 NTSTATUS
3670 STDCALL
3671 NtSetVolumeInformationFile(
3672 IN HANDLE FileHandle,
3673 OUT PIO_STATUS_BLOCK IoStatusBlock,
3674 IN PVOID FsInformation,
3675 IN ULONG Length,
3676 IN FS_INFORMATION_CLASS FsInformationClass
3677 );
3678
3679 NTSTATUS
3680 STDCALL
3681 ZwSetVolumeInformationFile(
3682 IN HANDLE FileHandle,
3683 OUT PIO_STATUS_BLOCK IoStatusBlock,
3684 IN PVOID FsInformation,
3685 IN ULONG Length,
3686 IN FS_INFORMATION_CLASS FsInformationClass
3687 );
3688
3689 /*
3690 * FUNCTION: Shuts the system down
3691 * ARGUMENTS:
3692 * Action = Specifies the type of shutdown, it can be one of the following values:
3693 * ShutdownNoReboot, ShutdownReboot, ShutdownPowerOff
3694 * RETURNS: Status
3695 */
3696 NTSTATUS
3697 STDCALL
3698 NtShutdownSystem(
3699 IN SHUTDOWN_ACTION Action
3700 );
3701
3702 NTSTATUS
3703 STDCALL
3704 ZwShutdownSystem(
3705 IN SHUTDOWN_ACTION Action
3706 );
3707
3708
3709 /* --- PROFILING --- */
3710
3711 /*
3712 * FUNCTION: Starts profiling
3713 * ARGUMENTS:
3714 * ProfileHandle = Handle to the profile
3715 * RETURNS: Status
3716 */
3717
3718 NTSTATUS
3719 STDCALL
3720 NtStartProfile(
3721 HANDLE ProfileHandle
3722 );
3723
3724 NTSTATUS
3725 STDCALL
3726 ZwStartProfile(
3727 HANDLE ProfileHandle
3728 );
3729
3730 /*
3731 * FUNCTION: Stops profiling
3732 * ARGUMENTS:
3733 * ProfileHandle = Handle to the profile
3734 * RETURNS: Status
3735 */
3736
3737 NTSTATUS
3738 STDCALL
3739 NtStopProfile(
3740 HANDLE ProfileHandle
3741 );
3742
3743 NTSTATUS
3744 STDCALL
3745 ZwStopProfile(
3746 HANDLE ProfileHandle
3747 );
3748
3749 /* --- PROCESS MANAGEMENT --- */
3750
3751 //--NtSystemDebugControl
3752 /*
3753 * FUNCTION: Terminates the execution of a process.
3754 * ARGUMENTS:
3755 * ThreadHandle = Handle to the process
3756 * ExitStatus = The exit status of the process to terminate with.
3757 * REMARKS
3758 Native applications should kill themselves using this function.
3759 * RETURNS: Status
3760 */
3761 NTSTATUS
3762 STDCALL
3763 NtTerminateProcess(
3764 IN HANDLE ProcessHandle ,
3765 IN NTSTATUS ExitStatus
3766 );
3767 NTSTATUS
3768 STDCALL
3769 ZwTerminateProcess(
3770 IN HANDLE ProcessHandle ,
3771 IN NTSTATUS ExitStatus
3772 );
3773
3774 /* --- DEVICE DRIVER CONTROL --- */
3775
3776 /*
3777 * FUNCTION: Unloads a driver.
3778 * ARGUMENTS:
3779 * DriverServiceName = Name of the driver to unload
3780 * RETURNS: Status
3781 */
3782 NTSTATUS
3783 STDCALL
3784 NtUnloadDriver(
3785 IN PUNICODE_STRING DriverServiceName
3786 );
3787 NTSTATUS
3788 STDCALL
3789 ZwUnloadDriver(
3790 IN PUNICODE_STRING DriverServiceName
3791 );
3792
3793 /* --- VIRTUAL MEMORY MANAGEMENT --- */
3794
3795 /*
3796 * FUNCTION: Writes a range of virtual memory
3797 * ARGUMENTS:
3798 * ProcessHandle = The handle to the process owning the address space.
3799 * BaseAddress = The points to the address to write to
3800 * Buffer = Pointer to the buffer to write
3801 * NumberOfBytesToWrite = Offset to the upper boundary to write
3802 * NumberOfBytesWritten = Total bytes written
3803 * REMARKS:
3804 * This function maps to the win32 WriteProcessMemory
3805 * RETURNS: Status
3806 */
3807 NTSTATUS
3808 STDCALL
3809 NtWriteVirtualMemory(
3810 IN HANDLE ProcessHandle,
3811 IN PVOID BaseAddress,
3812 IN PVOID Buffer,
3813 IN ULONG NumberOfBytesToWrite,
3814 OUT PULONG NumberOfBytesWritten
3815 );
3816
3817 NTSTATUS
3818 STDCALL
3819 ZwWriteVirtualMemory(
3820 IN HANDLE ProcessHandle,
3821 IN PVOID BaseAddress,
3822 IN PVOID Buffer,
3823 IN ULONG NumberOfBytesToWrite,
3824 OUT PULONG NumberOfBytesWritten
3825 );
3826
3827 /*
3828 * FUNCTION: Unmaps a piece of virtual memory backed by a file.
3829 * ARGUMENTS:
3830 * ProcessHandle = Handle to the process
3831 * BaseAddress = The address where the mapping begins
3832 * REMARK:
3833 This procedure maps to the win32 UnMapViewOfFile
3834 * RETURNS: Status
3835 */
3836 NTSTATUS
3837 STDCALL
3838 NtUnmapViewOfSection(
3839 IN HANDLE ProcessHandle,
3840 IN PVOID BaseAddress
3841 );
3842 NTSTATUS
3843 STDCALL
3844 ZwUnmapViewOfSection(
3845 IN HANDLE ProcessHandle,
3846 IN PVOID BaseAddress
3847 );
3848
3849 /* --- OBJECT SYNCHRONIZATION --- */
3850
3851 /*
3852 * FUNCTION: Signals an object and wait for an other one.
3853 * ARGUMENTS:
3854 * SignalObject = Handle to the object that should be signaled
3855 * WaitObject = Handle to the object that should be waited for
3856 * Alertable = True if the wait is alertable
3857 * Time = The time to wait
3858 * RETURNS: Status
3859 */
3860 NTSTATUS
3861 STDCALL
3862 NtSignalAndWaitForSingleObject(
3863 IN HANDLE SignalObject,
3864 IN HANDLE WaitObject,
3865 IN BOOLEAN Alertable,
3866 IN PLARGE_INTEGER Time
3867 );
3868
3869 NTSTATUS
3870 STDCALL
3871 NtSignalAndWaitForSingleObject(
3872 IN HANDLE SignalObject,
3873 IN HANDLE WaitObject,
3874 IN BOOLEAN Alertable,
3875 IN PLARGE_INTEGER Time
3876 );
3877
3878 /*
3879 * FUNCTION: Waits for an object to become signalled.
3880 * ARGUMENTS:
3881 * Object = The object handle
3882 * Alertable = If true the wait is alertable.
3883 * Time = The maximum wait time.
3884 * REMARKS:
3885 * This function maps to the win32 WaitForSingleObjectEx.
3886 * RETURNS: Status
3887 */
3888 NTSTATUS
3889 STDCALL
3890 NtWaitForSingleObject (
3891 IN HANDLE Object,
3892 IN BOOLEAN Alertable,
3893 IN PLARGE_INTEGER Time
3894 );
3895
3896 NTSTATUS
3897 STDCALL
3898 ZwWaitForSingleObject (
3899 IN HANDLE Object,
3900 IN BOOLEAN Alertable,
3901 IN PLARGE_INTEGER Time
3902 );
3903
3904 /* --- EVENT PAIR OBJECT --- */
3905
3906 /*
3907 * FUNCTION: Waits for the high part of an eventpair to become signalled
3908 * ARGUMENTS:
3909 * EventPairHandle = Handle to the event pair.
3910 * RETURNS: Status
3911 */
3912
3913 NTSTATUS
3914 STDCALL
3915 NtWaitHighEventPair(
3916 IN HANDLE EventPairHandle
3917 );
3918
3919 NTSTATUS
3920 STDCALL
3921 ZwWaitHighEventPair(
3922 IN HANDLE EventPairHandle
3923 );
3924
3925 /*
3926 * FUNCTION: Waits for the low part of an eventpair to become signalled
3927 * ARGUMENTS:
3928 * EventPairHandle = Handle to the event pair.
3929 * RETURNS: Status
3930 */
3931 NTSTATUS
3932 STDCALL
3933 NtWaitLowEventPair(
3934 IN HANDLE EventPairHandle
3935 );
3936
3937 NTSTATUS
3938 STDCALL
3939 ZwWaitLowEventPair(
3940 IN HANDLE EventPairHandle
3941 );
3942
3943 /* --- FILE MANAGEMENT --- */
3944
3945 /*
3946 * FUNCTION: Unlocks a range of bytes in a file.
3947 * ARGUMENTS:
3948 * FileHandle = Handle to the file
3949 * IoStatusBlock = Caller should supply storage for a structure containing
3950 * the completion status and information about the requested unlock operation.
3951 The information field is set to the number of bytes unlocked.
3952 * ByteOffset = Offset to start the range of bytes to unlock
3953 * Length = Number of bytes to unlock.
3954 * Key = Special value to enable other threads to unlock a file than the
3955 thread that locked the file. The key supplied must match with the one obtained
3956 in a previous call to NtLockFile.
3957 * REMARK:
3958 This procedure maps to the win32 procedure UnlockFileEx. STATUS_PENDING is returned if the lock could
3959 not be obtained immediately, the device queue is busy and the IRP is queued.
3960 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PENDING | STATUS_ACCESS_DENIED | STATUS_INSUFFICIENT_RESOURCES |
3961 STATUS_INVALID_PARAMETER | STATUS_INVALID_DEVICE_REQUEST | STATUS_RANGE_NOT_LOCKED ]
3962 */
3963 NTSTATUS
3964 STDCALL
3965 NtUnlockFile(
3966 IN HANDLE FileHandle,
3967 OUT PIO_STATUS_BLOCK IoStatusBlock,
3968 IN PLARGE_INTEGER ByteOffset,
3969 IN PLARGE_INTEGER Lenght,
3970 OUT PULONG Key OPTIONAL
3971 );
3972 NTSTATUS
3973 STDCALL
3974 ZwUnlockFile(
3975 IN HANDLE FileHandle,
3976 OUT PIO_STATUS_BLOCK IoStatusBlock,
3977 IN PLARGE_INTEGER ByteOffset,
3978 IN PLARGE_INTEGER Lenght,
3979 OUT PULONG Key OPTIONAL
3980 );
3981
3982 /*
3983 * FUNCTION: Writes data to a file
3984 * ARGUMENTS:
3985 * FileHandle = The handle a file ( from NtCreateFile )
3986 * Event = Specifies a event that will become signalled when the write operation completes.
3987 * ApcRoutine = Asynchroneous Procedure Callback [ Should not be used by device drivers ]
3988 * ApcContext = Argument to the Apc Routine
3989 * IoStatusBlock = Caller should supply storage for a structure containing the completion status and information about the requested write operation.
3990 * Buffer = Caller should supply storage for a buffer that will contain the information to be written to file.
3991 * Length = Size in bytest of the buffer
3992 * ByteOffset = Points to a file offset. If a combination of Length and BytesOfSet is past the end-of-file mark the file will be enlarged.
3993 * BytesOffset is ignored if the file is created with FILE_APPEND_DATA in the DesiredAccess. BytesOffset is also ignored if
3994 * the file is created with CreateOptions flags FILE_SYNCHRONOUS_IO_ALERT or FILE_SYNCHRONOUS_IO_NONALERT set, in that case a offset
3995 * should be created by specifying FILE_USE_FILE_POINTER_POSITION.
3996 * Key = Unused
3997 * REMARKS:
3998 * This function maps to the win32 WriteFile.
3999 * Callers to NtWriteFile should run at IRQL PASSIVE_LEVEL.
4000 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PENDING | STATUS_ACCESS_DENIED | STATUS_INSUFFICIENT_RESOURCES
4001 STATUS_INVALID_PARAMETER | STATUS_INVALID_DEVICE_REQUEST | STATUS_FILE_LOCK_CONFLICT ]
4002 */
4003 NTSTATUS
4004 STDCALL
4005 NtWriteFile(
4006 IN HANDLE FileHandle,
4007 IN HANDLE Event OPTIONAL,
4008 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
4009 IN PVOID ApcContext OPTIONAL,
4010 OUT PIO_STATUS_BLOCK IoStatusBlock,
4011 IN PVOID Buffer,
4012 IN ULONG Length,
4013 IN PLARGE_INTEGER ByteOffset,
4014 IN PULONG Key OPTIONAL
4015 );
4016
4017 NTSTATUS
4018 STDCALL
4019 ZwWriteFile(
4020 IN HANDLE FileHandle,
4021 IN HANDLE Event OPTIONAL,
4022 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
4023 IN PVOID ApcContext OPTIONAL,
4024 OUT PIO_STATUS_BLOCK IoStatusBlock,
4025 IN PVOID Buffer,
4026 IN ULONG Length,
4027 IN PLARGE_INTEGER ByteOffset ,
4028 IN PULONG Key OPTIONAL
4029 );
4030
4031 /*
4032 * FUNCTION: Writes a file
4033 * ARGUMENTS:
4034 * FileHandle = The handle of the file
4035 * Event =
4036 * ApcRoutine = Asynchroneous Procedure Callback [ Should not be used by device drivers ]
4037 * ApcContext = Argument to the Apc Routine
4038 * IoStatusBlock = Caller should supply storage for a structure containing the completion status and information about the requested write operation.
4039 * BufferDescription = Caller should supply storage for a buffer that will contain the information to be written to file.
4040 * BufferLength = Size in bytest of the buffer
4041 * ByteOffset = Points to a file offset. If a combination of Length and BytesOfSet is past the end-of-file mark the file will be enlarged.
4042 * BytesOffset is ignored if the file is created with FILE_APPEND_DATA in the DesiredAccess. BytesOffset is also ignored if
4043 * the file is created with CreateOptions flags FILE_SYNCHRONOUS_IO_ALERT or FILE_SYNCHRONOUS_IO_NONALERT set, in that case a offset
4044 * should be created by specifying FILE_USE_FILE_POINTER_POSITION. Use FILE_WRITE_TO_END_OF_FILE to write to the EOF.
4045 * Key = If a matching key [ a key provided at NtLockFile ] is provided the write operation will continue even if a byte range is locked.
4046 * REMARKS:
4047 * This function maps to the win32 WriteFile.
4048 * Callers to NtWriteFile should run at IRQL PASSIVE_LEVEL.
4049 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PENDING | STATUS_ACCESS_DENIED | STATUS_INSUFFICIENT_RESOURCES
4050 STATUS_INVALID_PARAMETER | STATUS_INVALID_DEVICE_REQUEST | STATUS_FILE_LOCK_CONFLICT ]
4051 */
4052
4053 NTSTATUS
4054 STDCALL
4055 NtWriteFileGather(
4056 IN HANDLE FileHandle,
4057 IN HANDLE Event OPTIONAL,
4058 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
4059 IN PVOID ApcContext OPTIONAL,
4060 OUT PIO_STATUS_BLOCK IoStatusBlock,
4061 IN FILE_SEGMENT_ELEMENT BufferDescription[],
4062 IN ULONG BufferLength,
4063 IN PLARGE_INTEGER ByteOffset,
4064 IN PULONG Key OPTIONAL
4065 );
4066
4067 NTSTATUS
4068 STDCALL
4069 ZwWriteFileGather(
4070 IN HANDLE FileHandle,
4071 IN HANDLE Event OPTIONAL,
4072 IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
4073 IN PVOID ApcContext OPTIONAL,
4074 OUT PIO_STATUS_BLOCK IoStatusBlock,
4075 IN FILE_SEGMENT_ELEMENT BufferDescription[],
4076 IN ULONG BufferLength,
4077 IN PLARGE_INTEGER ByteOffset,
4078 IN PULONG Key OPTIONAL
4079 );
4080
4081
4082 /* --- THREAD MANAGEMENT --- */
4083
4084 /*
4085 * FUNCTION: Increments a thread's resume count
4086 * ARGUMENTS:
4087 * ThreadHandle = Handle to the thread that should be resumed
4088 * PreviousSuspendCount = The resulting/previous suspend count.
4089 * REMARK:
4090 * A thread will be suspended if its suspend count is greater than 0. This procedure maps to
4091 * the win32 SuspendThread function. ( documentation about the the suspend count can be found here aswell )
4092 * The suspend count is not increased if it is greater than MAXIMUM_SUSPEND_COUNT.
4093 * RETURNS: Status
4094 */
4095 NTSTATUS
4096 STDCALL
4097 NtSuspendThread(
4098 IN HANDLE ThreadHandle,
4099 IN PULONG PreviousSuspendCount
4100 );
4101
4102 NTSTATUS
4103 STDCALL
4104 ZwSuspendThread(
4105 IN HANDLE ThreadHandle,
4106 IN PULONG PreviousSuspendCount
4107 );
4108
4109 /*
4110 * FUNCTION: Terminates the execution of a thread.
4111 * ARGUMENTS:
4112 * ThreadHandle = Handle to the thread
4113 * ExitStatus = The exit status of the thread to terminate with.
4114 * RETURNS: Status
4115 */
4116 NTSTATUS
4117 STDCALL
4118 NtTerminateThread(
4119 IN HANDLE ThreadHandle ,
4120 IN NTSTATUS ExitStatus
4121 );
4122 NTSTATUS
4123 STDCALL
4124 ZwTerminateThread(
4125 IN HANDLE ThreadHandle ,
4126 IN NTSTATUS ExitStatus
4127 );
4128 /*
4129 * FUNCTION: Tests to see if there are any pending alerts for the calling thread
4130 * RETURNS: Status
4131 */
4132 NTSTATUS
4133 STDCALL
4134 NtTestAlert(
4135 VOID
4136 );
4137 NTSTATUS
4138 STDCALL
4139 ZwTestAlert(
4140 VOID
4141 );
4142
4143 /*
4144 * FUNCTION: Yields the callers thread.
4145 * RETURNS: Status
4146 */
4147 NTSTATUS
4148 STDCALL
4149 NtYieldExecution(
4150 VOID
4151 );
4152
4153 NTSTATUS
4154 STDCALL
4155 ZwYieldExecution(
4156 VOID
4157 );
4158
4159 /* --- PLUG AND PLAY --- */
4160
4161 NTSTATUS
4162 STDCALL
4163 NtPlugPlayControl (
4164 VOID
4165 );
4166
4167 NTSTATUS
4168 STDCALL
4169 NtGetPlugPlayEvent (
4170 VOID
4171 );
4172
4173 /* --- POWER MANAGEMENT --- */
4174
4175 NTSTATUS STDCALL
4176 NtSetSystemPowerState(IN POWER_ACTION SystemAction,
4177 IN SYSTEM_POWER_STATE MinSystemState,
4178 IN ULONG Flags);
4179
4180 /* --- DEBUG SUBSYSTEM --- */
4181
4182 NTSTATUS STDCALL
4183 NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
4184 PVOID InputBuffer,
4185 ULONG InputBufferLength,
4186 PVOID OutputBuffer,
4187 ULONG OutputBufferLength,
4188 PULONG ReturnLength);
4189
4190 /* --- VIRTUAL DOS MACHINE (VDM) --- */
4191
4192 NTSTATUS
4193 STDCALL
4194 NtVdmControl (ULONG ControlCode, PVOID ControlData);
4195
4196
4197 /* --- WIN32 --- */
4198
4199 NTSTATUS STDCALL
4200 NtW32Call(IN ULONG RoutineIndex,
4201 IN PVOID Argument,
4202 IN ULONG ArgumentLength,
4203 OUT PVOID* Result OPTIONAL,
4204 OUT PULONG ResultLength OPTIONAL);
4205
4206 /* --- CHANNELS --- */
4207
4208 NTSTATUS
4209 STDCALL
4210 NtCreateChannel (
4211 VOID
4212 );
4213
4214 NTSTATUS
4215 STDCALL
4216 NtListenChannel (
4217 VOID
4218 );
4219
4220 NTSTATUS
4221 STDCALL
4222 NtOpenChannel (
4223 VOID
4224 );
4225
4226 NTSTATUS
4227 STDCALL
4228 NtReplyWaitSendChannel (
4229 VOID
4230 );
4231
4232 NTSTATUS
4233 STDCALL
4234 NtSendWaitReplyChannel (
4235 VOID
4236 );
4237
4238 NTSTATUS
4239 STDCALL
4240 NtSetContextChannel (
4241 VOID
4242 );
4243
4244 /* --- MISCELLANEA --- */
4245
4246 //NTSTATUS STDCALL NtSetLdtEntries(VOID);
4247 NTSTATUS
4248 STDCALL
4249 NtSetLdtEntries (ULONG Selector1,
4250 LDT_ENTRY LdtEntry1,
4251 ULONG Selector2,
4252 LDT_ENTRY LdtEntry2);
4253
4254 NTSTATUS
4255 STDCALL
4256 NtQueryOleDirectoryFile (
4257 VOID
4258 );
4259
4260 /*
4261 * FUNCTION: Checks a clients access rights to a object
4262 * ARGUMENTS:
4263 * SecurityDescriptor = Security information against which the access is checked
4264 * ClientToken = Represents a client
4265 * DesiredAcces =
4266 * GenericMapping =
4267 * PrivilegeSet =
4268 * ReturnLength = Bytes written
4269 * GrantedAccess =
4270 * AccessStatus = Indicates if the ClientToken allows the requested access
4271 * REMARKS: The arguments map to the win32 AccessCheck
4272 * RETURNS: Status
4273 */
4274
4275 NTSTATUS
4276 STDCALL
4277 NtAccessCheck(
4278 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
4279 IN HANDLE ClientToken,
4280 IN ACCESS_MASK DesiredAcces,
4281 IN PGENERIC_MAPPING GenericMapping,
4282 OUT PPRIVILEGE_SET PrivilegeSet,
4283 OUT PULONG ReturnLength,
4284 OUT PULONG GrantedAccess,
4285 OUT PBOOLEAN AccessStatus
4286 );
4287
4288 NTSTATUS
4289 STDCALL
4290 ZwAccessCheck(
4291 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
4292 IN HANDLE ClientToken,
4293 IN ACCESS_MASK DesiredAcces,
4294 IN PGENERIC_MAPPING GenericMapping,
4295 OUT PPRIVILEGE_SET PrivilegeSet,
4296 OUT PULONG ReturnLength,
4297 OUT PULONG GrantedAccess,
4298 OUT PBOOLEAN AccessStatus
4299 );
4300
4301 NTSTATUS
4302 STDCALL
4303 RtlOpenCurrentUser(
4304 IN ACCESS_MASK DesiredAccess,
4305 OUT PHANDLE KeyHandle);
4306
4307 /*
4308 * FUNCTION: Checks a clients access rights to a object and issues a audit a alarm. ( it logs the access )
4309 * ARGUMENTS:
4310 * SubsystemName = Specifies the name of the subsystem, can be "WIN32" or "DEBUG"
4311 * ObjectHandle =
4312 * ObjectTypeName =
4313 * ObjectName =
4314 * SecurityDescriptor =
4315 * DesiredAcces =
4316 * GenericMapping =
4317 * ObjectCreation =
4318 * GrantedAccess =
4319 * AccessStatus =
4320 * GenerateOnClose =
4321 * REMARKS: The arguments map to the win32 AccessCheck
4322 * RETURNS: Status
4323 */
4324
4325 NTSTATUS
4326 STDCALL
4327 NtAccessCheckAndAuditAlarm(
4328 IN PUNICODE_STRING SubsystemName,
4329 IN PHANDLE ObjectHandle,
4330 IN PUNICODE_STRING ObjectTypeName,
4331 IN PUNICODE_STRING ObjectName,
4332 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
4333 IN ACCESS_MASK DesiredAccess,
4334 IN PGENERIC_MAPPING GenericMapping,
4335 IN BOOLEAN ObjectCreation,
4336 OUT PACCESS_MASK GrantedAccess,
4337 OUT PNTSTATUS AccessStatus,
4338 OUT PBOOLEAN GenerateOnClose
4339 );
4340
4341 /*
4342 * FUNCTION: Cancels a timer
4343 * ARGUMENTS:
4344 * TimerHandle = Handle to the timer
4345 * CurrentState = Specifies the state of the timer when cancelled.
4346 * REMARKS:
4347 * The arguments to this function map to the function CancelWaitableTimer.
4348 * RETURNS: Status
4349 */
4350 NTSTATUS
4351 STDCALL
4352 NtCancelTimer(
4353 IN HANDLE TimerHandle,
4354 OUT PBOOLEAN CurrentState OPTIONAL
4355 );
4356
4357 /*
4358 * FUNCTION: Continues a thread with the specified context
4359 * ARGUMENTS:
4360 * Context = Specifies the processor context
4361 * IrqLevel = Specifies the Interupt Request Level to continue with. Can
4362 * be PASSIVE_LEVEL or APC_LEVEL
4363 * REMARKS
4364 * NtContinue can be used to continue after an exception or apc.
4365 * RETURNS: Status
4366 */
4367 //FIXME This function might need another parameter
4368
4369 NTSTATUS
4370 STDCALL
4371 NtContinue(
4372 IN PCONTEXT Context,
4373 IN BOOLEAN TestAlert
4374 );
4375
4376 /*
4377 * FUNCTION: Creates a paging file.
4378 * ARGUMENTS:
4379 * FileName = Name of the pagefile
4380 * InitialSize = Specifies the initial size in bytes
4381 * MaximumSize = Specifies the maximum size in bytes
4382 * Reserved = Reserved for future use
4383 * RETURNS: Status
4384 */
4385 NTSTATUS
4386 STDCALL
4387 NtCreatePagingFile(
4388 IN PUNICODE_STRING FileName,
4389 IN PLARGE_INTEGER InitialSize,
4390 IN PLARGE_INTEGER MaxiumSize,
4391 IN ULONG Reserved
4392 );
4393
4394
4395 /*
4396 * FUNCTION: Creates a profile
4397 * ARGUMENTS:
4398 * ProfileHandle (OUT) = Caller supplied storage for the resulting handle
4399 * ObjectAttribute = Initialized attributes for the object
4400 * ImageBase = Start address of executable image
4401 * ImageSize = Size of the image
4402 * Granularity = Bucket size
4403 * Buffer = Caller supplies buffer for profiling info
4404 * ProfilingSize = Buffer size
4405 * ClockSource = Specify 0 / FALSE ??
4406 * ProcessorMask = A value of -1 indicates disables per processor profiling,
4407 otherwise bit set for the processor to profile.
4408 * REMARKS:
4409 * This function maps to the win32 CreateProcess.
4410 * RETURNS: Status
4411 */
4412
4413 NTSTATUS
4414 STDCALL
4415 NtCreateProfile(OUT PHANDLE ProfileHandle,
4416 IN HANDLE ProcessHandle,
4417 IN PVOID ImageBase,
4418 IN ULONG ImageSize,
4419 IN ULONG Granularity,
4420 OUT PULONG Buffer,
4421 IN ULONG ProfilingSize,
4422 IN KPROFILE_SOURCE Source,
4423 IN ULONG ProcessorMask);
4424
4425 /*
4426 * FUNCTION: Creates a user mode thread
4427 * ARGUMENTS:
4428 * ThreadHandle (OUT) = Caller supplied storage for the resulting handle
4429 * DesiredAccess = Specifies the allowed or desired access to the thread.
4430 * ObjectAttributes = Initialized attributes for the object.
4431 * ProcessHandle = Handle to the threads parent process.
4432 * ClientId (OUT) = Caller supplies storage for returned process id and thread id.
4433 * ThreadContext = Initial processor context for the thread.
4434 * InitialTeb = Initial user mode stack context for the thread.
4435 * CreateSuspended = Specifies if the thread is ready for scheduling
4436 * REMARKS:
4437 * This function maps to the win32 function CreateThread.
4438 * RETURNS: Status
4439 */
4440 NTSTATUS
4441 STDCALL
4442 NtCreateThread(
4443 OUT PHANDLE ThreadHandle,
4444 IN ACCESS_MASK DesiredAccess,
4445 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
4446 IN HANDLE ProcessHandle,
4447 OUT PCLIENT_ID ClientId,
4448 IN PCONTEXT ThreadContext,
4449 IN PUSER_STACK UserStack,
4450 IN BOOLEAN CreateSuspended
4451 );
4452
4453 /*
4454 * FUNCTION: Delays the execution of the calling thread.
4455 * ARGUMENTS:
4456 * Alertable = If TRUE the thread is alertable during is wait period
4457 * Interval = Specifies the interval to wait.
4458 * RETURNS: Status
4459 */
4460
4461 NTSTATUS
4462 STDCALL
4463 NtDelayExecution(
4464 IN ULONG Alertable,
4465 IN TIME *Interval
4466 );
4467
4468 /*
4469 * FUNCTION: Extends a section
4470 * ARGUMENTS:
4471 * SectionHandle = Handle to the section
4472 * NewMaximumSize = Adjusted size
4473 * RETURNS: Status
4474 */
4475 NTSTATUS
4476 STDCALL
4477 NtExtendSection(
4478 IN HANDLE SectionHandle,
4479 IN ULONG NewMaximumSize
4480 );
4481
4482 /*
4483 * FUNCTION: Flushes a the processors instruction cache
4484 * ARGUMENTS:
4485 * ProcessHandle = Points to the process owning the cache
4486 * BaseAddress = // might this be a image address ????
4487 * NumberOfBytesToFlush =
4488 * RETURNS: Status
4489 * REMARKS:
4490 * This funciton is used by debuggers
4491 */
4492 NTSTATUS
4493 STDCALL
4494 NtFlushInstructionCache(
4495 IN HANDLE ProcessHandle,
4496 IN PVOID BaseAddress,
4497 IN UINT NumberOfBytesToFlush
4498 );
4499
4500 /*
4501 * FUNCTION: Flushes virtual memory to file
4502 * ARGUMENTS:
4503 * ProcessHandle = Points to the process that allocated the virtual memory
4504 * BaseAddress = Points to the memory address
4505 * NumberOfBytesToFlush = Limits the range to flush,
4506 * NumberOfBytesFlushed = Actual number of bytes flushed
4507 * RETURNS: Status
4508 * REMARKS:
4509 * Check return status on STATUS_NOT_MAPPED_DATA
4510 */
4511 NTSTATUS
4512 STDCALL
4513 NtFlushVirtualMemory(
4514 IN HANDLE ProcessHandle,
4515 IN PVOID BaseAddress,
4516 IN ULONG NumberOfBytesToFlush,
4517 OUT PULONG NumberOfBytesFlushed OPTIONAL
4518 );
4519
4520 /*
4521 * FUNCTION: Retrieves the uptime of the system
4522 * ARGUMENTS:
4523 * UpTime = Number of clock ticks since boot.
4524 * RETURNS: Status
4525 */
4526 NTSTATUS
4527 STDCALL
4528 NtGetTickCount(
4529 PULONG UpTime
4530 );
4531
4532 /*
4533 * FUNCTION: Loads a registry key.
4534 * ARGUMENTS:
4535 * KeyObjectAttributes = Key to be loaded
4536 * FileObjectAttributes = File to load the key from
4537 * REMARK:
4538 * This procedure maps to the win32 procedure RegLoadKey
4539 * RETURNS: Status
4540 */
4541 NTSTATUS
4542 STDCALL
4543 NtLoadKey(
4544 IN POBJECT_ATTRIBUTES KeyObjectAttributes,
4545 IN POBJECT_ATTRIBUTES FileObjectAttributes
4546 );
4547
4548
4549 /*
4550 * FUNCTION: Locks a range of virtual memory.
4551 * ARGUMENTS:
4552 * ProcessHandle = Handle to the process
4553 * BaseAddress = Lower boundary of the range of bytes to lock.
4554 * NumberOfBytesLock = Offset to the upper boundary.
4555 * NumberOfBytesLocked (OUT) = Number of bytes actually locked.
4556 * REMARK:
4557 This procedure maps to the win32 procedure VirtualLock.
4558 * RETURNS: Status [STATUS_SUCCESS | STATUS_WAS_LOCKED ]
4559 */
4560 NTSTATUS
4561 STDCALL
4562 NtLockVirtualMemory(
4563 HANDLE ProcessHandle,
4564 PVOID BaseAddress,
4565 ULONG NumberOfBytesToLock,
4566 PULONG NumberOfBytesLocked
4567 );
4568
4569 NTSTATUS
4570 STDCALL
4571 NtOpenObjectAuditAlarm(
4572 IN PUNICODE_STRING SubsystemName,
4573 IN PVOID HandleId,
4574 IN PUNICODE_STRING ObjectTypeName,
4575 IN PUNICODE_STRING ObjectName,
4576 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
4577 IN HANDLE ClientToken,
4578 IN ULONG DesiredAccess,
4579 IN ULONG GrantedAccess,
4580 IN PPRIVILEGE_SET Privileges,
4581 IN BOOLEAN ObjectCreation,
4582 IN BOOLEAN AccessGranted,
4583 OUT PBOOLEAN GenerateOnClose
4584 );
4585
4586 /*
4587 * FUNCTION: Set the access protection of a range of virtual memory
4588 * ARGUMENTS:
4589 * ProcessHandle = Handle to process owning the virtual address space
4590 * BaseAddress = Start address
4591 * NumberOfBytesToProtect = Delimits the range of virtual memory
4592 * for which the new access protection holds
4593 * NewAccessProtection = The new access proctection for the pages
4594 * OldAccessProtection = Caller should supply storage for the old
4595 * access protection
4596 *
4597 * REMARKS:
4598 * The function maps to the win32 VirtualProtectEx
4599 * RETURNS: Status
4600 */
4601 NTSTATUS
4602 STDCALL
4603 NtProtectVirtualMemory(
4604 IN HANDLE ProcessHandle,
4605 IN PVOID BaseAddress,
4606 IN ULONG NumberOfBytesToProtect,
4607 IN ULONG NewAccessProtection,
4608 OUT PULONG OldAccessProtection
4609 );
4610
4611 /*
4612 * FUNCTION: Query information about the content of a directory object
4613 * ARGUMENTS:
4614 DirectoryHandle =
4615 Buffer = Buffer must be large enough to hold the name strings too
4616 ReturnSingleEntry = If TRUE :return the index of the next object in this directory in ObjectIndex
4617 If FALSE: return the number of objects in this directory in ObjectIndex
4618 RestartScan = If TRUE: ignore input value of ObjectIndex always start at index 0
4619 If FALSE use input value of ObjectIndex
4620 Context = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
4621 ReturnLength = Actual size of the ObjectIndex ???
4622 * RETURNS: Status
4623 */
4624 NTSTATUS
4625 STDCALL
4626 NtQueryDirectoryObject(
4627 IN HANDLE DirectoryHandle,
4628 OUT PVOID Buffer,
4629 IN ULONG BufferLength,
4630 IN BOOLEAN ReturnSingleEntry,
4631 IN BOOLEAN RestartScan,
4632 IN OUT PULONG Context,
4633 OUT PULONG ReturnLength OPTIONAL
4634 );
4635
4636 /*
4637 * FUNCTION: Query the interval and the clocksource for profiling
4638 * ARGUMENTS:
4639 Interval =
4640 ClockSource =
4641 * RETURNS: Status
4642 */
4643 NTSTATUS
4644 STDCALL
4645 NtQueryIntervalProfile(
4646 OUT PULONG Interval,
4647 OUT KPROFILE_SOURCE ClockSource
4648 );
4649
4650 /*
4651 * FUNCTION: Queries the information of a section object.
4652 * ARGUMENTS:
4653 * SectionHandle = Handle to the section link object
4654 * SectionInformationClass = Index to a certain information structure
4655 * SectionInformation (OUT)= Caller supplies storage for resulting information
4656 * Length = Size of the supplied storage
4657 * ResultLength = Data written
4658 * RETURNS: Status
4659 *
4660 */
4661 NTSTATUS
4662 STDCALL
4663 NtQuerySection(
4664 IN HANDLE SectionHandle,
4665 IN CINT SectionInformationClass,
4666 OUT PVOID SectionInformation,
4667 IN ULONG Length,
4668 OUT PULONG ResultLength
4669 );
4670
4671 /*
4672 * FUNCTION: Queries the virtual memory information.
4673 * ARGUMENTS:
4674 ProcessHandle = Process owning the virtual address space
4675 BaseAddress = Points to the page where the information is queried for.
4676 * VirtualMemoryInformationClass = Index to a certain information structure
4677
4678 MemoryBasicInformation MEMORY_BASIC_INFORMATION
4679
4680 * VirtualMemoryInformation = caller supplies storage for the information structure
4681 * Length = size of the structure
4682 ResultLength = Data written
4683 * RETURNS: Status
4684 *
4685 */
4686
4687 NTSTATUS
4688 STDCALL
4689 NtQueryVirtualMemory(
4690 IN HANDLE ProcessHandle,
4691 IN PVOID Address,
4692 IN IN CINT VirtualMemoryInformationClass,
4693 OUT PVOID VirtualMemoryInformation,
4694 IN ULONG Length,
4695 OUT PULONG ResultLength
4696 );
4697
4698 /*
4699 * FUNCTION: Raises a hard error (stops the system)
4700 * ARGUMENTS:
4701 * Status = Status code of the hard error
4702 * Unknown2 = ??
4703 * Unknown3 = ??
4704 * Unknown4 = ??
4705 * Unknown5 = ??
4706 * Unknown6 = ??
4707 * RETURNS: Status
4708 *
4709 */
4710
4711 NTSTATUS
4712 STDCALL
4713 NtRaiseHardError(
4714 IN NTSTATUS Status,
4715 ULONG Unknown2,
4716 ULONG Unknown3,
4717 ULONG Unknown4,
4718 ULONG Unknown5,
4719 ULONG Unknown6
4720 );
4721
4722 /*
4723 * FUNCTION: Sets the information of a registry key.
4724 * ARGUMENTS:
4725 * KeyHandle = Handle to the registry key
4726 * KeyInformationClass = Index to the a certain information structure.
4727 Can be one of the following values:
4728
4729 * KeyWriteTimeInformation KEY_WRITE_TIME_INFORMATION
4730
4731 KeyInformation = Storage for the new information
4732 * KeyInformationLength = Size of the information strucure
4733 * RETURNS: Status
4734 */
4735
4736 NTSTATUS
4737 STDCALL
4738 NtSetInformationKey(
4739 IN HANDLE KeyHandle,
4740 IN CINT KeyInformationClass,
4741 IN PVOID KeyInformation,
4742 IN ULONG KeyInformationLength
4743 );
4744
4745 /*
4746 * FUNCTION: Changes a set of object specific parameters
4747 * ARGUMENTS:
4748 * ObjectHandle =
4749 * ObjectInformationClass = Index to the set of parameters to change.
4750
4751
4752 ObjectBasicInformation
4753 ObjectTypeInformation OBJECT_TYPE_INFORMATION
4754 ObjectAllInformation
4755 ObjectDataInformation OBJECT_DATA_INFORMATION
4756 ObjectNameInformation OBJECT_NAME_INFORMATION
4757
4758
4759 * ObjectInformation = Caller supplies storage for parameters to set.
4760 * Length = Size of the storage supplied
4761 * RETURNS: Status
4762 */
4763 NTSTATUS
4764 STDCALL
4765 NtSetInformationObject(
4766 IN HANDLE ObjectHandle,
4767 IN CINT ObjectInformationClass,
4768 IN PVOID ObjectInformation,
4769 IN ULONG Length
4770 );
4771
4772 /*
4773 * FUNCTION: Sets the characteristics of a timer
4774 * ARGUMENTS:
4775 * TimerHandle = Handle to the timer
4776 * DueTime = Time before the timer becomes signalled for the first time.
4777 * TimerApcRoutine = Completion routine can be called on time completion
4778 * TimerContext = Argument to the completion routine
4779 * Resume = Specifies if the timer should repeated after completing one cycle
4780 * Period = Cycle of the timer
4781 * REMARKS: This routine maps to the win32 SetWaitableTimer.
4782 * RETURNS: Status
4783 */
4784 NTSTATUS
4785 STDCALL
4786 NtSetTimer(
4787 IN HANDLE TimerHandle,
4788 IN PLARGE_INTEGER DueTime,
4789 IN PTIMERAPCROUTINE TimerApcRoutine,
4790 IN PVOID TimerContext,
4791 IN BOOL WakeTimer,
4792 IN ULONG Period OPTIONAL,
4793 OUT PBOOLEAN PreviousState OPTIONAL
4794 );
4795
4796 /*
4797 * FUNCTION: Unloads a registry key.
4798 * ARGUMENTS:
4799 * KeyHandle = Handle to the registry key
4800 * REMARK:
4801 * This procedure maps to the win32 procedure RegUnloadKey
4802 * RETURNS: Status
4803 */
4804 NTSTATUS
4805 STDCALL
4806 NtUnloadKey(
4807 IN POBJECT_ATTRIBUTES KeyObjectAttributes
4808 );
4809
4810 /*
4811 * FUNCTION: Unlocks a range of virtual memory.
4812 * ARGUMENTS:
4813 * ProcessHandle = Handle to the process
4814 * BaseAddress = Lower boundary of the range of bytes to unlock.
4815 * NumberOfBytesToUnlock = Offset to the upper boundary to unlock.
4816 * NumberOfBytesUnlocked (OUT) = Number of bytes actually unlocked.
4817 * REMARK:
4818 This procedure maps to the win32 procedure VirtualUnlock
4819 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PAGE_WAS_ULOCKED ]
4820 */
4821 NTSTATUS
4822 STDCALL
4823 NtUnlockVirtualMemory(
4824 IN HANDLE ProcessHandle,
4825 IN PVOID BaseAddress,
4826 IN ULONG NumberOfBytesToUnlock,
4827 OUT PULONG NumberOfBytesUnlocked OPTIONAL
4828 );
4829
4830 /*
4831 * FUNCTION: Waits for multiple objects to become signalled.
4832 * ARGUMENTS:
4833 * Count = The number of objects
4834 * Object = The array of object handles
4835 * WaitType = Can be one of the values UserMode or KernelMode
4836 * Alertable = If true the wait is alertable.
4837 * Time = The maximum wait time.
4838 * REMARKS:
4839 * This function maps to the win32 WaitForMultipleObjectEx.
4840 * RETURNS: Status
4841 */
4842 NTSTATUS
4843 STDCALL
4844 NtWaitForMultipleObjects (
4845 IN ULONG Count,
4846 IN HANDLE Object[],
4847 IN WAIT_TYPE WaitType,
4848 IN BOOLEAN Alertable,
4849 IN PLARGE_INTEGER Time
4850 );
4851
4852
4853
4854
4855
4856 #ifndef __USE_W32API
4857
4858 /*
4859 * FUNCTION: Continues a thread with the specified context
4860 * ARGUMENTS:
4861 * Context = Specifies the processor context
4862 * IrqLevel = Specifies the Interupt Request Level to continue with. Can
4863 * be PASSIVE_LEVEL or APC_LEVEL
4864 * REMARKS
4865 * NtContinue can be used to continue after an exception or apc.
4866 * RETURNS: Status
4867 */
4868 //FIXME This function might need another parameter
4869
4870 NTSTATUS STDCALL ZwContinue(IN PCONTEXT Context, IN CINT IrqLevel);
4871
4872 /*
4873 * FUNCTION: Retrieves the system time
4874 * ARGUMENTS:
4875 * CurrentTime (OUT) = Caller should supply storage for the resulting time.
4876 * RETURNS: Status
4877 *
4878 */
4879
4880 NTSTATUS
4881 STDCALL
4882 ZwQuerySystemTime (
4883 OUT PLARGE_INTEGER CurrentTime
4884 );
4885
4886 /*
4887 * FUNCTION: Copies a handle from one process space to another
4888 * ARGUMENTS:
4889 * SourceProcessHandle = The source process owning the handle. The source process should have opened
4890 * the SourceHandle with PROCESS_DUP_HANDLE access.
4891 * SourceHandle = The handle to the object.
4892 * TargetProcessHandle = The destination process owning the handle
4893 * TargetHandle (OUT) = Caller should supply storage for the duplicated handle.
4894 * DesiredAccess = The desired access to the handle.
4895 * InheritHandle = Indicates wheter the new handle will be inheritable or not.
4896 * Options = Specifies special actions upon duplicating the handle. Can be
4897 * one of the values DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS.
4898 * DUPLICATE_CLOSE_SOURCE specifies that the source handle should be
4899 * closed after duplicating. DUPLICATE_SAME_ACCESS specifies to ignore
4900 * the DesiredAccess paramter and just grant the same access to the new
4901 * handle.
4902 * RETURNS: Status
4903 * REMARKS: This function maps to the win32 DuplicateHandle.
4904 */
4905
4906 NTSTATUS
4907 STDCALL
4908 NtDuplicateObject(
4909 IN HANDLE SourceProcessHandle,
4910 IN HANDLE SourceHandle,
4911 IN HANDLE TargetProcessHandle,
4912 OUT PHANDLE TargetHandle,
4913 IN ACCESS_MASK DesiredAccess,
4914 IN BOOLEAN InheritHandle,
4915 IN ULONG Options
4916 );
4917
4918 NTSTATUS
4919 STDCALL
4920 ZwDuplicateObject(
4921 IN HANDLE SourceProcessHandle,
4922 IN PHANDLE SourceHandle,
4923 IN HANDLE TargetProcessHandle,
4924 OUT PHANDLE TargetHandle,
4925 IN ACCESS_MASK DesiredAccess,
4926 IN BOOLEAN InheritHandle,
4927 IN ULONG Options
4928 );
4929
4930 /*
4931 * FUNCTION: Checks a clients access rights to a object and issues a audit a alarm. ( it logs the access )
4932 * ARGUMENTS:
4933 * SubsystemName = Specifies the name of the subsystem, can be "WIN32" or "DEBUG"
4934 * ObjectHandle =
4935 * ObjectTypeName =
4936 * ObjectName =
4937 * SecurityDescriptor =
4938 * DesiredAcces =
4939 * GenericMapping =
4940 * ObjectCreation =
4941 * GrantedAccess =
4942 * AccessStatus =
4943 * GenerateOnClose =
4944 * REMARKS: The arguments map to the win32 AccessCheck
4945 * RETURNS: Status
4946 */
4947
4948 NTSTATUS
4949 STDCALL
4950 ZwAccessCheckAndAuditAlarm(
4951 IN PUNICODE_STRING SubsystemName,
4952 IN PHANDLE ObjectHandle,
4953 IN PUNICODE_STRING ObjectTypeName,
4954 IN PUNICODE_STRING ObjectName,
4955 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
4956 IN ACCESS_MASK DesiredAccess,
4957 IN PGENERIC_MAPPING GenericMapping,
4958 IN BOOLEAN ObjectCreation,
4959 OUT PACCESS_MASK GrantedAccess,
4960 OUT PNTSTATUS AccessStatus,
4961 OUT PBOOLEAN GenerateOnClose
4962 );
4963
4964 /*
4965 * FUNCTION: Adds an atom to the global atom table
4966 * ARGUMENTS:
4967 * AtomString = The string to add to the atom table.
4968 * Atom (OUT) = Caller supplies storage for the resulting atom.
4969 * REMARKS: The arguments map to the win32 add GlobalAddAtom.
4970 * RETURNS: Status
4971 */
4972 NTSTATUS
4973 STDCALL
4974 NtAddAtom(
4975 IN PWSTR AtomName,
4976 IN OUT PRTL_ATOM Atom
4977 );
4978
4979
4980 NTSTATUS
4981 STDCALL
4982 ZwAddAtom(
4983 IN PWSTR AtomName,
4984 IN OUT PRTL_ATOM Atom
4985 );
4986
4987 NTSTATUS
4988 STDCALL
4989 NtAllocateUuids(
4990 PULARGE_INTEGER Time,
4991 PULONG Range,
4992 PULONG Sequence
4993 );
4994
4995 NTSTATUS
4996 STDCALL
4997 ZwAllocateUuids(
4998 PULARGE_INTEGER Time,
4999 PULONG Range,
5000 PULONG Sequence
5001 );
5002
5003 NTSTATUS
5004 STDCALL
5005 ZwCancelTimer(
5006 IN HANDLE TimerHandle,
5007 OUT ULONG ElapsedTime
5008 );
5009
5010 /*
5011 * FUNCTION: Creates a paging file.
5012 * ARGUMENTS:
5013 * FileName = Name of the pagefile
5014 * InitialSize = Specifies the initial size in bytes
5015 * MaximumSize = Specifies the maximum size in bytes
5016 * Reserved = Reserved for future use
5017 * RETURNS: Status
5018 */
5019 NTSTATUS
5020 STDCALL
5021 ZwCreatePagingFile(
5022 IN PUNICODE_STRING FileName,
5023 IN PLARGE_INTEGER InitialSize,
5024 IN PLARGE_INTEGER MaxiumSize,
5025 IN ULONG Reserved
5026 );
5027
5028 /*
5029 * FUNCTION: Creates a user mode thread
5030 * ARGUMENTS:
5031 * ThreadHandle (OUT) = Caller supplied storage for the resulting handle
5032 * DesiredAccess = Specifies the allowed or desired access to the thread.
5033 * ObjectAttributes = Initialized attributes for the object.
5034 * ProcessHandle = Handle to the threads parent process.
5035 * ClientId (OUT) = Caller supplies storage for returned process id and thread id.
5036 * ThreadContext = Initial processor context for the thread.
5037 * InitialTeb = Initial user mode stack context for the thread.
5038 * CreateSuspended = Specifies if the thread is ready for scheduling
5039 * REMARKS:
5040 * This function maps to the win32 function CreateThread.
5041 * RETURNS: Status
5042 */
5043 NTSTATUS
5044 STDCALL
5045 ZwCreateThread(
5046 OUT PHANDLE ThreadHandle,
5047 IN ACCESS_MASK DesiredAccess,
5048 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
5049 IN HANDLE ProcessHandle,
5050 OUT PCLIENT_ID ClientId,
5051 IN PCONTEXT ThreadContext,
5052 IN PUSER_STACK UserStack,
5053 IN BOOLEAN CreateSuspended
5054 );
5055
5056 NTSTATUS
5057 STDCALL
5058 NtDuplicateToken(
5059 IN HANDLE ExistingToken,
5060 IN ACCESS_MASK DesiredAccess,
5061 IN POBJECT_ATTRIBUTES ObjectAttributes,
5062 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
5063 IN TOKEN_TYPE TokenType,
5064 OUT PHANDLE NewToken
5065 );
5066
5067 NTSTATUS
5068 STDCALL
5069 ZwDuplicateToken(
5070 IN HANDLE ExistingToken,
5071 IN ACCESS_MASK DesiredAccess,
5072 IN POBJECT_ATTRIBUTES ObjectAttributes,
5073 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
5074 IN TOKEN_TYPE TokenType,
5075 OUT PHANDLE NewToken
5076 );
5077
5078 /*
5079 * FUNCTION: Finds a atom
5080 * ARGUMENTS:
5081 * AtomName = Name to search for.
5082 * Atom = Caller supplies storage for the resulting atom
5083 * RETURNS: Status
5084 * REMARKS:
5085 * This funciton maps to the win32 GlobalFindAtom
5086 */
5087 NTSTATUS
5088 STDCALL
5089 NtFindAtom(
5090 IN PWSTR AtomName,
5091 OUT PRTL_ATOM Atom OPTIONAL
5092 );
5093
5094 NTSTATUS
5095 STDCALL
5096 ZwFindAtom(
5097 IN PWSTR AtomName,
5098 OUT PRTL_ATOM Atom OPTIONAL
5099 );
5100
5101 /*
5102 * FUNCTION: Flushes a the processors instruction cache
5103 * ARGUMENTS:
5104 * ProcessHandle = Points to the process owning the cache
5105 * BaseAddress = // might this be a image address ????
5106 * NumberOfBytesToFlush =
5107 * RETURNS: Status
5108 * REMARKS:
5109 * This funciton is used by debuggers
5110 */
5111 NTSTATUS
5112 STDCALL
5113 ZwFlushInstructionCache(
5114 IN HANDLE ProcessHandle,
5115 IN PVOID BaseAddress,
5116 IN UINT NumberOfBytesToFlush
5117 );
5118
5119 /*
5120 * FUNCTION: Flushes virtual memory to file
5121 * ARGUMENTS:
5122 * ProcessHandle = Points to the process that allocated the virtual memory
5123 * BaseAddress = Points to the memory address
5124 * NumberOfBytesToFlush = Limits the range to flush,
5125 * NumberOfBytesFlushed = Actual number of bytes flushed
5126 * RETURNS: Status
5127 * REMARKS:
5128 * Check return status on STATUS_NOT_MAPPED_DATA
5129 */
5130 NTSTATUS
5131 STDCALL
5132 ZwFlushVirtualMemory(
5133 IN HANDLE ProcessHandle,
5134 IN PVOID BaseAddress,
5135 IN ULONG NumberOfBytesToFlush,
5136 OUT PULONG NumberOfBytesFlushed OPTIONAL
5137 );
5138
5139 /*
5140 * FUNCTION: Retrieves the uptime of the system
5141 * ARGUMENTS:
5142 * UpTime = Number of clock ticks since boot.
5143 * RETURNS: Status
5144 */
5145 NTSTATUS
5146 STDCALL
5147 ZwGetTickCount(
5148 PULONG UpTime
5149 );
5150
5151 /*
5152 * FUNCTION: Loads a registry key.
5153 * ARGUMENTS:
5154 * KeyObjectAttributes = Key to be loaded
5155 * FileObjectAttributes = File to load the key from
5156 * REMARK:
5157 * This procedure maps to the win32 procedure RegLoadKey
5158 * RETURNS: Status
5159 */
5160 NTSTATUS
5161 STDCALL
5162 ZwLoadKey(
5163 IN POBJECT_ATTRIBUTES KeyObjectAttributes,
5164 IN POBJECT_ATTRIBUTES FileObjectAttributes
5165 );
5166
5167 /*
5168 * FUNCTION: Locks a range of virtual memory.
5169 * ARGUMENTS:
5170 * ProcessHandle = Handle to the process
5171 * BaseAddress = Lower boundary of the range of bytes to lock.
5172 * NumberOfBytesLock = Offset to the upper boundary.
5173 * NumberOfBytesLocked (OUT) = Number of bytes actually locked.
5174 * REMARK:
5175 This procedure maps to the win32 procedure VirtualLock.
5176 * RETURNS: Status [STATUS_SUCCESS | STATUS_WAS_LOCKED ]
5177 */
5178 NTSTATUS
5179 STDCALL
5180 ZwLockVirtualMemory(
5181 HANDLE ProcessHandle,
5182 PVOID BaseAddress,
5183 ULONG NumberOfBytesToLock,
5184 PULONG NumberOfBytesLocked
5185 );
5186
5187 NTSTATUS
5188 STDCALL
5189 ZwOpenObjectAuditAlarm(
5190 IN PUNICODE_STRING SubsystemName,
5191 IN PVOID HandleId,
5192 IN PUNICODE_STRING ObjectTypeName,
5193 IN PUNICODE_STRING ObjectName,
5194 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
5195 IN HANDLE ClientToken,
5196 IN ULONG DesiredAccess,
5197 IN ULONG GrantedAccess,
5198 IN PPRIVILEGE_SET Privileges,
5199 IN BOOLEAN ObjectCreation,
5200 IN BOOLEAN AccessGranted,
5201 OUT PBOOLEAN GenerateOnClose
5202 );
5203
5204 /*
5205 * FUNCTION: Set the access protection of a range of virtual memory
5206 * ARGUMENTS:
5207 * ProcessHandle = Handle to process owning the virtual address space
5208 * BaseAddress = Start address
5209 * NumberOfBytesToProtect = Delimits the range of virtual memory
5210 * for which the new access protection holds
5211 * NewAccessProtection = The new access proctection for the pages
5212 * OldAccessProtection = Caller should supply storage for the old
5213 * access protection
5214 *
5215 * REMARKS:
5216 * The function maps to the win32 VirtualProtectEx
5217 * RETURNS: Status
5218 */
5219 NTSTATUS
5220 STDCALL
5221 ZwProtectVirtualMemory(
5222 IN HANDLE ProcessHandle,
5223 IN PVOID BaseAddress,
5224 IN ULONG NumberOfBytesToProtect,
5225 IN ULONG NewAccessProtection,
5226 OUT PULONG OldAccessProtection
5227 );
5228
5229 NTSTATUS
5230 STDCALL
5231 NtQueryInformationAtom(
5232 IN RTL_ATOM Atom,
5233 IN ATOM_INFORMATION_CLASS AtomInformationClass,
5234 OUT PVOID AtomInformation,
5235 IN ULONG AtomInformationLength,
5236 OUT PULONG ReturnLength OPTIONAL
5237 );
5238
5239 NTSTATUS
5240 STDCALL
5241 ZwQueryInformationAtom(
5242 IN RTL_ATOM Atom,
5243 IN ATOM_INFORMATION_CLASS AtomInformationClass,
5244 OUT PVOID AtomInformation,
5245 IN ULONG AtomInformationLength,
5246 OUT PULONG ReturnLength OPTIONAL
5247 );
5248
5249 /*
5250 * FUNCTION: Query information about the content of a directory object
5251 * ARGUMENTS:
5252 DirectoryHandle =
5253 Buffer = Buffer must be large enough to hold the name strings too
5254 ReturnSingleEntry = If TRUE :return the index of the next object in this directory in ObjectIndex
5255 If FALSE: return the number of objects in this directory in ObjectIndex
5256 RestartScan = If TRUE: ignore input value of ObjectIndex always start at index 0
5257 If FALSE use input value of ObjectIndex
5258 Context = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex
5259 ReturnLength = Actual size of the ObjectIndex ???
5260 * RETURNS: Status
5261 */
5262 NTSTATUS
5263 STDCALL
5264 ZwQueryDirectoryObject(
5265 IN HANDLE DirectoryHandle,
5266 OUT PVOID Buffer,
5267 IN ULONG BufferLength,
5268 IN BOOLEAN ReturnSingleEntry,
5269 IN BOOLEAN RestartScan,
5270 IN OUT PULONG Context,
5271 OUT PULONG ReturnLength OPTIONAL
5272 );
5273
5274 /*
5275 * FUNCTION: Queries the information of a process object.
5276 * ARGUMENTS:
5277 * ProcessHandle = Handle to the process object
5278 * ProcessInformation = Index to a certain information structure
5279
5280 ProcessBasicInformation PROCESS_BASIC_INFORMATION
5281 ProcessQuotaLimits QUOTA_LIMITS
5282 ProcessIoCounters IO_COUNTERS
5283 ProcessVmCounters VM_COUNTERS
5284 ProcessTimes KERNEL_USER_TIMES
5285 ProcessBasePriority KPRIORITY
5286 ProcessRaisePriority KPRIORITY
5287 ProcessDebugPort HANDLE
5288 ProcessExceptionPort HANDLE
5289 ProcessAccessToken PROCESS_ACCESS_TOKEN
5290 ProcessLdtInformation LDT_ENTRY ??
5291 ProcessLdtSize ULONG
5292 ProcessDefaultHardErrorMode ULONG
5293 ProcessIoPortHandlers // kernel mode only
5294 ProcessPooledUsageAndLimits POOLED_USAGE_AND_LIMITS
5295 ProcessWorkingSetWatch PROCESS_WS_WATCH_INFORMATION
5296 ProcessUserModeIOPL (I/O Privilege Level)
5297 ProcessEnableAlignmentFaultFixup BOOLEAN
5298 ProcessPriorityClass ULONG
5299 ProcessWx86Information ULONG
5300 ProcessHandleCount ULONG
5301 ProcessAffinityMask ULONG
5302 ProcessPooledQuotaLimits QUOTA_LIMITS
5303 MaxProcessInfoClass
5304
5305 * ProcessInformation = Caller supplies storage for the process information structure
5306 * ProcessInformationLength = Size of the process information structure
5307 * ReturnLength = Actual number of bytes written
5308
5309 * REMARK:
5310 * This procedure maps to the win32 GetProcessTimes, GetProcessVersion,
5311 GetProcessWorkingSetSize, GetProcessPriorityBoost, GetProcessAffinityMask, GetPriorityClass,
5312 GetProcessShutdownParameters functions.
5313 * RETURNS: Status
5314 */
5315
5316 NTSTATUS
5317 STDCALL
5318 NtQueryInformationProcess(
5319 IN HANDLE ProcessHandle,
5320 IN CINT ProcessInformationClass,
5321 OUT PVOID ProcessInformation,
5322 IN ULONG ProcessInformationLength,
5323 OUT PULONG ReturnLength
5324 );
5325
5326 NTSTATUS
5327 STDCALL
5328 ZwQueryInformationProcess(
5329 IN HANDLE ProcessHandle,
5330 IN CINT ProcessInformationClass,
5331 OUT PVOID ProcessInformation,
5332 IN ULONG ProcessInformationLength,
5333 OUT PULONG ReturnLength
5334 );
5335
5336 /*
5337 * FUNCTION: Query the interval and the clocksource for profiling
5338 * ARGUMENTS:
5339 Interval =
5340 ClockSource =
5341 * RETURNS: Status
5342 */
5343 NTSTATUS
5344 STDCALL
5345 ZwQueryIntervalProfile(
5346 OUT PULONG Interval,
5347 OUT KPROFILE_SOURCE ClockSource
5348 );
5349
5350 /*
5351 * FUNCTION: Queries the information of a object.
5352 * ARGUMENTS:
5353 ObjectHandle = Handle to a object
5354 ObjectInformationClass = Index to a certain information structure
5355
5356 ObjectBasicInformation
5357 ObjectTypeInformation OBJECT_TYPE_INFORMATION
5358 ObjectNameInformation OBJECT_NAME_INFORMATION
5359 ObjectDataInformation OBJECT_DATA_INFORMATION
5360
5361 ObjectInformation = Caller supplies storage for resulting information
5362 Length = Size of the supplied storage
5363 ResultLength = Bytes written
5364 */
5365
5366 NTSTATUS
5367 STDCALL
5368 ZwQueryObject(
5369 IN HANDLE ObjectHandle,
5370 IN CINT ObjectInformationClass,
5371 OUT PVOID ObjectInformation,
5372 IN ULONG Length,
5373 OUT PULONG ResultLength
5374 );
5375
5376 NTSTATUS
5377 STDCALL
5378 NtQuerySecurityObject(
5379 IN HANDLE Handle,
5380 IN SECURITY_INFORMATION SecurityInformation,
5381 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
5382 IN ULONG Length,
5383 OUT PULONG ResultLength
5384 );
5385
5386 NTSTATUS
5387 STDCALL
5388 ZwQuerySecurityObject(
5389 IN HANDLE Handle,
5390 IN SECURITY_INFORMATION SecurityInformation,
5391 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
5392 IN ULONG Length,
5393 OUT PULONG ResultLength
5394 );
5395
5396 /*
5397 * FUNCTION: Queries the virtual memory information.
5398 * ARGUMENTS:
5399 ProcessHandle = Process owning the virtual address space
5400 BaseAddress = Points to the page where the information is queried for.
5401 * VirtualMemoryInformationClass = Index to a certain information structure
5402
5403 MemoryBasicInformation MEMORY_BASIC_INFORMATION
5404
5405 * VirtualMemoryInformation = caller supplies storage for the information structure
5406 * Length = size of the structure
5407 ResultLength = Data written
5408 * RETURNS: Status
5409 *
5410 */
5411
5412 NTSTATUS
5413 STDCALL
5414 ZwQueryVirtualMemory(
5415 IN HANDLE ProcessHandle,
5416 IN PVOID Address,
5417 IN IN CINT VirtualMemoryInformationClass,
5418 OUT PVOID VirtualMemoryInformation,
5419 IN ULONG Length,
5420 OUT PULONG ResultLength
5421 );
5422
5423 /*
5424 * FUNCTION: Raises a hard error (stops the system)
5425 * ARGUMENTS:
5426 * Status = Status code of the hard error
5427 * Unknown2 = ??
5428 * Unknown3 = ??
5429 * Unknown4 = ??
5430 * Unknown5 = ??
5431 * Unknown6 = ??
5432 * RETURNS: Status
5433 *
5434 */
5435 NTSTATUS
5436 STDCALL
5437 ZwRaiseHardError(
5438 IN NTSTATUS Status,
5439 ULONG Unknown2,
5440 ULONG Unknown3,
5441 ULONG Unknown4,
5442 ULONG Unknown5,
5443 ULONG Unknown6
5444 );
5445
5446 /*
5447 * FUNCTION: Sets the information of a registry key.
5448 * ARGUMENTS:
5449 * KeyHandle = Handle to the registry key
5450 * KeyInformationClass = Index to the a certain information structure.
5451 Can be one of the following values:
5452
5453 * KeyWriteTimeInformation KEY_WRITE_TIME_INFORMATION
5454
5455 KeyInformation = Storage for the new information
5456 * KeyInformationLength = Size of the information strucure
5457 * RETURNS: Status
5458 */
5459
5460 NTSTATUS
5461 STDCALL
5462 ZwSetInformationKey(
5463 IN HANDLE KeyHandle,
5464 IN CINT KeyInformationClass,
5465 IN PVOID KeyInformation,
5466 IN ULONG KeyInformationLength
5467 );
5468
5469 /*
5470 * FUNCTION: Changes a set of object specific parameters
5471 * ARGUMENTS:
5472 * ObjectHandle =
5473 * ObjectInformationClass = Index to the set of parameters to change.
5474
5475
5476 ObjectBasicInformation
5477 ObjectTypeInformation OBJECT_TYPE_INFORMATION
5478 ObjectAllInformation
5479 ObjectDataInformation OBJECT_DATA_INFORMATION
5480 ObjectNameInformation OBJECT_NAME_INFORMATION
5481
5482
5483 * ObjectInformation = Caller supplies storage for parameters to set.
5484 * Length = Size of the storage supplied
5485 * RETURNS: Status
5486 */
5487 NTSTATUS
5488 STDCALL
5489 ZwSetInformationObject(
5490 IN HANDLE ObjectHandle,
5491 IN CINT ObjectInformationClass,
5492 IN PVOID ObjectInformation,
5493 IN ULONG Length
5494 );
5495
5496 /*
5497 * FUNCTION: Changes a set of process specific parameters
5498 * ARGUMENTS:
5499 * ProcessHandle = Handle to the process
5500 * ProcessInformationClass = Index to a information structure.
5501 *
5502 * ProcessBasicInformation PROCESS_BASIC_INFORMATION
5503 * ProcessQuotaLimits QUOTA_LIMITS
5504 * ProcessBasePriority KPRIORITY
5505 * ProcessRaisePriority KPRIORITY
5506 * ProcessDebugPort HANDLE
5507 * ProcessExceptionPort HANDLE
5508 * ProcessAccessToken PROCESS_ACCESS_TOKEN
5509 * ProcessDefaultHardErrorMode ULONG
5510 * ProcessPriorityClass ULONG
5511 * ProcessAffinityMask KAFFINITY //??
5512 *
5513 * ProcessInformation = Caller supplies storage for information to set.
5514 * ProcessInformationLength = Size of the information structure
5515 * RETURNS: Status
5516 */
5517 NTSTATUS
5518 STDCALL
5519 NtSetInformationProcess(
5520 IN HANDLE ProcessHandle,
5521 IN CINT ProcessInformationClass,
5522 IN PVOID ProcessInformation,
5523 IN ULONG ProcessInformationLength
5524 );
5525
5526 NTSTATUS
5527 STDCALL
5528 ZwSetInformationProcess(
5529 IN HANDLE ProcessHandle,
5530 IN CINT ProcessInformationClass,
5531 IN PVOID ProcessInformation,
5532 IN ULONG ProcessInformationLength
5533 );
5534
5535 /*
5536 * FUNCTION: Sets the characteristics of a timer
5537 * ARGUMENTS:
5538 * TimerHandle = Handle to the timer
5539 * DueTime = Time before the timer becomes signalled for the first time.
5540 * TimerApcRoutine = Completion routine can be called on time completion
5541 * TimerContext = Argument to the completion routine
5542 * Resume = Specifies if the timer should repeated after completing one cycle
5543 * Period = Cycle of the timer
5544 * REMARKS: This routine maps to the win32 SetWaitableTimer.
5545 * RETURNS: Status
5546 */
5547 NTSTATUS
5548 STDCALL
5549 ZwSetTimer(
5550 IN HANDLE TimerHandle,
5551 IN PLARGE_INTEGER DueTime,
5552 IN PTIMERAPCROUTINE TimerApcRoutine,
5553 IN PVOID TimerContext,
5554 IN BOOL WakeTimer,
5555 IN ULONG Period OPTIONAL,
5556 OUT PBOOLEAN PreviousState OPTIONAL
5557 );
5558
5559 /*
5560 * FUNCTION: Unloads a registry key.
5561 * ARGUMENTS:
5562 * KeyHandle = Handle to the registry key
5563 * REMARK:
5564 * This procedure maps to the win32 procedure RegUnloadKey
5565 * RETURNS: Status
5566 */
5567 NTSTATUS
5568 STDCALL
5569 ZwUnloadKey(
5570 IN POBJECT_ATTRIBUTES KeyObjectAttributes
5571 );
5572
5573 /*
5574 * FUNCTION: Unlocks a range of virtual memory.
5575 * ARGUMENTS:
5576 * ProcessHandle = Handle to the process
5577 * BaseAddress = Lower boundary of the range of bytes to unlock.
5578 * NumberOfBytesToUnlock = Offset to the upper boundary to unlock.
5579 * NumberOfBytesUnlocked (OUT) = Number of bytes actually unlocked.
5580 * REMARK:
5581 This procedure maps to the win32 procedure VirtualUnlock
5582 * RETURNS: Status [ STATUS_SUCCESS | STATUS_PAGE_WAS_ULOCKED ]
5583 */
5584 NTSTATUS
5585 STDCALL
5586 ZwUnlockVirtualMemory(
5587 IN HANDLE ProcessHandle,
5588 IN PVOID BaseAddress,
5589 IN ULONG NumberOfBytesToUnlock,
5590 OUT PULONG NumberOfBytesUnlocked OPTIONAL
5591 );
5592
5593 /*
5594 * FUNCTION: Waits for multiple objects to become signalled.
5595 * ARGUMENTS:
5596 * Count = The number of objects
5597 * Object = The array of object handles
5598 * WaitType = Can be one of the values UserMode or KernelMode
5599 * Alertable = If true the wait is alertable.
5600 * Time = The maximum wait time.
5601 * REMARKS:
5602 * This function maps to the win32 WaitForMultipleObjectEx.
5603 * RETURNS: Status
5604 */
5605 NTSTATUS
5606 STDCALL
5607 ZwWaitForMultipleObjects (
5608 IN ULONG Count,
5609 IN HANDLE Object[],
5610 IN WAIT_TYPE WaitType,
5611 IN BOOLEAN Alertable,
5612 IN PLARGE_INTEGER Time
5613 );
5614
5615 /*
5616 * FUNCTION: Creates a profile
5617 * ARGUMENTS:
5618 * ProfileHandle (OUT) = Caller supplied storage for the resulting handle
5619 * ObjectAttribute = Initialized attributes for the object
5620 * ImageBase = Start address of executable image
5621 * ImageSize = Size of the image
5622 * Granularity = Bucket size
5623 * Buffer = Caller supplies buffer for profiling info
5624 * ProfilingSize = Buffer size
5625 * ClockSource = Specify 0 / FALSE ??
5626 * ProcessorMask = A value of -1 indicates disables per processor profiling,
5627 otherwise bit set for the processor to profile.
5628 * REMARKS:
5629 * This function maps to the win32 CreateProcess.
5630 * RETURNS: Status
5631 */
5632
5633 NTSTATUS
5634 STDCALL
5635 ZwCreateProfile(
5636 OUT PHANDLE ProfileHandle,
5637 IN POBJECT_ATTRIBUTES ObjectAttributes,
5638 IN ULONG ImageBase,
5639 IN ULONG ImageSize,
5640 IN ULONG Granularity,
5641 OUT PVOID Buffer,
5642 IN ULONG ProfilingSize,
5643 IN ULONG ClockSource,
5644 IN ULONG ProcessorMask
5645 );
5646
5647 /*
5648 * FUNCTION: Delays the execution of the calling thread.
5649 * ARGUMENTS:
5650 * Alertable = If TRUE the thread is alertable during is wait period
5651 * Interval = Specifies the interval to wait.
5652 * RETURNS: Status
5653 */
5654 NTSTATUS
5655 STDCALL
5656 ZwDelayExecution(
5657 IN BOOLEAN Alertable,
5658 IN TIME *Interval
5659 );
5660
5661 /*
5662 * FUNCTION: Extends a section
5663 * ARGUMENTS:
5664 * SectionHandle = Handle to the section
5665 * NewMaximumSize = Adjusted size
5666 * RETURNS: Status
5667 */
5668 NTSTATUS
5669 STDCALL
5670 ZwExtendSection(
5671 IN HANDLE SectionHandle,
5672 IN ULONG NewMaximumSize
5673 );
5674
5675 /*
5676 * FUNCTION: Queries the information of a section object.
5677 * ARGUMENTS:
5678 * SectionHandle = Handle to the section link object
5679 * SectionInformationClass = Index to a certain information structure
5680 * SectionInformation (OUT)= Caller supplies storage for resulting information
5681 * Length = Size of the supplied storage
5682 * ResultLength = Data written
5683 * RETURNS: Status
5684 *
5685 */
5686 NTSTATUS
5687 STDCALL
5688 ZwQuerySection(
5689 IN HANDLE SectionHandle,
5690 IN CINT SectionInformationClass,
5691 OUT PVOID SectionInformation,
5692 IN ULONG Length,
5693 OUT PULONG ResultLength
5694 );
5695
5696 typedef struct _SECTION_IMAGE_INFORMATION
5697 {
5698 PVOID EntryPoint;
5699 ULONG Unknown1;
5700 ULONG StackReserve;
5701 ULONG StackCommit;
5702 ULONG Subsystem;
5703 USHORT MinorSubsystemVersion;
5704 USHORT MajorSubsystemVersion;
5705 ULONG Unknown2;
5706 ULONG Characteristics;
5707 USHORT ImageNumber;
5708 BOOLEAN Executable;
5709 UCHAR Unknown3;
5710 ULONG Unknown4[3];
5711 } SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
5712
5713 #endif /* !__USE_W32API */
5714
5715 /*
5716 * FUNCTION: Loads a registry key.
5717 * ARGUMENTS:
5718 * KeyObjectAttributes = Key to be loaded
5719 * FileObjectAttributes = File to load the key from
5720 * Flags = ???
5721 * REMARK:
5722 * This procedure maps to the win32 procedure RegLoadKey
5723 * RETURNS: Status
5724 */
5725 NTSTATUS
5726 STDCALL
5727 NtLoadKey2(
5728 IN POBJECT_ATTRIBUTES KeyObjectAttributes,
5729 IN POBJECT_ATTRIBUTES FileObjectAttributes,
5730 IN ULONG Flags
5731 );
5732
5733 NTSTATUS
5734 STDCALL
5735 ZwLoadKey2(
5736 IN POBJECT_ATTRIBUTES KeyObjectAttributes,
5737 IN POBJECT_ATTRIBUTES FileObjectAttributes,
5738 IN ULONG Flags
5739 );
5740
5741 /*
5742 * FUNCTION: Retrieves the system time
5743 * ARGUMENTS:
5744 * CurrentTime (OUT) = Caller should supply storage for the resulting time.
5745 * RETURNS: Status
5746 *
5747 */
5748
5749 NTSTATUS
5750 STDCALL
5751 NtQuerySystemTime (
5752 OUT PLARGE_INTEGER CurrentTime
5753 );
5754
5755 /*
5756 * FUNCTION: Queries the information of a object.
5757 * ARGUMENTS:
5758 ObjectHandle = Handle to a object
5759 ObjectInformationClass = Index to a certain information structure
5760
5761 ObjectBasicInformation
5762 ObjectTypeInformation OBJECT_TYPE_INFORMATION
5763 ObjectNameInformation OBJECT_NAME_INFORMATION
5764 ObjectDataInformation OBJECT_DATA_INFORMATION
5765
5766 ObjectInformation = Caller supplies storage for resulting information
5767 Length = Size of the supplied storage
5768 ResultLength = Bytes written
5769 */
5770
5771 NTSTATUS
5772 STDCALL
5773 NtQueryObject(
5774 IN HANDLE ObjectHandle,
5775 IN CINT ObjectInformationClass,
5776 OUT PVOID ObjectInformation,
5777 IN ULONG Length,
5778 OUT PULONG ResultLength
5779 );
5780
5781 /* BEGIN REACTOS ONLY */
5782
5783 BOOLEAN STDCALL
5784 ExInitializeBinaryTree(IN PBINARY_TREE Tree,
5785 IN PKEY_COMPARATOR Compare,
5786 IN BOOLEAN UseNonPagedPool);
5787
5788 VOID STDCALL
5789 ExDeleteBinaryTree(IN PBINARY_TREE Tree);
5790
5791 VOID STDCALL
5792 ExInsertBinaryTree(IN PBINARY_TREE Tree,
5793 IN PVOID Key,
5794 IN PVOID Value);
5795
5796 BOOLEAN STDCALL
5797 ExSearchBinaryTree(IN PBINARY_TREE Tree,
5798 IN PVOID Key,
5799 OUT PVOID * Value);
5800
5801 BOOLEAN STDCALL
5802 ExRemoveBinaryTree(IN PBINARY_TREE Tree,
5803 IN PVOID Key,
5804 IN PVOID * Value);
5805
5806 BOOLEAN STDCALL
5807 ExTraverseBinaryTree(IN PBINARY_TREE Tree,
5808 IN TRAVERSE_METHOD Method,
5809 IN PTRAVERSE_ROUTINE Routine,
5810 IN PVOID Context);
5811
5812 BOOLEAN STDCALL
5813 ExInitializeSplayTree(IN PSPLAY_TREE Tree,
5814 IN PKEY_COMPARATOR Compare,
5815 IN BOOLEAN Weighted,
5816 IN BOOLEAN UseNonPagedPool);
5817
5818 VOID STDCALL
5819 ExDeleteSplayTree(IN PSPLAY_TREE Tree);
5820
5821 VOID STDCALL
5822 ExInsertSplayTree(IN PSPLAY_TREE Tree,
5823 IN PVOID Key,
5824 IN PVOID Value);
5825
5826 BOOLEAN STDCALL
5827 ExSearchSplayTree(IN PSPLAY_TREE Tree,
5828 IN PVOID Key,
5829 OUT PVOID * Value);
5830
5831 BOOLEAN STDCALL
5832 ExRemoveSplayTree(IN PSPLAY_TREE Tree,
5833 IN PVOID Key,
5834 IN PVOID * Value);
5835
5836 BOOLEAN STDCALL
5837 ExWeightOfSplayTree(IN PSPLAY_TREE Tree,
5838 OUT PULONG Weight);
5839
5840 BOOLEAN STDCALL
5841 ExTraverseSplayTree(IN PSPLAY_TREE Tree,
5842 IN TRAVERSE_METHOD Method,
5843 IN PTRAVERSE_ROUTINE Routine,
5844 IN PVOID Context);
5845
5846 BOOLEAN STDCALL
5847 ExInitializeHashTable(IN PHASH_TABLE HashTable,
5848 IN ULONG HashTableSize,
5849 IN PKEY_COMPARATOR Compare OPTIONAL,
5850 IN BOOLEAN UseNonPagedPool);
5851
5852 VOID STDCALL
5853 ExDeleteHashTable(IN PHASH_TABLE HashTable);
5854
5855 VOID STDCALL
5856 ExInsertHashTable(IN PHASH_TABLE HashTable,
5857 IN PVOID Key,
5858 IN ULONG KeyLength,
5859 IN PVOID Value);
5860
5861 BOOLEAN STDCALL
5862 ExSearchHashTable(IN PHASH_TABLE HashTable,
5863 IN PVOID Key,
5864 IN ULONG KeyLength,
5865 OUT PVOID * Value);
5866
5867 BOOLEAN STDCALL
5868 ExRemoveHashTable(IN PHASH_TABLE HashTable,
5869 IN PVOID Key,
5870 IN ULONG KeyLength,
5871 IN PVOID * Value);
5872
5873 /* END REACTOS ONLY */
5874
5875 #endif /* __DDK_ZW_H */