diff --git a/sdk/include/psdk/ntddvol.h b/sdk/include/psdk/ntddvol.h index 0777b073a13..401774a7df1 100644 --- a/sdk/include/psdk/ntddvol.h +++ b/sdk/include/psdk/ntddvol.h @@ -3,10 +3,11 @@ * * Volume IOCTL interface. * - * This file is part of the w32api package. + * This file is part of the ReactOS DDK package. * * Contributors: * Created by Casper S. Hornstrup + * Hermès Bélusca-Maïto * * THIS SOFTWARE IS NOT COPYRIGHTED * @@ -27,43 +28,44 @@ extern "C" { #endif +#if defined(_WINIOCTL_) || defined(IOCTL_VOLUME_BASE) +// Definitions duplicated in winioctl.h +#define _WINIOCTL_DEFINED_ +#endif + +#ifndef _WINIOCTL_DEFINED_ #define IOCTL_VOLUME_BASE ((ULONG) 'V') +#endif /* _WINIOCTL_DEFINED_ */ -#define IOCTL_VOLUME_LOGICAL_TO_PHYSICAL \ - CTL_CODE(IOCTL_VOLUME_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_VOLUME_PHYSICAL_TO_LOGICAL \ - CTL_CODE(IOCTL_VOLUME_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_VOLUME_READ_PLEX \ - CTL_CODE(IOCTL_VOLUME_BASE, 11, METHOD_OUT_DIRECT, FILE_READ_ACCESS) +#if (NTDDI_VERSION >= NTDDI_WIN2K) +#ifndef _WINIOCTL_DEFINED_ #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS \ CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_VOLUME_IS_CLUSTERED \ - CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) +typedef struct _DISK_EXTENT { + ULONG DiskNumber; + LARGE_INTEGER StartingOffset; + LARGE_INTEGER ExtentLength; +} DISK_EXTENT, *PDISK_EXTENT; -#define IOCTL_VOLUME_QUERY_VOLUME_NUMBER \ - CTL_CODE(IOCTL_VOLUME_BASE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_VOLUME_IS_PARTITION \ - CTL_CODE(IOCTL_VOLUME_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_VOLUME_SET_GPT_ATTRIBUTES \ - CTL_CODE(IOCTL_VOLUME_BASE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \ - CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) +typedef struct _VOLUME_DISK_EXTENTS { + ULONG NumberOfDiskExtents; + DISK_EXTENT Extents[1]; +} VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS; +#endif /* _WINIOCTL_DEFINED_ */ #define IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE \ CTL_CODE(IOCTL_VOLUME_BASE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS) +#ifndef _WINIOCTL_DEFINED_ #define IOCTL_VOLUME_ONLINE \ CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) #define IOCTL_VOLUME_OFFLINE \ CTL_CODE(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#endif /* _WINIOCTL_DEFINED_ */ #define IOCTL_VOLUME_IS_OFFLINE \ CTL_CODE(IOCTL_VOLUME_BASE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS) @@ -74,8 +76,25 @@ extern "C" { #define IOCTL_VOLUME_QUERY_FAILOVER_SET \ CTL_CODE(IOCTL_VOLUME_BASE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_VOLUME_POST_ONLINE \ - CTL_CODE(IOCTL_VOLUME_BASE, 25, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +typedef struct _VOLUME_FAILOVER_SET { + ULONG NumberOfDisks; + ULONG DiskNumbers[1]; +} VOLUME_FAILOVER_SET, *PVOLUME_FAILOVER_SET; + + +#define IOCTL_VOLUME_QUERY_VOLUME_NUMBER \ + CTL_CODE(IOCTL_VOLUME_BASE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define IOCTL_VOLUME_LOGICAL_TO_PHYSICAL \ + CTL_CODE(IOCTL_VOLUME_BASE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define IOCTL_VOLUME_PHYSICAL_TO_LOGICAL \ + CTL_CODE(IOCTL_VOLUME_BASE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS) + +typedef struct _VOLUME_NUMBER { + ULONG VolumeNumber; + WCHAR VolumeManagerName[8]; +} VOLUME_NUMBER, *PVOLUME_NUMBER; typedef struct _VOLUME_LOGICAL_OFFSET { LONGLONG LogicalOffset; @@ -91,16 +110,36 @@ typedef struct _VOLUME_PHYSICAL_OFFSETS { VOLUME_PHYSICAL_OFFSET PhysicalOffset[1]; } VOLUME_PHYSICAL_OFFSETS, *PVOLUME_PHYSICAL_OFFSETS; +#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ + + +#if (NTDDI_VERSION >= NTDDI_WINXP) + +#define IOCTL_VOLUME_IS_PARTITION \ + CTL_CODE(IOCTL_VOLUME_BASE, 10, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#define IOCTL_VOLUME_READ_PLEX \ + CTL_CODE(IOCTL_VOLUME_BASE, 11, METHOD_OUT_DIRECT, FILE_READ_ACCESS) + +#ifndef _WINIOCTL_DEFINED_ +#define IOCTL_VOLUME_IS_CLUSTERED \ + CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif /* _WINIOCTL_DEFINED_ */ + +#define IOCTL_VOLUME_SET_GPT_ATTRIBUTES \ + CTL_CODE(IOCTL_VOLUME_BASE, 13, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#ifndef _WINIOCTL_DEFINED_ +#define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \ + CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif /* _WINIOCTL_DEFINED_ */ + typedef struct _VOLUME_READ_PLEX_INPUT { LARGE_INTEGER ByteOffset; ULONG Length; ULONG PlexNumber; } VOLUME_READ_PLEX_INPUT, *PVOLUME_READ_PLEX_INPUT; -typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION { - ULONGLONG GptAttributes; -} VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION; - typedef struct _VOLUME_SET_GPT_ATTRIBUTES_INFORMATION { ULONGLONG GptAttributes; BOOLEAN RevertOnClose; @@ -109,26 +148,31 @@ typedef struct _VOLUME_SET_GPT_ATTRIBUTES_INFORMATION { ULONG Reserved2; } VOLUME_SET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_SET_GPT_ATTRIBUTES_INFORMATION; -typedef struct _DISK_EXTENT { - ULONG DiskNumber; - LARGE_INTEGER StartingOffset; - LARGE_INTEGER ExtentLength; -} DISK_EXTENT, *PDISK_EXTENT; +#ifndef _WINIOCTL_DEFINED_ +typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION { + ULONGLONG GptAttributes; +} VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION; +#endif /* _WINIOCTL_DEFINED_ */ -typedef struct _VOLUME_DISK_EXTENTS { - ULONG NumberOfDiskExtents; - DISK_EXTENT Extents[1]; -} VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS; +#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ -typedef struct _VOLUME_NUMBER { - ULONG VolumeNumber; - WCHAR VolumeManagerName[8]; -} VOLUME_NUMBER, *PVOLUME_NUMBER; -typedef struct _VOLUME_FAILOVER_SET { - ULONG NumberOfDisks; - ULONG DiskNumbers[1]; -} VOLUME_FAILOVER_SET, *PVOLUME_FAILOVER_SET; +#if (NTDDI_VERSION >= NTDDI_VISTA) +// TODO: Missing definitions +#endif /* (NTDDI_VERSION >= NTDDI_VISTA) */ + + +#if (NTDDI_VERSION >= NTDDI_WIN8) + +#define IOCTL_VOLUME_POST_ONLINE \ + CTL_CODE(IOCTL_VOLUME_BASE, 25, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + +#endif /* (NTDDI_VERSION >= NTDDI_WIN8) */ + + +#ifdef _WINIOCTL_DEFINED_ +#undef _WINIOCTL_DEFINED_ +#endif #ifdef __cplusplus } diff --git a/sdk/include/psdk/winioctl.h b/sdk/include/psdk/winioctl.h index 33a64c3aaa4..8a86d9dd5bf 100644 --- a/sdk/include/psdk/winioctl.h +++ b/sdk/include/psdk/winioctl.h @@ -1,3 +1,29 @@ +/* + * winioctl.h + * + * 32-Bit Windows Device I/O control codes. + * Definitions extracted from various NT DDK headers. + * + * This file is part of the w32api package. + * + * Contributors: + * Created by Casper S. Hornstrup + * Amine Khaldi + * Pierre Schweitzer + * Hermès Bélusca-Maïto + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + #ifndef _WINIOCTL_ #define _WINIOCTL_ @@ -11,93 +37,6 @@ extern "C" { #pragma warning(disable:4820) #endif -#define HIST_NO_OF_BUCKETS 24 -#define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET) -#define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM) - -#ifndef _NTDDSTOR_H_ -#define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE -#define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS) -#define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif - -#define IOCTL_DISK_BASE FILE_DEVICE_DISK -#define IOCTL_DISK_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_DISK_BASE,0,METHOD_BUFFERED, FILE_ANY_ACCESS) -#define IOCTL_DISK_GET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,1,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_SET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,2,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) -#define IOCTL_DISK_GET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,3,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_SET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,4,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) -#define IOCTL_DISK_VERIFY CTL_CODE(IOCTL_DISK_BASE,5,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_FORMAT_TRACKS CTL_CODE(IOCTL_DISK_BASE,6,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) -#define IOCTL_DISK_REASSIGN_BLOCKS CTL_CODE(IOCTL_DISK_BASE,7,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) -#define IOCTL_DISK_PERFORMANCE CTL_CODE(IOCTL_DISK_BASE,8,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_IS_WRITABLE CTL_CODE(IOCTL_DISK_BASE,9,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_LOGGING CTL_CODE(IOCTL_DISK_BASE,10,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_FORMAT_TRACKS_EX CTL_CODE(IOCTL_DISK_BASE,11,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) -#define IOCTL_DISK_HISTOGRAM_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_HISTOGRAM_DATA CTL_CODE(IOCTL_DISK_BASE,13,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_HISTOGRAM_RESET CTL_CODE(IOCTL_DISK_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_REQUEST_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,15,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_REQUEST_DATA CTL_CODE(IOCTL_DISK_BASE,16,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x12,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_SET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x13,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x14,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x15,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_DISK_CREATE_DISK CTL_CODE(IOCTL_DISK_BASE,0x16,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE(IOCTL_DISK_BASE,0x17,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_PERFORMANCE_OFF CTL_CODE(IOCTL_DISK_BASE,0x18,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_DISK_BASE,0x28,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_GROW_PARTITION CTL_CODE(IOCTL_DISK_BASE,0x34,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x35,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x36,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_DISK_DELETE_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,0x40,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE,0x50,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE,0x200,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE,0x201,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x202,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x203,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_RESERVE CTL_CODE(IOCTL_DISK_BASE,0x204,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE,0x205,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE,0x206,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_REMOVE_DEVICE CTL_CODE(IOCTL_DISK_BASE,0x207,METHOD_BUFFERED,FILE_READ_ACCESS) -#define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE,0x300,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_DISK_UPDATE_DRIVE_SIZE CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) -#define IOCTL_SERIAL_LSRMST_INSERT CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define IOCTL_VOLUME_BASE ((DWORD)'V') -#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_MOUNT_DBLS_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA|FILE_WRITE_DATA) -#define FSCTL_READ_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17,METHOD_NEITHER,FILE_READ_DATA) -#define FSCTL_WRITE_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18,METHOD_NEITHER,FILE_WRITE_DATA) -#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,25,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM,26,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM,27,METHOD_NEITHER,FILE_ANY_ACCESS) -#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,28,METHOD_NEITHER,FILE_ANY_ACCESS) -#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,29,METHOD_BUFFERED,FILE_ANY_ACCESS) -#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) #ifndef _DEVIOCTL_ #define _DEVIOCTL_ @@ -206,6 +145,80 @@ extern "C" { #endif /* _DEVIOCTL_ */ +#ifndef _NTDDSTOR_H_ +// #define _NTDDSTOR_H_ + +#define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE +#define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS) +#define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS) + +typedef struct _PREVENT_MEDIA_REMOVAL { + BOOLEAN PreventMediaRemoval; +} PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL; + +#endif /* _NTDDSTOR_H_ */ + +#ifndef _NTDDDISK_H_ +// #define _NTDDDISK_H_ + +#define IOCTL_DISK_BASE FILE_DEVICE_DISK +#define IOCTL_DISK_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_DISK_BASE,0,METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_DISK_GET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,1,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_SET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,2,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) +#define IOCTL_DISK_GET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,3,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_SET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,4,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) +#define IOCTL_DISK_VERIFY CTL_CODE(IOCTL_DISK_BASE,5,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_FORMAT_TRACKS CTL_CODE(IOCTL_DISK_BASE,6,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) +#define IOCTL_DISK_REASSIGN_BLOCKS CTL_CODE(IOCTL_DISK_BASE,7,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) +#define IOCTL_DISK_PERFORMANCE CTL_CODE(IOCTL_DISK_BASE,8,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_IS_WRITABLE CTL_CODE(IOCTL_DISK_BASE,9,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_LOGGING CTL_CODE(IOCTL_DISK_BASE,10,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_FORMAT_TRACKS_EX CTL_CODE(IOCTL_DISK_BASE,11,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS) +#define IOCTL_DISK_HISTOGRAM_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_HISTOGRAM_DATA CTL_CODE(IOCTL_DISK_BASE,13,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_HISTOGRAM_RESET CTL_CODE(IOCTL_DISK_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_REQUEST_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,15,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_REQUEST_DATA CTL_CODE(IOCTL_DISK_BASE,16,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x12,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_SET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x13,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x14,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x15,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_CREATE_DISK CTL_CODE(IOCTL_DISK_BASE,0x16,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE(IOCTL_DISK_BASE,0x17,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_PERFORMANCE_OFF CTL_CODE(IOCTL_DISK_BASE,0x18,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_DISK_BASE,0x28,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_GROW_PARTITION CTL_CODE(IOCTL_DISK_BASE,0x34,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x35,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x36,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_DELETE_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,0x40,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE,0x50,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE,0x200,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE,0x201,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x202,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x203,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_RESERVE CTL_CODE(IOCTL_DISK_BASE,0x204,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE,0x205,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE,0x206,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_REMOVE_DEVICE CTL_CODE(IOCTL_DISK_BASE,0x207,METHOD_BUFFERED,FILE_READ_ACCESS) +#define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE,0x300,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_DISK_UPDATE_DRIVE_SIZE CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + + #define PARTITION_ENTRY_UNUSED 0 #define PARTITION_FAT_12 1 #define PARTITION_XENIX_1 2 @@ -224,48 +237,87 @@ extern "C" { #define PARTITION_NTFT 0x80 #define VALID_NTFT 0xC0 #ifdef __REACTOS__ -#define PARTITION_OLD_LINUX 0x43 -#define PARTITION_LINUX 0x83 -#define PARTITION_FREEBSD 0xA5 -#define PARTITION_OPENBSD 0xA6 -#define PARTITION_NETBSD 0xA9 +#define PARTITION_OLD_LINUX 0x43 +#define PARTITION_LINUX 0x83 +#define PARTITION_FREEBSD 0xA5 +#define PARTITION_OPENBSD 0xA6 +#define PARTITION_NETBSD 0xA9 #endif -#define SERIAL_LSRMST_ESCAPE 0 -#define SERIAL_LSRMST_LSR_DATA 1 -#define SERIAL_LSRMST_LSR_NODATA 2 -#define SERIAL_LSRMST_MST 3 -/* Device GUIDs */ -#ifdef DEFINE_GUID -DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86E0D1E0L, 0x8089, - 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73); -DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, - 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18); +#ifdef __REACTOS__ +#define IsRecognizedPartition(t)\ + (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))||\ + ((t)==PARTITION_FAT_12)||\ + ((t)==PARTITION_FAT_16)||\ + ((t)==PARTITION_HUGE)||\ + ((t)==PARTITION_IFS)||\ + ((t)==PARTITION_FAT32)||\ + ((t)==PARTITION_FAT32_XINT13)||\ + ((t)==PARTITION_XINT13)||\ + ((t)==PARTITION_LINUX)||\ + ((t)==PARTITION_OLD_LINUX)||\ + ((t)==PARTITION_FREEBSD)||\ + ((t)==PARTITION_OPENBSD)||\ + ((t)==PARTITION_NETBSD)) +#else +#define IsRecognizedPartition(t)\ + (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))||\ + ((t)==PARTITION_FAT_12)||\ + ((t)==PARTITION_FAT_16)||\ + ((t)==PARTITION_HUGE)||\ + ((t)==PARTITION_IFS)||\ + ((t)==PARTITION_FAT32)||\ + ((t)==PARTITION_FAT32_XINT13)||\ + ((t)==PARTITION_XINT13)) +#endif -/* obsolete GUID names */ -#define GUID_CLASS_COMPORT GUID_DEVINTERFACE_COMPORT -#define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR +#define IsContainerPartition(t)\ + (((t)==PARTITION_EXTENDED)||\ + ((t)==PARTITION_XINT13_EXTENDED)) + +#define IsFTPartition(t)\ + (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\ + ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))) -#endif /* DEFINE_GUID */ #define DISK_LOGGING_START 0 #define DISK_LOGGING_STOP 1 #define DISK_LOGGING_DUMP 2 #define DISK_BINNING 3 -typedef WORD BAD_TRACK_NUMBER,*PBAD_TRACK_NUMBER; -typedef enum _BIN_TYPES {RequestSize,RequestLocation} BIN_TYPES; +typedef WORD BAD_TRACK_NUMBER, *PBAD_TRACK_NUMBER; +typedef enum _BIN_TYPES { + RequestSize, + RequestLocation +} BIN_TYPES; typedef struct _BIN_RANGE { LARGE_INTEGER StartValue; LARGE_INTEGER Length; -} BIN_RANGE,*PBIN_RANGE; +} BIN_RANGE, *PBIN_RANGE; typedef struct _BIN_COUNT { BIN_RANGE BinRange; DWORD BinCount; -} BIN_COUNT,*PBIN_COUNT; +} BIN_COUNT, *PBIN_COUNT; typedef struct _BIN_RESULTS { DWORD NumberOfBins; BIN_COUNT BinCounts[1]; -} BIN_RESULTS,*PBIN_RESULTS; +} BIN_RESULTS, *PBIN_RESULTS; typedef enum _MEDIA_TYPE { Unknown, @@ -504,7 +556,7 @@ typedef struct _DISK_CACHE_INFORMATION { WORD Maximum; } BlockPrefetch; }; -} DISK_CACHE_INFORMATION,*PDISK_CACHE_INFORMATION; +} DISK_CACHE_INFORMATION, *PDISK_CACHE_INFORMATION; typedef struct _DISK_PERFORMANCE { LARGE_INTEGER BytesRead; @@ -528,24 +580,25 @@ typedef struct _DISK_RECORD { DWORD NumberOfBytes; BYTE DeviceNumber; BOOLEAN ReadRequest; -} DISK_RECORD,*PDISK_RECORD; +} DISK_RECORD, *PDISK_RECORD; typedef struct _DISK_LOGGING { BYTE Function; PVOID BufferAddress; DWORD BufferSize; -} DISK_LOGGING,*PDISK_LOGGING; +} DISK_LOGGING, *PDISK_LOGGING; typedef struct DiskQuotaUserInformation { LONGLONG QuotaUsed; LONGLONG QuotaThreshold; LONGLONG QuotaLimit; -} DISKQUOTA_USER_INFORMATION,*PDISKQUOTA_USER_INFORMATION; +} DISKQUOTA_USER_INFORMATION, *PDISKQUOTA_USER_INFORMATION; + typedef struct _FORMAT_PARAMETERS { MEDIA_TYPE MediaType; DWORD StartCylinderNumber; DWORD EndCylinderNumber; DWORD StartHeadNumber; DWORD EndHeadNumber; -} FORMAT_PARAMETERS,*PFORMAT_PARAMETERS; +} FORMAT_PARAMETERS, *PFORMAT_PARAMETERS; typedef struct _FORMAT_EX_PARAMETERS { MEDIA_TYPE MediaType; DWORD StartCylinderNumber; @@ -555,14 +608,20 @@ typedef struct _FORMAT_EX_PARAMETERS { WORD FormatGapLength; WORD SectorsPerTrack; WORD SectorNumber[1]; -} FORMAT_EX_PARAMETERS,*PFORMAT_EX_PARAMETERS; -typedef struct { +} FORMAT_EX_PARAMETERS, *PFORMAT_EX_PARAMETERS; + +typedef struct _GET_LENGTH_INFORMATION { LARGE_INTEGER Length; -} GET_LENGTH_INFORMATION; +} GET_LENGTH_INFORMATION, *PGET_LENGTH_INFORMATION; + +#define HIST_NO_OF_BUCKETS 24 +#define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET) +#define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM) + typedef struct _HISTOGRAM_BUCKET { DWORD Reads; DWORD Writes; -} HISTOGRAM_BUCKET,*PHISTOGRAM_BUCKET; +} HISTOGRAM_BUCKET, *PHISTOGRAM_BUCKET; typedef struct _DISK_HISTOGRAM { LARGE_INTEGER DiskSize; LARGE_INTEGER Start; @@ -575,34 +634,139 @@ typedef struct _DISK_HISTOGRAM { DWORD ReadCount; DWORD WriteCount; PHISTOGRAM_BUCKET Histogram; -} DISK_HISTOGRAM,*PDISK_HISTOGRAM; +} DISK_HISTOGRAM, *PDISK_HISTOGRAM; + +typedef struct _PERF_BIN { + DWORD NumberOfBins; + DWORD TypeOfBin; + BIN_RANGE BinsRanges[1]; +} PERF_BIN, *PPERF_BIN; + +typedef struct _VERIFY_INFORMATION { + LARGE_INTEGER StartingOffset; + DWORD Length; +} VERIFY_INFORMATION, *PVERIFY_INFORMATION; + +typedef struct _REASSIGN_BLOCKS { + WORD Reserved; + WORD Count; + DWORD BlockNumber[1]; +} REASSIGN_BLOCKS, *PREASSIGN_BLOCKS; + +#endif /* _NTDDDISK_H_ */ + +// #ifndef _NTDDSER_ +// #define _NTDDSER_ + +/* Device GUIDs */ +#ifdef DEFINE_GUID + +DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86E0D1E0L, 0x8089, + 0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73); +DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325, + 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18); + +/* obsolete GUID names */ +#define GUID_CLASS_COMPORT GUID_DEVINTERFACE_COMPORT +#define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR + +#endif /* DEFINE_GUID */ + +#define IOCTL_SERIAL_LSRMST_INSERT CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS) + +#define SERIAL_LSRMST_ESCAPE 0 +#define SERIAL_LSRMST_LSR_DATA 1 +#define SERIAL_LSRMST_LSR_NODATA 2 +#define SERIAL_LSRMST_MST 3 + +// #endif /* _NTDDSER_ */ + +// #ifndef _NTDDVOL_ +// #define _NTDDVOL_ + +#define IOCTL_VOLUME_BASE ((DWORD)'V') + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS) + typedef struct _DISK_EXTENT { DWORD DiskNumber; LARGE_INTEGER StartingOffset; LARGE_INTEGER ExtentLength; -} DISK_EXTENT,*PDISK_EXTENT; +} DISK_EXTENT, *PDISK_EXTENT; typedef struct _VOLUME_DISK_EXTENTS { DWORD NumberOfDiskExtents; DISK_EXTENT Extents[1]; -} VOLUME_DISK_EXTENTS,*PVOLUME_DISK_EXTENTS; +} VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS; + +#define IOCTL_VOLUME_ONLINE CTL_CODE(IOCTL_VOLUME_BASE, 2, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_VOLUME_OFFLINE CTL_CODE(IOCTL_VOLUME_BASE, 3, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */ + +#if (NTDDI_VERSION >= NTDDI_WINXP) +#define IOCTL_VOLUME_IS_CLUSTERED \ + CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_VOLUME_GET_GPT_ATTRIBUTES \ + CTL_CODE(IOCTL_VOLUME_BASE, 14, METHOD_BUFFERED, FILE_ANY_ACCESS) + +typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION { + DWORDLONG GptAttributes; +} VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION; +#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */ + +// #endif /* _NTDDVOL_ */ + +#ifndef _FILESYSTEMFSCTL_ +#define _FILESYSTEMFSCTL_ + +#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_MOUNT_DBLS_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA|FILE_WRITE_DATA) +#define FSCTL_READ_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17,METHOD_NEITHER,FILE_READ_DATA) +#define FSCTL_WRITE_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18,METHOD_NEITHER,FILE_WRITE_DATA) +#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,25,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM,26,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM,27,METHOD_NEITHER,FILE_ANY_ACCESS) +#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,28,METHOD_NEITHER,FILE_ANY_ACCESS) +#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,29,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS) + +#define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#if (_WIN32_WINNT >= _WIN32_WINNT_NT4) +#define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) +#define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) +#endif + +#if (_WIN32_WINNT >= _WIN32_WINNT_WINBLUE) +#define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_DATA) +#endif + +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K) +#define VOLUME_IS_DIRTY (0x00000001) +#define VOLUME_UPGRADE_SCHEDULED (0x00000002) +#define VOLUME_SESSION_OPEN (0x00000004) +#endif + + typedef struct { HANDLE FileHandle; LARGE_INTEGER StartingVcn; LARGE_INTEGER StartingLcn; DWORD ClusterCount; -} MOVE_FILE_DATA,*PMOVE_FILE_DATA; -typedef struct _PERF_BIN { - DWORD NumberOfBins; - DWORD TypeOfBin; - BIN_RANGE BinsRanges[1]; -} PERF_BIN,*PPERF_BIN; - -#ifndef _NTDDSTOR_H_ -typedef struct _PREVENT_MEDIA_REMOVAL { - BOOLEAN PreventMediaRemoval; -} PREVENT_MEDIA_REMOVAL,*PPREVENT_MEDIA_REMOVAL; -#endif - +} MOVE_FILE_DATA, *PMOVE_FILE_DATA; typedef struct RETRIEVAL_POINTERS_BUFFER { DWORD ExtentCount; LARGE_INTEGER StartingVcn; @@ -610,27 +774,18 @@ typedef struct RETRIEVAL_POINTERS_BUFFER { LARGE_INTEGER NextVcn; LARGE_INTEGER Lcn; } Extents[1]; -} RETRIEVAL_POINTERS_BUFFER,*PRETRIEVAL_POINTERS_BUFFER; -typedef struct _REASSIGN_BLOCKS { - WORD Reserved; - WORD Count; - DWORD BlockNumber[1]; -} REASSIGN_BLOCKS,*PREASSIGN_BLOCKS; +} RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER; typedef struct { LARGE_INTEGER StartingLcn; -} STARTING_LCN_INPUT_BUFFER,*PSTARTING_LCN_INPUT_BUFFER; +} STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER; typedef struct { LARGE_INTEGER StartingVcn; -} STARTING_VCN_INPUT_BUFFER,*PSTARTING_VCN_INPUT_BUFFER; -typedef struct _VERIFY_INFORMATION { - LARGE_INTEGER StartingOffset; - DWORD Length; -} VERIFY_INFORMATION,*PVERIFY_INFORMATION; +} STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER; typedef struct { LARGE_INTEGER StartingLcn; LARGE_INTEGER BitmapSize; BYTE Buffer[1]; -} VOLUME_BITMAP_BUFFER,*PVOLUME_BITMAP_BUFFER; +} VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER; typedef struct { LARGE_INTEGER VolumeSerialNumber; LARGE_INTEGER NumberSectors; @@ -661,73 +816,6 @@ typedef struct { UCHAR FileRecordBuffer[1]; } NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER; -#ifdef __REACTOS__ -#define IsRecognizedPartition(t)\ - (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))||\ - ((t)==PARTITION_FAT_12)||\ - ((t)==PARTITION_FAT_16)||\ - ((t)==PARTITION_IFS)||\ - ((t)==PARTITION_HUGE)||\ - ((t)==PARTITION_FAT32)||\ - ((t)==PARTITION_FAT32_XINT13)||\ - ((t)==PARTITION_XINT13)||\ - ((t)==PARTITION_LINUX)||\ - ((t)==PARTITION_OLD_LINUX)||\ - ((t)==PARTITION_FREEBSD)||\ - ((t)==PARTITION_OPENBSD)||\ - ((t)==PARTITION_NETBSD)) -#else -#define IsRecognizedPartition(t)\ - (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))||\ - ((t)==PARTITION_FAT_12)||\ - ((t)==PARTITION_FAT_16)||\ - ((t)==PARTITION_IFS)||\ - ((t)==PARTITION_HUGE)||\ - ((t)==PARTITION_FAT32)||\ - ((t)==PARTITION_FAT32_XINT13)||\ - ((t)==PARTITION_XINT13)) -#endif -#define IsContainerPartition(t)\ - (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_EXTENDED))||\ - ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13_EXTENDED))||\ - ((t)==PARTITION_EXTENDED)||\ - ((t)==PARTITION_XINT13_EXTENDED)) - -#ifndef _FILESYSTEMFSCTL_ -#define _FILESYSTEMFSCTL_ - -#define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS) -#if (_WIN32_WINNT >= _WIN32_WINNT_NT4) -#define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS) -#endif - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) -#define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA) -#endif - -#if (_WIN32_WINNT >= _WIN32_WINNT_WINBLUE) -#define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_DATA) -#endif - -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K) -#define VOLUME_IS_DIRTY (0x00000001) -#define VOLUME_UPGRADE_SCHEDULED (0x00000002) -#define VOLUME_SESSION_OPEN (0x00000004) -#endif typedef struct _FILESYSTEM_STATISTICS { USHORT FileSystemType; @@ -876,10 +964,10 @@ typedef struct _DUPLICATE_EXTENTS_DATA { LARGE_INTEGER TargetFileOffset; LARGE_INTEGER ByteCount; } DUPLICATE_EXTENTS_DATA, *PDUPLICATE_EXTENTS_DATA; - #endif -#endif +#endif /* _FILESYSTEMFSCTL_ */ + #ifdef _MSC_VER #pragma warning(pop)