<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>

<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr"><br>


<div><div dir="ltr">

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">Hi,<br><br>Jonathan clearly mentionned he is not interested in wine development anymore though and did not respond to Alexandre.<br>I dont think I can do much more now that the paches are reviewed and (finally) correctly transmitted.<br>I hope AJ will consider looking at it someday.<br><br>Regards<br><br><div>> Subject: Re: [PATCH 1/2] reg: simplify root key search<br>> To: xantares09@hotmail.com; wine-devel@winehq.org<br>> From: stefandoesinger@gmail.com<br>> Date: Tue, 15 Sep 2015 11:38:21 +0200<br>> <br>> -----BEGIN PGP SIGNED MESSAGE-----<br>> Hash: SHA256<br>> <br>> Hi,<br>> <br>> Those patches look OK to me, and I've informed Alexandre on IRC about<br>> that. My guess is that he'd prefer if the original author (Jonathan)<br>> sent the code. I can't give any guarantees about that though, I can't<br>> look into Alexandre's mind.<br>> <br>> Cheers,<br>> Stefan<br>> <br>> Am 2015-09-14 um 15:18 schrieb Michel Zou:<br>> > Hi,<br>> > <br>> > Are those patches still ok ? I did not see a reply on wine-devel,<br>> > did I miss something ?<br>> > <br>> > M<br>> > <br>> >> Subject: Re: [PATCH 1/2] reg: simplify root key search To:<br>> >> wine-devel@winehq.org CC: xantares09@hotmail.com From:<br>> >> stefandoesinger@gmail.com Date: Fri, 4 Sep 2015 12:25:57 +0200<br>> >> <br>> > Hi,<br>> > <br>> > Thanks, this time the patches apply OK for me. I've told Alexandre<br>> >> that the patches look OK to me, let's see what he says.<br>> > <br>> > Cheers, Stefan<br>> > <br>> > Am 2015-09-03 um 21:51 schrieb Michel Zou:<br>> >> Split patch from Jonathan Vollebregt:<br>> > <br>> >> https://github.com/jnvsor/wine/commit/ea0e2fc70db6ce4904655ea4a27ee34531d96712<br>> >><br>> >> <br>> - ---<br>> >> programs/reg/reg.c | 85 <br>> >> +++++++++++++++++++++++++++--------------------------- 1 file<br>> >> changed, 43 insertions(+), 42 deletions(-)<br>> > <br>> >> diff --git a/programs/reg/reg.c b/programs/reg/reg.c index<br>> >> 4ec25bc..0f28b63 100644 --- a/programs/reg/reg.c +++<br>> >> b/programs/reg/reg.c @@ -22,6 +22,32 @@<br>> > <br>> >> #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A))<br>> > <br>> >> +static const WCHAR short_hklm[] = {'H','K','L','M',0}; +static<br>> >> const WCHAR short_hkcu[] = {'H','K','C','U',0}; +static const<br>> >> WCHAR short_hkcr[] = {'H','K','C','R',0}; +static const WCHAR<br>> >> short_hku[] = {'H','K','U',0}; +static const WCHAR short_hkcc[] =<br>> >> {'H','K','C','C',0}; +static const WCHAR long_hklm[] = <br>> >> {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0};<br>> >><br>> >> <br>> +static const WCHAR long_hkcu[] =<br>> >> {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0};<br>> >><br>> >> <br>> +static const WCHAR long_hkcr[] =<br>> >> {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0};<br>> >><br>> >> <br>> +static const WCHAR long_hku[] =<br>> >> {'H','K','E','Y','_','U','S','E','R','S',0}; +static const WCHAR<br>> >> long_hkcc[] = <br>> >> {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0};<br>> >><br>> >> <br>> +<br>> >> +static const struct +{ + HKEY key; + const WCHAR *short_name; +<br>> >> const WCHAR *long_name; +} +root_rels[] = +{ +<br>> >> {HKEY_LOCAL_MACHINE, short_hklm, long_hklm}, +<br>> >> {HKEY_CURRENT_USER, short_hkcu, long_hkcu}, + {HKEY_CLASSES_ROOT,<br>> >> short_hkcr, long_hkcr}, + {HKEY_USERS, short_hku, long_hku}, +<br>> >> {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, +}; + static const<br>> >> WCHAR type_none[] = {'R','E','G','_','N','O','N','E',0}; static<br>> >> const WCHAR type_sz[] = {'R','E','G','_','S','Z',0}; static const<br>> >> WCHAR type_expand_sz[] = <br>> >> {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; @@<br>> >> -95,51 +121,26 @@ static int reg_message(int msg) return<br>> >> reg_printfW(formatW, msg_buffer); }<br>> > <br>> >> -static int reg_StrCmpNIW(LPCWSTR str, LPCWSTR comp, int len) <br>> >> +static inline BOOL path_rootname_cmp(const WCHAR *input_path,<br>> >> const WCHAR *rootkey_name) { - int i; + DWORD length =<br>> >> strlenW(rootkey_name);<br>> > <br>> >> - for (i = 0; i < len; i++) - { - if (!str[i]) - { - len = i +<br>> >> 1; - break; - } - } - - return CompareStringW(CP_ACP,<br>> >> NORM_IGNORECASE, str, len, comp, len) - CSTR_EQUAL; + return<br>> >> (!strncmpiW(input_path, rootkey_name, length) && +<br>> >> (input_path[length] == 0 || input_path[length] == '\\')); }<br>> > <br>> >> -static HKEY get_rootkey(LPWSTR key) +static HKEY<br>> >> path_get_rootkey(const WCHAR *path) { - static const WCHAR<br>> >> szHKLM[] = {'H','K','L','M',0}; - static const WCHAR<br>> >> szHKEY_LOCAL_MACHINE[] = <br>> >> {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0};<br>> >><br>> >> <br>> - - static const WCHAR szHKCU[] = {'H','K','C','U',0};<br>> >> - static const WCHAR szHKEY_CURRENT_USER[] = <br>> >> {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0};<br>> >><br>> >> <br>> - - static const WCHAR szHKCR[] = {'H','K','C','R',0};<br>> >> - static const WCHAR szHKEY_CLASSES_ROOT[] = <br>> >> {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0};<br>> >><br>> >> <br>> - - static const WCHAR szHKU[] = {'H','K','U',0};<br>> >> - static const WCHAR szHKEY_USERS[] = <br>> >> {'H','K','E','Y','_','U','S','E','R','S',0}; - static const WCHAR<br>> >> szHKCC[] = {'H','K','C','C',0}; - static const WCHAR<br>> >> szHKEY_CURRENT_CONFIG[] = <br>> >> {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0};<br>> >><br>> >> <br>> - -<br>> >> - if (!reg_StrCmpNIW(key, szHKLM, 4) || - !reg_StrCmpNIW(key,<br>> >> szHKEY_LOCAL_MACHINE, 18)) - return HKEY_LOCAL_MACHINE; - else if<br>> >> (!reg_StrCmpNIW(key, szHKCU, 4) || - !reg_StrCmpNIW(key,<br>> >> szHKEY_CURRENT_USER, 17)) - return HKEY_CURRENT_USER; - else if<br>> >> (!reg_StrCmpNIW(key, szHKCR, 4) || - !reg_StrCmpNIW(key,<br>> >> szHKEY_CLASSES_ROOT, 17)) - return HKEY_CLASSES_ROOT; - else if<br>> >> (!reg_StrCmpNIW(key, szHKU, 3) || - !reg_StrCmpNIW(key,<br>> >> szHKEY_USERS, 10)) - return HKEY_USERS; - else if<br>> >> (!reg_StrCmpNIW(key, szHKCC, 4) || - !reg_StrCmpNIW(key,<br>> >> szHKEY_CURRENT_CONFIG, 19)) - return HKEY_CURRENT_CONFIG; - else<br>> >> return NULL; + DWORD i; + + for (i = 0; i <<br>> >> ARRAY_SIZE(root_rels); i++) + { + if (path_rootname_cmp(path,<br>> >> root_rels[i].short_name) || + path_rootname_cmp(path,<br>> >> root_rels[i].long_name)) + return root_rels[i].key; + } + +<br>> >> return NULL; }<br>> > <br>> >> static DWORD wchar_get_type(const WCHAR *type_name) @@ -237,7<br>> >> +238,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name,<br>> >> BOOL value_empty, } p++;<br>> > <br>> >> - root = get_rootkey(key_name); + root =<br>> >> path_get_rootkey(key_name); if (!root) { <br>> >> reg_message(STRING_INVALID_KEY); @@ -307,7 +308,7 @@ static int<br>> >> reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, <br>> >> } p++;<br>> > <br>> >> - root = get_rootkey(key_name); + root =<br>> >> path_get_rootkey(key_name); if (!root) { <br>> >> reg_message(STRING_INVALID_KEY);<br>> > <br>> > <br>> -----BEGIN PGP SIGNATURE-----<br>> Version: GnuPG v2<br>> <br>> iQIcBAEBCAAGBQJV9+cNAAoJEN0/YqbEcdMwaSEP/0DplIaF0ppoxF8ILAoGiZv/<br>> vRuinCBw3i/QwQwy7SNtrlm+Utj5o/g1OIMkedPBbgVvRTPKGfwahbw9rykr4DnD<br>> akaQHBfjvxVLT4XxKwoi+uGDyKEfkrEgSMq8Nc0+GB5MjJi4jHCgA1LAMp9r5J7t<br>> OSRbbPKprQUALRT4LzKCah/yXXMKz8qBjQ4SDldAbxEm8UiEpJJe1NL2WfIJAsTT<br>> tasBTT+8gs2aBJsO4LARrNRpAXojHpzvOAihDiCr782t3ZsPUg8gVr4d9Wp7xx+c<br>> 9X/xpbygEZQ3Icwa8/7kuClHvU8UXhJBcgt3FyPPux/lMgiRSlDM/uUEthDYOzB0<br>> xxyhx9tOW5led+40IfBlp94d6E9HKmaOzcbbCU8y+bv20eN5lMGNH9EH3QKZv8R6<br>> AniBoPp+AVokFuvmPPC7DKxqHrYJR2+TRm2iIPIdfxvDbo5/O0jfh5zpOvlk64dK<br>> hecpYVyZNTwDdCZPkkts6Y0PfOTB+rC5sR1Hx75nO3TWXKDtVQawFPdqMrnfJdCP<br>> TH6wUXXlas9HI5/KyzyWU9i6IcDnzhEVpUbmVLtgpfCGLU0lXUBmK6qa7mboRxD2<br>> DpMSbwsEU/Dwc0YKXM1B2F5dmkgsjtQ7pdkEjwLvn2pKn3QBKkLEjcarNWWXPptO<br>> MENLGfZu3FJOFXu0CwKH<br>> =MV7q<br>> -----END PGP SIGNATURE-----<br></div></div>
                                          </div>
<br></div></div>
                                          </div></body>
</html>