Signed-off-by: Hugh McMaster hugh.mcmaster@outlook.com --- programs/regedit/edit.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c index 980d1c22d8..9baf881621 100644 --- a/programs/regedit/edit.c +++ b/programs/regedit/edit.c @@ -196,7 +196,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType, WCHAR empty = 0;
lRet = RegQueryValueExW(hKey, valueName ? valueName : &empty, 0, lpType, 0, &valueDataLen); - if (lRet != ERROR_SUCCESS) { + if (lRet) { if (lRet == ERROR_FILE_NOT_FOUND && !valueName) { /* no default value here, make it up */ if (len) *len = 1; if (lpType) *lpType = REG_SZ; @@ -210,7 +210,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType, if ( *lpType == REG_DWORD ) valueDataLen = sizeof(DWORD); buffer = heap_xalloc(valueDataLen + sizeof(WCHAR)); lRet = RegQueryValueExW(hKey, valueName, 0, 0, (LPBYTE)buffer, &valueDataLen); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_BAD_VALUE, valueName); goto done; } @@ -234,7 +234,7 @@ BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR keyName) HKEY hKey;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_CREATE_SUB_KEY, &hKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_CREATE_KEY_FAILED); goto done; } @@ -245,13 +245,13 @@ BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR keyName) for (keyNum = 1; keyNum < 100; keyNum++) { wsprintfW(keyName, newKey, keyNum); lRet = RegOpenKeyW(hKey, keyName, &retKey); - if (lRet != ERROR_SUCCESS) break; + if (lRet) break; RegCloseKey(retKey); } if (lRet == ERROR_SUCCESS) goto done;
lRet = RegCreateKeyW(hKey, keyName, &retKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_CREATE_KEY_FAILED); goto done; } @@ -272,7 +272,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName) LONG len;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED); return FALSE; } @@ -388,7 +388,7 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath) HKEY hKey;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ|KEY_SET_VALUE, &hKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_DELETE_KEY_FAILED); return FALSE; } @@ -398,7 +398,7 @@ BOOL DeleteKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath) goto done; lRet = SHDeleteKeyW(hKeyRoot, keyPath); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_BAD_KEY, keyPath); goto done; } @@ -418,7 +418,7 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, B WCHAR empty = 0;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); - if (lRet != ERROR_SUCCESS) return FALSE; + if (lRet) return FALSE;
if (showMessageBox) { @@ -428,10 +428,10 @@ BOOL DeleteValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName, B }
lRet = RegDeleteValueW(hKey, valueName ? valueName : &empty); - if (lRet != ERROR_SUCCESS && valueName) { + if (lRet && valueName) { error_code_messagebox(hwnd, IDS_BAD_VALUE, valueName); } - if (lRet != ERROR_SUCCESS) goto done; + if (lRet) goto done; result = TRUE;
done: @@ -450,7 +450,7 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW LVITEMW item;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED); return FALSE; } @@ -469,7 +469,7 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW }
lRet = RegSetValueExW(hKey, valueName, 0, valueType, (BYTE*)&valueDword, sizeof(DWORD)); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_CREATE_VALUE_FAILED); goto done; } @@ -500,7 +500,7 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPC if (!newName) return FALSE;
lRet = RegOpenKeyExW(hKeyRoot, keyPath, 0, KEY_READ | KEY_SET_VALUE, &hKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_RENAME_VALUE_FAILED); return FALSE; } @@ -512,12 +512,12 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPC value = read_value(hwnd, hKey, oldName, &type, &len); if(!value) goto done; lRet = RegSetValueExW(hKey, newName, 0, type, (BYTE*)value, len); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_RENAME_VALUE_FAILED); goto done; } lRet = RegDeleteValueW(hKey, oldName); - if (lRet != ERROR_SUCCESS) { + if (lRet) { RegDeleteValueW(hKey, newName); error_code_messagebox(hwnd, IDS_RENAME_VALUE_FAILED); goto done; @@ -555,7 +555,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName) *srcSubKey_copy = 0; srcSubKey = srcSubKey_copy + 1; lRet = RegOpenKeyExW(hRootKey, parentPath, 0, KEY_READ | KEY_CREATE_SUB_KEY, &parentKey); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_RENAME_KEY_FAILED); goto done; } @@ -568,14 +568,14 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName) KEY_WRITE, NULL /* FIXME */, &destKey, &disposition); if (disposition == REG_OPENED_EXISTING_KEY) lRet = ERROR_FILE_EXISTS; - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_KEY_EXISTS, srcSubKey); goto done; }
/* FIXME: SHCopyKey does not copy the security attributes */ lRet = SHCopyKeyW(parentKey, srcSubKey, destKey, 0); - if (lRet != ERROR_SUCCESS) { + if (lRet) { RegCloseKey(destKey); RegDeleteKeyW(parentKey, newName); error_code_messagebox(hwnd, IDS_RENAME_KEY_FAILED); @@ -583,7 +583,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName) }
lRet = SHDeleteKeyW(hRootKey, keyPath); - if (lRet != ERROR_SUCCESS) { + if (lRet) { error_code_messagebox(hwnd, IDS_RENAME_KEY_FAILED); goto done; }