mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: Show Unicode UNC path for network drive as hint
This commit is contained in:
parent
67e4b6aabf
commit
82e72abe5c
2 changed files with 33 additions and 2 deletions
|
|
@ -898,7 +898,7 @@ begin
|
|||
dtFloppy:
|
||||
DriveLabel:= Path;
|
||||
dtNetwork:
|
||||
DriveLabel:= ExpandUNCFileName(Path);
|
||||
DriveLabel:= mbGetRemoteFileName(Path);
|
||||
else
|
||||
DriveLabel:= mbGetVolumeLabel(Name, True);
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@ procedure mbWaitLabelChange(const sDrv: UTF8String; const sCurLabel: UTF8String)
|
|||
@param(sDrv String specifying the root directory of a drive)
|
||||
}
|
||||
procedure mbCloseCD(const sDrv: UTF8String);
|
||||
{en
|
||||
Get remote file name by local file name
|
||||
@param(sLocalName String specifying the local file name)
|
||||
@returns(The function returns remote file name)
|
||||
}
|
||||
function mbGetRemoteFileName(const sLocalName: UTF8String): UTF8String;
|
||||
|
||||
function WinToDosTime (const Wtime: TFileTime; var DTime: LongInt): LongBool;
|
||||
function DosToWinTime (const DTime: LongInt; var Wtime: TFileTime): LongBool;
|
||||
|
|
@ -92,7 +98,7 @@ function DosToWinTime (const DTime: LongInt; var Wtime: TFileTime): LongBool;
|
|||
implementation
|
||||
|
||||
uses
|
||||
LCLProc, ShellAPI, MMSystem;
|
||||
LCLProc, ShellAPI, MMSystem, JwaWinNetWk;
|
||||
|
||||
function mciSendCommand(IDDevice: MCIDEVICEID; uMsg: UINT; fdwCommand: DWORD; dwParam: DWORD_PTR): MCIERROR; stdcall; external 'winmm.dll' name 'mciSendCommandA';
|
||||
|
||||
|
|
@ -190,6 +196,31 @@ begin
|
|||
mciSendCommand(OpenParms.wDeviceID, MCI_CLOSE, MCI_OPEN_TYPE or MCI_OPEN_ELEMENT, DWORD_PTR(@OpenParms));
|
||||
end;
|
||||
|
||||
function mbGetRemoteFileName(const sLocalName: UTF8String): UTF8String;
|
||||
var
|
||||
wsLocalName: WideString;
|
||||
dwResult,
|
||||
lpBufferSize: DWORD;
|
||||
lpBuffer: PUniversalNameInfoW;
|
||||
begin
|
||||
Result:= sLocalName;
|
||||
wsLocalName:= UTF8Decode(sLocalName);
|
||||
lpBufferSize:= SizeOf(TUniversalNameInfoW);
|
||||
GetMem(lpBuffer, lpBufferSize);
|
||||
try
|
||||
dwResult:= WNetGetUniversalNameW(PWideChar(wsLocalName), UNIVERSAL_NAME_INFO_LEVEL, lpBuffer, lpBufferSize);
|
||||
if dwResult = ERROR_MORE_DATA then
|
||||
begin
|
||||
lpBuffer:= ReallocMem(lpBuffer, lpBufferSize);
|
||||
dwResult:= WNetGetUniversalNameW(PWideChar(wsLocalName), UNIVERSAL_NAME_INFO_LEVEL, lpBuffer, lpBufferSize);
|
||||
end;
|
||||
if dwResult = NO_ERROR then
|
||||
Result:= UTF8Encode(WideString(lpBuffer^.lpUniversalName));
|
||||
finally
|
||||
FreeMem(lpBuffer);
|
||||
end;
|
||||
end;
|
||||
|
||||
function WinToDosTime (const Wtime: TFileTime; var DTime: LongInt): LongBool;
|
||||
var
|
||||
lft : TFileTime;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue