https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12d4409086283d7b021aeb8158a60d45b0e07568

commit 12d4409086283d7b021aeb8158a60d45b0e07568
Author:     Bișoc George <[email protected]>
AuthorDate: Wed Apr 15 12:47:01 2020 +0200
Commit:     GitHub <[email protected]>
CommitDate: Wed Apr 15 12:47:01 2020 +0200

    [SDK][PSDK] Add a version check for DiskGeometryGetPartition and 
DiskGeometryGetDetect and add a missing member to PARTITION_INFORMATION_EX 
structure (#2541)
    
    DiskGeometryGetPartition() and DiskGeometryGetDetect() are guarded in 
NTDDI_VERSION for version checking as they differ between Windows XP and Server 
2003. In conjunction to that, the PARTITION_INFORMATION_EX structure has 
"IsServicePartition" as member which is missing in the current NT IOCTL Disk 
interface header.
---
 sdk/include/psdk/ntdddisk.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sdk/include/psdk/ntdddisk.h b/sdk/include/psdk/ntdddisk.h
index 7c7cc1dd600..998f17ed0ab 100644
--- a/sdk/include/psdk/ntdddisk.h
+++ b/sdk/include/psdk/ntdddisk.h
@@ -387,12 +387,21 @@ typedef struct _DISK_GEOMETRY_EX {
   UCHAR  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 {
   LARGE_INTEGER  StartingOffset;
@@ -464,6 +473,9 @@ typedef struct _PARTITION_INFORMATION_EX {
   LARGE_INTEGER  PartitionLength;
   ULONG  PartitionNumber;
   BOOLEAN  RewritePartition;
+#if (NTDDI_VERSION >= NTDDI_WIN10_RS3)
+  BOOLEAN  IsServicePartition;
+#endif
   _ANONYMOUS_UNION union {
     PARTITION_INFORMATION_MBR  Mbr;
     PARTITION_INFORMATION_GPT  Gpt;

Reply via email to