[PATCH 6/7] regedit: Use the heap_*() functions in edit.c where possible
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Jul 26 08:17:14 CDT 2017
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
---
programs/regedit/edit.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c
index 038a37aff8..90603e97ac 100644
--- a/programs/regedit/edit.c
+++ b/programs/regedit/edit.c
@@ -159,13 +159,13 @@ static INT_PTR CALLBACK bin_modify_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wPara
case IDOK:
params = (struct edit_params *)GetWindowLongPtrW(hwndDlg, DWLP_USER);
cbData = SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, 0, 0);
- pData = HeapAlloc(GetProcessHeap(), 0, cbData);
+ pData = heap_alloc(cbData);
if (pData)
{
SendDlgItemMessageW(hwndDlg, IDC_VALUE_DATA, HEM_GETDATA, (WPARAM)cbData, (LPARAM)pData);
lRet = RegSetValueExW(params->hKey, params->lpszValueName, 0, REG_BINARY, pData, cbData);
- HeapFree(GetProcessHeap(), 0, pData);
+ heap_free(pData);
}
else
lRet = ERROR_OUTOFMEMORY;
@@ -206,7 +206,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType,
if (lRet == ERROR_FILE_NOT_FOUND && !valueName) { /* no default value here, make it up */
if (len) *len = 1;
if (lpType) *lpType = REG_SZ;
- buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR));
+ buffer = heap_alloc(sizeof(WCHAR));
*buffer = '\0';
return buffer;
}
@@ -229,7 +229,7 @@ static LPWSTR read_value(HWND hwnd, HKEY hKey, LPCWSTR valueName, DWORD *lpType,
return buffer;
done:
- HeapFree(GetProcessHeap(), 0, buffer);
+ heap_free(buffer);
return NULL;
}
@@ -307,7 +307,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
if (lRet == ERROR_SUCCESS) result = TRUE;
else error_code_messagebox(hwnd, IDS_SET_VALUE_FAILED);
}
- HeapFree(GetProcessHeap(), 0, valueA);
+ heap_free(valueA);
}
} else if ( type == REG_BINARY ) {
struct edit_params params;
@@ -339,7 +339,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
tmpValueData[j++] = stringValueData[i];
}
tmpValueData[j] = stringValueData[i];
- HeapFree( GetProcessHeap(), 0, stringValueData);
+ heap_free(stringValueData);
stringValueData = tmpValueData;
tmpValueData = NULL;
@@ -363,7 +363,7 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
tmpValueData[j++] = stringValueData[i];
tmpValueData[j++] = 0;
tmpValueData[j++] = 0;
- HeapFree( GetProcessHeap(), 0, stringValueData);
+ heap_free(stringValueData);
stringValueData = tmpValueData;
lRet = RegSetValueExW(hKey, valueName, 0, type, (LPBYTE)stringValueData, j * sizeof(WCHAR));
@@ -379,13 +379,13 @@ BOOL ModifyValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR valueName)
{
int index = SendMessageW(g_pChildWnd->hListWnd, LVM_GETNEXTITEM, -1,
MAKELPARAM(LVNI_FOCUSED | LVNI_SELECTED, 0));
- HeapFree(GetProcessHeap(), 0, stringValueData);
+ heap_free(stringValueData);
stringValueData = read_value(hwnd, hKey, valueName, &type, &len);
format_value_data(g_pChildWnd->hListWnd, index, type, stringValueData, len);
}
done:
- HeapFree(GetProcessHeap(), 0, stringValueData);
+ heap_free(stringValueData);
stringValueData = NULL;
RegCloseKey(hKey);
return result;
@@ -535,7 +535,7 @@ BOOL RenameValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPCWSTR oldName, LPC
result = TRUE;
done:
- HeapFree(GetProcessHeap(), 0, value);
+ heap_free(value);
RegCloseKey(hKey);
return result;
}
@@ -559,7 +559,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
} else {
LPWSTR srcSubKey_copy;
- parentPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(keyPath)+1)*sizeof(WCHAR));
+ parentPath = heap_alloc((lstrlenW(keyPath) + 1) * sizeof(WCHAR));
lstrcpyW(parentPath, keyPath);
srcSubKey_copy = strrchrW(parentPath, '\\');
*srcSubKey_copy = 0;
@@ -604,7 +604,7 @@ done:
RegCloseKey(destKey);
if (parentKey) {
RegCloseKey(parentKey);
- HeapFree(GetProcessHeap(), 0, parentPath);
+ heap_free(parentPath);
}
return result;
}
--
2.13.2
More information about the wine-patches
mailing list