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

Alexandre Julliard julliard at winehq.org
Thu Nov 18 11:09:31 CST 2010


Module: wine
Branch: master
Commit: ddc5cbb3711cf0624b4346449142c6d96833e931
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ddc5cbb3711cf0624b4346449142c6d96833e931

Author: Andrew Bogott <andrew at CodeWeavers.com>
Date:   Tue Nov  9 04:28:20 2010 -0600

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

---

 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();




More information about the wine-cvs mailing list