ole32/tests: Added a couple of simple tests for StgCreateStorageEx.

This commit is contained in:
Andrew Bogott 2010-11-09 04:28:20 -06:00 committed by Alexandre Julliard
parent 42cd791c4d
commit ddc5cbb371
1 changed files with 54 additions and 0 deletions

View File

@ -241,6 +241,59 @@ static void test_create_storage_modes(void)
ok(DeleteFileA(filenameA), "failed to delete file\n");
}
static void test_stgcreatestorageex(void)
{
HRESULT (WINAPI *pStgCreateStorageEx)(const WCHAR* pwcsName, DWORD grfMode, DWORD stgfmt, DWORD grfAttrs, STGOPTIONS* pStgOptions, void* reserved, REFIID riid, void** ppObjectOpen);
HMODULE hOle32 = GetModuleHandle("ole32");
IStorage *stg = NULL;
STGOPTIONS stgoptions = {1, 0, 4096};
HRESULT r;
pStgCreateStorageEx = (void *) GetProcAddress(hOle32, "StgCreateStorageEx");
if (!pStgCreateStorageEx)
{
win_skip("skipping test on NT4\n");
return;
}
DeleteFileA(filenameA);
/* Verify that StgCreateStorageEx can accept an options param */
r = pStgCreateStorageEx( filename,
STGM_SHARE_EXCLUSIVE | STGM_READWRITE,
STGFMT_DOCFILE,
0,
&stgoptions,
NULL,
&IID_IStorage,
(void **) &stg);
ok(r==S_OK || r==STG_E_UNIMPLEMENTEDFUNCTION, "StgCreateStorageEx with options failed\n");
if (r==STG_E_UNIMPLEMENTEDFUNCTION)
{
/* We're on win98 which means all bets are off. Let's get out of here. */
win_skip("skipping test on win9x\n");
return;
}
r = IStorage_Release(stg);
ok(r == 0, "storage not released\n");
ok(DeleteFileA(filenameA), "failed to delete file\n");
/* Verify that StgCreateStorageEx can accept a NULL pStgOptions */
r = pStgCreateStorageEx( filename,
STGM_SHARE_EXCLUSIVE | STGM_READWRITE,
STGFMT_STORAGE,
0,
NULL,
NULL,
&IID_IStorage,
(void **) &stg);
ok(r==S_OK, "StgCreateStorageEx with NULL options failed\n");
r = IStorage_Release(stg);
ok(r == 0, "storage not released\n");
ok(DeleteFileA(filenameA), "failed to delete file\n");
}
static void test_storage_stream(void)
{
static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 };
@ -2896,6 +2949,7 @@ START_TEST(storage32)
test_hglobal_storage_stat();
test_create_storage_modes();
test_stgcreatestorageex();
test_storage_stream();
test_open_storage();
test_storage_suminfo();