[2/5] ole32: Don't use real synchronous locks for storage synchronization.

Vincent Povirk madewokherd at gmail.com
Tue Mar 10 16:31:37 CDT 2015


-------------- next part --------------
From a4f5927fef46a609a0ef225f8dd7204a13922250 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 10 Mar 2015 14:37:09 -0500
Subject: [PATCH 2/5] ole32: Don't use real synchronous locks for storage
 synchronization.

We need to add timeouts. This should be possible with a synchronous lock,
but it's sufficiently complicated that we probably shouldn't have two
implementations of it.
---
 dlls/ole32/filelockbytes.c | 18 ------------------
 dlls/ole32/storage32.c     |  5 -----
 dlls/ole32/storage32.h     |  2 --
 3 files changed, 25 deletions(-)

diff --git a/dlls/ole32/filelockbytes.c b/dlls/ole32/filelockbytes.c
index 7dc4843..594da1b 100644
--- a/dlls/ole32/filelockbytes.c
+++ b/dlls/ole32/filelockbytes.c
@@ -346,24 +346,6 @@ static HRESULT WINAPI FileLockBytesImpl_LockRegion(ILockBytes* iface,
     return get_lock_error();
 }
 
-HRESULT FileLockBytesImpl_LockRegionSync(ILockBytes* iface,
-    ULARGE_INTEGER libOffset, ULARGE_INTEGER cb)
-{
-    FileLockBytesImpl* This = impl_from_ILockBytes(iface);
-    OVERLAPPED ol;
-
-    if (iface->lpVtbl != &FileLockBytesImpl_Vtbl)
-        return E_NOTIMPL;
-
-    ol.hEvent = 0;
-    ol.u.s.Offset = libOffset.u.LowPart;
-    ol.u.s.OffsetHigh = libOffset.u.HighPart;
-
-    if (LockFileEx(This->hfile, LOCKFILE_EXCLUSIVE_LOCK, 0, cb.u.LowPart, cb.u.HighPart, &ol))
-        return S_OK;
-    return get_lock_error();
-}
-
 static HRESULT WINAPI FileLockBytesImpl_UnlockRegion(ILockBytes* iface,
     ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType)
 {
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 5e434e0..0a9b1ad 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -2876,11 +2876,6 @@ static HRESULT StorageImpl_LockRegionSync(StorageImpl *This, ULARGE_INTEGER offs
     HRESULT hr;
     int delay = 0;
 
-    /* if it's a FileLockBytesImpl use LockFileEx in blocking mode */
-    if (SUCCEEDED(FileLockBytesImpl_LockRegionSync(This->lockBytes, offset, cb)))
-        return S_OK;
-
-    /* otherwise we have to fake it based on an async lock */
     do
     {
         hr = ILockBytes_LockRegion(This->lockBytes, offset, cb, dwLockType);
diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h
index a49add9..e03bf31 100644
--- a/dlls/ole32/storage32.h
+++ b/dlls/ole32/storage32.h
@@ -159,8 +159,6 @@ struct DirEntry
 
 HRESULT FileLockBytesImpl_Construct(HANDLE hFile, DWORD openFlags, LPCWSTR pwcsName, ILockBytes **pLockBytes) DECLSPEC_HIDDEN;
 
-HRESULT FileLockBytesImpl_LockRegionSync(ILockBytes* iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb) DECLSPEC_HIDDEN;
-
 /*************************************************************************
  * Ole Convert support
  */
-- 
2.1.0



More information about the wine-patches mailing list