View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001037 | Double Commander | Graphical user interface | public | 2015-03-10 13:07 | 2018-10-27 22:10 |
Reporter | ondrejsv | Assigned To | |||
Priority | high | Severity | block | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Projection | none | ETA | none | ||
Platform | win32 | OS | Windows | OS Version | 8.0 |
Product Version | 0.6.0 | Product Build | 0.6.0 beta | ||
Summary | 0001037: App hangs after a network drive was disconnected | ||||
Description | Double Commander hangs when a network shared folder is being browsed on a tab and this shared folder gets unavailable (by moving to a second physicial location with sleep/wake up cycle). | ||||
Steps To Reproduce | Start the application and browse to a network share (e.g. on location one). Put the computer to sleep and move to a second location where the network share is no longer available. Wake up the computer and Double Commander now hangs. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
Operating system | Windows | ||||
Widgetset | |||||
Architecture | 32-bit | ||||
|
I use the following functions on Windows to quickly check if drive is available. If DoubleCommander used something like this every time before it tried to access the drive or at least on startup it would avoid long pauses with frozen user interface. function NetUseGetInfo(UncServerName: LPWSTR; UseName: LPWSTR; Level: DWORD; BufPtr: Pointer): DWORD; stdcall; external 'netapi32.dll' name 'NetUseGetInfo'; function NetApiBufferFree(Buffer: Pointer): DWORD; stdcall; external 'netapi32.dll' name 'NetApiBufferFree'; function NetworkDriveStatus(ADrive: char): integer; type PUSEINFO1 = ^TUSEINFO1; TUSEINFO1 = packed record ui1_local: PChar; ui1_remote: PChar; ui1_password: PChar; ui1_status: DWORD; ui1_asg_type: DWORD; ui1_refcount: DWORD; ui1_usecount: DWORD; end; var liER, liSZ: Cardinal; lpUI: PUSEINFO1; lsDrive, lsRemote: string; begin result := -1; if ADrive = #0 then Exit; lsDrive := ADrive + ':'; liER := NetUseGetInfo(nil, PChar(lsDrive), 1, @lpUI); if liER = 0 then begin result := lpUI.ui1_status; NetApiBufferFree(lpUI); end else begin liSZ := 2048; SetLength(lsRemote, liSZ); liER := WNetGetConnection(PChar(lsDrive), PChar(lsRemote), liSZ); result := liER; end; end; function DriveCharNo(Drive: Char): integer; begin Result := -1; Drive := Drive.ToUpper; if not (CharInSet(Drive, ['A'..'Z'])) then exit; Result := Ord(Drive) - Ord('A') + 1; end; function DiskInDrive(Drive: Char): Boolean; var ErrorMode: Word; DriveNo: integer; begin Result := false; DriveNo := DriveCharNo(Drive); if (DriveNo < 1) then exit; // turn off critical errors ErrorMode := SetErrorMode(SEM_FAILCRITICALERRORS); try if DiskSize(DriveNo) = -1 then Result := false else Result := true; finally SetErrorMode(ErrorMode); end; end; function GetDriveLetter(const Path: string): char; begin result := #0; if Path <> '' then begin if (Length(Path) > 5) and (Copy(Path, 1, 4) = '\\?\') and (Copy(Path, 6, 1) = ':') then result := Copy(Path, 5, 1)[1] else if (Length(Path) > 2) and (Path[2] = ':') then result := Path[1]; end; end; function DriveAvailable(DriveLetter: char): boolean; var lsDrive: string; begin lsDrive := IncludeTrailingPathDelimiter(DriveLetter + ':'); case GetDriveType(PChar(lsDrive)) of DRIVE_REMOVABLE, DRIVE_CDROM: result := DiskInDrive(DriveLetter); DRIVE_FIXED: result := SysUtils.DirectoryExists(lsDrive); DRIVE_REMOTE: result := NetworkDriveStatus(DriveLetter) = NO_ERROR; else result := false; end; end; |
|
See comment in related issue. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-03-10 13:07 | ondrejsv | New Issue | |
2017-02-23 12:58 | dmz73 | Note Added: 0002098 | |
2018-09-24 09:46 | Alexx2000 | Relationship added | related to 0001837 |
2018-10-27 22:09 | Alexx2000 | Note Added: 0002843 | |
2018-10-27 22:09 | Alexx2000 | Status | new => closed |
2018-10-27 22:09 | Alexx2000 | Resolution | open => fixed |
2018-10-27 22:10 | Alexx2000 | Note Edited: 0002843 |