mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 12:14:11 +00:00
regedit: Fix item text reading in regedit.
This commit is contained in:
parent
28335fb39b
commit
c3821f6c63
|
@ -58,20 +58,17 @@ LPWSTR GetItemText(HWND hwndLV, UINT item)
|
|||
{
|
||||
LPWSTR newStr, curStr;
|
||||
unsigned int maxLen = 128;
|
||||
if (item == 0) return NULL; /* first item is ALWAYS a default */
|
||||
|
||||
curStr = HeapAlloc(GetProcessHeap(), 0, maxLen * sizeof(WCHAR));
|
||||
if (!curStr) return NULL;
|
||||
if (item == 0) { /* first item is ALWAYS a default */
|
||||
HeapFree(GetProcessHeap(), 0, curStr);
|
||||
return NULL;
|
||||
}
|
||||
do {
|
||||
ListView_GetItemTextW(hwndLV, item, 0, curStr, maxLen * sizeof(WCHAR));
|
||||
ListView_GetItemTextW(hwndLV, item, 0, curStr, maxLen);
|
||||
if (lstrlenW(curStr) < maxLen - 1) return curStr;
|
||||
newStr = HeapReAlloc(GetProcessHeap(), 0, curStr, maxLen * 2 * sizeof(WCHAR));
|
||||
maxLen *= 2;
|
||||
newStr = HeapReAlloc(GetProcessHeap(), 0, curStr, maxLen * sizeof(WCHAR));
|
||||
if (!newStr) break;
|
||||
curStr = newStr;
|
||||
maxLen *= 2;
|
||||
} while (TRUE);
|
||||
HeapFree(GetProcessHeap(), 0, curStr);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue