Commit 2e4954eb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32/tests: Basic tests for SHCreateSessionKey().

parent 3b48ba6c
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment