From eed120995b629bda0b7e4b863c2b36d77c55f120 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 3 Apr 2006 18:52:11 +0900 Subject: [PATCH] ole32: STGM_PRIORITY implies STGM_SHARE_EXCLUSIVE. --- dlls/ole32/storage32.c | 9 ++++++++- dlls/ole32/tests/storage32.c | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index bbb2d3cde7a..ef6b248f3a4 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -5908,10 +5908,17 @@ HRESULT WINAPI StgOpenStorage( goto end; } + /* STGM_PRIORITY implies exclusive access */ + if (grfMode & STGM_PRIORITY) + { + grfMode &= ~0xf0; /* remove the existing sharing mode */ + grfMode |= STGM_SHARE_EXCLUSIVE; + } + /* * Validate the sharing mode */ - if (!(grfMode & (STGM_TRANSACTED|STGM_PRIORITY))) + if (!(grfMode & STGM_TRANSACTED)) switch(STGM_SHARE_MODE(grfMode)) { case STGM_SHARE_EXCLUSIVE: diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 7ed965594cd..d9668a5c76b 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -474,6 +474,13 @@ static void test_open_storage(void) if (stg) IStorage_Release(stg); + /* open like Project 2003 */ + stg = NULL; + r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg); + ok(r == S_OK, "should succeed\n"); + if (stg) + IStorage_Release(stg); + r = DeleteFileW(filename); ok(r, "file didn't exist\n"); } -- 2.11.4.GIT