mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Determine Sd, Mmc drive type (Windows)
This commit is contained in:
parent
bd7deabcbd
commit
83296c5b48
2 changed files with 17 additions and 14 deletions
|
|
@ -555,8 +555,10 @@ begin
|
|||
end;
|
||||
if DriveType in [dtFlash, dtHardDisk] then
|
||||
begin
|
||||
if mbDriveUsb(DriveLetter) then
|
||||
DriveType:= dtRemovableUsb;
|
||||
case mbDriveBusType(DriveLetter) of
|
||||
BusTypeUsb: DriveType := dtRemovableUsb;
|
||||
BusTypeSd, BusTypeMmc: DriveType := dtFlash;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,13 @@ interface
|
|||
uses
|
||||
Graphics, Classes, SysUtils, JwaWinBase, Windows;
|
||||
|
||||
const
|
||||
// STORAGE_BUS_TYPE
|
||||
BusTypeUnknown = $00;
|
||||
BusTypeUsb = $07;
|
||||
BusTypeSd = $0C;
|
||||
BusTypeMmc = $0D;
|
||||
|
||||
procedure ShowWindowEx(hWnd: HWND);
|
||||
function FindMainWindow(ProcessId: DWORD): HWND;
|
||||
function GetMenuItemText(hMenu: HMENU; uItem: UINT; fByPosition: LongBool): UnicodeString;
|
||||
|
|
@ -76,7 +83,7 @@ procedure mbWaitLabelChange(const sDrv: String; const sCurLabel: String);
|
|||
@param(sDrv String specifying the root directory of a drive)
|
||||
}
|
||||
procedure mbCloseCD(const sDrv: String);
|
||||
function mbDriveUsb(Drive: AnsiChar): Boolean;
|
||||
function mbDriveBusType(Drive: AnsiChar): UInt32;
|
||||
procedure mbDriveUnlock(const sDrv: String);
|
||||
{en
|
||||
Get remote file name by local file name
|
||||
|
|
@ -416,13 +423,6 @@ begin
|
|||
mciSendCommandA(OpenParms.wDeviceID, MCI_CLOSE, MCI_OPEN_TYPE or MCI_OPEN_ELEMENT, DWORD_PTR(@OpenParms));
|
||||
end;
|
||||
|
||||
const
|
||||
// STORAGE_BUS_TYPE
|
||||
BusTypeUnknown = $00;
|
||||
BusTypeUsb = $07;
|
||||
// dwIoControlCode
|
||||
IOCTL_STORAGE_QUERY_PROPERTY = $2D1400;
|
||||
|
||||
type
|
||||
STORAGE_PROPERTY_QUERY = record
|
||||
PropertyId: DWORD;
|
||||
|
|
@ -446,15 +446,17 @@ type
|
|||
RawDeviceProperties: array[0..0] of Byte;
|
||||
end;
|
||||
|
||||
function mbDriveUsb(Drive: AnsiChar): Boolean;
|
||||
function mbDriveBusType(Drive: AnsiChar): UInt32;
|
||||
const
|
||||
IOCTL_STORAGE_QUERY_PROPERTY = $2D1400;
|
||||
var
|
||||
Dummy: DWORD;
|
||||
Handle: THandle;
|
||||
Query: STORAGE_PROPERTY_QUERY;
|
||||
BusType: DWORD = BusTypeUnknown;
|
||||
Descr: STORAGE_DEVICE_DESCRIPTOR;
|
||||
VolumePath: UnicodeString = '\\.\X:';
|
||||
begin
|
||||
Result := BusTypeUnknown;
|
||||
VolumePath[5] := WideChar(Drive);
|
||||
|
||||
Handle := CreateFileW(PWideChar(VolumePath), 0,
|
||||
|
|
@ -470,12 +472,11 @@ begin
|
|||
@Descr, SizeOf(STORAGE_DEVICE_DESCRIPTOR),
|
||||
@Dummy, nil)) then
|
||||
begin
|
||||
BusType := Descr.BusType;
|
||||
Result := Descr.BusType;
|
||||
end;
|
||||
|
||||
CloseHandle(Handle);
|
||||
end;
|
||||
Result := (BusType = BusTypeUsb);
|
||||
end;
|
||||
|
||||
function IsWow64: BOOL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue