VirtualBox

Changeset 8969 in vbox for trunk/src


Ignore:
Timestamp:
May 20, 2008 6:07:25 PM (17 years ago)
Author:
vboxsync
Message:

Disk size ioctl fix for createrawvmdk.

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk

    r8760 r8969  
    3232                         $(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \
    3333                         $(if $(VBOX_WITH_AHCI),VBOX_WITH_AHCI,)
     34VBoxManage_DEFS.win.x86 = _WIN32_WINNT=0x0500
    3435VBoxManage_SOURCES     = \
    3536        VBoxManage.cpp \
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r8835 r8969  
    788788    uint64_t cbSize = 0;
    789789#ifdef RT_OS_WINDOWS
     790    /* Windows NT has no IOCTL_DISK_GET_LENGTH_INFORMATION ioctl. This was
     791     * added to Windows XP, so we have to use the available info from DriveGeo.
     792     * Note that we cannot simply use IOCTL_DISK_GET_DRIVE_GEOMETRY as it
     793     * yields a slightly different result than IOCTL_DISK_GET_LENGTH_INFO.
     794     * We call IOCTL_DISK_GET_DRIVE_GEOMETRY first as we need to check the media
     795     * type anyway, and if IOCTL_DISK_GET_LENGTH_INFORMATION is supported
     796     * we will later override cbSize.
     797     */
    790798    DISK_GEOMETRY DriveGeo;
    791799    DWORD cbDriveGeo;
    792     /* Windows NT has no IOCTL_DISK_GET_LENGTH_INFORMATION ioctl. This was
    793      * added to Windows XP, so use the available info from DriveGeo. */
    794800    if (DeviceIoControl((HANDLE)RawFile,
    795801                        IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0,
     
    805811        else
    806812            return VERR_MEDIA_NOT_RECOGNIZED;
     813
     814        GET_LENGTH_INFORMATION DiskLenInfo;
     815        DWORD junk;
     816        if (DeviceIoControl((HANDLE)RawFile,
     817                            IOCTL_DISK_GET_LENGTH_INFO, NULL, 0,
     818                            &DiskLenInfo, sizeof(DiskLenInfo), &junk, (LPOVERLAPPED)NULL))
     819        {
     820            /* IOCTL_DISK_GET_LENGTH_INFO is supported -- override cbSize. */
     821            cbSize = DiskLenInfo.Length.QuadPart;
     822        }
    807823    }
    808824    else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette