[PATCH] shell32/tests: Basic tests for SHCreateSessionKey()

Nikolay Sivov nsivov at codeweavers.com
Sun Dec 27 07:26:18 CST 2015


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/shell32/tests/shellole.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c
index 71ba477..e8cf744 100644
--- a/dlls/shell32/tests/shellole.c
+++ b/dlls/shell32/tests/shellole.c
@@ -75,6 +75,7 @@ static HRESULT (WINAPI *pSHPropStgReadMultiple)(IPropertyStorage*, UINT,
 static HRESULT (WINAPI *pSHPropStgWriteMultiple)(IPropertyStorage*, UINT*,
         ULONG, const PROPSPEC*, PROPVARIANT*, PROPID);
 static HRESULT (WINAPI *pSHCreateQueryCancelAutoPlayMoniker)(IMoniker**);
+static HRESULT (WINAPI *pSHCreateSessionKey)(REGSAM, HKEY*);
 
 static void init(void)
 {
@@ -84,6 +85,7 @@ static void init(void)
     pSHPropStgReadMultiple = (void*)GetProcAddress(hmod, "SHPropStgReadMultiple");
     pSHPropStgWriteMultiple = (void*)GetProcAddress(hmod, "SHPropStgWriteMultiple");
     pSHCreateQueryCancelAutoPlayMoniker = (void*)GetProcAddress(hmod, "SHCreateQueryCancelAutoPlayMoniker");
+    pSHCreateSessionKey = (void*)GetProcAddress(hmod, (char*)723);
 }
 
 static HRESULT WINAPI PropertyStorage_QueryInterface(IPropertyStorage *This,
@@ -858,6 +860,36 @@ static void test_DragQueryFile(void)
 }
 #undef DROPTEST_FILENAME
 
+static void test_SHCreateSessionKey(void)
+{
+    HKEY hkey, hkey2;
+    HRESULT hr;
+
+    if (!pSHCreateSessionKey)
+    {
+        skip("SHCreateSessionKey is not implemented\n");
+        return;
+    }
+
+if (0) /* crashes on native */
+    hr = pSHCreateSessionKey(KEY_READ, NULL);
+
+    hkey = (HKEY)0xdeadbeef;
+    hr = pSHCreateSessionKey(0, &hkey);
+    ok(hr == E_ACCESSDENIED, "got 0x%08x\n", hr);
+    ok(hkey == NULL, "got %p\n", hkey);
+
+    hr = pSHCreateSessionKey(KEY_READ, &hkey);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    hr = pSHCreateSessionKey(KEY_READ, &hkey2);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hkey != hkey2, "got %p, %p\n", hkey, hkey2);
+
+    RegCloseKey(hkey);
+    RegCloseKey(hkey2);
+}
+
 START_TEST(shellole)
 {
     init();
@@ -865,4 +897,5 @@ START_TEST(shellole)
     test_SHPropStg_functions();
     test_SHCreateQueryCancelAutoPlayMoniker();
     test_DragQueryFile();
+    test_SHCreateSessionKey();
 }
-- 
2.6.4




More information about the wine-patches mailing list