[v3 PATCH] shell32: Implement SHCreateSessionKey.

Dmitry Timoshkov dmitry at baikal.ru
Wed Apr 18 23:33:28 CDT 2018


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

> +    static const WCHAR session_format[] = {
> +                'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
> +                'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
> +                'E','x','p','l','o','r','e','r','\\','S','e','s','s','i','o','n','I','n','f','o','\\','%','d',0};
> +    DWORD session;

'session' is unsigned, 'session_format' should use appropriate format specifier.

> +    WCHAR sessionW[MAX_PATH];

Why MAX_PATH?

> +    static WCHAR session_reg_str[sizeof(session_format) + 16];
> +
> +    if(hkey)
> +        *hkey = NULL;
> +
> +    if(!access)
> +        return E_ACCESSDENIED;
> +
> +    if(!ProcessIdToSessionId( GetCurrentProcessId(), &session))
> +        return E_INVALIDARG;

Please add a space after 'if' as in the original patch, and remove a stray
space after '('. Same comment applies for the tests.

> +    sprintfW(session_reg_str, session_format, session);
> +
> +    TRACE("using session key %s\n", debugstr_w(session_reg_str));
> +    return RegCreateKeyExW(HKEY_CURRENT_USER, session_reg_str, 0, NULL,
> +                        REG_OPTION_VOLATILE, access, NULL, hkey, NULL);

REG_OPTION_VOLATILE indentation should be aligned as in the original patch.

-- 
Dmitry.



More information about the wine-devel mailing list