|
@@ -61,7 +61,7 @@ uses
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$IFDEF MSWINDOWS}
|
|
{$IFDEF MSWINDOWS}
|
|
uMyWindows, Windows, JwaDbt, LazUTF8, JwaWinNetWk, ShlObj, DCOSUtils, uDebug,
|
|
uMyWindows, Windows, JwaDbt, LazUTF8, JwaWinNetWk, ShlObj, DCOSUtils, uDebug,
|
|
- uShlObjAdditional, JwaNative
|
|
|
|
|
|
+ uShlObjAdditional, JwaNative, uGlobs
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
;
|
|
;
|
|
|
|
|
|
@@ -176,11 +176,17 @@ var
|
|
function GetDrivePath(UnitMask: ULONG): String;
|
|
function GetDrivePath(UnitMask: ULONG): String;
|
|
var
|
|
var
|
|
DriveNum: Byte;
|
|
DriveNum: Byte;
|
|
|
|
+ DriveLetterOffset: Integer;
|
|
begin
|
|
begin
|
|
|
|
+ if (gUpperCaseDriveLetter) then
|
|
|
|
+ DriveLetterOffset := Ord('A')
|
|
|
|
+ else begin
|
|
|
|
+ DriveLetterOffset := Ord('a')
|
|
|
|
+ end;
|
|
for DriveNum:= 0 to 25 do
|
|
for DriveNum:= 0 to 25 do
|
|
begin
|
|
begin
|
|
if ((UnitMask shr DriveNum) and $01) <> 0 then
|
|
if ((UnitMask shr DriveNum) and $01) <> 0 then
|
|
- Exit(AnsiChar(DriveNum + Ord('a')) + ':\');
|
|
|
|
|
|
+ Exit(AnsiChar(DriveNum + DriveLetterOffset) + ':\');
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -507,15 +513,27 @@ var
|
|
DrivePath: String;
|
|
DrivePath: String;
|
|
WinDriveType: UINT;
|
|
WinDriveType: UINT;
|
|
nFile: TNetResourceW;
|
|
nFile: TNetResourceW;
|
|
|
|
+ OptionalColon: String;
|
|
DriveLetter: AnsiChar;
|
|
DriveLetter: AnsiChar;
|
|
NetworkPathSize: DWORD;
|
|
NetworkPathSize: DWORD;
|
|
lpBuffer: Pointer = nil;
|
|
lpBuffer: Pointer = nil;
|
|
nFileList: PNetResourceW;
|
|
nFileList: PNetResourceW;
|
|
|
|
+ DriveLetterOffset: Integer;
|
|
RegDrivePath: UnicodeString;
|
|
RegDrivePath: UnicodeString;
|
|
dwCount, dwBufferSize: DWORD;
|
|
dwCount, dwBufferSize: DWORD;
|
|
hEnum: THandle = INVALID_HANDLE_VALUE;
|
|
hEnum: THandle = INVALID_HANDLE_VALUE;
|
|
NetworkPath: array[0..MAX_PATH] of WideChar;
|
|
NetworkPath: array[0..MAX_PATH] of WideChar;
|
|
begin
|
|
begin
|
|
|
|
+ if gUpperCaseDriveLetter then
|
|
|
|
+ DriveLetterOffset := Ord('A')
|
|
|
|
+ else begin
|
|
|
|
+ DriveLetterOffset := Ord('a');
|
|
|
|
+ end;
|
|
|
|
+ if gShowColonAfterDrive then
|
|
|
|
+ OptionalColon := ':'
|
|
|
|
+ else begin
|
|
|
|
+ OptionalColon := EmptyStr;
|
|
|
|
+ end;
|
|
Result := TDrivesList.Create;
|
|
Result := TDrivesList.Create;
|
|
{ fill list }
|
|
{ fill list }
|
|
DriveBits := GetLogicalDrives;
|
|
DriveBits := GetLogicalDrives;
|
|
@@ -524,7 +542,7 @@ begin
|
|
if ((DriveBits shr DriveNum) and $1) = 0 then
|
|
if ((DriveBits shr DriveNum) and $1) = 0 then
|
|
begin
|
|
begin
|
|
// Try to find in mapped network drives
|
|
// Try to find in mapped network drives
|
|
- DriveLetter := AnsiChar(DriveNum + Ord('a'));
|
|
|
|
|
|
+ DriveLetter := AnsiChar(DriveNum + DriveLetterOffset);
|
|
RegDrivePath := 'Network' + PathDelim + WideChar(DriveLetter);
|
|
RegDrivePath := 'Network' + PathDelim + WideChar(DriveLetter);
|
|
if RegOpenKeyExW(HKEY_CURRENT_USER, PWideChar(RegDrivePath), 0, KEY_READ, Key) = ERROR_SUCCESS then
|
|
if RegOpenKeyExW(HKEY_CURRENT_USER, PWideChar(RegDrivePath), 0, KEY_READ, Key) = ERROR_SUCCESS then
|
|
begin
|
|
begin
|
|
@@ -537,7 +555,7 @@ begin
|
|
with Drive^ do
|
|
with Drive^ do
|
|
begin
|
|
begin
|
|
Path := DriveLetter + ':\';
|
|
Path := DriveLetter + ':\';
|
|
- DisplayName := DriveLetter;
|
|
|
|
|
|
+ DisplayName := DriveLetter + OptionalColon;
|
|
DriveLabel := UTF16ToUTF8(UnicodeString(NetworkPath));
|
|
DriveLabel := UTF16ToUTF8(UnicodeString(NetworkPath));
|
|
DriveType := dtNetwork;
|
|
DriveType := dtNetwork;
|
|
AutoMount := True;
|
|
AutoMount := True;
|
|
@@ -548,7 +566,7 @@ begin
|
|
Continue;
|
|
Continue;
|
|
end;
|
|
end;
|
|
|
|
|
|
- DriveLetter := AnsiChar(DriveNum + Ord('a'));
|
|
|
|
|
|
+ DriveLetter := AnsiChar(DriveNum + DriveLetterOffset);
|
|
DrivePath := DriveLetter + ':\';
|
|
DrivePath := DriveLetter + ':\';
|
|
WinDriveType := GetDriveType(PChar(DrivePath));
|
|
WinDriveType := GetDriveType(PChar(DrivePath));
|
|
if WinDriveType = DRIVE_NO_ROOT_DIR then Continue;
|
|
if WinDriveType = DRIVE_NO_ROOT_DIR then Continue;
|
|
@@ -558,7 +576,7 @@ begin
|
|
begin
|
|
begin
|
|
DeviceId := EmptyStr;
|
|
DeviceId := EmptyStr;
|
|
Path := DrivePath;
|
|
Path := DrivePath;
|
|
- DisplayName := DriveLetter;
|
|
|
|
|
|
+ DisplayName := DriveLetter + OptionalColon;
|
|
DriveLabel := EmptyStr;
|
|
DriveLabel := EmptyStr;
|
|
FileSystem := EmptyStr;
|
|
FileSystem := EmptyStr;
|
|
IsMediaAvailable := True;
|
|
IsMediaAvailable := True;
|