Re: [1/2] reg: Implement basic 'reg add'. [try 2]
"Andrew Riedi" <andrewriedi(a)gmail.com> writes:
+{ + LPCTSTR lpSubKey;
Please don't use TCHAR types.
+ static const WCHAR hkcrW[] = {'h','k','c','r',0}; + static const WCHAR hkcuW[] = {'h','k','c','u',0}; + static const WCHAR hklmW[] = {'h','k','l','m',0}; + static const WCHAR hkuW[] = {'h','k','u',0}; + static const WCHAR hkpdW[] = {'h','k','p','d',0}; + static const WCHAR hkccW[] = {'h','k','c','c',0}; + static const WCHAR hkddW[] = {'h','k','d','d',0}; + + /* Determine key type. */ + if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 4, hkcrW, 4) == CSTR_EQUAL) + *hKey = HKEY_CLASSES_ROOT; + else if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 4, hkcuW, 4) == CSTR_EQUAL) + *hKey = HKEY_CURRENT_USER; + else if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 4, hklmW, 4) == CSTR_EQUAL) + *hKey = HKEY_LOCAL_MACHINE; + else if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 3, hkuW, 3) == CSTR_EQUAL) + *hKey = HKEY_USERS; + else if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 4, hkpdW, 4) == CSTR_EQUAL) + *hKey = HKEY_PERFORMANCE_DATA; + else if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 4, hkccW, 4) == CSTR_EQUAL) + *hKey = HKEY_CURRENT_CONFIG; + else if (CompareString(LOCALE_NEUTRAL, NORM_IGNORECASE, key_name, 4, hkddW, 4) == CSTR_EQUAL) + *hKey = HKEY_DYN_DATA;
You should use some sort of array instead of duplicating all that code, and you need to check the next character of the string too. -- Alexandre Julliard julliard(a)winehq.org
participants (1)
-
Alexandre Julliard