VirtualBox

Changeset 76385 in vbox for trunk


Ignore:
Timestamp:
Dec 23, 2018 1:01:58 AM (6 years ago)
Author:
vboxsync
Message:

DrvHostBase-win.cpp,iprt/nt/nt.h: Use nt-and-windows.h and add FILE_FS_SIZE_INFORMATION to nt.h, then we don't have to carry all those stupid+outdated header workarounds with us.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/nt/nt.h

    r75878 r76385  
    15621562
    15631563#ifdef IPRT_NT_USE_WINTERNL
     1564typedef struct _FILE_FS_SIZE_INFORMATION
     1565{
     1566    LARGE_INTEGER   TotalAllocationUnits;
     1567    LARGE_INTEGER   AvailableAllocationUnits;
     1568    ULONG           SectorsPerAllocationUnit;
     1569    ULONG           BytesPerSector;
     1570} FILE_FS_SIZE_INFORMATION;
     1571typedef FILE_FS_SIZE_INFORMATION *PFILE_FS_SIZE_INFORMATION;
     1572
    15641573typedef enum _FSINFOCLASS
    15651574{
    15661575    FileFsVolumeInformation = 1,
    15671576    FileFsLabelInformation,
    1568     FileFsSizeInformation,
     1577    FileFsSizeInformation,          /**< FILE_FS_SIZE_INFORMATION */
    15691578    FileFsDeviceInformation,
    15701579    FileFsAttributeInformation,
  • trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp

    r76384 r76385  
    2121*********************************************************************************************************************************/
    2222#define LOG_GROUP LOG_GROUP_DRV_HOST_BASE
    23 #pragma warning(disable : 4163)
    24 #define _interlockedbittestandset      they_messed_it_up_in_winnt_h_this_time_sigh__interlockedbittestandset
    25 #define _interlockedbittestandreset    they_messed_it_up_in_winnt_h_this_time_sigh__interlockedbittestandreset
    26 #define _interlockedbittestandset64    they_messed_it_up_in_winnt_h_this_time_sigh__interlockedbittestandset64
    27 #define _interlockedbittestandreset64  they_messed_it_up_in_winnt_h_this_time_sigh__interlockedbittestandreset64
    28 
    29 #define WIN32_NO_STATUS
    30 #include <iprt/win/windows.h>
     23#include <iprt/nt/nt-and-windows.h>
    3124#include <dbt.h>
    32 #undef WIN32_NO_STATUS
    33 
    34 #include <winioctl.h>
    3525#include <ntddscsi.h>
    36 #pragma warning(default : 4163)
    37 #undef _interlockedbittestandset
    38 #undef _interlockedbittestandreset
    39 #undef _interlockedbittestandset64
    40 #undef _interlockedbittestandreset64
    41 #include <ntstatus.h>
    42 
    43 /* from ntdef.h */
    44 typedef LONG NTSTATUS;
    45 
    46 /* from ntddk.h */
    47 typedef struct _IO_STATUS_BLOCK {
    48     union {
    49         NTSTATUS Status;
    50         PVOID Pointer;
    51     };
    52     ULONG_PTR Information;
    53 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
    54 
    55 
    56 /* from ntinternals.com */
    57 typedef enum _FS_INFORMATION_CLASS {
    58     FileFsVolumeInformation=1,
    59     FileFsLabelInformation,
    60     FileFsSizeInformation,
    61     FileFsDeviceInformation,
    62     FileFsAttributeInformation,
    63     FileFsControlInformation,
    64     FileFsFullSizeInformation,
    65     FileFsObjectIdInformation,
    66     FileFsMaximumInformation
    67 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
    68 
    69 typedef struct _FILE_FS_SIZE_INFORMATION {
    70     LARGE_INTEGER   TotalAllocationUnits;
    71     LARGE_INTEGER   AvailableAllocationUnits;
    72     ULONG           SectorsPerAllocationUnit;
    73     ULONG           BytesPerSector;
    74 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
    75 
    76 extern "C"
    77 NTSTATUS __stdcall NtQueryVolumeInformationFile(
    78         /*IN*/ HANDLE               FileHandle,
    79         /*OUT*/ PIO_STATUS_BLOCK    IoStatusBlock,
    80         /*OUT*/ PVOID               FileSystemInformation,
    81         /*IN*/ ULONG                Length,
    82         /*IN*/ FS_INFORMATION_CLASS FileSystemInformationClass );
    8326
    8427#include <iprt/ctype.h>
     
    362305        /* use NT api, retry a few times if the media is being verified. */
    363306        IO_STATUS_BLOCK             IoStatusBlock = {0};
    364         FILE_FS_SIZE_INFORMATION    FsSize= {0};
     307        FILE_FS_SIZE_INFORMATION    FsSize = {0};
    365308        NTSTATUS rcNt = NtQueryVolumeInformationFile((HANDLE)RTFileToNative(pThis->Os.hFileDevice),  &IoStatusBlock,
    366309                                                     &FsSize, sizeof(FsSize), FileFsSizeInformation);
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