ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2020
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
131 discussions
Start a n
N
ew thread
[reactos] 01/01: [FSTUB] Fix out of bounds access in IoReadDiskSignature
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8d2fe54188616fa586946…
commit 8d2fe54188616fa5869468ecf108bf4af9a8624f Author: Victor Perevertkin <victor.perevertkin(a)reactos.org> AuthorDate: Mon Dec 7 14:43:34 2020 +0300 Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org> CommitDate: Mon Dec 7 14:43:34 2020 +0300 [FSTUB] Fix out of bounds access in IoReadDiskSignature - Convert PARTITION_TABLE_OFFSET to the number of bytes instead of (number of bytes) / 2. This avoids many confusing casts - Use a cache aligned buffer for MBR --- ntoskrnl/fstub/disksup.c | 31 ++++++++++++------------------- ntoskrnl/fstub/fstubex.c | 12 ++++++------ ntoskrnl/include/internal/hal.h | 7 ++++--- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/ntoskrnl/fstub/disksup.c b/ntoskrnl/fstub/disksup.c index 71d51873f94..a685393b143 100644 --- a/ntoskrnl/fstub/disksup.c +++ b/ntoskrnl/fstub/disksup.c @@ -1712,8 +1712,7 @@ xHalExamineMBR(IN PDEVICE_OBJECT DeviceObject, } /* Get the partition entry */ - PartitionDescriptor = (PPARTITION_DESCRIPTOR) - &(((PUSHORT)Buffer)[PARTITION_TABLE_OFFSET]); + PartitionDescriptor = (PPARTITION_DESCRIPTOR)&Buffer[PARTITION_TABLE_OFFSET]; /* Make sure it's what the caller wanted */ if (PartitionDescriptor->PartitionType != MbrTypeIdentifier) @@ -1831,7 +1830,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, DiskGeometryEx.DiskSize, MaxSector); /* Allocate our buffer */ - Buffer = ExAllocatePoolWithTag(NonPagedPool, InputSize, TAG_FILE_SYSTEM); + Buffer = ExAllocatePoolWithTag(NonPagedPoolCacheAligned, InputSize, TAG_FILE_SYSTEM); if (!Buffer) { /* Fail, free the input buffer */ @@ -1901,12 +1900,11 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, if (!Offset.QuadPart) { /* Then read the signature off the disk */ - (*PartitionBuffer)->Signature = ((PULONG)Buffer)[PARTITION_TABLE_OFFSET / 2 - 1]; + (*PartitionBuffer)->Signature = *(PUINT32)&Buffer[DISK_SIGNATURE_OFFSET]; } /* Get the partition descriptor array */ - PartitionDescriptor = (PPARTITION_DESCRIPTOR) - &(((PUSHORT)Buffer)[PARTITION_TABLE_OFFSET]); + PartitionDescriptor = (PPARTITION_DESCRIPTOR)&Buffer[PARTITION_TABLE_OFFSET]; /* Start looping partitions */ j++; @@ -2091,8 +2089,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, Offset.QuadPart = 0; /* Go back to the descriptor array and loop it */ - PartitionDescriptor = (PPARTITION_DESCRIPTOR) - &(((PUSHORT)Buffer)[PARTITION_TABLE_OFFSET]); + PartitionDescriptor = (PPARTITION_DESCRIPTOR)&Buffer[PARTITION_TABLE_OFFSET]; for (Entry = 1; Entry <= NUM_PARTITION_TABLE_ENTRIES; Entry++, PartitionDescriptor++) { /* Check if this is a container partition, since we skipped them */ @@ -2237,7 +2234,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, } /* Allocate our partition buffer */ - Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, TAG_FILE_SYSTEM); + Buffer = ExAllocatePoolWithTag(NonPagedPoolCacheAligned, PAGE_SIZE, TAG_FILE_SYSTEM); if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES; /* Initialize the event we'll use and loop partitions */ @@ -2290,8 +2287,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, } /* Get the partition descriptors and loop them */ - PartitionDescriptor = (PPARTITION_DESCRIPTOR) - &(((PUSHORT)Buffer)[PARTITION_TABLE_OFFSET]); + PartitionDescriptor = (PPARTITION_DESCRIPTOR)&Buffer[PARTITION_TABLE_OFFSET]; for (Entry = 1; Entry <= NUM_PARTITION_TABLE_ENTRIES; Entry++, PartitionDescriptor++) { /* Check if it's unused or a container partition */ @@ -2352,8 +2348,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, if (Entry <= NUM_PARTITION_TABLE_ENTRIES) break; /* Nothing found yet, get the partition array again */ - PartitionDescriptor = (PPARTITION_DESCRIPTOR) - &(((PUSHORT)Buffer)[PARTITION_TABLE_OFFSET]); + PartitionDescriptor = (PPARTITION_DESCRIPTOR)&Buffer[PARTITION_TABLE_OFFSET]; for (Entry = 1; Entry <= NUM_PARTITION_TABLE_ENTRIES; Entry++, PartitionDescriptor++) { /* Check if this was a container partition (we skipped these) */ @@ -2469,7 +2464,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, DiskLayout->TableCount = (PartitionBuffer->PartitionCount + NUM_PARTITION_TABLE_ENTRIES - 1) / NUM_PARTITION_TABLE_ENTRIES; /* Allocate our partition buffer */ - Buffer = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, TAG_FILE_SYSTEM); + Buffer = ExAllocatePoolWithTag(NonPagedPoolCacheAligned, PAGE_SIZE, TAG_FILE_SYSTEM); if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES; /* Loop the entries */ @@ -2520,7 +2515,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, if (!IsSuperFloppy) { /* Set the boot record signature */ - Buffer[BOOT_SIGNATURE_OFFSET] = BOOT_RECORD_SIGNATURE; + ((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] = BOOT_RECORD_SIGNATURE; /* By default, don't require a rewrite */ DoRewrite = FALSE; @@ -2529,12 +2524,10 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, if (!Offset.QuadPart) { /* Check if the signature doesn't match */ - if (((PULONG)Buffer)[PARTITION_TABLE_OFFSET / 2 - 1] != - PartitionBuffer->Signature) + if (*(PUINT32)&Buffer[PARTITION_TABLE_OFFSET] != PartitionBuffer->Signature) { /* Then write the signature and now we need a rewrite */ - ((PULONG)Buffer)[PARTITION_TABLE_OFFSET / 2 - 1] = - PartitionBuffer->Signature; + *(PUINT32)&Buffer[PARTITION_TABLE_OFFSET] = PartitionBuffer->Signature; DoRewrite = TRUE; } } diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c index c1ef4cdd47c..5e3a819ae7c 100644 --- a/ntoskrnl/fstub/fstubex.c +++ b/ntoskrnl/fstub/fstubex.c @@ -674,7 +674,7 @@ FstubDetectPartitionStyle(IN PDISK_INFORMATION Disk, /* Get the partition descriptor array */ PartitionDescriptor = (PPARTITION_DESCRIPTOR) - &(Disk->Buffer[PARTITION_TABLE_OFFSET]); + &(Disk->Buffer[PARTITION_TABLE_OFFSET / sizeof(Disk->Buffer[0])]); /* If we have not the 0xAA55 then it's raw partition */ if (Disk->Buffer[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE) { @@ -2140,7 +2140,7 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject, IN ULONG BytesPerSector, OUT PDISK_SIGNATURE Signature) { - PULONG Buffer; + PUCHAR Buffer; NTSTATUS Status; ULONG HeaderCRC32, i, CheckSum; PEFI_PARTITION_HEADER EFIHeader; @@ -2207,7 +2207,7 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject, /* Then zero the one in EFI header. This is needed to compute header checksum */ EFIHeader->HeaderCRC32 = 0; /* Compute header checksum and compare with the one present in partition table */ - if (RtlComputeCrc32(0, (PUCHAR)Buffer, sizeof(EFI_PARTITION_HEADER)) != HeaderCRC32) + if (RtlComputeCrc32(0, Buffer, sizeof(EFI_PARTITION_HEADER)) != HeaderCRC32) { Status = STATUS_DISK_CORRUPT_ERROR; goto Cleanup; @@ -2220,14 +2220,14 @@ IoReadDiskSignature(IN PDEVICE_OBJECT DeviceObject, else { /* Compute MBR checksum */ - for (i = 0, CheckSum = 0; i < 512 / sizeof(ULONG) ; i++) + for (i = 0, CheckSum = 0; i < BytesPerSector / sizeof(UINT32); i++) { - CheckSum += Buffer[i]; + CheckSum += *(PUINT32)&Buffer[i]; } /* Set partition table style to MBR and return signature (offset 440) and checksum */ Signature->PartitionStyle = PARTITION_STYLE_MBR; - Signature->Mbr.Signature = Buffer[PARTITION_TABLE_OFFSET / 2 - 1]; + Signature->Mbr.Signature = *(PUINT32)&Buffer[DISK_SIGNATURE_OFFSET]; Signature->Mbr.CheckSum = CheckSum; } diff --git a/ntoskrnl/include/internal/hal.h b/ntoskrnl/include/internal/hal.h index 1e61d138eac..b02b7575a60 100644 --- a/ntoskrnl/include/internal/hal.h +++ b/ntoskrnl/include/internal/hal.h @@ -240,9 +240,10 @@ xKdUnmapVirtualAddress( // // Various offsets in the boot record // -#define PARTITION_TABLE_OFFSET (0x1BE / 2) -#define BOOT_SIGNATURE_OFFSET ((0x200 / 2) - 1) -#define BOOT_RECORD_RESERVED 0x1BC +#define DISK_SIGNATURE_OFFSET 0x1B8 +#define PARTITION_TABLE_OFFSET 0x1BE +#define BOOT_SIGNATURE_OFFSET ((0x200 / sizeof(INT16)) - 1) + #define BOOT_RECORD_SIGNATURE 0xAA55 #define NUM_PARTITION_TABLE_ENTRIES 4
4 years
1
0
0
0
[reactos] 01/01: [CMAKE] Add a NO_REACTOS_BUILDNO option
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d4ece342c418eb85cb71…
commit 5d4ece342c418eb85cb718d4b77e7bec15eb7611 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Mon Nov 30 14:43:26 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Mon Dec 7 11:32:37 2020 +0100 [CMAKE] Add a NO_REACTOS_BUILDNO option This allows to not generate buildno.h and version.h after each commit and trigger the relinking of the complete module list --- sdk/include/reactos/version.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sdk/include/reactos/version.cmake b/sdk/include/reactos/version.cmake index 0ca632f2b7c..4566a6a0ef7 100644 --- a/sdk/include/reactos/version.cmake +++ b/sdk/include/reactos/version.cmake @@ -1,4 +1,10 @@ -string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC) +option(NO_REACTOS_BUILDNO "If true, disables the generation of buildno.h and version.h for each configure" OFF) + +if (NOT NO_REACTOS_BUILDNO) + string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC) +else() + set(KERNEL_VERSION_BUILD "custom") +endif() set(KERNEL_VERSION_MAJOR "0") set(KERNEL_VERSION_MINOR "4") @@ -24,7 +30,7 @@ endif() set(COMMIT_HASH "unknown-hash") set(REVISION "unknown-revision") -if(EXISTS "${REACTOS_SOURCE_DIR}/.git") +if((EXISTS "${REACTOS_SOURCE_DIR}/.git") AND (NOT NO_REACTOS_BUILDNO)) find_package(Git) if(GIT_FOUND) execute_process(
4 years
1
0
0
0
[reactos] 01/01: [PSDK] Re-arrange DISK/DRIVE/PARTITION layout-related structures in ntdddisk.h and winioctl.h. Add few missing structures in winioctl.h.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7ae3d530dbd5ec7f5adff…
commit 7ae3d530dbd5ec7f5adffdd14da6863c95f0af2c Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sun Dec 6 23:42:58 2020 +0100 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Dec 6 23:44:10 2020 +0100 [PSDK] Re-arrange DISK/DRIVE/PARTITION layout-related structures in ntdddisk.h and winioctl.h. Add few missing structures in winioctl.h. --- sdk/include/psdk/ntdddisk.h | 226 ++++++++++++++++---------------- sdk/include/psdk/winioctl.h | 309 +++++++++++++++++++++++++------------------- 2 files changed, 295 insertions(+), 240 deletions(-) diff --git a/sdk/include/psdk/ntdddisk.h b/sdk/include/psdk/ntdddisk.h index 3fe648c4cc3..b1b22d53f40 100644 --- a/sdk/include/psdk/ntdddisk.h +++ b/sdk/include/psdk/ntdddisk.h @@ -355,7 +355,10 @@ extern "C" { ((PartitionType) == PARTITION_XINT13)) #endif -#if(_WIN32_WINNT >= 0x0500) +#if (_WIN32_WINNT >= 0x0500) +/* Actually it should be > 0x0500, since this is not present in Windows 2000; + * however we keep >= 0x0500 for compatibility with MS PSDK. */ + #define GPT_ATTRIBUTE_PLATFORM_REQUIRED 0x00000001 #define GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY 0x10000000 #define GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY 0x20000000 @@ -398,6 +401,69 @@ typedef enum _MEDIA_TYPE { F3_32M_512 } MEDIA_TYPE, *PMEDIA_TYPE; +typedef struct _DISK_GEOMETRY { + LARGE_INTEGER Cylinders; + MEDIA_TYPE MediaType; + ULONG TracksPerCylinder; + ULONG SectorsPerTrack; + ULONG BytesPerSector; +} DISK_GEOMETRY, *PDISK_GEOMETRY; + +typedef struct _PARTITION_INFORMATION { + LARGE_INTEGER StartingOffset; + LARGE_INTEGER PartitionLength; + ULONG HiddenSectors; + ULONG PartitionNumber; + UCHAR PartitionType; + BOOLEAN BootIndicator; + BOOLEAN RecognizedPartition; + BOOLEAN RewritePartition; +} PARTITION_INFORMATION, *PPARTITION_INFORMATION; + +typedef struct _DRIVE_LAYOUT_INFORMATION { + ULONG PartitionCount; + ULONG Signature; + PARTITION_INFORMATION PartitionEntry[1]; +} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION; + +typedef struct _SET_PARTITION_INFORMATION { + UCHAR PartitionType; +} SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION; + +#if (_WIN32_WINNT >= 0x0500) +/* Actually it should be > 0x0500, since this is not present in Windows 2000; + * however we keep >= 0x0500 for compatibility with MS PSDK. */ + +typedef enum _PARTITION_STYLE { + PARTITION_STYLE_MBR, + PARTITION_STYLE_GPT, + PARTITION_STYLE_RAW, +#ifdef __REACTOS__ + /* ReactOS custom partition handlers */ + PARTITION_STYLE_BRFR = 128 /* Xbox-BRFR partitioning scheme */ +#endif +} PARTITION_STYLE; + +typedef struct _CREATE_DISK_GPT +{ + GUID DiskId; + ULONG MaxPartitionCount; +} CREATE_DISK_GPT, *PCREATE_DISK_GPT; + +typedef struct _CREATE_DISK_MBR +{ + ULONG Signature; +} CREATE_DISK_MBR, *PCREATE_DISK_MBR; + +typedef struct _CREATE_DISK +{ + PARTITION_STYLE PartitionStyle; + union { + CREATE_DISK_MBR Mbr; + CREATE_DISK_GPT Gpt; + }; +} CREATE_DISK, *PCREATE_DISK; + typedef enum _DETECTION_TYPE { DetectNone, DetectInt13, @@ -434,13 +500,19 @@ typedef struct _DISK_DETECTION_INFO { } DUMMYUNIONNAME; } DISK_DETECTION_INFO, *PDISK_DETECTION_INFO; -typedef struct _DISK_GEOMETRY { - LARGE_INTEGER Cylinders; - MEDIA_TYPE MediaType; - ULONG TracksPerCylinder; - ULONG SectorsPerTrack; - ULONG BytesPerSector; -} DISK_GEOMETRY, *PDISK_GEOMETRY; +typedef struct _DISK_PARTITION_INFO { + ULONG SizeOfPartitionInfo; + PARTITION_STYLE PartitionStyle; + _ANONYMOUS_UNION union { + struct { + ULONG Signature; + ULONG CheckSum; + } Mbr; + struct { + GUID DiskId; + } Gpt; + } DUMMYUNIONNAME; +} DISK_PARTITION_INFO, *PDISK_PARTITION_INFO; typedef struct _DISK_GEOMETRY_EX { DISK_GEOMETRY Geometry; @@ -464,17 +536,6 @@ typedef struct _DISK_GEOMETRY_EX { DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) #endif -typedef struct _PARTITION_INFORMATION { - LARGE_INTEGER StartingOffset; - LARGE_INTEGER PartitionLength; - ULONG HiddenSectors; - ULONG PartitionNumber; - UCHAR PartitionType; - BOOLEAN BootIndicator; - BOOLEAN RecognizedPartition; - BOOLEAN RewritePartition; -} PARTITION_INFORMATION, *PPARTITION_INFORMATION; - typedef struct _PARTITION_INFORMATION_GPT { GUID PartitionType; GUID PartitionId; @@ -482,45 +543,6 @@ typedef struct _PARTITION_INFORMATION_GPT { WCHAR Name [36]; } PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT; -typedef enum _PARTITION_STYLE { - PARTITION_STYLE_MBR, - PARTITION_STYLE_GPT, - PARTITION_STYLE_RAW, -#ifdef __REACTOS__ - /* ReactOS custom partition handlers */ - PARTITION_STYLE_BRFR = 128 /* Xbox-BRFR partitioning scheme */ -#endif -} PARTITION_STYLE; - -typedef struct _DISK_PARTITION_INFO { - ULONG SizeOfPartitionInfo; - PARTITION_STYLE PartitionStyle; - _ANONYMOUS_UNION union { - struct { - ULONG Signature; - ULONG CheckSum; - } Mbr; - struct { - GUID DiskId; - } Gpt; - } DUMMYUNIONNAME; -} DISK_PARTITION_INFO, *PDISK_PARTITION_INFO; - -typedef struct _DISK_PERFORMANCE { - LARGE_INTEGER BytesRead; - LARGE_INTEGER BytesWritten; - LARGE_INTEGER ReadTime; - LARGE_INTEGER WriteTime; - LARGE_INTEGER IdleTime; - ULONG ReadCount; - ULONG WriteCount; - ULONG QueueDepth; - ULONG SplitCount; - LARGE_INTEGER QueryTime; - ULONG StorageDeviceNumber; - WCHAR StorageManagerName[8]; -} DISK_PERFORMANCE, *PDISK_PERFORMANCE; - typedef struct _PARTITION_INFORMATION_MBR { UCHAR PartitionType; BOOLEAN BootIndicator; @@ -543,19 +565,6 @@ typedef struct _PARTITION_INFORMATION_EX { } DUMMYUNIONNAME; } PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX; -typedef struct _DRIVE_LAYOUT_INFORMATION { - ULONG PartitionCount; - ULONG Signature; - PARTITION_INFORMATION PartitionEntry[1]; -} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION; - -typedef struct _DRIVE_LAYOUT_INFORMATION_MBR { - ULONG Signature; -#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) - ULONG CheckSum; -#endif -} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR; - typedef struct _DRIVE_LAYOUT_INFORMATION_GPT { GUID DiskId; LARGE_INTEGER StartingUsableOffset; @@ -563,6 +572,13 @@ typedef struct _DRIVE_LAYOUT_INFORMATION_GPT { ULONG MaxPartitionCount; } DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT; +typedef struct _DRIVE_LAYOUT_INFORMATION_MBR { + ULONG Signature; +#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) + ULONG CheckSum; +#endif +} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR; + typedef struct _DRIVE_LAYOUT_INFORMATION_EX { ULONG PartitionStyle; ULONG PartitionCount; @@ -573,6 +589,34 @@ typedef struct _DRIVE_LAYOUT_INFORMATION_EX { PARTITION_INFORMATION_EX PartitionEntry[1]; } DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX; +typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR; +typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT; + +typedef struct _SET_PARTITION_INFORMATION_EX { + PARTITION_STYLE PartitionStyle; + _ANONYMOUS_UNION union { + SET_PARTITION_INFORMATION_MBR Mbr; + SET_PARTITION_INFORMATION_GPT Gpt; + } DUMMYUNIONNAME; +} SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX; + +#endif // (_WIN32_WINNT >= 0x0500) + +typedef struct _DISK_PERFORMANCE { + LARGE_INTEGER BytesRead; + LARGE_INTEGER BytesWritten; + LARGE_INTEGER ReadTime; + LARGE_INTEGER WriteTime; + LARGE_INTEGER IdleTime; + ULONG ReadCount; + ULONG WriteCount; + ULONG QueueDepth; + ULONG SplitCount; + LARGE_INTEGER QueryTime; + ULONG StorageDeviceNumber; + WCHAR StorageManagerName[8]; +} DISK_PERFORMANCE, *PDISK_PERFORMANCE; + typedef struct _FORMAT_EX_PARAMETERS { MEDIA_TYPE MediaType; ULONG StartCylinderNumber; @@ -608,21 +652,6 @@ typedef struct _REASSIGN_BLOCKS_EX { LARGE_INTEGER BlockNumber[1]; } REASSIGN_BLOCKS_EX, *PREASSIGN_BLOCKS_EX; -typedef struct _SET_PARTITION_INFORMATION { - UCHAR PartitionType; -} SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION; - -typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR; -typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT; - -typedef struct _SET_PARTITION_INFORMATION_EX { - PARTITION_STYLE PartitionStyle; - _ANONYMOUS_UNION union { - SET_PARTITION_INFORMATION_MBR Mbr; - SET_PARTITION_INFORMATION_GPT Gpt; - } DUMMYUNIONNAME; -} SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX; - typedef struct _VERIFY_INFORMATION { LARGE_INTEGER StartingOffset; ULONG Length; @@ -733,30 +762,7 @@ typedef struct _MAPPED_ADDRESS { } MAPPED_ADDRESS, *PMAPPED_ADDRESS; - -#if(_WIN32_WINNT >= 0x0500) - -typedef struct _CREATE_DISK_GPT -{ - GUID DiskId; - ULONG MaxPartitionCount; -} CREATE_DISK_GPT, *PCREATE_DISK_GPT; - -typedef struct _CREATE_DISK_MBR -{ - ULONG Signature; -} CREATE_DISK_MBR, *PCREATE_DISK_MBR; - - -typedef struct _CREATE_DISK -{ - PARTITION_STYLE PartitionStyle; - union { - CREATE_DISK_MBR Mbr; - CREATE_DISK_GPT Gpt; - }; -} CREATE_DISK, *PCREATE_DISK; - +#if (_WIN32_WINNT >= 0x0500) typedef enum { EqualPriority, diff --git a/sdk/include/psdk/winioctl.h b/sdk/include/psdk/winioctl.h index 0ba8f1be885..f10c4b41678 100644 --- a/sdk/include/psdk/winioctl.h +++ b/sdk/include/psdk/winioctl.h @@ -237,50 +237,87 @@ typedef struct _BIN_RESULTS { DWORD NumberOfBins; BIN_COUNT BinCounts[1]; } BIN_RESULTS,*PBIN_RESULTS; + +typedef enum _MEDIA_TYPE { + Unknown, + F5_1Pt2_512, + F3_1Pt44_512, + F3_2Pt88_512, + F3_20Pt8_512, + F3_720_512, + F5_360_512, + F5_320_512, + F5_320_1024, + F5_180_512, + F5_160_512, + RemovableMedia, + FixedMedia, + F3_120M_512, + F3_640_512, + F5_640_512, + F5_720_512, + F3_1Pt2_512, + F3_1Pt23_1024, + F5_1Pt23_1024, + F3_128Mb_512, + F3_230Mb_512, + F8_256_128, + F3_200Mb_512, + F3_240M_512, + F3_32M_512 +} MEDIA_TYPE,*PMEDIA_TYPE; + +typedef struct _DISK_GEOMETRY { + LARGE_INTEGER Cylinders; + MEDIA_TYPE MediaType; + DWORD TracksPerCylinder; + DWORD SectorsPerTrack; + DWORD BytesPerSector; +} DISK_GEOMETRY,*PDISK_GEOMETRY; +typedef struct _PARTITION_INFORMATION { + LARGE_INTEGER StartingOffset; + LARGE_INTEGER PartitionLength; + DWORD HiddenSectors; + DWORD PartitionNumber; + BYTE PartitionType; + BOOLEAN BootIndicator; + BOOLEAN RecognizedPartition; + BOOLEAN RewritePartition; +} PARTITION_INFORMATION,*PPARTITION_INFORMATION; +typedef struct _DRIVE_LAYOUT_INFORMATION { + DWORD PartitionCount; + DWORD Signature; + PARTITION_INFORMATION PartitionEntry[1]; +} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION; +typedef struct _SET_PARTITION_INFORMATION { + BYTE PartitionType; +} SET_PARTITION_INFORMATION,*PSET_PARTITION_INFORMATION; + +#if (_WIN32_WINNT >= 0x0500) +/* Actually it should be > 0x0500, since this is not present in Windows 2000; + * however we keep >= 0x0500 for compatibility with MS PSDK. */ + typedef enum _PARTITION_STYLE { PARTITION_STYLE_MBR, PARTITION_STYLE_GPT, PARTITION_STYLE_RAW } PARTITION_STYLE; -typedef struct { + +typedef struct _CREATE_DISK_GPT { GUID DiskId; DWORD MaxPartitionCount; } CREATE_DISK_GPT,*PCREATE_DISK_GPT; -typedef struct { +typedef struct _CREATE_DISK_MBR { DWORD Signature; } CREATE_DISK_MBR,*PCREATE_DISK_MBR; -typedef struct { +typedef struct _CREATE_DISK { PARTITION_STYLE PartitionStyle; _ANONYMOUS_UNION union { CREATE_DISK_MBR Mbr; CREATE_DISK_GPT Gpt; }; } CREATE_DISK,*PCREATE_DISK; -typedef enum { - EqualPriority, - KeepPrefetchedData, - KeepReadData -} DISK_CACHE_RETENTION_PRIORITY; -typedef struct _DISK_CACHE_INFORMATION { - BOOLEAN ParametersSavable; - BOOLEAN ReadCacheEnabled; - BOOLEAN WriteCacheEnabled; - DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority; - DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority; - WORD DisablePrefetchTransferLength; - BOOLEAN PrefetchScalar; - _ANONYMOUS_UNION union { - struct { - WORD Minimum; - WORD Maximum; - WORD MaximumBlocks; - } ScalarPrefetch; - struct { - WORD Minimum; - WORD Maximum; - } BlockPrefetch; - }; -} DISK_CACHE_INFORMATION,*PDISK_CACHE_INFORMATION; + typedef enum _DETECTION_TYPE { DetectNone, DetectInt13, @@ -313,62 +350,133 @@ typedef struct _DISK_DETECTION_INFO { }; }; } DISK_DETECTION_INFO,*PDISK_DETECTION_INFO; -typedef enum _MEDIA_TYPE { - Unknown, - F5_1Pt2_512, - F3_1Pt44_512, - F3_2Pt88_512, - F3_20Pt8_512, - F3_720_512, - F5_360_512, - F5_320_512, - F5_320_1024, - F5_180_512, - F5_160_512, - RemovableMedia, - FixedMedia, - F3_120M_512, - F3_640_512, - F5_640_512, - F5_720_512, - F3_1Pt2_512, - F3_1Pt23_1024, - F5_1Pt23_1024, - F3_128Mb_512, - F3_230Mb_512, - F8_256_128, - F3_200Mb_512, - F3_240M_512, - F3_32M_512 -} MEDIA_TYPE,*PMEDIA_TYPE; -typedef struct _DISK_GEOMETRY { - LARGE_INTEGER Cylinders; - MEDIA_TYPE MediaType; - DWORD TracksPerCylinder; - DWORD SectorsPerTrack; - DWORD BytesPerSector; -} DISK_GEOMETRY,*PDISK_GEOMETRY; +typedef struct _DISK_PARTITION_INFO { + DWORD SizeOfPartitionInfo; + PARTITION_STYLE PartitionStyle; + _ANONYMOUS_UNION union { + struct { + DWORD Signature; + DWORD CheckSum; + } Mbr; + struct { + GUID DiskId; + } Gpt; + }; +} DISK_PARTITION_INFO,*PDISK_PARTITION_INFO; typedef struct _DISK_GEOMETRY_EX { DISK_GEOMETRY Geometry; LARGE_INTEGER DiskSize; BYTE Data[1]; } DISK_GEOMETRY_EX,*PDISK_GEOMETRY_EX; + +#if (NTDDI_VERSION < NTDDI_WS03) +#define DiskGeometryGetPartition(Geometry) \ + ((PDISK_PARTITION_INFO)((Geometry) + 1)) + +#define DiskGeometryGetDetect(Geometry)\ + ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \ + DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) +#else +#define DiskGeometryGetPartition(Geometry) \ + ((PDISK_PARTITION_INFO)((Geometry)->Data)) + +#define DiskGeometryGetDetect(Geometry)\ + ((PDISK_DETECTION_INFO)(((ULONG_PTR)DiskGeometryGetPartition(Geometry) + \ + DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) +#endif + +typedef struct _PARTITION_INFORMATION_GPT { + GUID PartitionType; + GUID PartitionId; + DWORD64 Attributes; + WCHAR Name[36]; +} PARTITION_INFORMATION_GPT; +typedef struct _PARTITION_INFORMATION_MBR { + BYTE PartitionType; + BOOLEAN BootIndicator; + BOOLEAN RecognizedPartition; + DWORD HiddenSectors; +} PARTITION_INFORMATION_MBR; +typedef struct _PARTITION_INFORMATION_EX { + PARTITION_STYLE PartitionStyle; + LARGE_INTEGER StartingOffset; + LARGE_INTEGER PartitionLength; + DWORD PartitionNumber; + BOOLEAN RewritePartition; +#if (NTDDI_VERSION >= NTDDI_WIN10_RS3) + BOOLEAN IsServicePartition; +#endif + _ANONYMOUS_UNION union { + PARTITION_INFORMATION_MBR Mbr; + PARTITION_INFORMATION_GPT Gpt; + }; +} PARTITION_INFORMATION_EX; + +typedef struct _DRIVE_LAYOUT_INFORMATION_GPT { + GUID DiskId; + LARGE_INTEGER StartingUsableOffset; + LARGE_INTEGER UsableLength; + DWORD MaxPartitionCount; +} DRIVE_LAYOUT_INFORMATION_GPT,*PDRIVE_LAYOUT_INFORMATION_GPT; +typedef struct _DRIVE_LAYOUT_INFORMATION_MBR { + DWORD Signature; +#if (NTDDI_VERSION >= NTDDI_WIN10_RS1) + DWORD CheckSum; +#endif +} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR; +typedef struct _DRIVE_LAYOUT_INFORMATION_EX { + DWORD PartitionStyle; + DWORD PartitionCount; + _ANONYMOUS_UNION union { + DRIVE_LAYOUT_INFORMATION_MBR Mbr; + DRIVE_LAYOUT_INFORMATION_GPT Gpt; + }; + PARTITION_INFORMATION_EX PartitionEntry[1]; +} DRIVE_LAYOUT_INFORMATION_EX,*PDRIVE_LAYOUT_INFORMATION_EX; + +typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR; +typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT; + +typedef struct _SET_PARTITION_INFORMATION_EX { + PARTITION_STYLE PartitionStyle; + _ANONYMOUS_UNION union { + SET_PARTITION_INFORMATION_MBR Mbr; + SET_PARTITION_INFORMATION_GPT Gpt; + } DUMMYUNIONNAME; +} SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX; + +#endif // (_WIN32_WINNT >= 0x0500) + typedef struct _DISK_GROW_PARTITION { DWORD PartitionNumber; LARGE_INTEGER BytesToGrow; } DISK_GROW_PARTITION, *PDISK_GROW_PARTITION; -typedef struct _DISK_PARTITION_INFO { - DWORD SizeOfPartitionInfo; - PARTITION_STYLE PartitionStyle; +typedef enum { + EqualPriority, + KeepPrefetchedData, + KeepReadData +} DISK_CACHE_RETENTION_PRIORITY; +typedef struct _DISK_CACHE_INFORMATION { + BOOLEAN ParametersSavable; + BOOLEAN ReadCacheEnabled; + BOOLEAN WriteCacheEnabled; + DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority; + DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority; + WORD DisablePrefetchTransferLength; + BOOLEAN PrefetchScalar; _ANONYMOUS_UNION union { struct { - DWORD Signature; - } Mbr; + WORD Minimum; + WORD Maximum; + WORD MaximumBlocks; + } ScalarPrefetch; struct { - GUID DiskId; - } Gpt; + WORD Minimum; + WORD Maximum; + } BlockPrefetch; }; -} DISK_PARTITION_INFO,*PDISK_PARTITION_INFO; +} DISK_CACHE_INFORMATION,*PDISK_CACHE_INFORMATION; + typedef struct _DISK_PERFORMANCE { LARGE_INTEGER BytesRead; LARGE_INTEGER BytesWritten; @@ -448,62 +556,6 @@ typedef struct _VOLUME_DISK_EXTENTS { DWORD NumberOfDiskExtents; DISK_EXTENT Extents[1]; } VOLUME_DISK_EXTENTS,*PVOLUME_DISK_EXTENTS; -typedef struct _PARTITION_INFORMATION { - LARGE_INTEGER StartingOffset; - LARGE_INTEGER PartitionLength; - DWORD HiddenSectors; - DWORD PartitionNumber; - BYTE PartitionType; - BOOLEAN BootIndicator; - BOOLEAN RecognizedPartition; - BOOLEAN RewritePartition; -} PARTITION_INFORMATION,*PPARTITION_INFORMATION; -typedef struct _DRIVE_LAYOUT_INFORMATION { - DWORD PartitionCount; - DWORD Signature; - PARTITION_INFORMATION PartitionEntry[1]; -} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION; -typedef struct _DRIVE_LAYOUT_INFORMATION_GPT { - GUID DiskId; - LARGE_INTEGER StartingUsableOffset; - LARGE_INTEGER UsableLength; - ULONG MaxPartitionCount; -} DRIVE_LAYOUT_INFORMATION_GPT,*PDRIVE_LAYOUT_INFORMATION_GPT; -typedef struct _DRIVE_LAYOUT_INFORMATION_MBR { - ULONG Signature; -} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR; -typedef struct _PARTITION_INFORMATION_MBR { - BYTE PartitionType; - BOOLEAN BootIndicator; - BOOLEAN RecognizedPartition; - DWORD HiddenSectors; -} PARTITION_INFORMATION_MBR; -typedef struct _PARTITION_INFORMATION_GPT { - GUID PartitionType; - GUID PartitionId; - DWORD64 Attributes; - WCHAR Name[36]; -} PARTITION_INFORMATION_GPT; -typedef struct _PARTITION_INFORMATION_EX { - PARTITION_STYLE PartitionStyle; - LARGE_INTEGER StartingOffset; - LARGE_INTEGER PartitionLength; - DWORD PartitionNumber; - BOOLEAN RewritePartition; - _ANONYMOUS_UNION union { - PARTITION_INFORMATION_MBR Mbr; - PARTITION_INFORMATION_GPT Gpt; - }; -} PARTITION_INFORMATION_EX; -typedef struct _DRIVE_LAYOUT_INFORMATION_EX { - DWORD PartitionStyle; - DWORD PartitionCount; - _ANONYMOUS_UNION union { - DRIVE_LAYOUT_INFORMATION_MBR Mbr; - DRIVE_LAYOUT_INFORMATION_GPT Gpt; - }; - PARTITION_INFORMATION_EX PartitionEntry[1]; -} DRIVE_LAYOUT_INFORMATION_EX,*PDRIVE_LAYOUT_INFORMATION_EX; typedef struct { HANDLE FileHandle; LARGE_INTEGER StartingVcn; @@ -535,9 +587,6 @@ typedef struct _REASSIGN_BLOCKS { WORD Count; DWORD BlockNumber[1]; } REASSIGN_BLOCKS,*PREASSIGN_BLOCKS; -typedef struct _SET_PARTITION_INFORMATION { - BYTE PartitionType; -} SET_PARTITION_INFORMATION,*PSET_PARTITION_INFORMATION; typedef struct { LARGE_INTEGER StartingLcn; } STARTING_LCN_INPUT_BUFFER,*PSTARTING_LCN_INPUT_BUFFER;
4 years
1
0
0
0
[reactos] 01/01: [USBSTOR] Remove workarounds for old storage stack
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=39c48a4d91106f55141cb…
commit 39c48a4d91106f55141cb158f54444b0902a384a Author: Victor Perevertkin <victor.perevertkin(a)reactos.org> AuthorDate: Sun Dec 6 23:32:29 2020 +0300 Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org> CommitDate: Sun Dec 6 23:32:29 2020 +0300 [USBSTOR] Remove workarounds for old storage stack --- drivers/usb/usbstor/disk.c | 5 ----- drivers/usb/usbstor/fdo.c | 10 +--------- drivers/usb/usbstor/pdo.c | 7 ------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/usb/usbstor/disk.c b/drivers/usb/usbstor/disk.c index 1dbe0ad83d8..7f82bcbd539 100644 --- a/drivers/usb/usbstor/disk.c +++ b/drivers/usb/usbstor/disk.c @@ -173,13 +173,8 @@ USBSTOR_HandleInternalDeviceControl( { DPRINT1("SRB_FUNCTION_FLUSH / SRB_FUNCTION_FLUSH_QUEUE / SRB_FUNCTION_SHUTDOWN\n"); - // HACK: don't flush pending requests -#if 0 // we really need a proper storage stack - // // wait for pending requests to finish - // USBSTOR_QueueWaitForPendingRequests(PDODeviceExtension->LowerDeviceObject); -#endif Request->SrbStatus = SRB_STATUS_SUCCESS; Status = STATUS_SUCCESS; diff --git a/drivers/usb/usbstor/fdo.c b/drivers/usb/usbstor/fdo.c index ebf2d1976a4..6b8aa4c3e09 100644 --- a/drivers/usb/usbstor/fdo.c +++ b/drivers/usb/usbstor/fdo.c @@ -327,15 +327,7 @@ USBSTOR_FdoHandlePnp( case IRP_MN_QUERY_STOP_DEVICE: case IRP_MN_QUERY_REMOVE_DEVICE: { -#if 0 - // - // we can if nothing is pending - // - if (DeviceExtension->IrpPendingCount != 0 || - DeviceExtension->ActiveSrb != NULL) -#else - if (TRUE) -#endif + if (DeviceExtension->IrpPendingCount != 0 || DeviceExtension->ActiveSrb != NULL) { /* We have pending requests */ DPRINT1("Failing removal/stop request due to pending requests present\n"); diff --git a/drivers/usb/usbstor/pdo.c b/drivers/usb/usbstor/pdo.c index 86cf368bee6..8510a7941e6 100644 --- a/drivers/usb/usbstor/pdo.c +++ b/drivers/usb/usbstor/pdo.c @@ -604,14 +604,7 @@ USBSTOR_PdoHandlePnp( case IRP_MN_QUERY_REMOVE_DEVICE: case IRP_MN_QUERY_STOP_DEVICE: { -#if 0 - // - // if we're not claimed it's ok - // if (DeviceExtension->Claimed) -#else - if (TRUE) -#endif { Status = STATUS_UNSUCCESSFUL; DPRINT1("[USBSTOR] Request %x fails because device is still claimed\n", IoStack->MinorFunction);
4 years
1
0
0
0
[reactos] 03/03: [SETUPAPI] Do not use strlen on buffers which may possibly contain REG_MULTI_SZ
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aa05649902f0afac18ca6…
commit aa05649902f0afac18ca6fa2bdf2ff8846c915ad Author: Victor Perevertkin <victor.perevertkin(a)reactos.org> AuthorDate: Sun Dec 6 19:49:57 2020 +0300 Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org> CommitDate: Sun Dec 6 19:49:57 2020 +0300 [SETUPAPI] Do not use strlen on buffers which may possibly contain REG_MULTI_SZ CORE-14187 --- dll/win32/setupapi/cfgmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index fdbcc8cfb1b..b052553e9ac 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -2937,7 +2937,7 @@ CM_Get_Class_Registry_PropertyA( *pulLength = WideCharToMultiByte(CP_ACP, 0, BufferW, - lstrlenW(BufferW) + 1, + ulLength, Buffer, *pulLength, NULL, @@ -3859,7 +3859,7 @@ CM_Get_Device_ID_List_ExA( if (WideCharToMultiByte(CP_ACP, 0, BufferW, - lstrlenW(BufferW) + 1, + BufferLen, Buffer, BufferLen, NULL, @@ -4344,7 +4344,7 @@ CM_Get_Device_Interface_List_ExA( if (WideCharToMultiByte(CP_ACP, 0, BufferW, - lstrlenW(BufferW) + 1, + BufferLen, Buffer, BufferLen, NULL,
4 years
1
0
0
0
[reactos] 02/03: [UMPNPMGR] Set the data type in all cases of PNP_GetDeviceRegProp
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ff13301eb2a1b48768a8d…
commit ff13301eb2a1b48768a8dc125c4983fe90a2dec8 Author: Victor Perevertkin <victor.perevertkin(a)reactos.org> AuthorDate: Sun Dec 6 19:48:38 2020 +0300 Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org> CommitDate: Sun Dec 6 19:48:38 2020 +0300 [UMPNPMGR] Set the data type in all cases of PNP_GetDeviceRegProp CORE-14187 --- base/services/umpnpmgr/rpcserver.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index 004eb659b01..1d14d978ab0 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -1803,6 +1803,7 @@ PNP_GetDeviceRegProp( case CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME: PlugPlayData.Property = PNP_PROPERTY_PHYSICAL_DEVICE_OBJECT_NAME; + *pulRegDataType = REG_SZ; break; case CM_DRP_CAPABILITIES: @@ -1823,18 +1824,22 @@ PNP_GetDeviceRegProp( case CM_DRP_BUSTYPEGUID: PlugPlayData.Property = PNP_PROPERTY_BUSTYPEGUID; + *pulRegDataType = REG_BINARY; break; case CM_DRP_LEGACYBUSTYPE: PlugPlayData.Property = PNP_PROPERTY_LEGACYBUSTYPE; + *pulRegDataType = REG_DWORD; break; case CM_DRP_BUSNUMBER: PlugPlayData.Property = PNP_PROPERTY_BUSNUMBER; + *pulRegDataType = REG_DWORD; break; case CM_DRP_ENUMERATOR_NAME: PlugPlayData.Property = PNP_PROPERTY_ENUMERATOR_NAME; + *pulRegDataType = REG_SZ; break; case CM_DRP_SECURITY: @@ -1855,6 +1860,7 @@ PNP_GetDeviceRegProp( case CM_DRP_ADDRESS: PlugPlayData.Property = PNP_PROPERTY_ADDRESS; + *pulRegDataType = REG_DWORD; break; case CM_DRP_UI_NUMBER_DESC_FORMAT: @@ -1863,33 +1869,40 @@ PNP_GetDeviceRegProp( case CM_DRP_DEVICE_POWER_DATA: PlugPlayData.Property = PNP_PROPERTY_POWER_DATA; + *pulRegDataType = REG_BINARY; break; case CM_DRP_REMOVAL_POLICY: PlugPlayData.Property = PNP_PROPERTY_REMOVAL_POLICY; + *pulRegDataType = REG_DWORD; break; case CM_DRP_REMOVAL_POLICY_HW_DEFAULT: PlugPlayData.Property = PNP_PROPERTY_REMOVAL_POLICY_HARDWARE_DEFAULT; + *pulRegDataType = REG_DWORD; break; case CM_DRP_REMOVAL_POLICY_OVERRIDE: lpValueName = L"RemovalPolicy"; + *pulRegDataType = REG_DWORD; break; case CM_DRP_INSTALL_STATE: PlugPlayData.Property = PNP_PROPERTY_INSTALL_STATE; + *pulRegDataType = REG_DWORD; break; #if (WINVER >= _WIN32_WINNT_WS03) case CM_DRP_LOCATION_PATHS: PlugPlayData.Property = PNP_PROPERTY_LOCATION_PATHS; + *pulRegDataType = REG_MULTI_SZ; break; #endif #if (WINVER >= _WIN32_WINNT_WIN7) case CM_DRP_BASE_CONTAINERID: PlugPlayData.Property = PNP_PROPERTY_CONTAINERID; + *pulRegDataType = REG_SZ; break; #endif @@ -3454,7 +3467,7 @@ PNP_QueryRemove( pszDeviceID); PlugPlayData.VetoName = pszVetoName; PlugPlayData.NameLength = ulNameLength; -// PlugPlayData.Flags = +// PlugPlayData.Flags = Status = NtPlugPlayControl(PlugPlayControlQueryAndRemoveDevice, &PlugPlayData, @@ -3502,7 +3515,7 @@ PNP_RequestDeviceEject( pszDeviceID); PlugPlayData.VetoName = pszVetoName; PlugPlayData.NameLength = ulNameLength; -// PlugPlayData.Flags = +// PlugPlayData.Flags = Status = NtPlugPlayControl(PlugPlayControlQueryAndRemoveDevice, &PlugPlayData,
4 years
1
0
0
0
[reactos] 01/03: [PARTMGR] Register a disk interface for disk PDO
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d6c6fa38d6dc40503f24…
commit 2d6c6fa38d6dc40503f246b97b67b0472e561e0f Author: Victor Perevertkin <victor.perevertkin(a)reactos.org> AuthorDate: Sun Dec 6 19:47:15 2020 +0300 Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org> CommitDate: Sun Dec 6 19:47:15 2020 +0300 [PARTMGR] Register a disk interface for disk PDO CORE-14187 --- drivers/storage/partmgr/partmgr.c | 33 +++++++++++++++++++++++++++++++++ drivers/storage/partmgr/partmgr.h | 1 + 2 files changed, 34 insertions(+) diff --git a/drivers/storage/partmgr/partmgr.c b/drivers/storage/partmgr/partmgr.c index 8abfdccedd6..75ca8451137 100644 --- a/drivers/storage/partmgr/partmgr.c +++ b/drivers/storage/partmgr/partmgr.c @@ -846,6 +846,32 @@ FdoHandleStartDevice( } FdoExtension->DiskData.DeviceNumber = deviceNumber.DeviceNumber; + + // register the disk interface + // partmgr.sys from Windows 8.1 also registers a mysterious GUID_DEVINTERFACE_HIDDEN_DISK here + UNICODE_STRING interfaceName; + status = IoRegisterDeviceInterface(FdoExtension->PhysicalDiskDO, + &GUID_DEVINTERFACE_DISK, + NULL, + &interfaceName); + + if(!NT_SUCCESS(status)) + { + ERR("Failed to register GUID_DEVINTERFACE_DISK, status %x\n", status); + return status; + } + + FdoExtension->DiskInterfaceName = interfaceName; + status = IoSetDeviceInterfaceState(&interfaceName, TRUE); + + INFO("Disk interface %wZ\n", &interfaceName); + + if (!NT_SUCCESS(status)) + { + RtlFreeUnicodeString(&interfaceName); + RtlInitUnicodeString(&FdoExtension->DiskInterfaceName, NULL); + } + return status; } @@ -1002,6 +1028,13 @@ FdoHandleRemoveDevice( ASSERT(partExt->DeviceRemoved); } + if (FdoExtension->DiskInterfaceName.Buffer) + { + IoSetDeviceInterfaceState(&FdoExtension->DiskInterfaceName, FALSE); + RtlFreeUnicodeString(&FdoExtension->DiskInterfaceName); + RtlInitUnicodeString(&FdoExtension->DiskInterfaceName, NULL); + } + // Send the IRP down the stack IoSkipCurrentIrpStackLocation(Irp); Irp->IoStatus.Status = STATUS_SUCCESS; diff --git a/drivers/storage/partmgr/partmgr.h b/drivers/storage/partmgr/partmgr.h index 71eccfb8823..28d350c5363 100644 --- a/drivers/storage/partmgr/partmgr.h +++ b/drivers/storage/partmgr/partmgr.h @@ -44,6 +44,7 @@ typedef struct _FDO_EXTENSION SINGLE_LIST_ENTRY PartitionList; UINT32 EnumeratedPartitionsTotal; + UNICODE_STRING DiskInterfaceName; struct { UINT64 DiskSize;
4 years
1
0
0
0
[reactos] 01/01: [RTL] Fix RtlImageDirectoryEntryToData to support both 32 and 64 bit images
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=883ae6d93bff097e76cbe…
commit 883ae6d93bff097e76cbef4ac27babbd9c6ae483 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sun Oct 4 20:07:34 2020 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sun Dec 6 16:37:57 2020 +0100 [RTL] Fix RtlImageDirectoryEntryToData to support both 32 and 64 bit images --- sdk/lib/rtl/image.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/sdk/lib/rtl/image.c b/sdk/lib/rtl/image.c index 5ae6f679f72..9efb3d19744 100644 --- a/sdk/lib/rtl/image.c +++ b/sdk/lib/rtl/image.c @@ -289,17 +289,38 @@ RtlImageDirectoryEntryToData( if (NtHeader == NULL) return NULL; - if (Directory >= SWAPD(NtHeader->OptionalHeader.NumberOfRvaAndSizes)) - return NULL; + if (NtHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) + { + PIMAGE_OPTIONAL_HEADER64 OptionalHeader = (PIMAGE_OPTIONAL_HEADER64)&NtHeader->OptionalHeader; - Va = SWAPD(NtHeader->OptionalHeader.DataDirectory[Directory].VirtualAddress); - if (Va == 0) - return NULL; + if (Directory >= SWAPD(OptionalHeader->NumberOfRvaAndSizes)) + return NULL; + + Va = SWAPD(OptionalHeader->DataDirectory[Directory].VirtualAddress); + if (Va == 0) + return NULL; + + *Size = SWAPD(OptionalHeader->DataDirectory[Directory].Size); + + if (MappedAsImage || Va < SWAPD(OptionalHeader->SizeOfHeaders)) + return (PVOID)((ULONG_PTR)BaseAddress + Va); + } + else + { + PIMAGE_OPTIONAL_HEADER32 OptionalHeader = (PIMAGE_OPTIONAL_HEADER32)&NtHeader->OptionalHeader; + + if (Directory >= SWAPD(OptionalHeader->NumberOfRvaAndSizes)) + return NULL; + + Va = SWAPD(OptionalHeader->DataDirectory[Directory].VirtualAddress); + if (Va == 0) + return NULL; - *Size = SWAPD(NtHeader->OptionalHeader.DataDirectory[Directory].Size); + *Size = SWAPD(OptionalHeader->DataDirectory[Directory].Size); - if (MappedAsImage || Va < SWAPD(NtHeader->OptionalHeader.SizeOfHeaders)) - return (PVOID)((ULONG_PTR)BaseAddress + Va); + if (MappedAsImage || Va < SWAPD(OptionalHeader->SizeOfHeaders)) + return (PVOID)((ULONG_PTR)BaseAddress + Va); + } /* Image mapped as ordinary file, we must find raw pointer */ return RtlImageRvaToVa(NtHeader, BaseAddress, Va, NULL);
4 years
1
0
0
0
[reactos] 01/01: Implement IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocationInformation
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cac7b003c04c1f42f4522…
commit cac7b003c04c1f42f4522156c2d2f77996b271c2 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Dec 6 12:42:50 2020 +0100 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Dec 6 12:42:50 2020 +0100 Implement IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocationInformation --- drivers/storage/port/scsiport/pdo.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/storage/port/scsiport/pdo.c b/drivers/storage/port/scsiport/pdo.c index 182f2b029ec..5ddbd7e2b34 100644 --- a/drivers/storage/port/scsiport/pdo.c +++ b/drivers/storage/port/scsiport/pdo.c @@ -185,10 +185,12 @@ PdoHandleQueryDeviceText( PIO_STACK_LOCATION IoStack; UINT32 Offset = 0; PINQUIRYDATA InquiryData; - CHAR LocalBuffer[sizeof(InquiryData->VendorId) + sizeof(InquiryData->ProductId) + 2]; + CHAR LocalBuffer[40]; ANSI_STRING AnsiString; UNICODE_STRING DeviceDescription; + DPRINT("PdoHandleQueryDeviceText\n"); + IoStack = IoGetCurrentIrpStackLocation(Irp); InquiryData = &DeviceExtension->InquiryData; @@ -196,9 +198,8 @@ PdoHandleQueryDeviceText( switch (IoStack->Parameters.QueryDeviceText.DeviceTextType) { case DeviceTextDescription: - case DeviceTextLocationInformation: { - DPRINT("PdoHandleQueryDeviceText\n"); + DPRINT("DeviceTextDescription\n"); Offset += CopyFieldTruncate(InquiryData->VendorId, &LocalBuffer[Offset], @@ -227,6 +228,33 @@ PdoHandleQueryDeviceText( Irp->IoStatus.Information = (ULONG_PTR)DeviceDescription.Buffer; return STATUS_SUCCESS; } + + case DeviceTextLocationInformation: + { + DPRINT("DeviceTextLocationInformation\n"); + + sprintf(LocalBuffer, "Bus Number %d, Target ID %d, LUN %d", + DeviceExtension->PathId, DeviceExtension->TargetId, DeviceExtension->Lun); + + RtlInitAnsiString(&AnsiString, (PCSZ)&LocalBuffer); + + DeviceDescription.Length = 0; + DeviceDescription.MaximumLength = (USHORT)((strlen(LocalBuffer) + 1) * sizeof(WCHAR)); + DeviceDescription.Buffer = ExAllocatePoolWithTag(PagedPool, + DeviceDescription.MaximumLength, + TAG_SCSIPORT); + if (!DeviceDescription.Buffer) + { + Irp->IoStatus.Information = 0; + return STATUS_INSUFFICIENT_RESOURCES; + } + + RtlAnsiStringToUnicodeString(&DeviceDescription, &AnsiString, FALSE); + + Irp->IoStatus.Information = (ULONG_PTR)DeviceDescription.Buffer; + return STATUS_SUCCESS; + } + default: { Irp->IoStatus.Information = 0;
4 years
1
0
0
0
[reactos] 03/03: [USBSTOR] Enable USB (ATAPI) cdroms
by Victor Perevertkin
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f722be93d5df50416ce4b…
commit f722be93d5df50416ce4b4a62b11ec85f07cb1f2 Author: Victor Perevertkin <victor.perevertkin(a)reactos.org> AuthorDate: Sun Dec 6 02:08:32 2020 +0300 Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org> CommitDate: Sun Dec 6 02:08:32 2020 +0300 [USBSTOR] Enable USB (ATAPI) cdroms With the cdrom_new driver, they now work CORE-16112 --- boot/bootdata/hivesys.inf | 3 +++ drivers/usb/usbstor/usbstor.inf | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index 518c8a666e9..e5aba999df0 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -35,6 +35,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0C0320","Cl HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\USB#Class_08&SubClass_06&Prot_50","Service",0x00000000,"usbstor" HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\USB#Class_08&SubClass_06&Prot_50","ClassGUID",0x00000000,"{36FC9E60-C465-11CF-8056-444553540000}" +HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\USB#Class_08&SubClass_02&Prot_50","Service",0x00000000,"usbstor" +HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\USB#Class_08&SubClass_02&Prot_50","ClassGUID",0x00000000,"{36FC9E60-C465-11CF-8056-444553540000}" + HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\USB#COMPOSITE","Service",0x00000000,"usbccgp" HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\USB#COMPOSITE","ClassGUID",0x00000000,"{36FC9E60-C465-11CF-8056-444553540000}" diff --git a/drivers/usb/usbstor/usbstor.inf b/drivers/usb/usbstor/usbstor.inf index 87a80f63cb4..2b870393e8a 100644 --- a/drivers/usb/usbstor/usbstor.inf +++ b/drivers/usb/usbstor/usbstor.inf @@ -20,7 +20,7 @@ DefaultDestDir = 12 [GenericMfg] %GenericBulkOnlyTransport.DeviceDesc% = USBBulkOnly_Inst,USB\Class_08&SubClass_06&Prot_50 ; SCSI devices ; usbstor.sys supports usb-cdroms but cdrom.sys from ReactOS does not like it -;%GenericBulkOnlyTransport.DeviceDesc% = USBBulkOnly_Inst,USB\Class_08&SubClass_02&Prot_50 ; SFF-8020i (ATAPI) +%GenericBulkOnlyTransport.DeviceDesc% = USBBulkOnly_Inst,USB\Class_08&SubClass_02&Prot_50 ; SFF-8020i (ATAPI) ;-------------------------- USB STORAGE DRIVER --------------------------
4 years
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Results per page:
10
25
50
100
200