mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 15:53:37 +00:00
regedit: Store the data from a listview subitem in a valid memory address.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
793ddc992c
commit
5d9a4c4dbd
|
@ -397,6 +397,7 @@ static int listview_notify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
|
|||
LINE_INFO *info = (LINE_INFO *)nmlv->lParam;
|
||||
|
||||
heap_free(info->name);
|
||||
heap_free(info->val);
|
||||
heap_free(info);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -152,23 +152,27 @@ void format_value_data(HWND hwndLV, int index, DWORD type, void *data, DWORD siz
|
|||
|
||||
int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWORD dwCount, int pos)
|
||||
{
|
||||
LINE_INFO *linfo;
|
||||
LVITEMW item = { 0 };
|
||||
LINE_INFO* linfo;
|
||||
int index;
|
||||
|
||||
linfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINE_INFO) + dwCount);
|
||||
linfo = heap_xalloc(sizeof(LINE_INFO));
|
||||
linfo->dwValType = dwValType;
|
||||
linfo->val_len = dwCount;
|
||||
CopyMemory(&linfo[1], ValBuf, dwCount);
|
||||
|
||||
|
||||
if (Name)
|
||||
{
|
||||
linfo->name = heap_xalloc((lstrlenW(Name) + 1) * sizeof(WCHAR));
|
||||
lstrcpyW(linfo->name, Name);
|
||||
} else
|
||||
{
|
||||
linfo->name = NULL;
|
||||
}
|
||||
else linfo->name = NULL;
|
||||
|
||||
if (ValBuf && dwCount)
|
||||
{
|
||||
linfo->val = heap_xalloc(dwCount);
|
||||
memcpy(&linfo->val, ValBuf, dwCount);
|
||||
}
|
||||
else linfo->val = NULL;
|
||||
|
||||
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
|
||||
item.iItem = (pos == -1) ? SendMessageW(hwndLV, LVM_GETITEMCOUNT, 0, 0) : pos;
|
||||
|
|
Loading…
Reference in a new issue