1 /*++ NDK Version: 0098 2 3 Copyright (c) Alex Ionescu. All rights reserved. 4 5 Header Name: 6 7 iofuncs.h 8 9 Abstract: 10 11 Function definitions for the I/O Manager. 12 13 Author: 14 15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006 16 17 --*/ 18 19 #ifndef _IOFUNCS_H 20 #define _IOFUNCS_H 21 22 // 23 // Dependencies 24 // 25 #include <umtypes.h> 26 #include <iotypes.h> 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 // 33 // I/O Functions 34 // 35 #ifndef NTOS_MODE_USER 36 VOID 37 FASTCALL 38 IoAssignDriveLetters( 39 _In_ struct _LOADER_PARAMETER_BLOCK *LoaderBlock, 40 _In_ PSTRING NtDeviceName, 41 _Out_ PUCHAR NtSystemPath, 42 _Out_ PSTRING NtSystemPathString 43 ); 44 45 NTSTATUS 46 NTAPI 47 IoSynchronousInvalidateDeviceRelations( 48 _In_ PDEVICE_OBJECT DeviceObject, 49 _In_ DEVICE_RELATION_TYPE Type 50 ); 51 52 NTSTATUS 53 NTAPI 54 IoCreateDriver( 55 _In_opt_ PUNICODE_STRING DriverName, 56 _In_ PDRIVER_INITIALIZE InitializationFunction 57 ); 58 59 NTSTATUS 60 NTAPI 61 IoReportHalResourceUsage( 62 _In_ PUNICODE_STRING HalName, 63 _In_ PCM_RESOURCE_LIST RawResourceList, 64 _In_ PCM_RESOURCE_LIST TranslatedResourceList, 65 _In_ ULONG ResourceListSize 66 ); 67 #endif 68 69 // 70 // Native calls 71 // 72 NTSYSCALLAPI 73 NTSTATUS 74 NTAPI 75 NtAddBootEntry( 76 _In_ PBOOT_ENTRY BootEntry, 77 _In_ ULONG Id 78 ); 79 80 NTSYSCALLAPI 81 NTSTATUS 82 NTAPI 83 NtAddDriverEntry( 84 _In_ PEFI_DRIVER_ENTRY BootEntry, 85 _In_ ULONG Id 86 ); 87 88 NTSYSCALLAPI 89 NTSTATUS 90 NTAPI 91 NtCancelIoFile( 92 _In_ HANDLE FileHandle, 93 _Out_ PIO_STATUS_BLOCK IoStatusBlock 94 ); 95 96 __kernel_entry 97 NTSYSCALLAPI 98 NTSTATUS 99 NTAPI 100 NtCreateFile( 101 _Out_ PHANDLE FileHandle, 102 _In_ ACCESS_MASK DesiredAccess, 103 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 104 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 105 _In_opt_ PLARGE_INTEGER AllocationSize, 106 _In_ ULONG FileAttributes, 107 _In_ ULONG ShareAccess, 108 _In_ ULONG CreateDisposition, 109 _In_ ULONG CreateOptions, 110 _In_reads_bytes_opt_(EaLength) PVOID EaBuffer, 111 _In_ ULONG EaLength 112 ); 113 114 NTSYSCALLAPI 115 NTSTATUS 116 NTAPI 117 NtCreateIoCompletion( 118 _Out_ PHANDLE IoCompletionHandle, 119 _In_ ACCESS_MASK DesiredAccess, 120 _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes, 121 _In_ ULONG NumberOfConcurrentThreads 122 ); 123 124 NTSYSCALLAPI 125 NTSTATUS 126 NTAPI 127 NtCreateMailslotFile( 128 _Out_ PHANDLE MailSlotFileHandle, 129 _In_ ACCESS_MASK DesiredAccess, 130 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 131 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 132 _In_ ULONG FileAttributes, 133 _In_ ULONG ShareAccess, 134 _In_ ULONG MaxMessageSize, 135 _In_ PLARGE_INTEGER TimeOut 136 ); 137 138 NTSYSCALLAPI 139 NTSTATUS 140 NTAPI 141 NtCreateNamedPipeFile( 142 _Out_ PHANDLE NamedPipeFileHandle, 143 _In_ ACCESS_MASK DesiredAccess, 144 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 145 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 146 _In_ ULONG ShareAccess, 147 _In_ ULONG CreateDisposition, 148 _In_ ULONG CreateOptions, 149 _In_ ULONG WriteModeMessage, 150 _In_ ULONG ReadModeMessage, 151 _In_ ULONG NonBlocking, 152 _In_ ULONG MaxInstances, 153 _In_ ULONG InBufferSize, 154 _In_ ULONG OutBufferSize, 155 _In_ PLARGE_INTEGER DefaultTimeOut 156 ); 157 158 159 NTSYSCALLAPI 160 NTSTATUS 161 NTAPI 162 NtDeleteDriverEntry( 163 _In_ ULONG Id 164 ); 165 166 NTSYSCALLAPI 167 NTSTATUS 168 NTAPI 169 NtDeleteBootEntry( 170 _In_ ULONG Id 171 ); 172 173 NTSYSCALLAPI 174 NTSTATUS 175 NTAPI 176 NtDeleteFile( 177 _In_ POBJECT_ATTRIBUTES ObjectAttributes 178 ); 179 180 __kernel_entry 181 NTSYSCALLAPI 182 NTSTATUS 183 NTAPI 184 NtDeviceIoControlFile( 185 _In_ HANDLE FileHandle, 186 _In_opt_ HANDLE Event, 187 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 188 _In_opt_ PVOID ApcContext, 189 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 190 _In_ ULONG IoControlCode, 191 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, 192 _In_ ULONG InputBufferLength, 193 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, 194 _In_ ULONG OutputBufferLength 195 ); 196 197 NTSYSCALLAPI 198 NTSTATUS 199 NTAPI 200 NtEnumerateBootEntries( 201 _In_ PVOID Buffer, 202 _In_ PULONG BufferLength 203 ); 204 205 NTSYSCALLAPI 206 NTSTATUS 207 NTAPI 208 NtEnumerateDriverEntries( 209 _In_ PVOID Buffer, 210 _In_ PULONG BufferLength 211 ); 212 213 NTSYSCALLAPI 214 NTSTATUS 215 NTAPI 216 NtFlushBuffersFile( 217 _In_ HANDLE FileHandle, 218 _Out_ PIO_STATUS_BLOCK IoStatusBlock 219 ); 220 221 NTSYSCALLAPI 222 NTSTATUS 223 NTAPI 224 NtFlushWriteBuffer(VOID); 225 226 __kernel_entry 227 NTSYSCALLAPI 228 NTSTATUS 229 NTAPI 230 NtFsControlFile( 231 _In_ HANDLE FileHandle, 232 _In_opt_ HANDLE Event, 233 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 234 _In_opt_ PVOID ApcContext, 235 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 236 _In_ ULONG FsControlCode, 237 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, 238 _In_ ULONG InputBufferLength, 239 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, 240 _In_ ULONG OutputBufferLength 241 ); 242 243 NTSYSCALLAPI 244 NTSTATUS 245 NTAPI 246 NtLoadDriver( 247 _In_ PUNICODE_STRING DriverServiceName 248 ); 249 250 NTSYSCALLAPI 251 NTSTATUS 252 NTAPI 253 NtLockFile( 254 _In_ HANDLE FileHandle, 255 _In_opt_ HANDLE Event, 256 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 257 _In_opt_ PVOID ApcContext, 258 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 259 _In_ PLARGE_INTEGER ByteOffset, 260 _In_ PLARGE_INTEGER Length, 261 _In_ ULONG Key, 262 _In_ BOOLEAN FailImmediatedly, 263 _In_ BOOLEAN ExclusiveLock 264 ); 265 266 NTSYSCALLAPI 267 NTSTATUS 268 NTAPI 269 NtModifyBootEntry( 270 _In_ PBOOT_ENTRY BootEntry 271 ); 272 273 NTSYSCALLAPI 274 NTSTATUS 275 NTAPI 276 NtModifyDriverEntry( 277 _In_ PEFI_DRIVER_ENTRY DriverEntry 278 ); 279 280 NTSYSCALLAPI 281 NTSTATUS 282 NTAPI 283 NtNotifyChangeDirectoryFile( 284 _In_ HANDLE FileHandle, 285 _In_opt_ HANDLE Event, 286 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 287 _In_opt_ PVOID ApcContext, 288 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 289 _Out_ PVOID Buffer, 290 _In_ ULONG BufferSize, 291 _In_ ULONG CompletionFilter, 292 _In_ BOOLEAN WatchTree 293 ); 294 295 NTSYSCALLAPI 296 NTSTATUS 297 NTAPI 298 NtOpenFile( 299 _Out_ PHANDLE FileHandle, 300 _In_ ACCESS_MASK DesiredAccess, 301 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 302 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 303 _In_ ULONG ShareAccess, 304 _In_ ULONG OpenOptions 305 ); 306 307 NTSYSCALLAPI 308 NTSTATUS 309 NTAPI 310 NtOpenIoCompletion( 311 _Out_ PHANDLE CompetionPort, 312 _In_ ACCESS_MASK DesiredAccess, 313 _In_ POBJECT_ATTRIBUTES ObjectAttributes 314 ); 315 316 NTSYSCALLAPI 317 NTSTATUS 318 NTAPI 319 NtQueryAttributesFile( 320 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 321 _Out_ PFILE_BASIC_INFORMATION FileInformation 322 ); 323 324 NTSTATUS 325 NTAPI 326 NtQueryDriverEntryOrder( 327 _In_ PULONG Ids, 328 _In_ PULONG Count 329 ); 330 331 NTSYSCALLAPI 332 NTSTATUS 333 NTAPI 334 NtQueryBootEntryOrder( 335 _In_ PULONG Ids, 336 _In_ PULONG Count 337 ); 338 339 NTSYSCALLAPI 340 NTSTATUS 341 NTAPI 342 NtQueryBootOptions( 343 _In_ PBOOT_OPTIONS BootOptions, 344 _In_ PULONG BootOptionsLength 345 ); 346 347 __kernel_entry 348 NTSYSCALLAPI 349 NTSTATUS 350 NTAPI 351 NtQueryDirectoryFile( 352 _In_ HANDLE FileHandle, 353 _In_opt_ HANDLE Event, 354 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 355 _In_opt_ PVOID ApcContext, 356 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 357 _Out_writes_bytes_(Length) PVOID FileInformation, 358 _In_ ULONG Length, 359 _In_ FILE_INFORMATION_CLASS FileInformationClass, 360 _In_ BOOLEAN ReturnSingleEntry, 361 _In_opt_ PUNICODE_STRING FileName, 362 _In_ BOOLEAN RestartScan 363 ); 364 365 NTSYSCALLAPI 366 NTSTATUS 367 NTAPI 368 NtQueryEaFile( 369 _In_ HANDLE FileHandle, 370 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 371 _Out_ PVOID Buffer, 372 _In_ ULONG Length, 373 _In_ BOOLEAN ReturnSingleEntry, 374 _In_opt_ PVOID EaList, 375 _In_ ULONG EaListLength, 376 _In_opt_ PULONG EaIndex, 377 _In_ BOOLEAN RestartScan 378 ); 379 380 NTSYSCALLAPI 381 NTSTATUS 382 NTAPI 383 NtQueryFullAttributesFile( 384 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 385 _Out_ PFILE_NETWORK_OPEN_INFORMATION FileInformation 386 ); 387 388 __kernel_entry 389 NTSYSCALLAPI 390 NTSTATUS 391 NTAPI 392 NtQueryInformationFile( 393 _In_ HANDLE FileHandle, 394 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 395 _Out_writes_bytes_(Length) PVOID FileInformation, 396 _In_ ULONG Length, 397 _In_ FILE_INFORMATION_CLASS FileInformationClass 398 ); 399 400 NTSYSCALLAPI 401 NTSTATUS 402 NTAPI 403 NtQueryIoCompletion( 404 _In_ HANDLE IoCompletionHandle, 405 _In_ IO_COMPLETION_INFORMATION_CLASS IoCompletionInformationClass, 406 _Out_ PVOID IoCompletionInformation, 407 _In_ ULONG IoCompletionInformationLength, 408 _Out_opt_ PULONG ResultLength 409 ); 410 411 __kernel_entry 412 NTSYSCALLAPI 413 NTSTATUS 414 NTAPI 415 NtQueryQuotaInformationFile( 416 _In_ HANDLE FileHandle, 417 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 418 _Out_writes_bytes_(Length) PVOID Buffer, 419 _In_ ULONG Length, 420 _In_ BOOLEAN ReturnSingleEntry, 421 _In_reads_bytes_opt_(SidListLength) PVOID SidList, 422 _In_ ULONG SidListLength, 423 _In_reads_bytes_opt_((8 + (4 * ((SID *)StartSid)->SubAuthorityCount))) // SeLengthSid() 424 PSID StartSid, 425 _In_ BOOLEAN RestartScan 426 ); 427 428 __kernel_entry 429 NTSYSCALLAPI 430 NTSTATUS 431 NTAPI 432 NtQueryVolumeInformationFile( 433 _In_ HANDLE FileHandle, 434 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 435 _Out_writes_bytes_(Length) PVOID FsInformation, 436 _In_ ULONG Length, 437 _In_ FS_INFORMATION_CLASS FsInformationClass 438 ); 439 440 __kernel_entry 441 NTSYSCALLAPI 442 NTSTATUS 443 NTAPI 444 NtReadFile( 445 _In_ HANDLE FileHandle, 446 _In_opt_ HANDLE Event, 447 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 448 _In_opt_ PVOID ApcContext, 449 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 450 _Out_writes_bytes_(Length) PVOID Buffer, 451 _In_ ULONG Length, 452 _In_opt_ PLARGE_INTEGER ByteOffset, 453 _In_opt_ PULONG Key 454 ); 455 456 NTSYSCALLAPI 457 NTSTATUS 458 NTAPI 459 NtReadFileScatter( 460 _In_ HANDLE FileHandle, 461 _In_opt_ HANDLE Event, 462 _In_opt_ PIO_APC_ROUTINE UserApcRoutine, 463 _In_opt_ PVOID UserApcContext, 464 _Out_ PIO_STATUS_BLOCK UserIoStatusBlock, 465 _In_ FILE_SEGMENT_ELEMENT BufferDescription[], 466 _In_ ULONG BufferLength, 467 _In_ PLARGE_INTEGER ByteOffset, 468 _In_opt_ PULONG Key 469 ); 470 471 NTSYSCALLAPI 472 NTSTATUS 473 NTAPI 474 NtRemoveIoCompletion( 475 _In_ HANDLE IoCompletionHandle, 476 _Out_ PVOID *CompletionKey, 477 _Out_ PVOID *CompletionContext, 478 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 479 _In_opt_ PLARGE_INTEGER Timeout 480 ); 481 482 NTSYSCALLAPI 483 NTSTATUS 484 NTAPI 485 NtSetBootEntryOrder( 486 _In_ PULONG Ids, 487 _In_ PULONG Count 488 ); 489 490 NTSYSCALLAPI 491 NTSTATUS 492 NTAPI 493 NtSetBootOptions( 494 _In_ PBOOT_OPTIONS BootOptions, 495 _In_ ULONG FieldsToChange 496 ); 497 498 NTSTATUS 499 NTAPI 500 NtSetDriverEntryOrder( 501 _In_ PULONG Ids, 502 _In_ PULONG Count 503 ); 504 505 NTSYSCALLAPI 506 NTSTATUS 507 NTAPI 508 NtSetEaFile( 509 _In_ HANDLE FileHandle, 510 _In_ PIO_STATUS_BLOCK IoStatusBlock, 511 PVOID EaBuffer, 512 ULONG EaBufferSize 513 ); 514 515 __kernel_entry 516 NTSYSCALLAPI 517 NTSTATUS 518 NTAPI 519 NtSetInformationFile( 520 _In_ HANDLE FileHandle, 521 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 522 _In_reads_bytes_(Length) PVOID FileInformation, 523 _In_ ULONG Length, 524 _In_ FILE_INFORMATION_CLASS FileInformationClass 525 ); 526 527 NTSYSCALLAPI 528 NTSTATUS 529 NTAPI 530 NtSetIoCompletion( 531 _In_ HANDLE IoCompletionPortHandle, 532 _In_ PVOID CompletionKey, 533 _In_ PVOID CompletionContext, 534 _In_ NTSTATUS CompletionStatus, 535 _In_ ULONG CompletionInformation 536 ); 537 538 NTSYSCALLAPI 539 NTSTATUS 540 NTAPI 541 NtSetQuotaInformationFile( 542 HANDLE FileHandle, 543 PIO_STATUS_BLOCK IoStatusBlock, 544 PVOID Buffer, 545 ULONG BufferLength 546 ); 547 548 __kernel_entry 549 NTSYSCALLAPI 550 NTSTATUS 551 NTAPI 552 NtSetVolumeInformationFile( 553 _In_ HANDLE FileHandle, 554 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 555 _In_reads_bytes_(Length) PVOID FsInformation, 556 _In_ ULONG Length, 557 _In_ FS_INFORMATION_CLASS FsInformationClass 558 ); 559 560 NTSYSCALLAPI 561 NTSTATUS 562 NTAPI 563 NtTranslateFilePath( 564 PFILE_PATH InputFilePath, 565 ULONG OutputType, 566 PFILE_PATH OutputFilePath, 567 ULONG OutputFilePathLength 568 ); 569 570 NTSYSCALLAPI 571 NTSTATUS 572 NTAPI 573 NtUnloadDriver( 574 _In_ PUNICODE_STRING DriverServiceName 575 ); 576 577 __kernel_entry 578 NTSYSCALLAPI 579 NTSTATUS 580 NTAPI 581 NtUnlockFile( 582 _In_ HANDLE FileHandle, 583 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 584 _In_ PLARGE_INTEGER ByteOffset, 585 _In_ PLARGE_INTEGER Length, 586 _In_ ULONG Key 587 ); 588 589 __kernel_entry 590 NTSYSCALLAPI 591 NTSTATUS 592 NTAPI 593 NtWriteFile( 594 _In_ HANDLE FileHandle, 595 _In_opt_ HANDLE Event, 596 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 597 _In_opt_ PVOID ApcContext, 598 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 599 _In_reads_bytes_(Length) PVOID Buffer, 600 _In_ ULONG Length, 601 _In_opt_ PLARGE_INTEGER ByteOffset, 602 _In_opt_ PULONG Key 603 ); 604 605 NTSYSCALLAPI 606 NTSTATUS 607 NTAPI 608 NtWriteFileGather( 609 _In_ HANDLE FileHandle, 610 _In_opt_ HANDLE Event, 611 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 612 _In_opt_ PVOID ApcContext, 613 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 614 _In_ FILE_SEGMENT_ELEMENT BufferDescription[], 615 _In_ ULONG BufferLength, 616 _In_ PLARGE_INTEGER ByteOffset, 617 _In_opt_ PULONG Key 618 ); 619 620 NTSYSAPI 621 NTSTATUS 622 NTAPI 623 ZwAddBootEntry( 624 _In_ PUNICODE_STRING EntryName, 625 _In_ PUNICODE_STRING EntryValue 626 ); 627 628 NTSYSAPI 629 NTSTATUS 630 NTAPI 631 ZwCancelIoFile( 632 _In_ HANDLE FileHandle, 633 _Out_ PIO_STATUS_BLOCK IoStatusBlock 634 ); 635 636 _IRQL_requires_max_(PASSIVE_LEVEL) 637 NTSYSAPI 638 NTSTATUS 639 NTAPI 640 ZwCreateFile( 641 _Out_ PHANDLE FileHandle, 642 _In_ ACCESS_MASK DesiredAccess, 643 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 644 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 645 _In_opt_ PLARGE_INTEGER AllocationSize, 646 _In_ ULONG FileAttributes, 647 _In_ ULONG ShareAccess, 648 _In_ ULONG CreateDisposition, 649 _In_ ULONG CreateOptions, 650 _In_reads_bytes_opt_(EaLength) PVOID EaBuffer, 651 _In_ ULONG EaLength 652 ); 653 654 NTSYSAPI 655 NTSTATUS 656 NTAPI 657 ZwCreateIoCompletion( 658 _Out_ PHANDLE IoCompletionHandle, 659 _In_ ACCESS_MASK DesiredAccess, 660 _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes, 661 _In_ ULONG NumberOfConcurrentThreads 662 ); 663 664 NTSYSAPI 665 NTSTATUS 666 NTAPI 667 ZwCreateMailslotFile( 668 _Out_ PHANDLE MailSlotFileHandle, 669 _In_ ACCESS_MASK DesiredAccess, 670 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 671 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 672 _In_ ULONG FileAttributes, 673 _In_ ULONG ShareAccess, 674 _In_ ULONG MaxMessageSize, 675 _In_ PLARGE_INTEGER TimeOut 676 ); 677 678 NTSYSAPI 679 NTSTATUS 680 NTAPI 681 ZwCreateNamedPipeFile( 682 _Out_ PHANDLE NamedPipeFileHandle, 683 _In_ ACCESS_MASK DesiredAccess, 684 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 685 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 686 _In_ ULONG ShareAccess, 687 _In_ ULONG CreateDisposition, 688 _In_ ULONG CreateOptions, 689 _In_ ULONG WriteModeMessage, 690 _In_ ULONG ReadModeMessage, 691 _In_ ULONG NonBlocking, 692 _In_ ULONG MaxInstances, 693 _In_ ULONG InBufferSize, 694 _In_ ULONG OutBufferSize, 695 _In_ PLARGE_INTEGER DefaultTimeOut 696 ); 697 698 NTSYSAPI 699 NTSTATUS 700 NTAPI 701 ZwDeleteBootEntry( 702 _In_ PUNICODE_STRING EntryName, 703 _In_ PUNICODE_STRING EntryValue 704 ); 705 706 NTSYSAPI 707 NTSTATUS 708 NTAPI 709 ZwDeleteFile( 710 _In_ POBJECT_ATTRIBUTES ObjectAttributes 711 ); 712 713 _IRQL_requires_max_(PASSIVE_LEVEL) 714 NTSYSAPI 715 NTSTATUS 716 NTAPI 717 ZwDeviceIoControlFile( 718 _In_ HANDLE FileHandle, 719 _In_opt_ HANDLE Event, 720 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 721 _In_opt_ PVOID ApcContext, 722 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 723 _In_ ULONG IoControlCode, 724 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, 725 _In_ ULONG InputBufferLength, 726 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, 727 _In_ ULONG OutputBufferLength 728 ); 729 730 _IRQL_requires_max_(PASSIVE_LEVEL) 731 NTSYSAPI 732 NTSTATUS 733 NTAPI 734 ZwFlushBuffersFile( 735 _In_ HANDLE FileHandle, 736 _Out_ PIO_STATUS_BLOCK IoStatusBlock 737 ); 738 739 NTSYSAPI 740 NTSTATUS 741 NTAPI 742 ZwFlushWriteBuffer(VOID); 743 744 _IRQL_requires_max_(PASSIVE_LEVEL) 745 NTSYSAPI 746 NTSTATUS 747 NTAPI 748 ZwFsControlFile( 749 _In_ HANDLE FileHandle, 750 _In_opt_ HANDLE Event, 751 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 752 _In_opt_ PVOID ApcContext, 753 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 754 _In_ ULONG FsControlCode, 755 _In_reads_bytes_opt_(InputBufferLength) PVOID InputBuffer, 756 _In_ ULONG InputBufferLength, 757 _Out_writes_bytes_opt_(OutputBufferLength) PVOID OutputBuffer, 758 _In_ ULONG OutputBufferLength 759 ); 760 761 #ifdef NTOS_MODE_USER 762 NTSYSAPI 763 NTSTATUS 764 NTAPI 765 ZwLoadDriver( 766 _In_ PUNICODE_STRING DriverServiceName 767 ); 768 #endif 769 770 NTSYSAPI 771 NTSTATUS 772 NTAPI 773 ZwLockFile( 774 _In_ HANDLE FileHandle, 775 _In_opt_ HANDLE Event, 776 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 777 _In_opt_ PVOID ApcContext, 778 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 779 _In_ PLARGE_INTEGER ByteOffset, 780 _In_ PLARGE_INTEGER Length, 781 _In_ ULONG Key, 782 _In_ BOOLEAN FailImmediatedly, 783 _In_ BOOLEAN ExclusiveLock 784 ); 785 786 NTSYSAPI 787 NTSTATUS 788 NTAPI 789 ZwNotifyChangeDirectoryFile( 790 _In_ HANDLE FileHandle, 791 _In_opt_ HANDLE Event, 792 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 793 _In_opt_ PVOID ApcContext, 794 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 795 _Out_ PVOID Buffer, 796 _In_ ULONG BufferSize, 797 _In_ ULONG CompletionFilter, 798 _In_ BOOLEAN WatchTree 799 ); 800 801 NTSYSAPI 802 NTSTATUS 803 NTAPI 804 ZwOpenFile( 805 _Out_ PHANDLE FileHandle, 806 _In_ ACCESS_MASK DesiredAccess, 807 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 808 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 809 _In_ ULONG ShareAccess, 810 _In_ ULONG OpenOptions 811 ); 812 813 NTSYSAPI 814 NTSTATUS 815 NTAPI 816 ZwOpenIoCompletion( 817 _Out_ PHANDLE CompetionPort, 818 _In_ ACCESS_MASK DesiredAccess, 819 _In_ POBJECT_ATTRIBUTES ObjectAttributes 820 ); 821 822 NTSYSAPI 823 NTSTATUS 824 NTAPI 825 ZwQueryAttributesFile( 826 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 827 _Out_ PFILE_BASIC_INFORMATION FileInformation 828 ); 829 830 _IRQL_requires_max_(PASSIVE_LEVEL) 831 NTSYSAPI 832 NTSTATUS 833 NTAPI 834 ZwQueryDirectoryFile( 835 _In_ HANDLE FileHandle, 836 _In_opt_ HANDLE Event, 837 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 838 _In_opt_ PVOID ApcContext, 839 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 840 _Out_writes_bytes_(Length) PVOID FileInformation, 841 _In_ ULONG Length, 842 _In_ FILE_INFORMATION_CLASS FileInformationClass, 843 _In_ BOOLEAN ReturnSingleEntry, 844 _In_opt_ PUNICODE_STRING FileName, 845 _In_ BOOLEAN RestartScan 846 ); 847 848 #ifdef NTOS_MODE_USER 849 NTSYSAPI 850 NTSTATUS 851 NTAPI 852 ZwQueryEaFile( 853 _In_ HANDLE FileHandle, 854 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 855 _Out_ PVOID Buffer, 856 _In_ ULONG Length, 857 _In_ BOOLEAN ReturnSingleEntry, 858 _In_opt_ PVOID EaList, 859 _In_ ULONG EaListLength, 860 _In_opt_ PULONG EaIndex, 861 _In_ BOOLEAN RestartScan 862 ); 863 #endif 864 865 NTSYSAPI 866 NTSTATUS 867 NTAPI 868 ZwQueryFullAttributesFile( 869 _In_ POBJECT_ATTRIBUTES ObjectAttributes, 870 _Out_ PFILE_NETWORK_OPEN_INFORMATION FileInformation 871 ); 872 873 _IRQL_requires_max_(PASSIVE_LEVEL) 874 NTSYSAPI 875 NTSTATUS 876 NTAPI 877 ZwQueryInformationFile( 878 _In_ HANDLE FileHandle, 879 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 880 _Out_writes_bytes_(Length) PVOID FileInformation, 881 _In_ ULONG Length, 882 _In_ FILE_INFORMATION_CLASS FileInformationClass 883 ); 884 885 NTSYSAPI 886 NTSTATUS 887 NTAPI 888 ZwQueryIoCompletion( 889 _In_ HANDLE IoCompletionHandle, 890 _In_ IO_COMPLETION_INFORMATION_CLASS IoCompletionInformationClass, 891 _Out_ PVOID IoCompletionInformation, 892 _In_ ULONG IoCompletionInformationLength, 893 _Out_opt_ PULONG ResultLength 894 ); 895 896 NTSYSAPI 897 NTSTATUS 898 NTAPI 899 ZwQueryQuotaInformationFile( 900 _In_ HANDLE FileHandle, 901 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 902 _Out_ PVOID Buffer, 903 _In_ ULONG Length, 904 _In_ BOOLEAN ReturnSingleEntry, 905 _In_opt_ PVOID SidList, 906 _In_ ULONG SidListLength, 907 _In_opt_ PSID StartSid, 908 _In_ BOOLEAN RestartScan 909 ); 910 911 _IRQL_requires_max_(PASSIVE_LEVEL) 912 NTSYSAPI 913 NTSTATUS 914 NTAPI 915 ZwQueryVolumeInformationFile( 916 _In_ HANDLE FileHandle, 917 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 918 _Out_writes_bytes_(Length) PVOID FsInformation, 919 _In_ ULONG Length, 920 _In_ FS_INFORMATION_CLASS FsInformationClass 921 ); 922 923 _IRQL_requires_max_(PASSIVE_LEVEL) 924 NTSYSAPI 925 NTSTATUS 926 NTAPI 927 ZwReadFile( 928 _In_ HANDLE FileHandle, 929 _In_opt_ HANDLE Event, 930 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 931 _In_opt_ PVOID ApcContext, 932 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 933 _Out_writes_bytes_(Length) PVOID Buffer, 934 _In_ ULONG Length, 935 _In_opt_ PLARGE_INTEGER ByteOffset, 936 _In_opt_ PULONG Key 937 ); 938 939 NTSYSAPI 940 NTSTATUS 941 NTAPI 942 ZwReadFileScatter( 943 _In_ HANDLE FileHandle, 944 _In_opt_ HANDLE Event, 945 _In_opt_ PIO_APC_ROUTINE UserApcRoutine, 946 _In_opt_ PVOID UserApcContext, 947 _Out_ PIO_STATUS_BLOCK UserIoStatusBlock, 948 _In_ FILE_SEGMENT_ELEMENT BufferDescription[], 949 _In_ ULONG BufferLength, 950 _In_ PLARGE_INTEGER ByteOffset, 951 _In_opt_ PULONG Key 952 ); 953 954 NTSYSAPI 955 NTSTATUS 956 NTAPI 957 ZwRemoveIoCompletion( 958 _In_ HANDLE IoCompletionHandle, 959 _Out_ PVOID *CompletionKey, 960 _Out_ PVOID *CompletionContext, 961 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 962 _In_opt_ PLARGE_INTEGER Timeout 963 ); 964 965 #ifdef NTOS_MODE_USER 966 NTSYSAPI 967 NTSTATUS 968 NTAPI 969 ZwSetEaFile( 970 _In_ HANDLE FileHandle, 971 _In_ PIO_STATUS_BLOCK IoStatusBlock, 972 PVOID EaBuffer, 973 ULONG EaBufferSize 974 ); 975 #endif 976 977 _IRQL_requires_max_(PASSIVE_LEVEL) 978 NTSYSAPI 979 NTSTATUS 980 NTAPI 981 ZwSetInformationFile( 982 _In_ HANDLE FileHandle, 983 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 984 _In_reads_bytes_(Length) PVOID FileInformation, 985 _In_ ULONG Length, 986 _In_ FILE_INFORMATION_CLASS FileInformationClass 987 ); 988 989 NTSYSAPI 990 NTSTATUS 991 NTAPI 992 ZwSetIoCompletion( 993 _In_ HANDLE IoCompletionPortHandle, 994 _In_ PVOID CompletionKey, 995 _In_ PVOID CompletionContext, 996 _In_ NTSTATUS CompletionStatus, 997 _In_ ULONG CompletionInformation 998 ); 999 1000 NTSYSAPI 1001 NTSTATUS 1002 NTAPI 1003 ZwSetQuotaInformationFile( 1004 _In_ HANDLE FileHandle, 1005 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 1006 _In_ PVOID Buffer, 1007 _In_ ULONG BufferLength 1008 ); 1009 1010 _IRQL_requires_max_(PASSIVE_LEVEL) 1011 NTSYSAPI 1012 NTSTATUS 1013 NTAPI 1014 ZwSetVolumeInformationFile( 1015 _In_ HANDLE FileHandle, 1016 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 1017 _In_reads_bytes_(Length) PVOID FsInformation, 1018 _In_ ULONG Length, 1019 _In_ FS_INFORMATION_CLASS FsInformationClass 1020 ); 1021 1022 NTSYSAPI 1023 NTSTATUS 1024 NTAPI 1025 ZwUnloadDriver( 1026 _In_ PUNICODE_STRING DriverServiceName 1027 ); 1028 1029 NTSYSAPI 1030 NTSTATUS 1031 NTAPI 1032 ZwUnlockFile( 1033 _In_ HANDLE FileHandle, 1034 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 1035 _In_ PLARGE_INTEGER ByteOffset, 1036 _In_ PLARGE_INTEGER Length, 1037 _In_opt_ ULONG Key 1038 ); 1039 1040 _IRQL_requires_max_(PASSIVE_LEVEL) 1041 NTSYSAPI 1042 NTSTATUS 1043 NTAPI 1044 ZwWriteFile( 1045 _In_ HANDLE FileHandle, 1046 _In_opt_ HANDLE Event, 1047 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 1048 _In_opt_ PVOID ApcContext, 1049 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 1050 _In_reads_bytes_(Length) PVOID Buffer, 1051 _In_ ULONG Length, 1052 _In_opt_ PLARGE_INTEGER ByteOffset, 1053 _In_opt_ PULONG Key 1054 ); 1055 1056 NTSYSAPI 1057 NTSTATUS 1058 NTAPI 1059 ZwWriteFileGather( 1060 _In_ HANDLE FileHandle, 1061 _In_opt_ HANDLE Event, 1062 _In_opt_ PIO_APC_ROUTINE ApcRoutine, 1063 _In_opt_ PVOID ApcContext, 1064 _Out_ PIO_STATUS_BLOCK IoStatusBlock, 1065 _In_ FILE_SEGMENT_ELEMENT BufferDescription[], 1066 _In_ ULONG BufferLength, 1067 _In_ PLARGE_INTEGER ByteOffset, 1068 _In_opt_ PULONG Key 1069 ); 1070 1071 #ifdef __cplusplus 1072 } 1073 #endif 1074 1075 #endif 1076 1077 1078