1304 lines
40 KiB
C
1304 lines
40 KiB
C
/*++ BUILD Version: 0007 // Increment this if a change has global effects
|
||
|
||
Copyright (c) 1989-1999 Microsoft Corporation
|
||
|
||
Module Name:
|
||
|
||
ntioapi.h
|
||
|
||
Abstract:
|
||
|
||
This module contains the user APIs for the NT I/O system.
|
||
|
||
Author:
|
||
|
||
Darryl E. Havens (darrylh) 12-Apr-1989
|
||
|
||
|
||
Revision History:
|
||
|
||
|
||
--*/
|
||
|
||
#ifndef _NTIOAPI_
|
||
#define _NTIOAPI_
|
||
|
||
#if _MSC_VER > 1000
|
||
#pragma once
|
||
#endif
|
||
|
||
//
|
||
// This file contains io definitions that must be portable across operating
|
||
// systems (i.e. DOS)
|
||
//
|
||
|
||
#include <devioctl.h>
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
// begin_ntddk begin_wdm begin_nthal begin_ntifs
|
||
// begin_winnt
|
||
|
||
//
|
||
// Define access rights to files and directories
|
||
//
|
||
|
||
//
|
||
// The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in
|
||
// devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these
|
||
// constants *MUST* always be in sync.
|
||
// The values are redefined in devioctl.h because they must be available to
|
||
// both DOS and NT.
|
||
//
|
||
|
||
#define FILE_READ_DATA ( 0x0001 ) // file & pipe
|
||
#define FILE_LIST_DIRECTORY ( 0x0001 ) // directory
|
||
|
||
#define FILE_WRITE_DATA ( 0x0002 ) // file & pipe
|
||
#define FILE_ADD_FILE ( 0x0002 ) // directory
|
||
|
||
#define FILE_APPEND_DATA ( 0x0004 ) // file
|
||
#define FILE_ADD_SUBDIRECTORY ( 0x0004 ) // directory
|
||
#define FILE_CREATE_PIPE_INSTANCE ( 0x0004 ) // named pipe
|
||
|
||
|
||
#define FILE_READ_EA ( 0x0008 ) // file & directory
|
||
|
||
#define FILE_WRITE_EA ( 0x0010 ) // file & directory
|
||
|
||
#define FILE_EXECUTE ( 0x0020 ) // file
|
||
#define FILE_TRAVERSE ( 0x0020 ) // directory
|
||
|
||
#define FILE_DELETE_CHILD ( 0x0040 ) // directory
|
||
|
||
#define FILE_READ_ATTRIBUTES ( 0x0080 ) // all
|
||
|
||
#define FILE_WRITE_ATTRIBUTES ( 0x0100 ) // all
|
||
|
||
#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
|
||
|
||
#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ |\
|
||
FILE_READ_DATA |\
|
||
FILE_READ_ATTRIBUTES |\
|
||
FILE_READ_EA |\
|
||
SYNCHRONIZE)
|
||
|
||
|
||
#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\
|
||
FILE_WRITE_DATA |\
|
||
FILE_WRITE_ATTRIBUTES |\
|
||
FILE_WRITE_EA |\
|
||
FILE_APPEND_DATA |\
|
||
SYNCHRONIZE)
|
||
|
||
|
||
#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\
|
||
FILE_READ_ATTRIBUTES |\
|
||
FILE_EXECUTE |\
|
||
SYNCHRONIZE)
|
||
|
||
// end_winnt
|
||
|
||
|
||
//
|
||
// Define share access rights to files and directories
|
||
//
|
||
|
||
#define FILE_SHARE_READ 0x00000001 // winnt
|
||
#define FILE_SHARE_WRITE 0x00000002 // winnt
|
||
#define FILE_SHARE_DELETE 0x00000004 // winnt
|
||
#define FILE_SHARE_VALID_FLAGS 0x00000007
|
||
|
||
//
|
||
// Define the file attributes values
|
||
//
|
||
// Note: 0x00000008 is reserved for use for the old DOS VOLID (volume ID)
|
||
// and is therefore not considered valid in NT.
|
||
//
|
||
// Note: 0x00000010 is reserved for use for the old DOS SUBDIRECTORY flag
|
||
// and is therefore not considered valid in NT. This flag has
|
||
// been disassociated with file attributes since the other flags are
|
||
// protected with READ_ and WRITE_ATTRIBUTES access to the file.
|
||
//
|
||
// Note: Note also that the order of these flags is set to allow both the
|
||
// FAT and the Pinball File Systems to directly set the attributes
|
||
// flags in attributes words without having to pick each flag out
|
||
// individually. The order of these flags should not be changed!
|
||
//
|
||
|
||
#define FILE_ATTRIBUTE_READONLY 0x00000001 // winnt
|
||
#define FILE_ATTRIBUTE_HIDDEN 0x00000002 // winnt
|
||
#define FILE_ATTRIBUTE_SYSTEM 0x00000004 // winnt
|
||
//OLD DOS VOLID 0x00000008
|
||
|
||
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 // winnt
|
||
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 // winnt
|
||
#define FILE_ATTRIBUTE_DEVICE 0x00000040 // winnt
|
||
#define FILE_ATTRIBUTE_NORMAL 0x00000080 // winnt
|
||
|
||
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 // winnt
|
||
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
||
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
||
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
||
|
||
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
|
||
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
||
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
||
|
||
//
|
||
// This definition is old and will disappear shortly
|
||
//
|
||
|
||
#define FILE_ATTRIBUTE_CONTENT_INDEXED FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
|
||
|
||
#define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
|
||
#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
|
||
|
||
//
|
||
// Define the create disposition values
|
||
//
|
||
|
||
#define FILE_SUPERSEDE 0x00000000
|
||
#define FILE_OPEN 0x00000001
|
||
#define FILE_CREATE 0x00000002
|
||
#define FILE_OPEN_IF 0x00000003
|
||
#define FILE_OVERWRITE 0x00000004
|
||
#define FILE_OVERWRITE_IF 0x00000005
|
||
#define FILE_MAXIMUM_DISPOSITION 0x00000005
|
||
|
||
//
|
||
// Define the create/open option flags
|
||
//
|
||
|
||
#define FILE_DIRECTORY_FILE 0x00000001
|
||
#define FILE_WRITE_THROUGH 0x00000002
|
||
#define FILE_SEQUENTIAL_ONLY 0x00000004
|
||
#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
|
||
|
||
#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
|
||
#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
|
||
#define FILE_NON_DIRECTORY_FILE 0x00000040
|
||
#define FILE_CREATE_TREE_CONNECTION 0x00000080
|
||
|
||
#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
|
||
#define FILE_NO_EA_KNOWLEDGE 0x00000200
|
||
#define FILE_OPEN_FOR_RECOVERY 0x00000400
|
||
#define FILE_RANDOM_ACCESS 0x00000800
|
||
|
||
#define FILE_DELETE_ON_CLOSE 0x00001000
|
||
#define FILE_OPEN_BY_FILE_ID 0x00002000
|
||
#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
|
||
#define FILE_NO_COMPRESSION 0x00008000
|
||
|
||
#define FILE_RESERVE_OPFILTER 0x00100000
|
||
#define FILE_OPEN_REPARSE_POINT 0x00200000
|
||
#define FILE_OPEN_NO_RECALL 0x00400000
|
||
#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
|
||
|
||
#define FILE_COPY_STRUCTURED_STORAGE 0x00000041
|
||
#define FILE_STRUCTURED_STORAGE 0x00000441
|
||
|
||
#define FILE_VALID_OPTION_FLAGS 0x00ffffff
|
||
#define FILE_VALID_SET_FLAGS 0x00000036
|
||
|
||
//
|
||
// Define the I/O status information return values for NtCreateFile/NtOpenFile
|
||
//
|
||
|
||
#define FILE_SUPERSEDED 0x00000000
|
||
#define FILE_OPENED 0x00000001
|
||
#define FILE_CREATED 0x00000002
|
||
#define FILE_OVERWRITTEN 0x00000003
|
||
#define FILE_EXISTS 0x00000004
|
||
#define FILE_DOES_NOT_EXIST 0x00000005
|
||
|
||
// end_ntddk end_wdm end_nthal
|
||
|
||
//
|
||
// Define the filter flags for NtNotifyChangeDirectoryFile
|
||
//
|
||
|
||
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
|
||
#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
|
||
#define FILE_NOTIFY_CHANGE_NAME 0x00000003
|
||
#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
|
||
#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
|
||
#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
|
||
#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
|
||
#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
|
||
#define FILE_NOTIFY_CHANGE_EA 0x00000080
|
||
#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
|
||
#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
|
||
#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
|
||
#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
|
||
#define FILE_NOTIFY_VALID_MASK 0x00000fff
|
||
|
||
//
|
||
// Define the file action type codes for NtNotifyChangeDirectoryFile
|
||
//
|
||
|
||
#define FILE_ACTION_ADDED 0x00000001
|
||
#define FILE_ACTION_REMOVED 0x00000002
|
||
#define FILE_ACTION_MODIFIED 0x00000003
|
||
#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
|
||
#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
|
||
#define FILE_ACTION_ADDED_STREAM 0x00000006
|
||
#define FILE_ACTION_REMOVED_STREAM 0x00000007
|
||
#define FILE_ACTION_MODIFIED_STREAM 0x00000008
|
||
#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
|
||
#define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
|
||
#define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
|
||
|
||
// end_ntifs
|
||
|
||
// begin_ntddk begin_wdm begin_nthal begin_ntifs
|
||
//
|
||
// Define special ByteOffset parameters for read and write operations
|
||
//
|
||
|
||
#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
|
||
#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
|
||
|
||
//
|
||
// Define alignment requirement values
|
||
//
|
||
|
||
#define FILE_BYTE_ALIGNMENT 0x00000000
|
||
#define FILE_WORD_ALIGNMENT 0x00000001
|
||
#define FILE_LONG_ALIGNMENT 0x00000003
|
||
#define FILE_QUAD_ALIGNMENT 0x00000007
|
||
#define FILE_OCTA_ALIGNMENT 0x0000000f
|
||
#define FILE_32_BYTE_ALIGNMENT 0x0000001f
|
||
#define FILE_64_BYTE_ALIGNMENT 0x0000003f
|
||
#define FILE_128_BYTE_ALIGNMENT 0x0000007f
|
||
#define FILE_256_BYTE_ALIGNMENT 0x000000ff
|
||
#define FILE_512_BYTE_ALIGNMENT 0x000001ff
|
||
|
||
//
|
||
// Define the maximum length of a filename string
|
||
//
|
||
|
||
#define MAXIMUM_FILENAME_LENGTH 256
|
||
|
||
// end_ntddk end_wdm end_nthal
|
||
|
||
//
|
||
// Define the file system attributes flags
|
||
//
|
||
|
||
#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
|
||
#define FILE_CASE_PRESERVED_NAMES 0x00000002
|
||
#define FILE_UNICODE_ON_DISK 0x00000004
|
||
#define FILE_PERSISTENT_ACLS 0x00000008
|
||
#define FILE_FILE_COMPRESSION 0x00000010
|
||
#define FILE_VOLUME_QUOTAS 0x00000020
|
||
#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
|
||
#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
|
||
#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
|
||
#define FILE_VOLUME_IS_COMPRESSED 0x00008000
|
||
#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
|
||
#define FILE_SUPPORTS_ENCRYPTION 0x00020000
|
||
#define FILE_NAMED_STREAMS 0x00040000
|
||
|
||
//
|
||
// Define the flags for NtSet(Query)EaFile service structure entries
|
||
//
|
||
|
||
#define FILE_NEED_EA 0x00000080
|
||
|
||
//
|
||
// Define EA type values
|
||
//
|
||
|
||
#define FILE_EA_TYPE_BINARY 0xfffe
|
||
#define FILE_EA_TYPE_ASCII 0xfffd
|
||
#define FILE_EA_TYPE_BITMAP 0xfffb
|
||
#define FILE_EA_TYPE_METAFILE 0xfffa
|
||
#define FILE_EA_TYPE_ICON 0xfff9
|
||
#define FILE_EA_TYPE_EA 0xffee
|
||
#define FILE_EA_TYPE_MVMT 0xffdf
|
||
#define FILE_EA_TYPE_MVST 0xffde
|
||
#define FILE_EA_TYPE_ASN1 0xffdd
|
||
#define FILE_EA_TYPE_FAMILY_IDS 0xff01
|
||
|
||
// begin_ntddk begin_wdm begin_nthal
|
||
//
|
||
// Define the various device characteristics flags
|
||
//
|
||
|
||
#define FILE_REMOVABLE_MEDIA 0x00000001
|
||
#define FILE_READ_ONLY_DEVICE 0x00000002
|
||
#define FILE_FLOPPY_DISKETTE 0x00000004
|
||
#define FILE_WRITE_ONCE_MEDIA 0x00000008
|
||
#define FILE_REMOTE_DEVICE 0x00000010
|
||
#define FILE_DEVICE_IS_MOUNTED 0x00000020
|
||
#define FILE_VIRTUAL_VOLUME 0x00000040
|
||
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
|
||
#define FILE_DEVICE_SECURE_OPEN 0x00000100
|
||
|
||
// end_wdm
|
||
|
||
//
|
||
// flags specified here will be propagated up and down a device stack
|
||
// after FDO and all filter devices are added, but before the device
|
||
// stack is started
|
||
//
|
||
|
||
#define FILE_CHARACTERISTICS_PROPAGATED ( FILE_REMOVABLE_MEDIA | \
|
||
FILE_READ_ONLY_DEVICE | \
|
||
FILE_FLOPPY_DISKETTE | \
|
||
FILE_WRITE_ONCE_MEDIA | \
|
||
FILE_DEVICE_SECURE_OPEN )
|
||
|
||
// end_ntddk end_nthal
|
||
|
||
// begin_ntddk begin_wdm begin_nthal
|
||
//
|
||
// Define the base asynchronous I/O argument types
|
||
//
|
||
|
||
typedef struct _IO_STATUS_BLOCK {
|
||
union {
|
||
NTSTATUS Status;
|
||
PVOID Pointer;
|
||
};
|
||
|
||
ULONG_PTR Information;
|
||
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
||
|
||
#if defined(_WIN64)
|
||
typedef struct _IO_STATUS_BLOCK32 {
|
||
NTSTATUS Status;
|
||
ULONG Information;
|
||
} IO_STATUS_BLOCK32, *PIO_STATUS_BLOCK32;
|
||
#endif
|
||
|
||
|
||
//
|
||
// Define an Asynchronous Procedure Call from I/O viewpoint
|
||
//
|
||
|
||
typedef
|
||
VOID
|
||
(NTAPI *PIO_APC_ROUTINE) (
|
||
IN PVOID ApcContext,
|
||
IN PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN ULONG Reserved
|
||
);
|
||
#define PIO_APC_ROUTINE_DEFINED
|
||
|
||
// end_ntddk end_wdm end_nthal
|
||
|
||
//
|
||
// Define the file notification information structure
|
||
//
|
||
|
||
typedef struct _FILE_NOTIFY_INFORMATION {
|
||
ULONG NextEntryOffset;
|
||
ULONG Action;
|
||
ULONG FileNameLength;
|
||
OCHAR FileName[1];
|
||
} FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
|
||
|
||
// begin_ntddk begin_wdm begin_nthal
|
||
//
|
||
// Define the file information class values
|
||
//
|
||
// WARNING: The order of the following values are assumed by the I/O system.
|
||
// Any changes made here should be reflected there as well.
|
||
//
|
||
|
||
typedef enum _FILE_INFORMATION_CLASS {
|
||
// end_wdm
|
||
FileDirectoryInformation = 1,
|
||
FileFullDirectoryInformation, // 2
|
||
FileBothDirectoryInformation, // 3
|
||
FileBasicInformation, // 4 wdm
|
||
FileStandardInformation, // 5 wdm
|
||
FileInternalInformation, // 6
|
||
FileEaInformation, // 7
|
||
FileAccessInformation, // 8
|
||
FileNameInformation, // 9
|
||
FileRenameInformation, // 10
|
||
FileLinkInformation, // 11
|
||
FileNamesInformation, // 12
|
||
FileDispositionInformation, // 13
|
||
FilePositionInformation, // 14 wdm
|
||
FileFullEaInformation, // 15
|
||
FileModeInformation, // 16
|
||
FileAlignmentInformation, // 17
|
||
FileAllInformation, // 18
|
||
FileAllocationInformation, // 19
|
||
FileEndOfFileInformation, // 20 wdm
|
||
FileAlternateNameInformation, // 21
|
||
FileStreamInformation, // 22
|
||
FilePipeInformation, // 23
|
||
FilePipeLocalInformation, // 24
|
||
FilePipeRemoteInformation, // 25
|
||
FileMailslotQueryInformation, // 26
|
||
FileMailslotSetInformation, // 27
|
||
FileCompressionInformation, // 28
|
||
FileObjectIdInformation, // 29
|
||
FileCompletionInformation, // 30
|
||
FileMoveClusterInformation, // 31
|
||
FileQuotaInformation, // 32
|
||
FileReparsePointInformation, // 33
|
||
FileNetworkOpenInformation, // 34
|
||
FileAttributeTagInformation, // 35
|
||
FileTrackingInformation, // 36
|
||
FileMaximumInformation
|
||
// begin_wdm
|
||
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
||
|
||
//
|
||
// Define the various structures which are returned on query operations
|
||
//
|
||
|
||
// end_ntddk end_wdm end_nthal
|
||
|
||
//
|
||
// NtQueryDirectoryFile return types:
|
||
//
|
||
// FILE_DIRECTORY_INFORMATION
|
||
// FILE_FULL_DIR_INFORMATION
|
||
// FILE_BOTH_DIR_INFORMATION
|
||
// FILE_NAMES_INFORMATION
|
||
// FILE_OBJECTID_INFORMATION
|
||
//
|
||
|
||
typedef struct _FILE_DIRECTORY_INFORMATION {
|
||
ULONG NextEntryOffset;
|
||
ULONG FileIndex;
|
||
LARGE_INTEGER CreationTime;
|
||
LARGE_INTEGER LastAccessTime;
|
||
LARGE_INTEGER LastWriteTime;
|
||
LARGE_INTEGER ChangeTime;
|
||
LARGE_INTEGER EndOfFile;
|
||
LARGE_INTEGER AllocationSize;
|
||
ULONG FileAttributes;
|
||
ULONG FileNameLength;
|
||
OCHAR FileName[1];
|
||
} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
|
||
|
||
typedef struct _FILE_NAMES_INFORMATION {
|
||
ULONG NextEntryOffset;
|
||
ULONG FileIndex;
|
||
ULONG FileNameLength;
|
||
OCHAR FileName[1];
|
||
} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
|
||
|
||
//
|
||
// The following constants provide addition meta characters to fully
|
||
// support the more obscure aspects of DOS wild card processing.
|
||
//
|
||
|
||
#define ANSI_DOS_STAR ('<')
|
||
#define ANSI_DOS_QM ('>')
|
||
#define ANSI_DOS_DOT ('"')
|
||
|
||
#define DOS_STAR (L'<')
|
||
#define DOS_QM (L'>')
|
||
#define DOS_DOT (L'"')
|
||
|
||
//
|
||
// NtQuery(Set)InformationFile return types:
|
||
//
|
||
// FILE_BASIC_INFORMATION
|
||
// FILE_STANDARD_INFORMATION
|
||
// FILE_INTERNAL_INFORMATION
|
||
// FILE_EA_INFORMATION
|
||
// FILE_ACCESS_INFORMATION
|
||
// FILE_POSITION_INFORMATION
|
||
// FILE_MODE_INFORMATION
|
||
// FILE_ALIGNMENT_INFORMATION
|
||
// FILE_NAME_INFORMATION
|
||
// FILE_ALL_INFORMATION
|
||
//
|
||
// FILE_NETWORK_OPEN_INFORMATION
|
||
//
|
||
// FILE_ALLOCATION_INFORMATION
|
||
// FILE_COMPRESSION_INFORMATION
|
||
// FILE_DISPOSITION_INFORMATION
|
||
// FILE_END_OF_FILE_INFORMATION
|
||
// FILE_LINK_INFORMATION
|
||
// FILE_MOVE_CLUSTER_INFORMATION
|
||
// FILE_RENAME_INFORMATION
|
||
// FILE_STREAM_INFORMATION
|
||
// FILE_COMPLETION_INFORMATION
|
||
//
|
||
// FILE_PIPE_INFORMATION
|
||
// FILE_PIPE_LOCAL_INFORMATION
|
||
// FILE_PIPE_REMOTE_INFORMATION
|
||
//
|
||
// FILE_MAILSLOT_QUERY_INFORMATION
|
||
// FILE_MAILSLOT_SET_INFORMATION
|
||
// FILE_REPARSE_POINT_INFORMATION
|
||
//
|
||
|
||
typedef struct _FILE_BASIC_INFORMATION { // ntddk wdm nthal
|
||
LARGE_INTEGER CreationTime; // ntddk wdm nthal
|
||
LARGE_INTEGER LastAccessTime; // ntddk wdm nthal
|
||
LARGE_INTEGER LastWriteTime; // ntddk wdm nthal
|
||
LARGE_INTEGER ChangeTime; // ntddk wdm nthal
|
||
ULONG FileAttributes; // ntddk wdm nthal
|
||
} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; // ntddk wdm nthal
|
||
// ntddk wdm nthal
|
||
typedef struct _FILE_STANDARD_INFORMATION { // ntddk wdm nthal
|
||
LARGE_INTEGER AllocationSize; // ntddk wdm nthal
|
||
LARGE_INTEGER EndOfFile; // ntddk wdm nthal
|
||
ULONG NumberOfLinks; // ntddk wdm nthal
|
||
BOOLEAN DeletePending; // ntddk wdm nthal
|
||
BOOLEAN Directory; // ntddk wdm nthal
|
||
} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; // ntddk wdm nthal
|
||
// ntddk wdm nthal
|
||
typedef struct _FILE_INTERNAL_INFORMATION {
|
||
LARGE_INTEGER IndexNumber;
|
||
} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
|
||
|
||
typedef struct _FILE_EA_INFORMATION {
|
||
ULONG EaSize;
|
||
} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
|
||
|
||
typedef struct _FILE_ACCESS_INFORMATION {
|
||
ACCESS_MASK AccessFlags;
|
||
} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
|
||
|
||
typedef struct _FILE_POSITION_INFORMATION { // ntddk wdm nthal
|
||
LARGE_INTEGER CurrentByteOffset; // ntddk wdm nthal
|
||
} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; // ntddk wdm nthal
|
||
// ntddk wdm nthal
|
||
typedef struct _FILE_MODE_INFORMATION {
|
||
ULONG Mode;
|
||
} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
|
||
|
||
typedef struct _FILE_ALIGNMENT_INFORMATION { // ntddk nthal
|
||
ULONG AlignmentRequirement; // ntddk nthal
|
||
} FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; // ntddk nthal
|
||
// ntddk nthal
|
||
typedef struct _FILE_NAME_INFORMATION { // ntddk
|
||
ULONG FileNameLength; // ntddk
|
||
OCHAR FileName[1]; // ntddk
|
||
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; // ntddk
|
||
// ntddk
|
||
typedef struct _FILE_ALL_INFORMATION {
|
||
FILE_BASIC_INFORMATION BasicInformation;
|
||
FILE_STANDARD_INFORMATION StandardInformation;
|
||
FILE_INTERNAL_INFORMATION InternalInformation;
|
||
FILE_EA_INFORMATION EaInformation;
|
||
FILE_ACCESS_INFORMATION AccessInformation;
|
||
FILE_POSITION_INFORMATION PositionInformation;
|
||
FILE_MODE_INFORMATION ModeInformation;
|
||
FILE_ALIGNMENT_INFORMATION AlignmentInformation;
|
||
FILE_NAME_INFORMATION NameInformation;
|
||
} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
|
||
|
||
typedef struct _FILE_NETWORK_OPEN_INFORMATION { // ntddk wdm nthal
|
||
LARGE_INTEGER CreationTime; // ntddk wdm nthal
|
||
LARGE_INTEGER LastAccessTime; // ntddk wdm nthal
|
||
LARGE_INTEGER LastWriteTime; // ntddk wdm nthal
|
||
LARGE_INTEGER ChangeTime; // ntddk wdm nthal
|
||
LARGE_INTEGER AllocationSize; // ntddk wdm nthal
|
||
LARGE_INTEGER EndOfFile; // ntddk wdm nthal
|
||
ULONG FileAttributes; // ntddk wdm nthal
|
||
} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; // ntddk wdm nthal
|
||
// ntddk wdm nthal
|
||
typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION { // ntddk nthal
|
||
ULONG FileAttributes; // ntddk nthal
|
||
ULONG ReparseTag; // ntddk nthal
|
||
} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION; // ntddk nthal
|
||
// ntddk nthal
|
||
typedef struct _FILE_ALLOCATION_INFORMATION {
|
||
LARGE_INTEGER AllocationSize;
|
||
} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
|
||
|
||
// end_ntifs begin_ntsrv
|
||
|
||
typedef struct _FILE_COMPRESSION_INFORMATION {
|
||
LARGE_INTEGER CompressedFileSize;
|
||
USHORT CompressionFormat;
|
||
UCHAR CompressionUnitShift;
|
||
UCHAR ChunkShift;
|
||
UCHAR ClusterShift;
|
||
UCHAR Reserved[3];
|
||
} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
|
||
|
||
// end_ntsrv begin_ntifs
|
||
|
||
typedef struct _FILE_DISPOSITION_INFORMATION { // ntddk nthal
|
||
BOOLEAN DeleteFile; // ntddk nthal
|
||
} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; // ntddk nthal
|
||
// ntddk nthal
|
||
typedef struct _FILE_END_OF_FILE_INFORMATION { // ntddk nthal
|
||
LARGE_INTEGER EndOfFile; // ntddk nthal
|
||
} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; // ntddk nthal
|
||
// ntddk nthal
|
||
#ifdef _MAC
|
||
#pragma warning( disable : 4121)
|
||
#endif
|
||
|
||
typedef struct _FILE_LINK_INFORMATION {
|
||
BOOLEAN ReplaceIfExists;
|
||
HANDLE RootDirectory;
|
||
ULONG FileNameLength;
|
||
OCHAR FileName[1];
|
||
} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
|
||
|
||
// end_ntifs begin_ntsrv
|
||
|
||
#ifdef _MAC
|
||
#pragma warning( default : 4121 )
|
||
#endif
|
||
|
||
typedef struct _FILE_MOVE_CLUSTER_INFORMATION {
|
||
ULONG ClusterCount;
|
||
HANDLE RootDirectory;
|
||
ULONG FileNameLength;
|
||
OCHAR FileName[1];
|
||
} FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION;
|
||
|
||
#ifdef _MAC
|
||
#pragma warning( disable : 4121)
|
||
#endif
|
||
|
||
// begin_ntifs end_ntsrv
|
||
|
||
typedef struct _FILE_RENAME_INFORMATION {
|
||
BOOLEAN ReplaceIfExists;
|
||
HANDLE RootDirectory;
|
||
OBJECT_STRING FileName;
|
||
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
|
||
|
||
#ifdef _MAC
|
||
#pragma warning( default : 4121 )
|
||
#endif
|
||
|
||
typedef struct _FILE_STREAM_INFORMATION {
|
||
ULONG NextEntryOffset;
|
||
ULONG StreamNameLength;
|
||
LARGE_INTEGER StreamSize;
|
||
LARGE_INTEGER StreamAllocationSize;
|
||
OCHAR StreamName[1];
|
||
} FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
|
||
|
||
typedef struct _FILE_TRACKING_INFORMATION {
|
||
HANDLE DestinationFile;
|
||
ULONG ObjectInformationLength;
|
||
CHAR ObjectInformation[1];
|
||
} FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
|
||
|
||
typedef struct _FILE_COMPLETION_INFORMATION {
|
||
HANDLE Port;
|
||
PVOID Key;
|
||
} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
|
||
|
||
typedef struct _FILE_PIPE_INFORMATION {
|
||
ULONG ReadMode;
|
||
ULONG CompletionMode;
|
||
} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
|
||
|
||
typedef struct _FILE_PIPE_LOCAL_INFORMATION {
|
||
ULONG NamedPipeType;
|
||
ULONG NamedPipeConfiguration;
|
||
ULONG MaximumInstances;
|
||
ULONG CurrentInstances;
|
||
ULONG InboundQuota;
|
||
ULONG ReadDataAvailable;
|
||
ULONG OutboundQuota;
|
||
ULONG WriteQuotaAvailable;
|
||
ULONG NamedPipeState;
|
||
ULONG NamedPipeEnd;
|
||
} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
|
||
|
||
typedef struct _FILE_PIPE_REMOTE_INFORMATION {
|
||
LARGE_INTEGER CollectDataTime;
|
||
ULONG MaximumCollectionCount;
|
||
} FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
|
||
|
||
// end_ntifs
|
||
|
||
typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
|
||
ULONG MaximumMessageSize;
|
||
ULONG MailslotQuota;
|
||
ULONG NextMessageSize;
|
||
ULONG MessagesAvailable;
|
||
LARGE_INTEGER ReadTimeout;
|
||
} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
|
||
|
||
typedef struct _FILE_MAILSLOT_SET_INFORMATION {
|
||
PLARGE_INTEGER ReadTimeout;
|
||
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
|
||
|
||
typedef struct _FILE_REPARSE_POINT_INFORMATION {
|
||
LONGLONG FileReference;
|
||
ULONG Tag;
|
||
} FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION;
|
||
|
||
// begin_ntifs
|
||
// begin_ntddk begin_wdm begin_nthal
|
||
//
|
||
// Define the file system information class values
|
||
//
|
||
// WARNING: The order of the following values are assumed by the I/O system.
|
||
// Any changes made here should be reflected there as well.
|
||
|
||
typedef enum _FSINFOCLASS {
|
||
FileFsVolumeInformation = 1,
|
||
FileFsLabelInformation, // 2
|
||
FileFsSizeInformation, // 3
|
||
FileFsDeviceInformation, // 4
|
||
FileFsAttributeInformation, // 5
|
||
FileFsControlInformation, // 6
|
||
FileFsFullSizeInformation, // 7
|
||
FileFsObjectIdInformation, // 8
|
||
FileFsMaximumInformation
|
||
} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
|
||
|
||
// end_ntddk end_wdm end_nthal
|
||
//
|
||
// NtQuery[Set]VolumeInformationFile types:
|
||
//
|
||
// FILE_FS_LABEL_INFORMATION
|
||
// FILE_FS_VOLUME_INFORMATION
|
||
// FILE_FS_SIZE_INFORMATION
|
||
// FILE_FS_DEVICE_INFORMATION
|
||
// FILE_FS_ATTRIBUTE_INFORMATION
|
||
// FILE_FS_CONTROL_INFORMATION
|
||
// FILE_FS_OBJECTID_INFORMATION
|
||
//
|
||
|
||
typedef struct _FILE_FS_LABEL_INFORMATION {
|
||
ULONG VolumeLabelLength;
|
||
OCHAR VolumeLabel[1];
|
||
} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
|
||
|
||
typedef struct _FILE_FS_VOLUME_INFORMATION {
|
||
LARGE_INTEGER VolumeCreationTime;
|
||
ULONG VolumeSerialNumber;
|
||
ULONG VolumeLabelLength;
|
||
BOOLEAN SupportsObjects;
|
||
OCHAR VolumeLabel[1];
|
||
} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
|
||
|
||
typedef struct _FILE_FS_SIZE_INFORMATION {
|
||
LARGE_INTEGER TotalAllocationUnits;
|
||
LARGE_INTEGER AvailableAllocationUnits;
|
||
ULONG SectorsPerAllocationUnit;
|
||
ULONG BytesPerSector;
|
||
} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
|
||
|
||
typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
|
||
LARGE_INTEGER TotalAllocationUnits;
|
||
LARGE_INTEGER CallerAvailableAllocationUnits;
|
||
LARGE_INTEGER ActualAvailableAllocationUnits;
|
||
ULONG SectorsPerAllocationUnit;
|
||
ULONG BytesPerSector;
|
||
} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
|
||
|
||
typedef struct _FILE_FS_OBJECTID_INFORMATION {
|
||
UCHAR ObjectId[16];
|
||
UCHAR ExtendedInfo[48];
|
||
} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION;
|
||
|
||
typedef struct _FILE_FS_DEVICE_INFORMATION { // ntddk wdm nthal
|
||
DEVICE_TYPE DeviceType; // ntddk wdm nthal
|
||
ULONG Characteristics; // ntddk wdm nthal
|
||
} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION; // ntddk wdm nthal
|
||
// ntddk wdm nthal
|
||
typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
|
||
ULONG FileSystemAttributes;
|
||
LONG MaximumComponentNameLength;
|
||
ULONG FileSystemNameLength;
|
||
OCHAR FileSystemName[1];
|
||
} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
|
||
|
||
// end_ntifs begin_ntsrv
|
||
|
||
//
|
||
// File system control flags
|
||
//
|
||
|
||
#define FILE_VC_QUOTA_NONE 0x00000000
|
||
#define FILE_VC_QUOTA_TRACK 0x00000001
|
||
#define FILE_VC_QUOTA_ENFORCE 0x00000002
|
||
#define FILE_VC_QUOTA_MASK 0x00000003
|
||
|
||
#define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
|
||
|
||
#define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
|
||
#define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
|
||
#define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
|
||
#define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
|
||
|
||
#define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
|
||
#define FILE_VC_QUOTAS_REBUILDING 0x00000200
|
||
|
||
#define FILE_VC_VALID_MASK 0x000003ff
|
||
|
||
typedef struct _FILE_FS_CONTROL_INFORMATION {
|
||
LARGE_INTEGER FreeSpaceStartFiltering;
|
||
LARGE_INTEGER FreeSpaceThreshold;
|
||
LARGE_INTEGER FreeSpaceStopFiltering;
|
||
LARGE_INTEGER DefaultQuotaThreshold;
|
||
LARGE_INTEGER DefaultQuotaLimit;
|
||
ULONG FileSystemControlFlags;
|
||
} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
|
||
|
||
// end_ntsrv begin_winnt begin_ntddk begin_nthal
|
||
|
||
//
|
||
// Define segment buffer structure for scatter/gather read/write.
|
||
//
|
||
|
||
typedef union _FILE_SEGMENT_ELEMENT {
|
||
PVOID Buffer;
|
||
ULONG Alignment;
|
||
} FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
|
||
|
||
// end_winnt end_ntddk end_nthal
|
||
|
||
//
|
||
// I/O system user APIs
|
||
//
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtCancelIoFile(
|
||
IN HANDLE FileHandle,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtDeleteFile(
|
||
IN POBJECT_ATTRIBUTES ObjectAttributes
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtFlushBuffersFile(
|
||
IN HANDLE FileHandle,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtQueryFullAttributesFile(
|
||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||
OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation
|
||
);
|
||
|
||
// begin_ntsrv
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtCreateFile(
|
||
OUT PHANDLE FileHandle,
|
||
IN ACCESS_MASK DesiredAccess,
|
||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PLARGE_INTEGER AllocationSize OPTIONAL,
|
||
IN ULONG FileAttributes,
|
||
IN ULONG ShareAccess,
|
||
IN ULONG CreateDisposition,
|
||
IN ULONG CreateOptions
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtDeviceIoControlFile(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN ULONG IoControlCode,
|
||
IN PVOID InputBuffer OPTIONAL,
|
||
IN ULONG InputBufferLength,
|
||
OUT PVOID OutputBuffer OPTIONAL,
|
||
IN ULONG OutputBufferLength
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtFsControlFile(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN ULONG FsControlCode,
|
||
IN PVOID InputBuffer OPTIONAL,
|
||
IN ULONG InputBufferLength,
|
||
OUT PVOID OutputBuffer OPTIONAL,
|
||
IN ULONG OutputBufferLength
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtOpenFile(
|
||
OUT PHANDLE FileHandle,
|
||
IN ACCESS_MASK DesiredAccess,
|
||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN ULONG ShareAccess,
|
||
IN ULONG OpenOptions
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtQueryDirectoryFile(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
OUT PVOID FileInformation,
|
||
IN ULONG Length,
|
||
IN FILE_INFORMATION_CLASS FileInformationClass,
|
||
IN POBJECT_STRING FileName OPTIONAL,
|
||
IN BOOLEAN RestartScan
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtQueryInformationFile(
|
||
IN HANDLE FileHandle,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
OUT PVOID FileInformation,
|
||
IN ULONG Length,
|
||
IN FILE_INFORMATION_CLASS FileInformationClass
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtQueryVolumeInformationFile(
|
||
IN HANDLE FileHandle,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
OUT PVOID FsInformation,
|
||
IN ULONG Length,
|
||
IN FS_INFORMATION_CLASS FsInformationClass
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtReadFile(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
OUT PVOID Buffer,
|
||
IN ULONG Length,
|
||
IN PLARGE_INTEGER ByteOffset OPTIONAL
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtSetInformationFile(
|
||
IN HANDLE FileHandle,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PVOID FileInformation,
|
||
IN ULONG Length,
|
||
IN FILE_INFORMATION_CLASS FileInformationClass
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtSetVolumeInformationFile(
|
||
IN HANDLE FileHandle,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PVOID FsInformation,
|
||
IN ULONG Length,
|
||
IN FS_INFORMATION_CLASS FsInformationClass
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtWriteFile(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PVOID Buffer,
|
||
IN ULONG Length,
|
||
IN PLARGE_INTEGER ByteOffset OPTIONAL
|
||
);
|
||
|
||
// end_ntsrv
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtReadFileScatter(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PFILE_SEGMENT_ELEMENT SegmentArray,
|
||
IN ULONG Length,
|
||
IN PLARGE_INTEGER ByteOffset OPTIONAL
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtWriteFileGather(
|
||
IN HANDLE FileHandle,
|
||
IN HANDLE Event OPTIONAL,
|
||
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
|
||
IN PVOID ApcContext OPTIONAL,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PFILE_SEGMENT_ELEMENT SegmentArray,
|
||
IN ULONG Length,
|
||
IN PLARGE_INTEGER ByteOffset OPTIONAL
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
VOID
|
||
NTAPI
|
||
NtUserIoApcDispatcher(
|
||
IN PVOID ApcContext,
|
||
IN PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN ULONG Reserved
|
||
);
|
||
|
||
|
||
// begin_ntifs
|
||
//
|
||
// Macro definition for defining IOCTL and FSCTL function control codes. Note
|
||
// that function codes 0-2047 are reserved for Microsoft Corporation, and
|
||
// 2048-4095 are reserved for customers.
|
||
//
|
||
// These macros are defined in devioctl.h which contains the portable IO
|
||
// definitions (for use by both DOS and NT)
|
||
//
|
||
|
||
//
|
||
// The IoGetFunctionCodeFromCtlCode( ControlCode ) Macro is defined in io.h
|
||
// This macro is used to extract the function code from an IOCTL (or FSCTL).
|
||
// The macro can only be used in kernel mode code.
|
||
//
|
||
|
||
//
|
||
// General File System control codes - Note that these values are valid
|
||
// regardless of the actual file system type
|
||
//
|
||
|
||
//
|
||
// IMPORTANT: These values have been arranged in order of increasing
|
||
// control codes. Do NOT breaks this!! Add all new codes
|
||
// at end of list regardless of functionality type.
|
||
//
|
||
// Note: FSCTL_QUERY_RETRIEVAL_POINTER and FSCTL_MARK_AS_SYSTEM_HIVE only
|
||
// work from Kernel mode on local paging files or the system hives.
|
||
//
|
||
|
||
// begin_winioctl
|
||
#ifndef _FILESYSTEMFSCTL_
|
||
#define _FILESYSTEMFSCTL_
|
||
|
||
//
|
||
// The following is a list of the native file system fsctls followed by
|
||
// additional network file system fsctls. Some values have been
|
||
// decommissioned.
|
||
//
|
||
|
||
#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||
#define FSCTL_READ_VOLUME_METADATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||
#define FSCTL_WRITE_VOLUME_METADATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
||
|
||
//
|
||
// Structure for FSCTL_READ_VOLUME_METADATA and FSCTL_WRITE_VOLUME_METADATA.
|
||
//
|
||
|
||
typedef struct _FSCTL_VOLUME_METADATA {
|
||
ULONG ByteOffset;
|
||
ULONG TransferLength;
|
||
PVOID TransferBuffer;
|
||
} FSCTL_VOLUME_METADATA, *PFSCTL_VOLUME_METADATA;
|
||
|
||
#endif // _FILESYSTEMFSCTL_
|
||
|
||
// end_winioctl
|
||
|
||
// end_ntifs
|
||
|
||
//
|
||
// I/O Completion Specific Access Rights.
|
||
//
|
||
|
||
#define IO_COMPLETION_QUERY_STATE 0x0001
|
||
#define IO_COMPLETION_MODIFY_STATE 0x0002 // winnt
|
||
#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) // winnt
|
||
|
||
//
|
||
// I/O Completition Information Structures.
|
||
//
|
||
|
||
typedef struct _IO_COMPLETION_BASIC_INFORMATION {
|
||
LONG Depth;
|
||
} IO_COMPLETION_BASIC_INFORMATION, *PIO_COMPLETION_BASIC_INFORMATION;
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtCreateIoCompletion (
|
||
OUT PHANDLE IoCompletionHandle,
|
||
IN ACCESS_MASK DesiredAccess,
|
||
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
||
IN ULONG Count OPTIONAL
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtOpenIoCompletion (
|
||
OUT PHANDLE IoCompletionHandle,
|
||
IN ACCESS_MASK DesiredAccess,
|
||
IN POBJECT_ATTRIBUTES ObjectAttributes
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtQueryIoCompletion (
|
||
IN HANDLE IoCompletionHandle,
|
||
OUT PIO_COMPLETION_BASIC_INFORMATION IoCompletionInformation
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtSetIoCompletion (
|
||
IN HANDLE IoCompletionHandle,
|
||
IN PVOID KeyContext,
|
||
IN PVOID ApcContext,
|
||
IN NTSTATUS IoStatus,
|
||
IN ULONG_PTR IoStatusInformation
|
||
);
|
||
|
||
NTSYSCALLAPI
|
||
NTSTATUS
|
||
NTAPI
|
||
NtRemoveIoCompletion (
|
||
IN HANDLE IoCompletionHandle,
|
||
OUT PVOID *KeyContext,
|
||
OUT PVOID *ApcContext,
|
||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||
IN PLARGE_INTEGER Timeout
|
||
);
|
||
|
||
|
||
//
|
||
// Defines that are used to access the registry, but are not registry
|
||
// specific.
|
||
//
|
||
|
||
// begin_ntddk begin_wdm begin_nthal begin_ntminiport begin_ntndis begin_ntifs
|
||
//
|
||
// Define the I/O bus interface types.
|
||
//
|
||
|
||
typedef enum _INTERFACE_TYPE {
|
||
InterfaceTypeUndefined = -1,
|
||
Internal,
|
||
Isa,
|
||
Eisa,
|
||
MicroChannel,
|
||
TurboChannel,
|
||
PCIBus,
|
||
VMEBus,
|
||
NuBus,
|
||
PCMCIABus,
|
||
CBus,
|
||
MPIBus,
|
||
MPSABus,
|
||
ProcessorInternal,
|
||
InternalPowerBus,
|
||
PNPISABus,
|
||
PNPBus,
|
||
MaximumInterfaceType
|
||
}INTERFACE_TYPE, *PINTERFACE_TYPE;
|
||
|
||
//
|
||
// Define the DMA transfer widths.
|
||
//
|
||
|
||
typedef enum _DMA_WIDTH {
|
||
Width8Bits,
|
||
Width16Bits,
|
||
Width32Bits,
|
||
MaximumDmaWidth
|
||
}DMA_WIDTH, *PDMA_WIDTH;
|
||
|
||
//
|
||
// Define DMA transfer speeds.
|
||
//
|
||
|
||
typedef enum _DMA_SPEED {
|
||
Compatible,
|
||
TypeA,
|
||
TypeB,
|
||
TypeC,
|
||
TypeF,
|
||
MaximumDmaSpeed
|
||
}DMA_SPEED, *PDMA_SPEED;
|
||
|
||
//
|
||
// Define Interface reference/dereference routines for
|
||
// Interfaces exported by IRP_MN_QUERY_INTERFACE
|
||
//
|
||
|
||
typedef VOID (*PINTERFACE_REFERENCE)(PVOID Context);
|
||
typedef VOID (*PINTERFACE_DEREFERENCE)(PVOID Context);
|
||
|
||
// end_wdm
|
||
|
||
//
|
||
// Define types of bus information.
|
||
//
|
||
|
||
typedef enum _BUS_DATA_TYPE {
|
||
ConfigurationSpaceUndefined = -1,
|
||
Cmos,
|
||
EisaConfiguration,
|
||
Pos,
|
||
CbusConfiguration,
|
||
PCIConfiguration,
|
||
VMEConfiguration,
|
||
NuBusConfiguration,
|
||
PCMCIAConfiguration,
|
||
MPIConfiguration,
|
||
MPSAConfiguration,
|
||
PNPISAConfiguration,
|
||
SgiInternalConfiguration,
|
||
MaximumBusDataType
|
||
} BUS_DATA_TYPE, *PBUS_DATA_TYPE;
|
||
|
||
// end_ntddk end_nthal end_ntminiport end_ntndis end_ntifs
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif // _NTIOAPI_
|