[1/3] ole32: Warn in cases where we might corrupt storage files.

Vincent Povirk madewokherd at gmail.com
Thu May 8 15:17:37 CDT 2014


This case (where two programs open a storage in transacted mode at
once and commit to it) is really hard to support safely (probably
comparable to the original transacted implementation), and I don't
know if anything really uses it, so I'm adding a fixme so I can find
out. The FIXME means we could potentially corrupt something, and the
ERR means we probably did.

AFAICT this has been broken forever, and my recent work hasn't made it
any worse. So, if we decided to fail in the ERR case it would protect
users' data but could in theory cause regressions. But I'm not sure
I'd be against it.
-------------- next part --------------
From e832e5cccd9091ba959d4eefa7dc096ed449b981 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Thu, 8 May 2014 13:34:38 -0500
Subject: [PATCH 1/3] ole32: Warn in cases where we might corrupt storage
 files.

---
 dlls/ole32/storage32.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 7f1affb..a71ec41 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -4992,6 +4992,8 @@ static HRESULT WINAPI TransactedSnapshotImpl_Commit(
     {
       if ((grfCommitFlags & STGC_ONLYIFCURRENT) && transactionSig != This->lastTransactionSig)
         hr = STG_E_NOTCURRENT;
+      else if (transactionSig != This->lastTransactionSig)
+        ERR("proceeding with unsafe commit\n");
 
       if (SUCCEEDED(hr))
       {
@@ -5546,6 +5548,12 @@ static HRESULT Storage_Construct(
 
   if (openFlags & STGM_TRANSACTED)
   {
+    static int fixme;
+
+    if (STGM_SHARE_MODE(openFlags) != STGM_SHARE_DENY_WRITE &&
+        STGM_SHARE_MODE(openFlags) != STGM_SHARE_EXCLUSIVE && !fixme++)
+        FIXME("transacted storage write sharing not implemented safely\n");
+
     hr = Storage_ConstructTransacted(&newStorage->base, &newTransactedStorage);
     if (FAILED(hr))
       IStorage_Release(&newStorage->base.IStorage_iface);
-- 
1.8.3.2



More information about the wine-patches mailing list