diff --git a/reactos/base/applications/cmdutils/reg/reg.c b/reactos/base/applications/cmdutils/reg/reg.c index 8e948672603..b7144eae51c 100644 --- a/reactos/base/applications/cmdutils/reg/reg.c +++ b/reactos/base/applications/cmdutils/reg/reg.c @@ -44,6 +44,10 @@ static int reg_printfW(const WCHAR *msg, ...) DWORD len; char *msgA; + /* On Windows WriteConsoleW() fails if the output is redirected. So fall + * back to WriteFile(), assuming the console encoding is still the right + * one in that case. + */ len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen, NULL, 0, NULL, NULL); msgA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(char)); @@ -72,20 +76,30 @@ static int reg_message(int msg) static HKEY get_rootkey(LPWSTR key) { static const WCHAR szHKLM[] = {'H','K','L','M',0}; + static const WCHAR szHKEY_LOCAL_MACHINE[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; static const WCHAR szHKCU[] = {'H','K','C','U',0}; + static const WCHAR szHKEY_CURRENT_USER[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; static const WCHAR szHKCR[] = {'H','K','C','R',0}; + static const WCHAR szHKEY_CLASSES_ROOT[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; static const WCHAR szHKU[] = {'H','K','U',0}; + static const WCHAR szHKEY_USERS[] = {'H','K','E','Y','_','U','S','E','R','S',0}; static const WCHAR szHKCC[] = {'H','K','C','C',0}; + static const WCHAR szHKEY_CURRENT_CONFIG[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; - if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKLM,4)==2) + if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKLM,4)==CSTR_EQUAL || + CompareStringW(CP_ACP,NORM_IGNORECASE,key,18,szHKEY_LOCAL_MACHINE,18)==CSTR_EQUAL) return HKEY_LOCAL_MACHINE; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCU,4)==2) + else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCU,4)==CSTR_EQUAL || + CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CURRENT_USER,17)==CSTR_EQUAL) return HKEY_CURRENT_USER; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCR,4)==2) + else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCR,4)==CSTR_EQUAL || + CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CLASSES_ROOT,17)==CSTR_EQUAL) return HKEY_CLASSES_ROOT; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,3,szHKU,3)==2) + else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,3,szHKU,3)==CSTR_EQUAL || + CompareStringW(CP_ACP,NORM_IGNORECASE,key,10,szHKEY_USERS,10)==CSTR_EQUAL) return HKEY_USERS; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCC,4)==2) + else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCC,4)==CSTR_EQUAL || + CompareStringW(CP_ACP,NORM_IGNORECASE,key,19,szHKEY_CURRENT_CONFIG,19)==CSTR_EQUAL) return HKEY_CURRENT_CONFIG; else return NULL; } diff --git a/reactos/base/applications/cmdutils/reg/reg.rc b/reactos/base/applications/cmdutils/reg/reg.rc index ccd34f676b8..4b686287fee 100644 --- a/reactos/base/applications/cmdutils/reg/reg.rc +++ b/reactos/base/applications/cmdutils/reg/reg.rc @@ -11,6 +11,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL /* UTF-8 */ #pragma code_page(65001) + #ifdef LANGUAGE_BG_BG #include "lang/bg-BG.rc" #endif diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 5ef3b83258c..d96a4cef21f 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -225,7 +225,7 @@ reactos/dll/cpl/inetcpl # Synced to Wine-1.7.1 ReactOS shares the following programs with Winehq. -reactos/base/applications/cmdutils/reg # Synced to Wine-1.1.40 +reactos/base/applications/cmdutils/reg # Synced to Wine-1.7.1 reactos/base/applications/cmdutils/taskkill # Synced to Wine-1.7.1 reactos/base/applications/cmdutils/wmic # Synced to Wine-1.7.1 reactos/base/applications/cmdutils/xcopy # Synced to Wine-1.3.37