Added over 100 new structures supporting control codes and DeviceIoControl

pull/213/head
dahall 2021-02-18 15:34:42 -07:00
parent 21c4311935
commit 7ce8ade62d
4 changed files with 9274 additions and 936 deletions

File diff suppressed because it is too large Load Diff

View File

@ -75,376 +75,6 @@ namespace Vanara.PInvoke
/// <summary>Windows system partition</summary>
public static readonly Guid PARTITION_WINDOWS_SYSTEM_GUID = new Guid(0x57434F53, 0xE3E3, 0x4631, 0xA5, 0xC5, 0x26, 0xD2, 0x24, 0x38, 0x73, 0xAA);
/// <summary>The detected partition type.</summary>
[PInvokeData("winioctl.h", MSDNShortId = "57ca68f4-f748-4bc4-90c3-13d545716d87")]
public enum DETECTION_TYPE
{
/// <summary>The disk does not have an Int13 or an extended Int13 partition.</summary>
DetectNone,
/// <summary>The disk has a standard Int13 partition.</summary>
DetectInt13,
/// <summary>The disk has an extended Int13 partition.</summary>
DetectExInt13
}
/// <summary>
/// Determines the likelihood of data cached from a read operation remaining in the cache. This data might be given a different
/// priority than data cached under other circumstances, such as from a prefetch operation.
/// </summary>
[PInvokeData("winioctl.h", MSDNShortId = "ea175bea-5f2b-4f3e-9fe0-239b1d2e3d96")]
public enum DISK_CACHE_RETENTION_PRIORITY
{
/// <summary>No data is held in the cache on a preferential basis.</summary>
EqualPriority,
/// <summary>A preference is to be given to prefetched data.</summary>
KeepPrefetchedData,
/// <summary>A preference is to be given to data cached from a read operation.</summary>
KeepReadData
}
/// <summary>
/// Specifies the partition entry attributes used for diagnostics, recovery tools, and other firmware essential to the operation of
/// the device.
/// </summary>
[PInvokeData("winioctl.h", MSDNShortId = "373b4eb3-af6d-4112-9787-f14c19972189")]
[Flags]
public enum GPT_ATTRIBUTE : ulong
{
/// <summary>
/// If this attribute is set, the partition is required by a computer to function properly.
/// <para>
/// For example, this attribute must be set for OEM partitions. Note that if this attribute is set, you can use the DiskPart.exe
/// utility to perform partition operations such as deleting the partition. However, because the partition is not a volume, you
/// cannot use the DiskPart.exe utility to perform volume operations on the partition.
/// </para>
/// <para>
/// This attribute can be set for basic and dynamic disks. If it is set for a partition on a basic disk and the disk is converted
/// to a dynamic disk, the partition remains a basic partition, even though the rest of the disk is a dynamic disk. This is
/// because the partition is considered to be an OEM partition on a GPT disk.
/// </para>
/// </summary>
GPT_ATTRIBUTE_PLATFORM_REQUIRED = 0x0000000000000001,
/// <summary>
/// If this attribute is set, the partition does not receive a drive letter by default when the disk is moved to another computer
/// or when the disk is seen for the first time by a computer.
/// <para>This attribute is useful in storage area network (SAN) environments.</para>
/// <para>Despite its name, this attribute can be set for basic and dynamic disks.</para>
/// </summary>
GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER = 0x8000000000000000,
/// <summary>
/// If this attribute is set, the partition is not detected by the Mount Manager.
/// <para>
/// As a result, the partition does not receive a drive letter, does not receive a volume GUID path, does not host mounted
/// folders (also called volume mount points), and is not enumerated by calls to FindFirstVolume and FindNextVolume.This ensures
/// that applications such as Disk Defragmenter do not access the partition. The Volume Shadow Copy Service (VSS) uses this attribute.
/// </para>
/// <para>Despite its name, this attribute can be set for basic and dynamic disks.</para>
/// </summary>
GPT_BASIC_DATA_ATTRIBUTE_HIDDEN = 0x4000000000000000,
/// <summary>
/// If this attribute is set, the partition is a shadow copy of another partition.
/// <para>
/// VSS uses this attribute. This attribute is an indication for file system filter driver-based software (such as antivirus
/// programs) to avoid attaching to the volume.
/// </para>
/// <para>
/// An application can use the attribute to differentiate a shadow copy volume from a production volume.An application that does
/// a fast recovery, for example, will break a shadow copy LUN and clear the read-only and hidden attributes and this
/// attribute.This attribute is set when the shadow copy is created and cleared when the shadow copy is broken.
/// </para>
/// <para>Despite its name, this attribute can be set for basic and dynamic disks.</para>
/// <para>Windows Server 2003: This attribute is not supported before Windows Server 2003 with SP1.</para>
/// </summary>
GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY = 0x2000000000000000,
/// <summary>
/// If this attribute is set, the partition is read-only.
/// <para>
/// Writes to the partition will fail. IOCTL_DISK_IS_WRITABLE will fail with the ERROR_WRITE_PROTECT Win32 error code, which
/// causes the file system to mount as read only, if a file system is present.
/// </para>
/// <para>VSS uses this attribute.</para>
/// <para>
/// Do not set this attribute for dynamic disks. Setting it can cause I/O errors and prevent the file system from mounting properly.
/// </para>
/// </summary>
GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY = 0x1000000000000000,
/// <summary>Undocumented.</summary>
GPT_BASIC_DATA_ATTRIBUTE_OFFLINE = 0x0800000000000000,
/// <summary>Undocumented.</summary>
GPT_BASIC_DATA_ATTRIBUTE_DAX = 0x0400000000000000,
/// <summary>Undocumented.</summary>
GPT_BASIC_DATA_ATTRIBUTE_SERVICE = 0x0200000000000000,
/// <summary>Undocumented.</summary>
GPT_SPACES_ATTRIBUTE_NO_METADATA = 0x8000000000000000,
}
/// <summary>Partition types.</summary>
[PInvokeData("winioctl.h")]
public enum PartitionType : byte
{
/// <summary>Unused entry</summary>
PARTITION_ENTRY_UNUSED = 0,
/// <summary>Specifies a partition with 12-bit FAT entries</summary>
PARTITION_FAT_12,
/// <summary>Specifies a XENIX Type 1 partition</summary>
PARTITION_XENIX_1,
/// <summary>Specifies a XENIX Type 2 partition</summary>
PARTITION_XENIX_2,
/// <summary>Specifies a partition with 16-bit FAT entries.</summary>
PARTITION_FAT_16,
/// <summary>Specifies an MS-DOS V4 extended partition</summary>
PARTITION_EXTENDED,
/// <summary>Specifies an MS-DOS V4 huge partition</summary>
PARTITION_HUGE,
/// <summary>Specifies an IFS partition</summary>
PARTITION_IFS,
/// <summary>OS/2 Boot Manager/OPUS/Coherent swap</summary>
PARTITION_OS2BOOTMGR = 0x0A,
/// <summary>Specifies a FAT32 partition</summary>
PARTITION_FAT32,
/// <summary>Win95 partition using extended int13 services</summary>
PARTITION_XINT13 = 0x0E,
/// <summary>Windows 95/98: Specifies a partition that uses extended INT 13 services</summary>
PARTITION_FAT32_XINT13,
/// <summary>Windows 95/98: Same as PARTITION_EXTENDED, but uses extended INT 13 services</summary>
PARTITION_XINT13_EXTENDED,
/// <summary>Microsoft recovery partition</summary>
PARTITION_MSFT_RECOVERY = 0x27,
/// <summary>Main OS partition</summary>
PARTITION_MAIN_OS = 0x28,
/// <summary>OS data partition</summary>
PARTIITON_OS_DATA = 0x29,
/// <summary>PreInstalled partition</summary>
PARTITION_PRE_INSTALLED = 0x2a,
/// <summary>BSP partition</summary>
PARTITION_BSP = 0x2b,
/// <summary>DPP partition</summary>
PARTITION_DPP = 0x2c,
/// <summary>Windows system partition</summary>
PARTITION_WINDOWS_SYSTEM = 0x2d,
/// <summary>Specifies a PowerPC Reference Platform partition</summary>
PARTITION_PREP = 0x41,
/// <summary>Specifies a logical disk manager partition</summary>
PARTITION_LDM,
/// <summary>OnTrack Disk Manager partition</summary>
PARTITION_DM = 0x54,
/// <summary>EZ-Drive partition</summary>
PARTITION_EZDRIVE = 0x55,
/// <summary>Specifies a UNIX partition</summary>
PARTITION_UNIX = 0x63,
/// <summary>Storage Spaces protective partition</summary>
PARTITION_SPACES_DATA = 0xD7,
/// <summary>Storage Spaces protective partition</summary>
PARTITION_SPACES = 0xE7,
/// <summary>Gpt protective partition</summary>
PARTITION_GPT = 0xEE,
/// <summary>System partition</summary>
PARTITION_SYSTEM = 0xEF,
/// <summary>
/// Specifies an NTFT partition. This value is used in combination (that is, bitwise logically ORed) with the other values in
/// this table
/// </summary>
PARTITION_NTFT = 0x80,
}
/// <summary>
/// <para>
/// The flags that identify reasons for changes that have accumulated in this file or directory journal record since the file or
/// directory opened.
/// </para>
/// <para>
/// When a file or directory closes, then a final USN record is generated with the <c>USN_REASON_CLOSE</c> flag set. The next change
/// (for example, after the next open operation or deletion) starts a new record with a new set of reason flags.
/// </para>
/// <para>
/// A rename or move operation generates two USN records, one that records the old parent directory for the item, and one that
/// records a new parent.
/// </para>
/// </summary>
[PInvokeData("winioctl.h", MSDNShortId = "1747453d-fd18-4853-a953-47131f3067ae")]
[Flags]
public enum USN_REASON : uint
{
/// <summary>
/// A user has either changed one or more file or directory attributes (for example, the read-only, hidden, system, archive, or
/// sparse attribute), or one or more time stamps.
/// </summary>
USN_REASON_BASIC_INFO_CHANGE = 0x00008000,
/// <summary>The file or directory is closed.</summary>
USN_REASON_CLOSE = 0x80000000,
/// <summary>The compression state of the file or directory is changed from or to compressed.</summary>
USN_REASON_COMPRESSION_CHANGE = 0x00020000,
/// <summary>The file or directory is extended (added to).</summary>
USN_REASON_DATA_EXTEND = 0x00000002,
/// <summary>The data in the file or directory is overwritten.</summary>
USN_REASON_DATA_OVERWRITE = 0x00000001,
/// <summary>The file or directory is truncated.</summary>
USN_REASON_DATA_TRUNCATION = 0x00000004,
/// <summary>
/// The user made a change to the extended attributes of a file or directory.
/// <para>These NTFS file system attributes are not accessible to Windows-based applications.</para>
/// </summary>
USN_REASON_EA_CHANGE = 0x00000400,
/// <summary>The file or directory is encrypted or decrypted.</summary>
USN_REASON_ENCRYPTION_CHANGE = 0x00040000,
/// <summary>The file or directory is created for the first time.</summary>
USN_REASON_FILE_CREATE = 0x00000100,
/// <summary>The file or directory is deleted.</summary>
USN_REASON_FILE_DELETE = 0x00000200,
/// <summary>
/// An NTFS file system hard link is added to or removed from the file or directory.
/// <para>
/// An NTFS file system hard link, similar to a POSIX hard link, is one of several directory entries that see the same file or directory.
/// </para>
/// </summary>
USN_REASON_HARD_LINK_CHANGE = 0x00010000,
/// <summary>
/// A user changes the FILE_ATTRIBUTE_NOT_CONTENT_INDEXED attribute.
/// <para>
/// That is, the user changes the file or directory from one where content can be indexed to one where content cannot be indexed,
/// or vice versa. Content indexing permits rapid searching of data by building a database of selected content.
/// </para>
/// </summary>
USN_REASON_INDEXABLE_CHANGE = 0x00004000,
/// <summary>
/// A user changed the state of the FILE_ATTRIBUTE_INTEGRITY_STREAM attribute for the given stream.
/// <para>
/// On the ReFS file system, integrity streams maintain a checksum of all data for that stream, so that the contents of the file
/// can be validated during read or write operations.
/// </para>
/// </summary>
USN_REASON_INTEGRITY_CHANGE = 0x00800000,
/// <summary>The one or more named data streams for a file are extended (added to).</summary>
USN_REASON_NAMED_DATA_EXTEND = 0x00000020,
/// <summary>The data in one or more named data streams for a file is overwritten.</summary>
USN_REASON_NAMED_DATA_OVERWRITE = 0x00000010,
/// <summary>The one or more named data streams for a file is truncated.</summary>
USN_REASON_NAMED_DATA_TRUNCATION = 0x00000040,
/// <summary>The object identifier of a file or directory is changed.</summary>
USN_REASON_OBJECT_ID_CHANGE = 0x00080000,
/// <summary>A file or directory is renamed, and the file name in the USN_RECORD_V2 structure is the new name.</summary>
USN_REASON_RENAME_NEW_NAME = 0x00002000,
/// <summary>The file or directory is renamed, and the file name in the USN_RECORD_V2 structure is the previous name.</summary>
USN_REASON_RENAME_OLD_NAME = 0x00001000,
/// <summary>
/// The reparse point that is contained in a file or directory is changed, or a reparse point is added to or deleted from a file
/// or directory.
/// </summary>
USN_REASON_REPARSE_POINT_CHANGE = 0x00100000,
/// <summary>A change is made in the access rights to a file or directory.</summary>
USN_REASON_SECURITY_CHANGE = 0x00000800,
/// <summary>A named stream is added to or removed from a file, or a named stream is renamed.</summary>
USN_REASON_STREAM_CHANGE = 0x00200000,
/// <summary>The given stream is modified through a TxF transaction.</summary>
USN_REASON_TRANSACTED_CHANGE = 0x00400000,
}
/// <summary>
/// <para>Additional information about the source of the change, set by the FSCTL_MARK_HANDLE of the DeviceIoControl operation.</para>
/// <para>
/// When a thread writes a new USN record, the source information flags in the prior record continues to be present only if the
/// thread also sets those flags. Therefore, the source information structure allows applications to filter out USN records that are
/// set only by a known source, for example, an antivirus filter.
/// </para>
/// </summary>
[PInvokeData("winioctl.h", MSDNShortId = "1747453d-fd18-4853-a953-47131f3067ae")]
[Flags]
public enum USN_SOURCE
{
/// <summary>
/// The operation adds a private data stream to a file or directory.
/// <para>
/// An example might be a virus detector adding checksum information. As the virus detector modifies the item, the system
/// generates USN records. USN_SOURCE_AUXILIARY_DATA indicates that the modifications did not change the application data.
/// </para>
/// </summary>
USN_SOURCE_AUXILIARY_DATA = 0x00000002,
/// <summary>
/// The operation provides information about a change to the file or directory made by the operating system.
/// <para>
/// A typical use is when the Remote Storage system moves data from external to local storage. Remote Storage is the hierarchical
/// storage management software. Such a move usually at a minimum adds the USN_REASON_DATA_OVERWRITE flag to a USN record.
/// However, the data has not changed from the user's point of view. By noting USN_SOURCE_DATA_MANAGEMENT in the SourceInfo
/// member, you can determine that although a write operation is performed on the item, data has not changed.
/// </para>
/// </summary>
USN_SOURCE_DATA_MANAGEMENT = 0x00000001,
/// <summary>
/// The operation is modifying a file to match the contents of the same file which exists in another member of the replica set.
/// </summary>
USN_SOURCE_REPLICATION_MANAGEMENT = 0x00000004,
/// <summary>
/// The operation is modifying a file on client systems to match the contents of the same file that exists in the cloud.
/// </summary>
USN_SOURCE_CLIENT_REPLICATION_MANAGEMENT = 0x00000008,
}
/// <summary>Contains the output for the FSCTL_GET_BOOT_AREA_INFO control code.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-boot_area_info typedef struct _BOOT_AREA_INFO { DWORD
// BootSectorCount; struct { LARGE_INTEGER Offset; } BootSectors[2]; } BOOT_AREA_INFO, *PBOOT_AREA_INFO;
@ -2369,15 +1999,15 @@ namespace Vanara.PInvoke
public GPT_ATTRIBUTE Attributes;
// Little hack to get 72 blittable bytes for 'Name'.
private ulong ul1;
private ulong ul2;
private ulong ul3;
private ulong ul4;
private ulong ul5;
private ulong ul6;
private ulong ul7;
private ulong ul8;
private ulong ul9;
private readonly ulong ul1;
private readonly ulong ul2;
private readonly ulong ul3;
private readonly ulong ul4;
private readonly ulong ul5;
private readonly ulong ul6;
private readonly ulong ul7;
private readonly ulong ul8;
private readonly ulong ul9;
/// <summary>A wide-character string that describes the partition.</summary>
public string Name
@ -2388,7 +2018,7 @@ namespace Vanara.PInvoke
{
fixed (ulong* p = &ul1)
{
return Vanara.Extensions.StringHelper.GetString((IntPtr)(void*)p, CharSet.Unicode, nameBytes);
return Vanara.Extensions.StringHelper.GetString((IntPtr)p, CharSet.Unicode, nameBytes);
}
}
}
@ -2398,7 +2028,7 @@ namespace Vanara.PInvoke
{
fixed (ulong* p = &ul1)
{
Vanara.Extensions.StringHelper.Write(value, (IntPtr)(void*)p, out _, true, CharSet.Unicode, nameBytes);
Vanara.Extensions.StringHelper.Write(value, (IntPtr)p, out _, true, CharSet.Unicode, nameBytes);
}
}
}
@ -4211,301 +3841,39 @@ namespace Vanara.PInvoke
public DISK_EXTENT[] Extents;
}
/*
https://docs.microsoft.com/en-us/windows/win32/api/winioctl/
CHANGER_ELEMENT : 8
CHANGER_ELEMENT_LIST : 12
CHANGER_ELEMENT_STATUS : 100
CHANGER_ELEMENT_STATUS_EX : 156
CHANGER_EXCHANGE_MEDIUM : 36
CHANGER_INITIALIZE_ELEMENT_STATUS : 16
CHANGER_MOVE_MEDIUM : 28
CHANGER_PRODUCT_DATA : 61
CHANGER_READ_ELEMENT_STATUS : 16
CHANGER_SEND_VOLUME_TAG_INFORMATION : 52
CHANGER_SET_ACCESS : 12
CHANGER_SET_POSITION : 20
CLASS_MEDIA_CHANGE_CONTEXT : 8
CREATE_DISK : 24
CREATE_DISK_GPT : 20
CREATE_DISK_MBR : 4
CSV_CONTROL_PARAM : 16
CSV_IS_OWNED_BY_CSVFS : 1
CSV_NAMESPACE_INFO : 24
CSV_QUERY_FILE_REVISION : 32
CSV_QUERY_MDS_PATH : 16
CSV_QUERY_REDIRECT_STATE : 12
CSV_QUERY_VETO_FILE_DIRECT_IO_OUTPUT : 528
DEVICE_COPY_OFFLOAD_DESCRIPTOR : 48
DEVICE_DATA_SET_LB_PROVISIONING_STATE : 32
DEVICE_DATA_SET_RANGE : 16
DEVICE_DATA_SET_REPAIR_PARAMETERS : 12
DEVICE_DSM_NOTIFICATION_PARAMETERS : 28
DEVICE_DSM_OFFLOAD_READ_PARAMETERS : 16
DEVICE_DSM_OFFLOAD_WRITE_PARAMETERS : 528
DEVICE_LB_PROVISIONING_DESCRIPTOR : 40
DEVICE_MANAGE_DATA_SET_ATTRIBUTES : 28
DEVICE_MANAGE_DATA_SET_ATTRIBUTES_OUTPUT : 36
DEVICE_MEDIA_INFO : 32
DEVICE_POWER_DESCRIPTOR : 20
DEVICE_SEEK_PENALTY_DESCRIPTOR : 12
DEVICE_TRIM_DESCRIPTOR : 12
DEVICE_WRITE_AGGREGATION_DESCRIPTOR : 12
DRIVE_LAYOUT_INFORMATION : 40
DRIVE_LAYOUT_INFORMATION_EX : 192
DRIVE_LAYOUT_INFORMATION_GPT : 40
DRIVE_LAYOUT_INFORMATION_MBR : 8
DUPLICATE_EXTENTS_DATA : 32
EXFAT_STATISTICS : 36
FAT_STATISTICS : 36
FILE_ALLOCATED_RANGE_BUFFER : 16
FILE_LEVEL_TRIM : 24
FILE_LEVEL_TRIM_OUTPUT : 4
FILE_LEVEL_TRIM_RANGE : 16
FILE_MAKE_COMPATIBLE_BUFFER : 1
FILE_OBJECTID_BUFFER : 64
FILE_QUERY_ON_DISK_VOL_INFO_BUFFER : 336
FILE_QUERY_SPARING_BUFFER : 16
FILE_SET_DEFECT_MGMT_BUFFER : 1
FILE_SET_SPARSE_BUFFER : 1
FILE_STORAGE_TIER : 1064
FILE_STORAGE_TIER_REGION : 32
FILE_SYSTEM_RECOGNITION_INFORMATION : 9
FILE_ZERO_DATA_INFORMATION : 16
FILESYSTEM_STATISTICS : 56
FILESYSTEM_STATISTICS_EX : 104
FIND_BY_SID_DATA : 16
FIND_BY_SID_OUTPUT : 16
FORMAT_EX_PARAMETERS : 28
FORMAT_PARAMETERS : 20
FSCTL_GET_INTEGRITY_INFORMATION_BUFFER : 16
FSCTL_QUERY_REGION_INFO_INPUT : 32
FSCTL_QUERY_REGION_INFO_OUTPUT : 64
FSCTL_QUERY_STORAGE_CLASSES_OUTPUT : 1088
FSCTL_SET_INTEGRITY_INFORMATION_BUFFER : 8
GET_CHANGER_PARAMETERS : 60
GET_DISK_ATTRIBUTES : 16
GET_LENGTH_INFORMATION : 8
GET_MEDIA_TYPES : 40
LOOKUP_STREAM_FROM_CLUSTER_ENTRY : 32
LOOKUP_STREAM_FROM_CLUSTER_INPUT : 16
LOOKUP_STREAM_FROM_CLUSTER_OUTPUT : 12
MARK_HANDLE_INFO : 12
MFT_ENUM_DATA_V0 : 24
MFT_ENUM_DATA_V1 : 32
MOVE_FILE_DATA : 32
NTFS_EXTENDED_VOLUME_DATA : 32
NTFS_FILE_RECORD_INPUT_BUFFER : 8
NTFS_FILE_RECORD_OUTPUT_BUFFER : 16
NTFS_STATISTICS : 216
NTFS_STATISTICS_EX : 496
NTFS_VOLUME_DATA_BUFFER : 96
PARTITION_INFORMATION : 32
PARTITION_INFORMATION_EX : 144
PARTITION_INFORMATION_GPT : 112
PARTITION_INFORMATION_MBR : 24
PLEX_READ_DATA_REQUEST : 16
PREVENT_MEDIA_REMOVAL : 1
READ_ELEMENT_ADDRESS_INFO : 104
REASSIGN_BLOCKS : 8
REASSIGN_BLOCKS_EX : 12
REPAIR_COPIES_INPUT : 32
REPAIR_COPIES_OUTPUT : 16
REQUEST_OPLOCK_INPUT_BUFFER : 12
REQUEST_OPLOCK_OUTPUT_BUFFER : 24
RETRIEVAL_POINTER_BASE : 8
RETRIEVAL_POINTERS_BUFFER : 32
SET_DISK_ATTRIBUTES : 40
SET_PARTITION_INFORMATION : 1
SHRINK_VOLUME_INFORMATION : 24
STARTING_LCN_INPUT_BUFFER : 8
STARTING_VCN_INPUT_BUFFER : 8
STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR : 28
STORAGE_ADAPTER_DESCRIPTOR : 32
STORAGE_DESCRIPTOR_HEADER : 8
STORAGE_DEVICE_ATTRIBUTES_DESCRIPTOR : 16
STORAGE_DEVICE_DESCRIPTOR : 40
STORAGE_DEVICE_ID_DESCRIPTOR : 16
STORAGE_DEVICE_IO_CAPABILITY_DESCRIPTOR : 16
STORAGE_DEVICE_NUMBER : 12
STORAGE_DEVICE_POWER_CAP : 24
STORAGE_DEVICE_RESILIENCY_DESCRIPTOR : 32
STORAGE_HOTPLUG_INFO : 8
STORAGE_HW_FIRMWARE_ACTIVATE : 16
STORAGE_HW_FIRMWARE_DOWNLOAD : 40
STORAGE_MEDIUM_PRODUCT_TYPE_DESCRIPTOR : 12
STORAGE_MINIPORT_DESCRIPTOR : 24
STORAGE_OFFLOAD_READ_OUTPUT : 536
STORAGE_OFFLOAD_TOKEN : 512
STORAGE_OFFLOAD_WRITE_OUTPUT : 16
STORAGE_PHYSICAL_ADAPTER_DATA : 128
STORAGE_PHYSICAL_DEVICE_DATA : 136
STORAGE_PHYSICAL_NODE_DATA : 40
STORAGE_PHYSICAL_TOPOLOGY_DESCRIPTOR : 56
STORAGE_PROPERTY_QUERY : 12
STORAGE_PROTOCOL_COMMAND : 84
STORAGE_PROTOCOL_DATA_DESCRIPTOR : 48
STORAGE_PROTOCOL_SPECIFIC_DATA : 40
STORAGE_RPMB_DATA_FRAME : 512
STORAGE_RPMB_DESCRIPTOR : 20
STORAGE_SPEC_VERSION : 4
STORAGE_TEMPERATURE_DATA_DESCRIPTOR : 40
STORAGE_TEMPERATURE_INFO : 16
STORAGE_TEMPERATURE_THRESHOLD : 16
STORAGE_WRITE_CACHE_PROPERTY : 28
TXFS_GET_METADATA_INFO_OUT : 48
TXFS_GET_TRANSACTED_VERSION : 16
TXFS_LIST_TRANSACTION_LOCKED_FILES : 40
TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY : 48
TXFS_LIST_TRANSACTIONS : 16
TXFS_LIST_TRANSACTIONS_ENTRY : 40
TXFS_MODIFY_RM : 40
TXFS_QUERY_RM_INFORMATION : 176
TXFS_READ_BACKUP_INFORMATION_OUT : 4
TXFS_TRANSACTION_ACTIVE_INFO : 1
TXFS_WRITE_BACKUP_INFORMATION : 1
VERIFY_INFORMATION : 16
VOLUME_BITMAP_BUFFER : 24
VOLUME_GET_GPT_ATTRIBUTES_INFORMATION : 8
winioctl_CHANGER_ELEMENT_STATUS Represents the status of the specified element.
winioctl_CHANGER_ELEMENT_STATUS_EX Represents the status of the specified element.
winioctl_CHANGER_EXCHANGE_MEDIUM Contains information the IOCTL_CHANGER_EXCHANGE_MEDIUM control code uses to move a piece of media to a destination, and the piece of media originally in the first destination to a second destination.
winioctl_CHANGER_INITIALIZE_ELEMENT_STATUS Represents the status of all media changer elements or the specified elements of a particular type.
winioctl_CHANGER_MOVE_MEDIUM Contains information that the IOCTL_CHANGER_MOVE_MEDIUM control code uses to move a piece of media to a destination.
winioctl_CHANGER_PRODUCT_DATA Represents product data for a changer device. It is used by the IOCTL_CHANGER_GET_PRODUCT_DATA control code.
winioctl_CHANGER_READ_ELEMENT_STATUS Contains information that the IOCTL_CHANGER_GET_ELEMENT_STATUS control code needs to determine the elements whose status is to be retrieved.
winioctl_CHANGER_SEND_VOLUME_TAG_INFORMATION Contains information that the IOCTL_CHANGER_QUERY_VOLUME_TAGS control code uses to determine the volume information to be retrieved.
winioctl_CHANGER_SET_ACCESS Contains information that the IOCTL_CHANGER_SET_ACCESS control code needs to set the state of the device's insert/eject port, door, or keypad.
winioctl_CHANGER_SET_POSITION Contains information needed by the IOCTL_CHANGER_SET_POSITION control code to set the changer's robotic transport mechanism to the specified element address.
winioctl_CLASS_MEDIA_CHANGE_CONTEXT Contains information associated with a media change event.
winioctl_CSV_CONTROL_PARAM Represents a type of CSV control operation.
winioctl_CSV_IS_OWNED_BY_CSVFS Contains the output for the FSCTL_IS_VOLUME_OWNED_BYCSVFS control code that determines whether a volume is owned by CSVFS.
winioctl_CSV_NAMESPACE_INFO Contains the output for the FSCTL_IS_CSV_FILE control code that retrieves namespace information for a file.
winioctl_CSV_QUERY_FILE_REVISION Contains information about whether files in a stream have been modified.
winioctl_CSV_QUERY_MDS_PATH Contains the path that is used by CSV to communicate to the MDS.
winioctl_CSV_QUERY_REDIRECT_STATE Contains information about whether files in a stream have been redirected.
winioctl_CSV_QUERY_VETO_FILE_DIRECT_IO_OUTPUT Contains troubleshooting information about why a volume is in redirected mode.
winioctl_DEVICE_COPY_OFFLOAD_DESCRIPTOR Contains the copy offload capabilities for a storage device.
winioctl_DEVICE_DATA_SET_LB_PROVISIONING_STATE Output structure for the DeviceDsmAction_Allocation action of the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_DEVICE_DATA_SET_RANGE Provides data set range information for use with the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_DEVICE_DATA_SET_REPAIR_PARAMETERS Specifies parameters for the repair operation.
winioctl_DEVICE_DSM_NOTIFICATION_PARAMETERS Contains parameters for the DeviceDsmAction_Notification action for the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_DEVICE_DSM_OFFLOAD_READ_PARAMETERS Contains parameters for the DeviceDsmAction_OffloadRead action for the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_DEVICE_DSM_OFFLOAD_WRITE_PARAMETERS Specifies parameters for the offload write operation.
winioctl_DEVICE_LB_PROVISIONING_DESCRIPTOR Contains the thin provisioning capabilities for a storage device.
winioctl_DEVICE_MANAGE_DATA_SET_ATTRIBUTES Input structure for the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_DEVICE_MANAGE_DATA_SET_ATTRIBUTES_OUTPUT Output structure for the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_DEVICE_MEDIA_INFO Provides information about the media supported by a device.
winioctl_DEVICE_POWER_DESCRIPTOR The DEVICE_POWER_DESCRIPTOR structure describes the power capabilities of a storage device.
winioctl_DEVICE_SEEK_PENALTY_DESCRIPTOR Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY request to retrieve the seek penalty descriptor data for a device.
winioctl_DEVICE_TRIM_DESCRIPTOR Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY request to retrieve the trim descriptor data for a device.
winioctl_DEVICE_WRITE_AGGREGATION_DESCRIPTOR Reserved for system use.
winioctl_DUPLICATE_EXTENTS_DATA Contains parameters for the FSCTL_DUPLICATE_EXTENTS control code that performs the Block Cloning operation.
winioctl_FILE_ALLOCATED_RANGE_BUFFER Indicates a range of bytes in a file.
winioctl_FILE_LEVEL_TRIM Used as input to the FSCTL_FILE_LEVEL_TRIM control code.
winioctl_FILE_LEVEL_TRIM_OUTPUT Used as output to the FSCTL_FILE_LEVEL_TRIM control code.
winioctl_FILE_LEVEL_TRIM_RANGE Specifies a range of a file that is to be trimmed.
winioctl_FILE_MAKE_COMPATIBLE_BUFFER Specifies the disc to close the current session for. This control code is used for UDF file systems. This structure is used for input when calling FSCTL_MAKE_MEDIA_COMPATIBLE.
winioctl_FILE_OBJECTID_BUFFER Contains an object identifier and user-defined metadata associated with the object identifier.
winioctl_FILE_QUERY_ON_DISK_VOL_INFO_BUFFER Receives the volume information from a call to FSCTL_QUERY_ON_DISK_VOLUME_INFO.
winioctl_FILE_QUERY_SPARING_BUFFER Contains defect management properties.
winioctl_FILE_SET_DEFECT_MGMT_BUFFER Specifies the defect management state to be set.
winioctl_FILE_SET_SPARSE_BUFFER Specifies the sparse state to be set.
winioctl_FILE_STORAGE_TIER Represents an identifier for the storage tier relative to the volume.
winioctl_FILE_STORAGE_TIER_REGION Describes a single storage tier region.
winioctl_FILE_SYSTEM_RECOGNITION_INFORMATION Contains file system recognition information retrieved by the FSCTL_QUERY_FILE_SYSTEM_RECOGNITION control code.
winioctl_FILE_ZERO_DATA_INFORMATION Contains a range of a file to set to zeros.
winioctl_FIND_BY_SID_DATA Contains data for the FSCTL_FIND_FILES_BY_SID control code.
winioctl_FIND_BY_SID_OUTPUT Represents a file name.
winioctl_FORMAT_EX_PARAMETERS Contains information used in formatting a contiguous set of disk tracks. It is used by the IOCTL_DISK_FORMAT_TRACKS_EX control code.
winioctl_FORMAT_PARAMETERS Contains information used in formatting a contiguous set of disk tracks.
winioctl_FSCTL_GET_INTEGRITY_INFORMATION_BUFFER Contains the integrity information for a file or directory.
winioctl_FSCTL_QUERY_REGION_INFO_INPUT Contains the storage tier regions from the storage stack for a particular volume.
winioctl_FSCTL_QUERY_REGION_INFO_OUTPUT Contains information for one or more regions.
winioctl_FSCTL_QUERY_STORAGE_CLASSES_OUTPUT Contains information for all tiers of a specific volume.
winioctl_FSCTL_SET_INTEGRITY_INFORMATION_BUFFER Input buffer passed with the FSCTL_SET_INTEGRITY_INFORMATION control code.
winioctl_GET_CHANGER_PARAMETERS Represents the parameters of a changer.
winioctl_GET_DISK_ATTRIBUTES Contains the attributes of a disk device.
winioctl_GET_LENGTH_INFORMATION Contains disk, volume, or partition length information used by the IOCTL_DISK_GET_LENGTH_INFO control code.
winioctl_GET_MEDIA_TYPES Contains information about the media types supported by a device.
winioctl_LOOKUP_STREAM_FROM_CLUSTER_ENTRY Returned from the FSCTL_LOOKUP_STREAM_FROM_CLUSTER control code.
winioctl_LOOKUP_STREAM_FROM_CLUSTER_INPUT Passed as input to the FSCTL_LOOKUP_STREAM_FROM_CLUSTER control code.
winioctl_LOOKUP_STREAM_FROM_CLUSTER_OUTPUT Received as output from the FSCTL_LOOKUP_STREAM_FROM_CLUSTER control code.
winioctl_MARK_HANDLE_INFO Contains information that is used to mark a specified file or directory, and its update sequence number (USN) change journal record with data about changes.
winioctl_MARK_HANDLE_INFO32 Contains information that is used to mark a specified file or directory, and its update sequence number (USN) change journal record with data about changes.
winioctl_MOVE_FILE_DATA Contains input data for the FSCTL_MOVE_FILE control code.
winioctl_NTFS_EXTENDED_VOLUME_DATA Represents volume data.
winioctl_NTFS_FILE_RECORD_INPUT_BUFFER Contains data for the FSCTL_GET_NTFS_FILE_RECORD control code.
winioctl_NTFS_FILE_RECORD_OUTPUT_BUFFER Receives output data from the FSCTL_GET_NTFS_FILE_RECORD control code.
winioctl_NTFS_VOLUME_DATA_BUFFER Represents volume data.
winioctl_PLEX_READ_DATA_REQUEST Indicates the range of the read operation to perform and the plex from which to read.
winioctl_PREVENT_MEDIA_REMOVAL Provides removable media locking data. It is used by the IOCTL_STORAGE_MEDIA_REMOVAL control code.
winioctl_READ_ELEMENT_ADDRESS_INFO Represents the volume tag information. It is used by the IOCTL_CHANGER_QUERY_VOLUME_TAGS control code.
winioctl_REASSIGN_BLOCKS Contains disk block reassignment data.
winioctl_REASSIGN_BLOCKS_EX Contains disk block reassignment data.
winioctl_REPAIR_COPIES_INPUT Input structure for the FSCTL_REPAIR_COPIES control code.
winioctl_REPAIR_COPIES_OUTPUT Contains output of a repair copies operation returned from the FSCTL_REPAIR_COPIES control code.
winioctl_REQUEST_OPLOCK_INPUT_BUFFER Contains the information to request an opportunistic lock (oplock) or to acknowledge an oplock break with the FSCTL_REQUEST_OPLOCK control code.
winioctl_REQUEST_OPLOCK_OUTPUT_BUFFER Contains the opportunistic lock (oplock) information returned by the FSCTL_REQUEST_OPLOCK control code.
winioctl_RETRIEVAL_POINTER_BASE Contains the output for the FSCTL_GET_RETRIEVAL_POINTER_BASE control code.
winioctl_RETRIEVAL_POINTERS_BUFFER Contains the output for the FSCTL_GET_RETRIEVAL_POINTERS control code.
winioctl_SET_DISK_ATTRIBUTES Specifies the attributes to be set on a disk device.
winioctl_SET_PARTITION_INFORMATION Contains information used to set a disk partition's type.
winioctl_SHRINK_VOLUME_INFORMATION Specifies the volume shrink operation to perform.
winioctl_STARTING_LCN_INPUT_BUFFER Contains the starting LCN to the FSCTL_GET_VOLUME_BITMAP control code.
winioctl_STARTING_VCN_INPUT_BUFFER Contains the starting VCN to the FSCTL_GET_RETRIEVAL_POINTERS control code.
winioctl_STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve the storage access alignment descriptor data for a device.
winioctl_STORAGE_ADAPTER_DESCRIPTOR Used with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve the storage adapter descriptor data for a device.
winioctl_STORAGE_DESCRIPTOR_HEADER Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve the properties of a storage device or adapter.
winioctl_STORAGE_DEVICE_ATTRIBUTES_DESCRIPTOR Reserved for future use.
winioctl_STORAGE_DEVICE_DESCRIPTOR Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve the storage device descriptor data for a device.
winioctl_STORAGE_DEVICE_ID_DESCRIPTOR Used with the IOCTL_STORAGE_QUERY_PROPERTY control code request to retrieve the device ID descriptor data for a device.
winioctl_STORAGE_DEVICE_IO_CAPABILITY_DESCRIPTOR The output buffer for the StorageDeviceIoCapabilityProperty as defined in STORAGE_PROPERTY_ID.
winioctl_STORAGE_DEVICE_NUMBER Contains information about a device. This structure is used by the IOCTL_STORAGE_GET_DEVICE_NUMBER control code.
winioctl_STORAGE_DEVICE_POWER_CAP This structure is used as an input and output buffer for the IOCTL_STORAGE_DEVICE_POWER_CAP.
winioctl_STORAGE_DEVICE_RESILIENCY_DESCRIPTOR Reserved for system use.
winioctl_STORAGE_HOTPLUG_INFO Provides information about the hotplug information of a device.
winioctl_STORAGE_HW_FIRMWARE_ACTIVATE This structure contains information about the downloaded firmware to activate.
winioctl_STORAGE_HW_FIRMWARE_DOWNLOAD This structure contains a firmware image payload to be downloaded to the target.
winioctl_STORAGE_MEDIUM_PRODUCT_TYPE_DESCRIPTOR Used in conjunction with the IOCTL_STORAGE_QUERY_PROPERTY request to describe the product type of a storage device.
winioctl_STORAGE_MINIPORT_DESCRIPTOR Reserved for system use.
winioctl_STORAGE_OFFLOAD_READ_OUTPUT Output structure for the DeviceDsmAction_OffloadRead action of the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_STORAGE_OFFLOAD_TOKEN The token used to represent a portion of a file used in by offload read and write operations.
winioctl_STORAGE_OFFLOAD_WRITE_OUTPUT Output structure for the DeviceDsmAction_OffloadWrite action of the IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES control code.
winioctl_STORAGE_PHYSICAL_ADAPTER_DATA Describes a physical storage adapter.
winioctl_STORAGE_PHYSICAL_DEVICE_DATA Describes a physical storage device.
winioctl_STORAGE_PHYSICAL_NODE_DATA Specifies the physical device data of a storage node.
winioctl_STORAGE_PHYSICAL_TOPOLOGY_DESCRIPTOR The STORAGE_PHYSICAL_TOPOLOGY_DESCRIPTOR structure is one of the query result structures returned from an IOCTL_STORAGE_QUERY_PROPERTY request.
winioctl_STORAGE_PROPERTY_QUERY Indicates the properties of a storage device or adapter to retrieve as the input buffer passed to the IOCTL_STORAGE_QUERY_PROPERTY control code.
winioctl_STORAGE_PROTOCOL_COMMAND This structure is used as an input buffer when using the pass-through mechanism to issue a vendor-specific command to a storage device (via IOCTL_STORAGE_PROTOCOL_COMMAND).
winioctl_STORAGE_PROTOCOL_DATA_DESCRIPTOR This structure is used in conjunction with IOCTL_STORAGE_QUERY_PROPERTY to return protocol-specific data from a storage device or adapter.
winioctl_STORAGE_PROTOCOL_SPECIFIC_DATA Describes protocol-specific device data, provided in the input and output buffer of an IOCTL_STORAGE_QUERY_PROPERTY request.
winioctl_STORAGE_RPMB_DATA_FRAME
winioctl_STORAGE_RPMB_DESCRIPTOR
winioctl_STORAGE_SPEC_VERSION Storage specification version.
winioctl_STORAGE_TEMPERATURE_DATA_DESCRIPTOR This structure is used in conjunction with IOCTL_STORAGE_QUERY_PROPERTY to return temperature data from a storage device or adapter.
winioctl_STORAGE_TEMPERATURE_INFO Describes device temperature data. Returned as part of STORAGE_TEMPERATURE_DATA_DESCRIPTOR when querying for temperature data with an IOCTL_STORAGE_QUERY_PROPERTY request.
winioctl_STORAGE_TEMPERATURE_THRESHOLD This structure is used to set the over or under temperature threshold of a storage device (via IOCTL_STORAGE_SET_TEMPERATURE_THRESHOLD).
winioctl_STORAGE_WRITE_CACHE_PROPERTY Used with the IOCTL_STORAGE_QUERY_PROPERTY control code to retrieve information about a device's write cache property.
winioctl_TXFS_CREATE_MINIVERSION_INFO Contains the version information about the miniversion created by FSCTL_TXFS_CREATE_MINIVERSION.
winioctl_TXFS_GET_METADATA_INFO_OUT Contains the version information about the miniversion that is created.
winioctl_TXFS_GET_TRANSACTED_VERSION Contains the information about the base and latest versions of the specified file.
winioctl_TXFS_LIST_TRANSACTION_LOCKED_FILES Contains a list of files locked by a transacted writer.
winioctl_TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY Contains information about a locked transaction.
winioctl_TXFS_LIST_TRANSACTIONS Contains a list of transactions.
winioctl_TXFS_LIST_TRANSACTIONS_ENTRY Contains information about a transaction.
winioctl_TXFS_MODIFY_RM Contains the information required when modifying log parameters and logging mode for a secondary resource manager.
winioctl_TXFS_QUERY_RM_INFORMATION Contains information about the resource manager (RM).
winioctl_TXFS_READ_BACKUP_INFORMATION_OUT Contains a Transactional NTFS (TxF) specific structure. This information should only be used when calling TXFS_WRITE_BACKUP_INFORMATION.
winioctl_TXFS_SAVEPOINT_INFORMATION The FSCTL_TXFS_SAVEPOINT_INFORMATION structure specifies the action to perform, and on which transaction.
winioctl_TXFS_TRANSACTION_ACTIVE_INFO Contains the flag that indicates whether transactions were active or not when a snapshot was taken.
winioctl_TXFS_WRITE_BACKUP_INFORMATION Contains a Transactional NTFS (TxF) specific structure. This information should only be used when calling TXFS_WRITE_BACKUP_INFORMATION.
winioctl_VERIFY_INFORMATION Contains information used to verify a disk extent.
winioctl_VOLUME_BITMAP_BUFFER Represents the occupied and available clusters on a disk.
winioctl_VOLUME_DISK_EXTENTS Represents a physical location on a disk.
winioctl_VOLUME_GET_GPT_ATTRIBUTES_INFORMATION Contains volume attributes retrieved with the IOCTL_VOLUME_GET_GPT_ATTRIBUTES control code.
*/
/// <summary>Contains volume attributes retrieved with the IOCTL_VOLUME_GET_GPT_ATTRIBUTES control code.</summary>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ns-winioctl-volume_get_gpt_attributes_information typedef struct
// _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION { DWORDLONG GptAttributes; } VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION;
[PInvokeData("winioctl.h", MSDNShortId = "NS:winioctl._VOLUME_GET_GPT_ATTRIBUTES_INFORMATION")]
[StructLayout(LayoutKind.Sequential)]
public struct VOLUME_GET_GPT_ATTRIBUTES_INFORMATION
{
/// <summary>
/// <para>Specifies all of the attributes associated with a volume.</para>
/// <list type="table">
/// <listheader>
/// <term>Value</term>
/// <term>Meaning</term>
/// </listheader>
/// <item>
/// <term>GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY 0x1000000000000000</term>
/// <term>The volume is read-only.</term>
/// </item>
/// <item>
/// <term>GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY 0x2000000000000000</term>
/// <term>The volume is a shadow copy of another volume. For more information, see Volume Shadow Copy Service Overview.</term>
/// </item>
/// <item>
/// <term>GPT_BASIC_DATA_ATTRIBUTE_HIDDEN 0x4000000000000000</term>
/// <term>The volume is hidden.</term>
/// </item>
/// <item>
/// <term>GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER 0x8000000000000000</term>
/// <term>The volume is not assigned a default drive letter.</term>
/// </item>
/// </list>
/// </summary>
public GPT_BASIC_DATA_ATTRIBUTE GptAttributes;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -5,223 +5,39 @@ namespace Vanara.PInvoke
{
public static partial class Kernel32
{
/// <summary>Device types defined by the system.</summary>
[PInvokeData("WinIOCtl.h")]
public enum DEVICE_TYPE : ushort
{
/// <summary/>
FILE_DEVICE_BEEP = 0x00000001,
/// <summary/>
FILE_DEVICE_CD_ROM = 0x00000002,
/// <summary/>
FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003,
/// <summary/>
FILE_DEVICE_CONTROLLER = 0x00000004,
/// <summary/>
FILE_DEVICE_DATALINK = 0x00000005,
/// <summary/>
FILE_DEVICE_DFS = 0x00000006,
/// <summary/>
FILE_DEVICE_DISK = 0x00000007,
/// <summary/>
FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008,
/// <summary/>
FILE_DEVICE_FILE_SYSTEM = 0x00000009,
/// <summary/>
FILE_DEVICE_INPORT_PORT = 0x0000000a,
/// <summary/>
FILE_DEVICE_KEYBOARD = 0x0000000b,
/// <summary/>
FILE_DEVICE_MAILSLOT = 0x0000000c,
/// <summary/>
FILE_DEVICE_MIDI_IN = 0x0000000d,
/// <summary/>
FILE_DEVICE_MIDI_OUT = 0x0000000e,
/// <summary/>
FILE_DEVICE_MOUSE = 0x0000000f,
/// <summary/>
FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010,
/// <summary/>
FILE_DEVICE_NAMED_PIPE = 0x00000011,
/// <summary/>
FILE_DEVICE_NETWORK = 0x00000012,
/// <summary/>
FILE_DEVICE_NETWORK_BROWSER = 0x00000013,
/// <summary/>
FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014,
/// <summary/>
FILE_DEVICE_NULL = 0x00000015,
/// <summary/>
FILE_DEVICE_PARALLEL_PORT = 0x00000016,
/// <summary/>
FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017,
/// <summary/>
FILE_DEVICE_PRINTER = 0x00000018,
/// <summary/>
FILE_DEVICE_SCANNER = 0x00000019,
/// <summary/>
FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001a,
/// <summary/>
FILE_DEVICE_SERIAL_PORT = 0x0000001b,
/// <summary/>
FILE_DEVICE_SCREEN = 0x0000001c,
/// <summary/>
FILE_DEVICE_SOUND = 0x0000001d,
/// <summary/>
FILE_DEVICE_STREAMS = 0x0000001e,
/// <summary/>
FILE_DEVICE_TAPE = 0x0000001f,
/// <summary/>
FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020,
/// <summary/>
FILE_DEVICE_TRANSPORT = 0x00000021,
/// <summary/>
FILE_DEVICE_UNKNOWN = 0x00000022,
/// <summary/>
FILE_DEVICE_VIDEO = 0x00000023,
/// <summary/>
FILE_DEVICE_VIRTUAL_DISK = 0x00000024,
/// <summary/>
FILE_DEVICE_WAVE_IN = 0x00000025,
/// <summary/>
FILE_DEVICE_WAVE_OUT = 0x00000026,
/// <summary/>
FILE_DEVICE_8042_PORT = 0x00000027,
/// <summary/>
FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028,
/// <summary/>
FILE_DEVICE_BATTERY = 0x00000029,
/// <summary/>
FILE_DEVICE_BUS_EXTENDER = 0x0000002a,
/// <summary/>
FILE_DEVICE_MODEM = 0x0000002b,
/// <summary/>
FILE_DEVICE_VDM = 0x0000002c,
/// <summary/>
FILE_DEVICE_MASS_STORAGE = 0x0000002d,
/// <summary/>
FILE_DEVICE_SMB = 0x0000002e,
/// <summary/>
FILE_DEVICE_KS = 0x0000002f,
/// <summary/>
FILE_DEVICE_CHANGER = 0x00000030,
/// <summary/>
FILE_DEVICE_SMARTCARD = 0x00000031,
/// <summary/>
FILE_DEVICE_ACPI = 0x00000032,
/// <summary/>
FILE_DEVICE_DVD = 0x00000033,
/// <summary/>
FILE_DEVICE_FULLSCREEN_VIDEO = 0x00000034,
/// <summary/>
FILE_DEVICE_DFS_FILE_SYSTEM = 0x00000035,
/// <summary/>
FILE_DEVICE_DFS_VOLUME = 0x00000036,
/// <summary/>
FILE_DEVICE_SERENUM = 0x00000037,
/// <summary/>
FILE_DEVICE_TERMSRV = 0x00000038,
/// <summary/>
FILE_DEVICE_KSEC = 0x00000039,
/// <summary/>
FILE_DEVICE_FIPS = 0x0000003A,
/// <summary/>
FILE_DEVICE_INFINIBAND = 0x0000003B,
/// <summary/>
FILE_DEVICE_AVIO = 0x0000003C,
/// <summary/>
FILE_DEVICE_VMBUS = 0x0000003E,
/// <summary/>
FILE_DEVICE_CRYPT_PROVIDER = 0x0000003F,
/// <summary/>
FILE_DEVICE_WPD = 0x00000040,
/// <summary/>
FILE_DEVICE_BLUETOOTH = 0x00000041,
/// <summary/>
FILE_DEVICE_MT_COMPOSITE = 0x00000042,
/// <summary/>
FILE_DEVICE_MT_TRANSPORT = 0x00000043,
/// <summary/>
FILE_DEVICE_BIOMETRIC = 0x00000044,
/// <summary/>
FILE_DEVICE_PMI = 0x00000045,
/// <summary/>
FILE_DEVICE_EHSTOR = 0x00000046,
/// <summary/>
FILE_DEVICE_DEVAPI = 0x00000047,
/// <summary/>
FILE_DEVICE_GPIO = 0x00000048,
/// <summary/>
FILE_DEVICE_USBEX = 0x00000049,
/// <summary/>
FILE_DEVICE_CONSOLE = 0x00000050,
/// <summary/>
FILE_DEVICE_NFP = 0x00000051,
/// <summary/>
FILE_DEVICE_SYSENV = 0x00000052,
/// <summary/>
FILE_DEVICE_VIRTUAL_BLOCK = 0x00000053,
/// <summary/>
FILE_DEVICE_POINT_OF_SERVICE = 0x00000054,
/// <summary/>
FILE_DEVICE_STORAGE_REPLICATION = 0x00000055,
/// <summary/>
FILE_DEVICE_TRUST_ENV = 0x00000056,
/// <summary/>
FILE_DEVICE_UCM = 0x00000057,
/// <summary/>
FILE_DEVICE_UCMTCPCI = 0x00000058,
/// <summary/>
FILE_DEVICE_PERSISTENT_MEMORY = 0x00000059,
/// <summary/>
FILE_DEVICE_NVDIMM = 0x0000005a,
/// <summary/>
FILE_DEVICE_HOLOGRAPHIC = 0x0000005b,
/// <summary/>
FILE_DEVICE_SDFXHCI = 0x0000005c,
/// <summary/>
FILE_DEVICE_UCMUCSI = 0x0000005d,
/// <summary/>
IOCTL_STORAGE_BASE = FILE_DEVICE_MASS_STORAGE,
/// <summary/>
IOCTL_CHANGER_BASE = FILE_DEVICE_CHANGER,
/// <summary/>
IOCTL_VOLUME_BASE = 0x00000056,
}
/// <summary>
/// Defined access check value for any access within an I/O control code (IOCTL). The FILE_ACCESS_ANY is generally the correct value.
/// </summary>
[Flags]
[PInvokeData("WinIOCtl.h")]
public enum IOAccess : byte
{
/// <summary>Request all access.</summary>
FILE_ANY_ACCESS = 0,
/// <summary>Request read access. Can be used with FILE_WRITE_ACCESS.</summary>
FILE_READ_ACCESS = 1,
/// <summary>Request write access. Can be used with FILE_READ_ACCESS.</summary>
FILE_WRITE_ACCESS = 2,
/// <summary>Request read and write access. This value is equivalent to (FILE_READ_ACCESS | FILE_WRITE_ACCESS).</summary>
FILE_READ_WRITE_ACCESS = 3,
}
/// <summary>Defined method codes for how buffers are passed for I/O and file system controls within an I/O control code (IOCTL).</summary>
[PInvokeData("WinIOCtl.h")]
public enum IOMethod : byte
{
/// <summary>The method buffered</summary>
METHOD_BUFFERED = 0,
/// <summary>The method in direct</summary>
METHOD_IN_DIRECT = 1,
/// <summary>The method out direct</summary>
METHOD_OUT_DIRECT = 2,
/// <summary>The method neither</summary>
METHOD_NEITHER = 3,
}
/// <summary>This macro is used to determine to which partitions drive letters should be assigned.</summary>
/// <param name="PartitionType">Supplies the type of the partition being examined.</param>
/// <returns><see langword="true"/> if the partition type is recognized; otherwise, <see langword="false"/>.</returns>
[PInvokeData("winioctl.h")]
public static bool IsRecognizedPartition(PartitionType PartitionType) => Environment.OSVersion.Version.Major < 6 ?
((PartitionType & PartitionType.PARTITION_NTFT) != 0 &&
((((byte)PartitionType & ~0xC0) == (byte)PartitionType.PARTITION_HUGE) ||
(((byte)PartitionType & ~0xC0) == (byte)PartitionType.PARTITION_IFS) ||
(((byte)PartitionType & ~0xC0) == (byte)PartitionType.PARTITION_FAT32) ||
(((byte)PartitionType & ~0xC0) == (byte)PartitionType.PARTITION_FAT32_XINT13))) ||
((PartitionType) == PartitionType.PARTITION_FAT_12) ||
((PartitionType) == PartitionType.PARTITION_FAT_16) ||
((PartitionType) == PartitionType.PARTITION_HUGE) ||
((PartitionType) == PartitionType.PARTITION_IFS) ||
((PartitionType) == PartitionType.PARTITION_FAT32) ||
((PartitionType) == PartitionType.PARTITION_FAT32_XINT13) ||
((PartitionType) == PartitionType.PARTITION_XINT13)
:
((PartitionType) == PartitionType.PARTITION_BSP) ||
((PartitionType) == PartitionType.PARTITION_DPP) ||
((PartitionType) == PartitionType.PARTITION_FAT_12) ||
((PartitionType) == PartitionType.PARTITION_FAT_16) ||
((PartitionType) == PartitionType.PARTITION_FAT32) ||
((PartitionType) == PartitionType.PARTITION_FAT32_XINT13) ||
((PartitionType) == PartitionType.PARTITION_HUGE) ||
((PartitionType) == PartitionType.PARTITION_IFS) ||
((PartitionType) == PartitionType.PARTITION_MAIN_OS) ||
((PartitionType) == PartitionType.PARTITION_MSFT_RECOVERY) ||
((PartitionType) == PartitionType.PARTIITON_OS_DATA) ||
((PartitionType) == PartitionType.PARTITION_PRE_INSTALLED) ||
((PartitionType) == PartitionType.PARTITION_SYSTEM) ||
((PartitionType) == PartitionType.PARTITION_WINDOWS_SYSTEM) ||
((PartitionType) == PartitionType.PARTITION_XINT13);
/// <summary>Represents IO control codes.</summary>
[PInvokeData("WinIOCtl.h")]
@ -230,35 +46,138 @@ namespace Vanara.PInvoke
private const ushort IOCTL_SCM_LOGICAL_DEVICE_FUNCTION_BASE = 0x300;
private const ushort IOCTL_SCM_PHYSICAL_DEVICE_FUNCTION_BASE = 0x600;
private const ushort IOCTL_SCMBUS_DEVICE_FUNCTION_BASE = 0x0;
/// <summary/>
public static uint FSCTL_ADD_OVERLAY => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 204, IOMethod.METHOD_BUFFERED, IOAccess.FILE_WRITE_ACCESS);
/// <summary/>
public static uint FSCTL_ADVANCE_FILE_ID => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 177, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>
/// Signals the file system driver not to perform any I/O boundary checks on partition read or write calls. Instead, boundary
/// checks are performed by the device driver.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// A call using the <c>FSCTL_ALLOW_EXTENDED_DASD_IO</c> control code should only be used with great caution by programmers
/// familiar with the underlying structure of a hard disk drive and file system. Improper use or inaccurate checking in
/// subsequent write operations to the partition can result in damage to data on the partition, or destruction of the entire partition.
/// </para>
/// <para>
/// The <c>FSCTL_ALLOW_EXTENDED_DASD_IO</c> control code is used to signal the file system driver not to perform any I/O
/// boundary checks on read or write calls made with the specified handle. <c>FSCTL_ALLOW_EXTENDED_DASD_IO</c> allows access to
/// hidden sectors, a part of the partition that might exist between the first sector of the partition (the boot parameter
/// block) and the first useful sector of the partition. <c>FSCTL_ALLOW_EXTENDED_DASD_IO</c> also allows access to lost
/// clusters, which might exist between the last useful cluster and the end of the partition.
/// </para>
/// <para>
/// I/O requests issued after this operation are passed directly to the device driver. If these subsequent calls request data
/// beyond the partition boundary, the driver causes them to fail.
/// </para>
/// <para>For the implications of overlapped I/O on this operation, see the Remarks section of DeviceIoControl.</para>
/// <para>
/// To retrieve a handle to a partition, call CreateFile with the lpFileName parameter set to a string of the following form:
/// </para>
/// <para>\.\X:</para>
/// <para>where X is the drive letter.</para>
/// <para>
/// The application calling CreateFile must also specify the <c>FILE_SHARE_READ</c> and <c>FILE_SHARE_WRITE</c> flags in the
/// dwShareMode parameter of CreateFile. For more information, see the Disk Devices section in CreateFile.
/// </para>
/// <para>
/// To determine the partition structure of the drive and to determine if the system recognizes the partition, use the
/// IOCTL_DISK_GET_DRIVE_LAYOUT_EX or IOCTL_DISK_GET_DRIVE_LAYOUT control code, as appropriate. For similar information on a
/// single partition, use the IOCTL_DISK_GET_PARTITION_INFO_EX or IOCTL_DISK_GET_PARTITION_INFO control code, as appropriate. To
/// determine the size of a cluster, use the GetDiskFreeSpaceEx or GetDiskFreeSpace function, as appropriate.
/// </para>
/// <para>In Windows Server 2012, this function is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.0 protocol</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>SMB 3.0 Transparent Failover (TFO)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>SMB 3.0 with Scale-out File Shares (SO)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Resilient File System (ReFS)</term>
/// <term>Yes</term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_allow_extended_dasd_io
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_ALLOW_EXTENDED_DASD_IO")]
public static uint FSCTL_ALLOW_EXTENDED_DASD_IO => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 32, IOMethod.METHOD_NEITHER, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
public static uint FSCTL_CLEAN_VOLUME_METADATA => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 223, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
public static uint FSCTL_CORRUPTION_HANDLING => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 152, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Retrieves the object identifier for the specified file or directory. If no object identifier exists, using <c>FSCTL_CREATE_OR_GET_OBJECT_ID</c> creates one.</para>
/// <para>To perform this operation, call the <c>DeviceIoControl</c> function with the following parameters.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device FSCTL_CREATE_OR_GET_OBJECT_ID, // dwIoControlCode NULL, // lpInBuffer 0, // nInBufferSize (LPVOID) lpOutBuffer, // output buffer (DWORD) nOutBufferSize, // size of output buffer (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
/// <remarks>
/// <para>Object identifiers are used to track files and directories. They are invisible to most applications and should never be modified by applications. Modifying an object identifier can result in the loss of data from portions of a file, up to and including entire volumes of data.</para>
/// <para>This operation creates an object identifier if the object does not already have one. To test for the presence of an object identifier, and retrieve it if it exists, use the FSCTL_GET_OBJECT_ID operation. To create an object identifier without first testing for the presence of one, use the FSCTL_SET_OBJECT_ID operation.</para>
/// <para>In Windows Server 2012, this function is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.0 protocol</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.0 Transparent Failover (TFO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.0 with Scale-out File Shares (SO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Resilient File System (ReFS)</term>
/// <term>No</term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_create_or_get_object_id
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_CREATE_OR_GET_OBJECT_ID")]
[CorrespondingType(typeof(FILE_OBJECTID_BUFFER), CorrespondingAction.Get)]
public static uint FSCTL_CREATE_OR_GET_OBJECT_ID => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 48, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary>
/// <para>
/// Creates an update sequence number (USN) change journal stream on a target volume, or modifies an existing change journal stream.
/// </para>
/// <para>Major Code</para>
/// <para>IRP_MJ_DEVICE_CONTROL</para>
/// <para>Input Buffer</para>
/// <para>Input Buffer Length</para>
/// <para>Output Buffer</para>
/// <para>Output Buffer Length</para>
/// <para>Input / Output Buffer</para>
/// <para>Input / Output Buffer Length</para>
/// <para>Status Block</para>
/// <para>Irp-&gt;IoStatus.Status is set to STATUS_SUCCESS if the request is successful.</para>
/// <para>Otherwise, Status to the appropriate error condition as a NTSTATUS code.</para>
/// <para>For more information, see NTSTATUS Values.</para>
/// <para>Input buffer</para>
/// <para>Input buffer length</para>
/// <para>Output buffer</para>
/// <para>Output buffer length</para>
/// <para>Input / Output buffer</para>
/// <para>Input / Output buffer length</para>
/// </summary>
/// <remarks>
/// <para>For the implications of overlapped I/O on this operation, see the Remarks section of the DeviceIoControl topic.</para>
@ -273,7 +192,7 @@ namespace Vanara.PInvoke
/// </para>
/// <para>For more information, see Creating, Modifying, and Deleting a Change Journal.</para>
/// <para>To retrieve a handle to a volume, call CreateFile with the lpFileName parameter set to a string in the following form:</para>
/// <para>\.&lt;i&gt;X:</para>
/// <para>\.\X:</para>
/// <para>
/// In the preceding string, X is the letter identifying the drive on which the volume appears. The volume must be NTFS 3.0 or
/// later. To obtain the NTFS version of a volume, open a command prompt with Administrator access rights and execute the
@ -305,15 +224,26 @@ namespace Vanara.PInvoke
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_create_usn_journal?redirectedfrom=MSDN
[PInvokeData("winioctl.h", MSDNShortId = "92e737e6-dba6-47f1-a077-e303039e12eb")]
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_create_usn_journal
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_CREATE_USN_JOURNAL")]
[CorrespondingType(typeof(CREATE_USN_JOURNAL_DATA), CorrespondingAction.Get)]
public static uint FSCTL_CREATE_USN_JOURNAL => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 57, IOMethod.METHOD_NEITHER, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
public static uint FSCTL_CSC_INTERNAL => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 107, IOMethod.METHOD_NEITHER, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Retrieves the results of a CSV control operation.</para>
/// <para>To perform this operation, call the <c>DeviceIoControl</c> function with the following parameters.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device FSCTL_CSV_CONTROL, // dwIoControlCode (LPVOID) lpInBuffer, // input buffer (DWORD) nInBufferSize, // size of input buffer (LPVOID) lpOutBuffer, // output buffer (DWORD) nOutBufferSize, // size of output buffer (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_csv_control
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_CSV_CONTROL")]
[CorrespondingType(typeof(CSV_CONTROL_PARAM), CorrespondingAction.Set)]
[CorrespondingType(typeof(CSV_QUERY_FILE_REVISION), CorrespondingAction.Get)]
[CorrespondingType(typeof(CSV_QUERY_MDS_PATH), CorrespondingAction.Get)]
[CorrespondingType(typeof(CSV_QUERY_REDIRECT_STATE), CorrespondingAction.Get)]
[CorrespondingType(typeof(CSV_QUERY_VETO_FILE_DIRECT_IO_OUTPUT), CorrespondingAction.Get)]
public static uint FSCTL_CSV_CONTROL => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 181, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
@ -334,7 +264,13 @@ namespace Vanara.PInvoke
/// <summary/>
public static uint FSCTL_CSV_MGMT_LOCK => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 175, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Retrieves information about a file system for which CSVFS is a proxy.</para>
/// <para>To perform this operation, call the <c>DeviceIoControl</c> function with the following parameters.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS, // dwIoControlCode NULL, // input buffer 0, // size of input buffer (LPVOID) lpOutBuffer, // lpOutBuffer (DWORD) nOutBufferSize, // nOutBufferSize (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_csv_query_down_level_file_system_characteristics
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS")]
public static uint FSCTL_CSV_QUERY_DOWN_LEVEL_FILE_SYSTEM_CHARACTERISTICS => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 176, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
@ -350,12 +286,101 @@ namespace Vanara.PInvoke
public static uint FSCTL_DELETE_CORRUPTED_REFS_CONTAINER => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 253, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>The <c>FSCTL_DELETE_EXTERNAL_BACKING</c> control code removes the association of a file with an external backing provider, including the Windows Image Format (WIM) provider or compressed file provider. As a result of this operation, the entire contents of a backed file are read, decompressed, and written into the file.</para>
/// <para>To perform this operation, call <c>FltFsControlFile</c> or <c>ZwFsControlFile</c> with the following parameters.</para>
/// <para><c>Parameters</c></para>
/// <para>Instance [in] <c>FltFsControlFile</c> only. An opaque instance pointer for the caller. This parameter is required and cannot be NULL.</para>
/// <para>FileObject [in] <c>FltFsControlFile</c> only. The file pointer object of the file for which backing association is deleted. This parameter is required and cannot be NULL.</para>
/// <para>FileHandle [in] <c>ZwFsControlFile</c> only. The handle of the file for which backing association is deleted. This parameter is required and cannot be NULL.</para>
/// <para>FsControlCode [in] The control code for the operation. Use <c>FSCTL_DELETE_EXTERNAL_BACKING</c> for this operation.</para>
/// <para>InputBuffer None. Set to NULL.</para>
/// <para>InputBufferLength [in] Set to 0.</para>
/// <para>OutputBuffer [out] None. Set to NULL.</para>
/// <para>OutputBufferLength [out] Set to 0.</para>
/// </summary>
/// <remarks>As a result of the delete operation, the contents of the file are read from the backing source and the entire file is written to the volume.</remarks>
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ifs/fsctl-delete-external-backing
[PInvokeData("Ntifs.h")]
public static uint FSCTL_DELETE_EXTERNAL_BACKING => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 197, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Removes the object identifier from a specified file or directory. The underlying object is not deleted.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device FSCTL_DELETE_OBJECT_ID, // dwIoControlCode NULL, // lpInBuffer 0, // nInBufferSize NULL, // lpOutBuffer 0, // nOutBufferSize (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
/// <remarks>
/// <para>Object identifiers are used to track files and directories. They are invisible to most applications and should never be modified by applications. Modifying an object identifier can result in the loss of data from portions of a file, up to and including entire volumes of data.</para>
/// <para>In Windows 8 and Windows Server 2012, this code is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.0 protocol</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.0 Transparent Failover (TFO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.0 with Scale-out File Shares (SO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Resilient File System (ReFS)</term>
/// <term>No</term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_delete_object_id
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_DELETE_OBJECT_ID")]
public static uint FSCTL_DELETE_OBJECT_ID => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 40, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Deletes a reparse point from the specified file or directory. Using <c>FSCTL_DELETE_REPARSE_POINT</c> does not delete the file or directory.</para>
/// <para>To perform this operation, call the <c>DeviceIoControl</c> function with the following parameters.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to file or directory FSCTL_DELETE_REPARSE_POINT, // dwIoControlCode (LPVOID) lpInBuffer, // input buffer (DWORD) nInBufferSize, // size of input buffer NULL, // lpOutBuffer 0, // nOutBufferSize (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
/// <remarks>
/// <para>In Windows 8 and Windows Server 2012, this code is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.0 protocol</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.0 Transparent Failover (TFO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.0 with Scale-out File Shares (SO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>Resilient File System (ReFS)</term>
/// <term>Yes</term>
/// </item>
/// </list>
/// <para>CsvFs does not support reparse points.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_delete_reparse_point
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_DELETE_REPARSE_POINT")]
//[CorrespondingType(typeof(REPARSE_GUID_DATA_BUFFER), CorrespondingAction.Set)]
//[CorrespondingType(typeof(REPARSE_DATA_BUFFER), CorrespondingAction.Set)]
public static uint FSCTL_DELETE_REPARSE_POINT => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 43, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary>
@ -445,13 +470,126 @@ namespace Vanara.PInvoke
/// <summary/>
public static uint FSCTL_DISABLE_LOCAL_BUFFERING => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 174, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Dismounts a volume regardless of whether or not the volume is currently in use. For more information, see the Remarks section.</para>
/// </summary>
/// <remarks>
/// <para>The <c>FSCTL_DISMOUNT_VOLUME</c> control code will attempt to dismount a volume regardless of whether or not any other processes are using the volume, which can have unpredictable results for those processes if they do not hold a lock on the volume. For information about locking a volume, see FSCTL_LOCK_VOLUME.</para>
/// <para>The hDevice handle passed to DeviceIoControl must be a handle to a volume, opened for direct access. To retrieve a volume handle, call CreateFile with the lpFileName parameter set to a string of the following form:</para>
/// <para>\.\X:</para>
/// <para>where X is a hard-drive partition letter, floppy disk drive, or CD-ROM drive. The application must also specify the <c>FILE_SHARE_READ</c> and <c>FILE_SHARE_WRITE</c> flags in the dwShareMode parameter of CreateFile.</para>
/// <para>If the specified volume is a system volume or contains a page file, the operation fails.</para>
/// <para>If the specified volume is locked by another process, the operation fails. To prevent another process from locking the volume, lock it as soon as you open it.</para>
/// <para>A dismounted volume has the following properties:</para>
/// <list type="bullet">
/// <item>
/// <term>There are no open files.</term>
/// </item>
/// <item>
/// <term>The operating system does detect the volume.</term>
/// </item>
/// </list>
/// <para>The operating system tries to mount an unmounted volume as soon as an attempt is made to access it. For example, a call to GetLogicalDrives triggers the operating system to mount unmounted volumes.</para>
/// <para>Dismounting a volume is useful when a volume needs to disappear for a while. For example, an application that changes a volume file system from the FAT file system to the NTFS file system might use the following procedure.</para>
/// <para><c>To change a volume file system</c></para>
/// <list type="number">
/// <item>
/// <term>Open a volume.</term>
/// </item>
/// <item>
/// <term>Lock the volume.</term>
/// </item>
/// <item>
/// <term>Format the volume.</term>
/// </item>
/// <item>
/// <term>Dismount the volume.</term>
/// </item>
/// <item>
/// <term>Unlock the volume.</term>
/// </item>
/// <item>
/// <term>Close the volume handle.</term>
/// </item>
/// </list>
/// <para>A dismounting operation removes the volume from the FAT file system awareness. When the operating system mounts the volume, it appears as an NTFS file system volume.</para>
/// <para>In Windows 8 and Windows Server 2012, this code is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.0 protocol</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>SMB 3.0 Transparent Failover (TFO)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>SMB 3.0 with Scale-out File Shares (SO)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>See comment</term>
/// </item>
/// </list>
/// <para>On CsvFs the node where dismount is issued will see a normal dismount sequence. On all other nodes FS will invalidate all the opened files.</para>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_dismount_volume
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_DISMOUNT_VOLUME")]
public static uint FSCTL_DISMOUNT_VOLUME => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 8, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
/// <summary>
/// <para>Instructs the file system to copy a range of file bytes on behalf of an application. The destination file may be the same as, or different from, the source file. See Block Cloning for more information.</para>
/// <para>To perform this operation, call the <c>DeviceIoControl</c> function with the following parameters.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device FSCTL_DUPLICATE_EXTENTS_TO_FILE, // dwIoControlCode (LPVOID) lpInBuffer, // input buffer (DWORD) nInBufferSize, // size of input buffer NULL, // lpOutBuffer 0, // nOutBufferSize (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
/// <remarks>
/// <para>For the implications of overlapped I/O on this operation, see the Remarks section of the DeviceIoControl topic.</para>
/// <para>See Block Cloning for more information on this operation.</para>
/// <para>In Windows Server 2016, this function is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.1.1 protocol</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.1.1 Transparent Failover (TFO)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>SMB 3.1.1 with Scale-out File Shares (SoFS)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>Yes</term>
/// </item>
/// <item>
/// <term>Resilient File System (ReFS)</term>
/// <term>Yes</term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_duplicate_extents_to_file
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.FSCTL_DUPLICATE_EXTENTS_TO_FILE")]
[CorrespondingType(typeof(DUPLICATE_EXTENTS_DATA), CorrespondingAction.Set)]
public static uint FSCTL_DUPLICATE_EXTENTS_TO_FILE => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 209, IOMethod.METHOD_BUFFERED, IOAccess.FILE_WRITE_ACCESS);
/// <summary/>
/// <summary>
/// <para>The <c>FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX</c> control code instructs the file system to copy a range of file bytes on behalf of an application. The destination file may be the same as, or different from, the source file.</para>
/// </summary>
/// <remarks>For the implications of overlapped I/O on this operation, see the Remarks section of the <c>DeviceIoControl</c> topic.</remarks>
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ifs/fsctl-duplicate-extents-to-file-ex
[PInvokeData("WinIoctl.h")]
//[CorrespondingType(typeof(DUPLICATE_EXTENTS_DATA_EX), CorrespondingAction.Set)]
public static uint FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 250, IOMethod.METHOD_BUFFERED, IOAccess.FILE_WRITE_ACCESS);
/// <summary/>
@ -599,6 +737,7 @@ namespace Vanara.PInvoke
public static uint FSCTL_GET_BOOT_AREA_INFO => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 140, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
[CorrespondingType(typeof(COMPRESSION_FORMAT), CorrespondingAction.Get)]
public static uint FSCTL_GET_COMPRESSION => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 15, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
@ -1035,8 +1174,9 @@ namespace Vanara.PInvoke
/// <summary/>
public static uint FSCTL_SET_BOOTLOADER_ACCESSED => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 19, IOMethod.METHOD_NEITHER, IOAccess.FILE_ANY_ACCESS);
/// <summary/>
[CorrespondingType(typeof(COMPRESSION_FORMAT), CorrespondingAction.Set)]
public static uint FSCTL_SET_COMPRESSION => CTL_CODE(DEVICE_TYPE.FILE_DEVICE_FILE_SYSTEM, 16, IOMethod.METHOD_BUFFERED, IOAccess.FILE_READ_WRITE_ACCESS);
/// <summary/>
@ -2113,8 +2253,40 @@ namespace Vanara.PInvoke
/// <summary/>
public static uint IOCTL_STORAGE_STOP_DATA_INTEGRITY_CHECK => CTL_CODE(DEVICE_TYPE.IOCTL_STORAGE_BASE, 0x0622, IOMethod.METHOD_BUFFERED, IOAccess.FILE_READ_WRITE_ACCESS);
/// <summary/>
/// <summary>
/// <para>Retrieves the attributes for a volume.</para>
/// <para>To perform this operation, call the <c>DeviceIoControl</c> function with the following parameters.</para>
/// <para><code>BOOL DeviceIoControl( (HANDLE) hDevice, // handle to the volume device IOCTL_VOLUME_GET_GPT_ATTRIBUTES, // dwIoControlCode NULL, // lpInBuffer 0, // nInBufferSize (LPVOID) lpOutBuffer, // output buffer (DWORD) nOutBufferSize, // size of output buffer (LPDWORD) lpBytesReturned, // number of bytes returned (LPOVERLAPPED) lpOverlapped // OVERLAPPED structure ); </code></para>
/// </summary>
/// <remarks>
/// <para>In Windows 8 and Windows Server 2012, this code is supported by the following technologies.</para>
/// <list type="table">
/// <listheader>
/// <term>Technology</term>
/// <term>Supported</term>
/// </listheader>
/// <item>
/// <term>Server Message Block (SMB) 3.0 protocol</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>SMB 3.0 Transparent Failover (TFO)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>SMB 3.0 with Scale-out File Shares (SO)</term>
/// <term>No</term>
/// </item>
/// <item>
/// <term>Cluster Shared Volume File System (CsvFS)</term>
/// <term>Yes</term>
/// </item>
/// </list>
/// </remarks>
// https://docs.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-ioctl_volume_get_gpt_attributes
[PInvokeData("winioctl.h", MSDNShortId = "NI:winioctl.IOCTL_VOLUME_GET_GPT_ATTRIBUTES")]
[CorrespondingType(typeof(VOLUME_GET_GPT_ATTRIBUTES_INFORMATION), CorrespondingAction.Get)]
public static uint IOCTL_VOLUME_GET_GPT_ATTRIBUTES => CTL_CODE(DEVICE_TYPE.IOCTL_VOLUME_BASE, 14, IOMethod.METHOD_BUFFERED, IOAccess.FILE_ANY_ACCESS);
/// <summary>