ole32: Use pstgPriority if specified in StgOpenStorage.
This commit is contained in:
parent
cdc03fa9b8
commit
2e384c4f95
|
@ -7609,11 +7609,21 @@ HRESULT WINAPI StgOpenStorage(
|
|||
HANDLE hFile = 0;
|
||||
DWORD shareMode;
|
||||
DWORD accessMode;
|
||||
LPWSTR temp_name = NULL;
|
||||
|
||||
TRACE("(%s, %p, %x, %p, %d, %p)\n",
|
||||
debugstr_w(pwcsName), pstgPriority, grfMode,
|
||||
snbExclude, reserved, ppstgOpen);
|
||||
|
||||
if (pstgPriority)
|
||||
{
|
||||
/* FIXME: Copy ILockBytes instead? But currently for STGM_PRIORITY it'll be read-only. */
|
||||
hr = StorageBaseImpl_GetFilename((StorageBaseImpl*)pstgPriority, &temp_name);
|
||||
if (FAILED(hr)) goto end;
|
||||
pwcsName = temp_name;
|
||||
TRACE("using filename %s\n", debugstr_w(temp_name));
|
||||
}
|
||||
|
||||
if (pwcsName == 0)
|
||||
{
|
||||
hr = STG_E_INVALIDNAME;
|
||||
|
@ -7775,6 +7785,8 @@ HRESULT WINAPI StgOpenStorage(
|
|||
*ppstgOpen = &newStorage->IStorage_iface;
|
||||
|
||||
end:
|
||||
CoTaskMemFree(temp_name);
|
||||
if (pstgPriority) IStorage_Release(pstgPriority);
|
||||
TRACE("<-- %08x, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL);
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -929,7 +929,48 @@ static void test_storage_refcount(void)
|
|||
r = IStorage_Release(stg);
|
||||
ok(r == 0, "wrong ref count\n");
|
||||
}
|
||||
IStorage_Release(stgprio);
|
||||
|
||||
/* Multiple STGM_PRIORITY opens are possible. */
|
||||
r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg);
|
||||
ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
|
||||
if(stg)
|
||||
{
|
||||
r = IStorage_Release(stg);
|
||||
ok(r == 0, "wrong ref count\n");
|
||||
}
|
||||
|
||||
r = StgOpenStorage( NULL, stgprio, STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE, NULL, 0, &stg);
|
||||
ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
|
||||
if(stg)
|
||||
{
|
||||
static const WCHAR stgname[] = { ' ',' ',' ','2','9',0 };
|
||||
IStorage *stg2;
|
||||
STATSTG statstg;
|
||||
|
||||
r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
|
||||
ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r);
|
||||
ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
|
||||
ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %d\n", U(statstg.cbSize).LowPart);
|
||||
ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %d\n", U(statstg.cbSize).HighPart);
|
||||
ok(statstg.grfMode == (STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE),
|
||||
"Statstg grfMode should have been 0x10022 instead of 0x%x\n", statstg.grfMode);
|
||||
ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
|
||||
ok(IsEqualCLSID(&statstg.clsid, &test_stg_cls), "Statstg clsid is not test_stg_cls\n");
|
||||
ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
|
||||
ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
|
||||
|
||||
r = IStorage_CreateStorage( stg, stgname, STGM_SHARE_EXCLUSIVE, 0, 0, &stg2 );
|
||||
ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08x\n", r);
|
||||
|
||||
IStorage_Release(stg2);
|
||||
|
||||
r = IStorage_Commit( stg, 0 );
|
||||
ok(r == S_OK, "Commit should have succeeded instead of returning 0x%08x\n", r);
|
||||
|
||||
r = IStorage_Release(stg);
|
||||
ok(r == 0, "wrong ref count\n");
|
||||
}
|
||||
/* IStorage_Release(stgprio) not necessary because StgOpenStorage released it. */
|
||||
|
||||
DeleteFileA(filenameA);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue