Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-12858

IOCTL_DISK_GET_DRIVE_GEOMETRY_EX in ReactOS is different from Windows 7

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Fix Version/s: 0.4.5
    • Component/s: Drivers
    • Labels:
      None
    • Sprint:
      February 2017

      Description

      I was running my exe under Windows 7 and ReactOS 0.4.4 (the latter in an VirtualBox machine).

      I noticed that the function DeviceIoControl(..IOCTL_DISK_GET_DRIVE_GEOMETRY_EX..) fails in ReactOS. The error message says something like "specified struture size too short".

      The structure passed to this function is:

      typedef struct _DISK_GEOMETRY_EX {
          DISK_GEOMETRY Geometry;       
          LARGE_INTEGER DiskSize;          
          BYTE  Data[1];                              
      } DISK_GEOMETRY_EX;

      The structure is aligned on 1 byte boundary.
      It has a size of 33 bytes.

      The follwoing code works in Windows 7 (32 bit).

      DISK_GEOMETRY_EX    geometry_ex;
      DWORD dwBytesReturned = 0;
      DeviceIoControl(hDevice,
                      IOCTL_DISK_GET_DRIVE_GEOMETRY_EX,
                      NULL,
                      0,
                      &geometry_ex,
                      sizeof(geometry_ex),
                      &dwBytesReturned,
                      NULL);

      It also works when I specify sizeof(geometry_ex) -1 as parameter 6.
      It fails when I specify sizeof(geometry_ex) -2 as parameter 6.

      This means Windows 7 checks the specified size of the output structure and fills this structure depending on the available size.
      When the size is 32 then DISK_GEOMETRY_EX.Data is probably not filled by Windows 7.

      ReactOS, on the other hand, fails if the specified size is 33.
      This behaviour of ReactOS is different from Windows 7.

      Regards
      Ulrich Straub

        Attachments

          Activity

            People

            • Assignee:
              Heis Spiter Pierre Schweitzer
              Reporter:
              ustraub ustraub
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: