Commit 0c3530d6 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

uninstaller: Use CRT allocation functions.

parent 8418962f
...@@ -61,12 +61,12 @@ static void output_writeconsole(const WCHAR *str, DWORD len) ...@@ -61,12 +61,12 @@ static void output_writeconsole(const WCHAR *str, DWORD len)
* If this occurs, we should use an OEM codepage and call WriteFile. * If this occurs, we should use an OEM codepage and call WriteFile.
*/ */
lenA = WideCharToMultiByte(GetOEMCP(), 0, str, len, NULL, 0, NULL, NULL); lenA = WideCharToMultiByte(GetOEMCP(), 0, str, len, NULL, 0, NULL, NULL);
strA = HeapAlloc(GetProcessHeap(), 0, lenA); strA = malloc(lenA);
if (strA) if (strA)
{ {
WideCharToMultiByte(GetOEMCP(), 0, str, len, strA, lenA, NULL, NULL); WideCharToMultiByte(GetOEMCP(), 0, str, len, strA, lenA, NULL, NULL);
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &written, FALSE); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), strA, lenA, &written, FALSE);
HeapFree(GetProcessHeap(), 0, strA); free(strA);
} }
} }
...@@ -257,13 +257,12 @@ static int FetchFromRootKey(HKEY root) ...@@ -257,13 +257,12 @@ static int FetchFromRootKey(HKEY root)
if (!RegQueryValueExW(hkeyApp, L"WindowsInstaller", NULL, &type, (BYTE *)&value, &size) && if (!RegQueryValueExW(hkeyApp, L"WindowsInstaller", NULL, &type, (BYTE *)&value, &size) &&
type == REG_DWORD && value == 1) type == REG_DWORD && value == 1)
{ {
command = HeapAlloc(GetProcessHeap(), 0, command = malloc(sizeof(L"msiexec /x") + wcslen(subKeyName) * sizeof(WCHAR));
sizeof(L"msiexec /x") + wcslen(subKeyName) * sizeof(WCHAR));
wsprintfW(command, L"msiexec /x%s", subKeyName); wsprintfW(command, L"msiexec /x%s", subKeyName);
} }
else if (!RegQueryValueExW(hkeyApp, L"UninstallString", NULL, NULL, NULL, &uninstlen)) else if (!RegQueryValueExW(hkeyApp, L"UninstallString", NULL, NULL, NULL, &uninstlen))
{ {
command = HeapAlloc(GetProcessHeap(), 0, uninstlen); command = malloc(uninstlen);
RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen); RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen);
} }
else else
...@@ -273,11 +272,10 @@ static int FetchFromRootKey(HKEY root) ...@@ -273,11 +272,10 @@ static int FetchFromRootKey(HKEY root)
continue; continue;
} }
numentries++; numentries++;
entries = HeapReAlloc(GetProcessHeap(), 0, entries, numentries*sizeof(uninst_entry)); entries = realloc(entries, numentries * sizeof(uninst_entry));
entries[numentries-1].root = root; entries[numentries-1].root = root;
entries[numentries-1].key = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(subKeyName)+1)*sizeof(WCHAR)); entries[numentries-1].key = wcsdup(subKeyName);
lstrcpyW(entries[numentries-1].key, subKeyName); entries[numentries-1].descr = malloc(displen);
entries[numentries-1].descr = HeapAlloc(GetProcessHeap(), 0, displen);
RegQueryValueExW(hkeyApp, L"DisplayName", 0, 0, (BYTE *)entries[numentries-1].descr, &displen); RegQueryValueExW(hkeyApp, L"DisplayName", 0, 0, (BYTE *)entries[numentries-1].descr, &displen);
entries[numentries-1].command = command; entries[numentries-1].command = command;
entries[numentries-1].active = 0; entries[numentries-1].active = 0;
...@@ -302,7 +300,7 @@ static int FetchUninstallInformation(void) ...@@ -302,7 +300,7 @@ static int FetchUninstallInformation(void)
numentries = 0; numentries = 0;
oldsel = -1; oldsel = -1;
if (!entries) if (!entries)
entries = HeapAlloc(GetProcessHeap(), 0, sizeof(uninst_entry)); entries = malloc(sizeof(uninst_entry));
if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, PathUninstallW, 0, KEY_READ, &root)) if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, PathUninstallW, 0, KEY_READ, &root))
{ {
......
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