Andrew Nguyen : reg: Accept full names of the standard registry hives.

Alexandre Julliard julliard at winehq.org
Tue Jan 4 09:47:31 CST 2011


Module: wine
Branch: master
Commit: 060c8f0c6e6285630b68ada0712ca733c68a6901
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=060c8f0c6e6285630b68ada0712ca733c68a6901

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Tue Jan  4 04:47:13 2011 -0600

reg: Accept full names of the standard registry hives.

---

 programs/reg/reg.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/programs/reg/reg.c b/programs/reg/reg.c
index f65a3c8..0f8aa15 100644
--- a/programs/reg/reg.c
+++ b/programs/reg/reg.c
@@ -66,20 +66,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)==2 ||
+        CompareStringW(CP_ACP,NORM_IGNORECASE,key,18,szHKEY_LOCAL_MACHINE,18)==2)
         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)==2 ||
+             CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CURRENT_USER,17)==2)
         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)==2 ||
+             CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CLASSES_ROOT,17)==2)
         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)==2 ||
+             CompareStringW(CP_ACP,NORM_IGNORECASE,key,10,szHKEY_USERS,10)==2)
         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)==2 ||
+             CompareStringW(CP_ACP,NORM_IGNORECASE,key,19,szHKEY_CURRENT_CONFIG,19)==2)
         return HKEY_CURRENT_CONFIG;
     else return NULL;
 }




More information about the wine-cvs mailing list