sxs: Use CRT memory allocation functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6341e6d924
commit
686843655c
|
@ -106,19 +106,19 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
||||||
*/
|
*/
|
||||||
static void FreeAppInfo(APPINFO *info)
|
static void FreeAppInfo(APPINFO *info)
|
||||||
{
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, info->title);
|
free(info->title);
|
||||||
HeapFree(GetProcessHeap(), 0, info->path);
|
free(info->path);
|
||||||
HeapFree(GetProcessHeap(), 0, info->path_modify);
|
free(info->path_modify);
|
||||||
HeapFree(GetProcessHeap(), 0, info->icon);
|
free(info->icon);
|
||||||
HeapFree(GetProcessHeap(), 0, info->publisher);
|
free(info->publisher);
|
||||||
HeapFree(GetProcessHeap(), 0, info->version);
|
free(info->version);
|
||||||
HeapFree(GetProcessHeap(), 0, info->contact);
|
free(info->contact);
|
||||||
HeapFree(GetProcessHeap(), 0, info->helplink);
|
free(info->helplink);
|
||||||
HeapFree(GetProcessHeap(), 0, info->helptelephone);
|
free(info->helptelephone);
|
||||||
HeapFree(GetProcessHeap(), 0, info->readme);
|
free(info->readme);
|
||||||
HeapFree(GetProcessHeap(), 0, info->urlupdateinfo);
|
free(info->urlupdateinfo);
|
||||||
HeapFree(GetProcessHeap(), 0, info->comments);
|
free(info->comments);
|
||||||
HeapFree(GetProcessHeap(), 0, info);
|
free(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WCHAR *get_reg_str(HKEY hkey, const WCHAR *value)
|
static WCHAR *get_reg_str(HKEY hkey, const WCHAR *value)
|
||||||
|
@ -127,7 +127,7 @@ static WCHAR *get_reg_str(HKEY hkey, const WCHAR *value)
|
||||||
WCHAR *ret = NULL;
|
WCHAR *ret = NULL;
|
||||||
if (!RegQueryValueExW(hkey, value, NULL, &type, NULL, &len) && type == REG_SZ)
|
if (!RegQueryValueExW(hkey, value, NULL, &type, NULL, &len) && type == REG_SZ)
|
||||||
{
|
{
|
||||||
if (!(ret = HeapAlloc(GetProcessHeap(), 0, len))) return NULL;
|
if (!(ret = malloc(len))) return NULL;
|
||||||
RegQueryValueExW(hkey, value, 0, 0, (BYTE *)ret, &len);
|
RegQueryValueExW(hkey, value, 0, 0, (BYTE *)ret, &len);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -176,12 +176,12 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
|
||||||
{
|
{
|
||||||
int len = lstrlenW(L"msiexec /x%s") + lstrlenW(subKeyName);
|
int len = lstrlenW(L"msiexec /x%s") + lstrlenW(subKeyName);
|
||||||
|
|
||||||
if (!(command = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) goto err;
|
if (!(command = malloc(len * sizeof(WCHAR)))) goto err;
|
||||||
wsprintfW(command, L"msiexec /x%s", subKeyName);
|
wsprintfW(command, L"msiexec /x%s", subKeyName);
|
||||||
}
|
}
|
||||||
else if (!RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, NULL, &uninstlen))
|
else if (!RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, NULL, &uninstlen))
|
||||||
{
|
{
|
||||||
if (!(command = HeapAlloc(GetProcessHeap(), 0, uninstlen))) goto err;
|
if (!(command = malloc(uninstlen))) goto err;
|
||||||
RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen);
|
RegQueryValueExW(hkeyApp, L"UninstallString", 0, 0, (BYTE *)command, &uninstlen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -191,10 +191,10 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct APPINFO));
|
info = calloc(1, sizeof(*info));
|
||||||
if (!info) goto err;
|
if (!info) goto err;
|
||||||
|
|
||||||
info->title = HeapAlloc(GetProcessHeap(), 0, displen);
|
info->title = malloc(displen);
|
||||||
|
|
||||||
if (!info->title)
|
if (!info->title)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -209,7 +209,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
|
||||||
info->icon = 0;
|
info->icon = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info->icon = HeapAlloc(GetProcessHeap(), 0, displen);
|
info->icon = malloc(displen);
|
||||||
|
|
||||||
if (!info->icon)
|
if (!info->icon)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -259,12 +259,12 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
|
||||||
{
|
{
|
||||||
int len = lstrlenW(L"msiexec /i%s") + lstrlenW(subKeyName);
|
int len = lstrlenW(L"msiexec /i%s") + lstrlenW(subKeyName);
|
||||||
|
|
||||||
if (!(info->path_modify = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) goto err;
|
if (!(info->path_modify = malloc(len * sizeof(WCHAR)))) goto err;
|
||||||
wsprintfW(info->path_modify, L"msiexec /i%s", subKeyName);
|
wsprintfW(info->path_modify, L"msiexec /i%s", subKeyName);
|
||||||
}
|
}
|
||||||
else if (!RegQueryValueExW(hkeyApp, L"ModifyPath", 0, 0, NULL, &displen))
|
else if (!RegQueryValueExW(hkeyApp, L"ModifyPath", 0, 0, NULL, &displen))
|
||||||
{
|
{
|
||||||
if (!(info->path_modify = HeapAlloc(GetProcessHeap(), 0, displen))) goto err;
|
if (!(info->path_modify = malloc(displen))) goto err;
|
||||||
RegQueryValueExW(hkeyApp, L"ModifyPath", 0, 0, (BYTE *)info->path_modify, &displen);
|
RegQueryValueExW(hkeyApp, L"ModifyPath", 0, 0, (BYTE *)info->path_modify, &displen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
|
||||||
err:
|
err:
|
||||||
RegCloseKey(hkeyApp);
|
RegCloseKey(hkeyApp);
|
||||||
if (info) FreeAppInfo(info);
|
if (info) FreeAppInfo(info);
|
||||||
HeapFree(GetProcessHeap(), 0, command);
|
free(command);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue