Francois Gouget : regedit: The registry functions return standard error codes, not HRESULTs.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jun 14 07:47:07 CDT 2007


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Jun 14 11:46:46 2007 +0200

regedit: The registry functions return standard error codes, not HRESULTs.

---

 programs/regedit/regproc.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index 368f5c5..0399efc 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -209,9 +209,9 @@ static void REGPROC_unescape_string(LPSTR str)
  * val_name - name of the registry value
  * val_data - registry value data
  */
-static HRESULT setValue(LPSTR val_name, LPSTR val_data)
+static LONG setValue(LPSTR val_name, LPSTR val_data)
 {
-    HRESULT hRes;
+    LONG res;
     DWORD  dwDataType, dwParseType;
     LPBYTE lpbData;
     DWORD  dwData, dwLen;
@@ -259,7 +259,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
         return ERROR_INVALID_DATA;
     }
 
-    hRes = RegSetValueEx(
+    res = RegSetValueEx(
                currentKeyHandle,
                val_name,
                0,                  /* Reserved */
@@ -268,7 +268,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
                dwLen);
     if (dwParseType == REG_BINARY)
         HeapFree(GetProcessHeap(), 0, lpbData);
-    return hRes;
+    return res;
 }
 
 
@@ -352,10 +352,10 @@ static LPSTR getRegKeyName(LPSTR lpLine)
 /******************************************************************************
  * Open the key
  */
-static HRESULT openKey( LPSTR stdInput)
+static LONG openKey( LPSTR stdInput)
 {
-    DWORD   dwDisp;
-    HRESULT hRes;
+    DWORD dwDisp;
+    LONG res;
 
     /* Sanity checks */
     if (stdInput == NULL)
@@ -364,14 +364,14 @@ static HRESULT openKey( LPSTR stdInput)
     /* Get the registry class */
     currentKeyClass = getRegClass(stdInput); /* Sets global variable */
     if (currentKeyClass == (HKEY)ERROR_INVALID_PARAMETER)
-        return (HRESULT)ERROR_INVALID_PARAMETER;
+        return ERROR_INVALID_PARAMETER;
 
     /* Get the key name */
     currentKeyName = getRegKeyName(stdInput); /* Sets global variable */
     if (currentKeyName == NULL)
         return ERROR_INVALID_PARAMETER;
 
-    hRes = RegCreateKeyEx(
+    res = RegCreateKeyEx(
                currentKeyClass,          /* Class     */
                currentKeyName,           /* Sub Key   */
                0,                        /* MUST BE 0 */
@@ -383,10 +383,10 @@ static HRESULT openKey( LPSTR stdInput)
                &dwDisp);                 /* disposition, REG_CREATED_NEW_KEY or
                                                         REG_OPENED_EXISTING_KEY */
 
-    if (hRes == ERROR_SUCCESS)
+    if (res == ERROR_SUCCESS)
         bTheKeyIsOpen = TRUE;
 
-    return hRes;
+    return res;
 
 }
 
@@ -420,7 +420,7 @@ static void processSetValue(LPSTR line)
     LPSTR val_data;                   /* registry value data   */
 
     int line_idx = 0;                 /* current character under analysis */
-    HRESULT hRes = 0;
+    LONG res;
 
     /* get value name */
     if (line[line_idx] == '@' && line[line_idx + 1] == '=') {
@@ -458,8 +458,8 @@ static void processSetValue(LPSTR line)
     val_data = line + line_idx;
 
     REGPROC_unescape_string(val_name);
-    hRes = setValue(val_name, val_data);
-    if ( hRes != ERROR_SUCCESS )
+    res = setValue(val_name, val_data);
+    if ( res != ERROR_SUCCESS )
         fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n",
                 getAppName(),
                 currentKeyName,




More information about the wine-cvs mailing list