Commit 56bc0515 authored by Alexander Kochetkov's avatar Alexander Kochetkov Committed by Alexandre Julliard

ole32/storage32: Fix return value for invalid access mode in OpenStream.

parent 75fde14f
......@@ -448,7 +448,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
if(!(This->openFlags & STGM_TRANSACTED)) {
if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( This->openFlags ) )
{
res = STG_E_ACCESSDENIED;
res = STG_E_INVALIDFLAG;
goto end;
}
}
......
......@@ -355,6 +355,19 @@ static void test_storage_stream(void)
r = IStorage_Release(stg);
ok(r == 0, "wrong ref count\n");
/* try create some invalid streams */
stg = NULL;
stm = NULL;
r = StgOpenStorage(filename, NULL, STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
ok(r == S_OK, "should succeed\n");
if (stg)
{
r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
ok(r == STG_E_INVALIDFLAG, "IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08x\n", r);
IStorage_Release(stg);
}
r = DeleteFileA(filenameA);
ok(r, "file should exist\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment