ole32: Add a 20 second timeout when attempting to grab locks.

This commit is contained in:
Vincent Povirk 2015-03-10 14:47:33 -05:00 committed by Alexandre Julliard
parent 1645f7b9e3
commit eead04803f
1 changed files with 6 additions and 0 deletions

View File

@ -2875,6 +2875,7 @@ static HRESULT StorageImpl_LockRegionSync(StorageImpl *This, ULARGE_INTEGER offs
{
HRESULT hr;
int delay = 0;
DWORD start_time = GetTickCount();
do
{
@ -2882,6 +2883,11 @@ static HRESULT StorageImpl_LockRegionSync(StorageImpl *This, ULARGE_INTEGER offs
if (hr == STG_E_ACCESSDENIED || hr == STG_E_LOCKVIOLATION)
{
if (GetTickCount() - start_time >= 20000)
{
/* timeout */
break;
}
Sleep(delay);
if (delay < 150) delay++;
}