Nikolay Sivov : shell32/tests: Basic tests for SHCreateSessionKey().

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 29 15:49:00 CST 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Dec 27 16:26:18 2015 +0300

shell32/tests: Basic tests for SHCreateSessionKey().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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




More information about the wine-cvs mailing list