Added a couple of simple tests for StgCreateStorageEx.

Andrew Bogott andrew at CodeWeavers.com
Tue Nov 9 04:28:20 CST 2010


---
 dlls/ole32/tests/storage32.c |   54 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 9bd8f33..bf3402d 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -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();
-- 
1.6.5


--------------020408020300090801060008--



More information about the wine-patches mailing list