Commit bde3cf9b authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

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

parent 804ec044
...@@ -209,9 +209,9 @@ static void REGPROC_unescape_string(LPSTR str) ...@@ -209,9 +209,9 @@ static void REGPROC_unescape_string(LPSTR str)
* val_name - name of the registry value * val_name - name of the registry value
* val_data - registry value data * 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; DWORD dwDataType, dwParseType;
LPBYTE lpbData; LPBYTE lpbData;
DWORD dwData, dwLen; DWORD dwData, dwLen;
...@@ -259,7 +259,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data) ...@@ -259,7 +259,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
return ERROR_INVALID_DATA; return ERROR_INVALID_DATA;
} }
hRes = RegSetValueEx( res = RegSetValueEx(
currentKeyHandle, currentKeyHandle,
val_name, val_name,
0, /* Reserved */ 0, /* Reserved */
...@@ -268,7 +268,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data) ...@@ -268,7 +268,7 @@ static HRESULT setValue(LPSTR val_name, LPSTR val_data)
dwLen); dwLen);
if (dwParseType == REG_BINARY) if (dwParseType == REG_BINARY)
HeapFree(GetProcessHeap(), 0, lpbData); HeapFree(GetProcessHeap(), 0, lpbData);
return hRes; return res;
} }
...@@ -352,10 +352,10 @@ static LPSTR getRegKeyName(LPSTR lpLine) ...@@ -352,10 +352,10 @@ static LPSTR getRegKeyName(LPSTR lpLine)
/****************************************************************************** /******************************************************************************
* Open the key * Open the key
*/ */
static HRESULT openKey( LPSTR stdInput) static LONG openKey( LPSTR stdInput)
{ {
DWORD dwDisp; DWORD dwDisp;
HRESULT hRes; LONG res;
/* Sanity checks */ /* Sanity checks */
if (stdInput == NULL) if (stdInput == NULL)
...@@ -364,14 +364,14 @@ static HRESULT openKey( LPSTR stdInput) ...@@ -364,14 +364,14 @@ static HRESULT openKey( LPSTR stdInput)
/* Get the registry class */ /* Get the registry class */
currentKeyClass = getRegClass(stdInput); /* Sets global variable */ currentKeyClass = getRegClass(stdInput); /* Sets global variable */
if (currentKeyClass == (HKEY)ERROR_INVALID_PARAMETER) if (currentKeyClass == (HKEY)ERROR_INVALID_PARAMETER)
return (HRESULT)ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
/* Get the key name */ /* Get the key name */
currentKeyName = getRegKeyName(stdInput); /* Sets global variable */ currentKeyName = getRegKeyName(stdInput); /* Sets global variable */
if (currentKeyName == NULL) if (currentKeyName == NULL)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
hRes = RegCreateKeyEx( res = RegCreateKeyEx(
currentKeyClass, /* Class */ currentKeyClass, /* Class */
currentKeyName, /* Sub Key */ currentKeyName, /* Sub Key */
0, /* MUST BE 0 */ 0, /* MUST BE 0 */
...@@ -383,10 +383,10 @@ static HRESULT openKey( LPSTR stdInput) ...@@ -383,10 +383,10 @@ static HRESULT openKey( LPSTR stdInput)
&dwDisp); /* disposition, REG_CREATED_NEW_KEY or &dwDisp); /* disposition, REG_CREATED_NEW_KEY or
REG_OPENED_EXISTING_KEY */ REG_OPENED_EXISTING_KEY */
if (hRes == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
bTheKeyIsOpen = TRUE; bTheKeyIsOpen = TRUE;
return hRes; return res;
} }
...@@ -420,7 +420,7 @@ static void processSetValue(LPSTR line) ...@@ -420,7 +420,7 @@ static void processSetValue(LPSTR line)
LPSTR val_data; /* registry value data */ LPSTR val_data; /* registry value data */
int line_idx = 0; /* current character under analysis */ int line_idx = 0; /* current character under analysis */
HRESULT hRes = 0; LONG res;
/* get value name */ /* get value name */
if (line[line_idx] == '@' && line[line_idx + 1] == '=') { if (line[line_idx] == '@' && line[line_idx + 1] == '=') {
...@@ -458,8 +458,8 @@ static void processSetValue(LPSTR line) ...@@ -458,8 +458,8 @@ static void processSetValue(LPSTR line)
val_data = line + line_idx; val_data = line + line_idx;
REGPROC_unescape_string(val_name); REGPROC_unescape_string(val_name);
hRes = setValue(val_name, val_data); res = setValue(val_name, val_data);
if ( hRes != ERROR_SUCCESS ) if ( res != ERROR_SUCCESS )
fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n", fprintf(stderr,"%s: ERROR Key %s not created. Value: %s, Data: %s\n",
getAppName(), getAppName(),
currentKeyName, currentKeyName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment