[v2 PATCH] shell32: Implement SHCreateSessionKey.

Alexandre Julliard julliard at winehq.org
Wed Apr 18 04:27:09 CDT 2018


Alistair Leslie-Hughes <leslie_alistair at hotmail.com> writes:

>  HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey)
>  {
> -    FIXME("stub: %d %p\n", access, hkey);
> -    *hkey = NULL;
> -    return E_NOTIMPL;
> +    static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
> +    static WCHAR session_reg_str[MAX_PATH];
> +
> +    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);

I'd suggest to always use RegCreateKeyExW and get rid of the init once
part.

> +    /* Check the registery */
> +    ProcessIdToSessionId( GetCurrentProcessId(), &session);
> +    wsprintfW(sessionW, session_format, session);
> +
> +    ret = RegOpenKeyW(HKEY_CURRENT_USER, sessionW, &hkey);
> +    /* Fails on XP and w2k3, SHGetPathFromIDListEx available for Vista+ */
> +    ok(!ret || (ret && !pSHGetPathFromIDListEx), "key not found\n");

SHGetPathFromIDListEx doesn't seem related to this function. This could
be a simple broken(), or even better a check for the different location
presumably used in XP.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list