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

This commit is contained in:
Alexander Kochetkov 2009-12-30 03:54:20 +03:00 committed by Alexandre Julliard
parent 75fde14ffc
commit 56bc0515c2
2 changed files with 14 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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");
}