[process] add a timeout for the process search

* The process search appears to be blocking on some platform, and we
  also don't want users to have to wait too long on format startup
* Also update the update check for Windows XP SSL errors
This commit is contained in:
Pete Batard 2017-07-20 17:42:53 +01:00
parent 5c3437f6de
commit 4617ba786d
6 changed files with 72 additions and 35 deletions

View file

@ -153,7 +153,7 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
bWriteShare = TRUE;
// Try to report the process that is locking the drive
// We also use bit 6 as a flag to indicate that SearchProcess was called.
access_mask = SearchProcess(DevPath, TRUE, TRUE, FALSE) | 0x40;
access_mask = SearchProcess(DevPath, 5000, TRUE, TRUE, FALSE) | 0x40;
}
Sleep(DRIVE_ACCESS_TIMEOUT / DRIVE_ACCESS_RETRIES);
}
@ -184,7 +184,7 @@ static HANDLE GetHandle(char* Path, BOOL bLockDrive, BOOL bWriteAccess, BOOL bWr
uprintf("Could not lock access to %s: %s", Path, WindowsErrorString());
// See if we can report the processes are accessing the drive
if (!IS_ERROR(FormatStatus) && (access_mask == 0))
access_mask = SearchProcess(DevPath, TRUE, TRUE, FALSE);
access_mask = SearchProcess(DevPath, 5000, TRUE, TRUE, FALSE);
// Try to continue if the only access rights we saw were for read-only
if ((access_mask & 0x07) != 0x01)
safe_closehandle(hDrive);