[Wine-patches] [eterhack] shell32: Implement SHCreateSessionKey.
Dmitry Timoshkov
dtimoshkov на etersoft.ru
Вт Мар 4 06:20:21 MSK 2014
This implementation is based on the Geoff Chappell description.
---
dlls/shell32/shell32.spec | 1 +
dlls/shell32/shellreg.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index 5044479..32dd0cd 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -261,6 +261,7 @@
704 stdcall -noname GUIDFromStringW(wstr ptr)
709 stdcall SHGetSetFolderCustomSettings(ptr str long)
714 stdcall @(ptr) SHELL32_714 # PathIsTemporaryW
+ 723 stdcall SHCreateSessionKey(long ptr)
727 stdcall SHGetImageList(long ptr ptr)
730 stdcall -noname RestartDialogEx(long wstr long long)
743 stdcall SHCreateFileExtractIconW(wstr long ptr ptr)
diff --git a/dlls/shell32/shellreg.c b/dlls/shell32/shellreg.c
index 37f3d9e..96a450e 100644
--- a/dlls/shell32/shellreg.c
+++ b/dlls/shell32/shellreg.c
@@ -147,3 +147,44 @@ HRESULT WINAPI SHRegCloseKey (HKEY hkey)
TRACE("%p\n",hkey);
return RegCloseKey( hkey );
}
+
+static const char session_reg_key[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\";
+
+static BOOL WINAPI create_session_key(INIT_ONCE *once, void *param, void **context)
+{
+ static const char desktop_guid[] = "__wine_display_device_guid";
+ ATOM guid_atom;
+ HKEY hkey_session;
+ LPWSTR session_reg_str = param;
+
+ guid_atom = HandleToULong(GetPropA(GetDesktopWindow(), desktop_guid));
+ if (!guid_atom) return FALSE;
+
+ MultiByteToWideChar(CP_ACP, 0, session_reg_key, sizeof(session_reg_key), session_reg_str, sizeof(session_reg_key));
+
+ if (!GlobalGetAtomNameW(guid_atom, session_reg_str + sizeof(session_reg_key) - 1, 39))
+ return FALSE;
+
+ if (RegCreateKeyExW(HKEY_CURRENT_USER, session_reg_str, 0, NULL,
+ REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hkey_session, NULL))
+ return FALSE;
+
+ RegCloseKey(hkey_session);
+ TRACE("session key %s\n", debugstr_w(session_reg_str));
+ return TRUE;
+}
+
+/*************************************************************************
+ * SHCreateSessionKey [SHELL32.723]
+ *
+ */
+HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey)
+{
+ static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
+ static WCHAR session_reg_str[sizeof(session_reg_key) + 39];
+
+ InitOnceExecuteOnce(&init_once, create_session_key, session_reg_str, NULL);
+
+ TRACE("using session key %s\n", debugstr_w(session_reg_str));
+ return RegOpenKeyExW(HKEY_CURRENT_USER, session_reg_str, 0, access, hkey);
+}
--
1.8.5.5
Подробная информация о списке рассылки Wine-patches