shell32: Use global memory allocation helpers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-02-22 10:43:28 +03:00 committed by Alexandre Julliard
parent 0914e5ea76
commit e3b200bd8a
32 changed files with 451 additions and 464 deletions

View File

@ -253,7 +253,7 @@ static HRESULT WINAPI IQueryAssociations_fnInit(
0, 0,
KEY_READ, KEY_READ,
&This->hkeyProgID); &This->hkeyProgID);
HeapFree(GetProcessHeap(), 0, progId); heap_free(progId);
return S_OK; return S_OK;
} }
@ -278,13 +278,13 @@ static HRESULT ASSOC_GetValue(HKEY hkey, const WCHAR *name, void **data, DWORD *
return HRESULT_FROM_WIN32(ret); return HRESULT_FROM_WIN32(ret);
if (!size) if (!size)
return E_FAIL; return E_FAIL;
*data = HeapAlloc(GetProcessHeap(), 0, size); *data = heap_alloc(size);
if (!*data) if (!*data)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
ret = RegQueryValueExW(hkey, name, 0, NULL, (LPBYTE)*data, &size); ret = RegQueryValueExW(hkey, name, 0, NULL, (LPBYTE)*data, &size);
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
{ {
HeapFree(GetProcessHeap(), 0, *data); heap_free(*data);
return HRESULT_FROM_WIN32(ret); return HRESULT_FROM_WIN32(ret);
} }
if(data_size) if(data_size)
@ -312,7 +312,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
HKEY hkeyFile; HKEY hkeyFile;
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, filetype, 0, KEY_READ, &hkeyFile); ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, filetype, 0, KEY_READ, &hkeyFile);
HeapFree(GetProcessHeap(), 0, filetype); heap_free(filetype);
if (ret == ERROR_SUCCESS) if (ret == ERROR_SUCCESS)
{ {
@ -344,7 +344,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
} }
max_subkey_len++; max_subkey_len++;
extra_from_reg = HeapAlloc(GetProcessHeap(), 0, max_subkey_len * sizeof(WCHAR)); extra_from_reg = heap_alloc(max_subkey_len * sizeof(WCHAR));
if (!extra_from_reg) if (!extra_from_reg)
{ {
RegCloseKey(hkeyShell); RegCloseKey(hkeyShell);
@ -354,7 +354,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
ret = RegEnumKeyExW(hkeyShell, 0, extra_from_reg, &max_subkey_len, NULL, NULL, NULL, NULL); ret = RegEnumKeyExW(hkeyShell, 0, extra_from_reg, &max_subkey_len, NULL, NULL, NULL, NULL);
if (ret) if (ret)
{ {
HeapFree(GetProcessHeap(), 0, extra_from_reg); heap_free(extra_from_reg);
RegCloseKey(hkeyShell); RegCloseKey(hkeyShell);
return HRESULT_FROM_WIN32(ret); return HRESULT_FROM_WIN32(ret);
} }
@ -364,7 +364,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
/* open verb subkey */ /* open verb subkey */
ret = RegOpenKeyExW(hkeyShell, extra, 0, KEY_READ, &hkeyVerb); ret = RegOpenKeyExW(hkeyShell, extra, 0, KEY_READ, &hkeyVerb);
HeapFree(GetProcessHeap(), 0, extra_from_reg); heap_free(extra_from_reg);
RegCloseKey(hkeyShell); RegCloseKey(hkeyShell);
if (ret) return HRESULT_FROM_WIN32(ret); if (ret) return HRESULT_FROM_WIN32(ret);
@ -415,7 +415,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
*len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL); *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
} }
HeapFree(GetProcessHeap(), 0, pszCommand); heap_free(pszCommand);
if (!*len) if (!*len)
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
return S_OK; return S_OK;
@ -530,7 +530,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, command, strlenW(command) + 1); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, command, strlenW(command) + 1);
HeapFree(GetProcessHeap(), 0, command); heap_free(command);
} }
return hr; return hr;
} }
@ -554,7 +554,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION);
} }
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, docName, strlenW(docName) + 1); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, docName, strlenW(docName) + 1);
HeapFree(GetProcessHeap(), 0, docName); heap_free(docName);
return hr; return hr;
} }
@ -582,7 +582,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
retval = GetFileVersionInfoSizeW(path, &size); retval = GetFileVersionInfoSizeW(path, &size);
if (!retval) if (!retval)
goto get_friendly_name_fail; goto get_friendly_name_fail;
verinfoW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, retval); verinfoW = heap_alloc_zero(retval);
if (!verinfoW) if (!verinfoW)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (!GetFileVersionInfoW(path, 0, retval, verinfoW)) if (!GetFileVersionInfoW(path, 0, retval, verinfoW))
@ -601,7 +601,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
len = strlenW(bufW) + 1; len = strlenW(bufW) + 1;
TRACE("found FileDescription: %s\n", debugstr_w(bufW)); TRACE("found FileDescription: %s\n", debugstr_w(bufW));
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len);
HeapFree(GetProcessHeap(), 0, verinfoW); heap_free(verinfoW);
return hr; return hr;
} }
} }
@ -611,7 +611,7 @@ get_friendly_name_fail:
PathStripPathW(path); PathStripPathW(path);
TRACE("using filename: %s\n", debugstr_w(path)); TRACE("using filename: %s\n", debugstr_w(path));
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, path, strlenW(path) + 1); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, path, strlenW(path) + 1);
HeapFree(GetProcessHeap(), 0, verinfoW); heap_free(verinfoW);
return hr; return hr;
} }
@ -626,7 +626,7 @@ get_friendly_name_fail:
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, NULL, &size); ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret); return HRESULT_FROM_WIN32(ret);
contentType = HeapAlloc(GetProcessHeap(), 0, size); contentType = heap_alloc(size);
if (contentType != NULL) if (contentType != NULL)
{ {
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size); ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size);
@ -634,7 +634,7 @@ get_friendly_name_fail:
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, strlenW(contentType) + 1); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, strlenW(contentType) + 1);
else else
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, contentType); heap_free(contentType);
} }
else else
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
@ -652,7 +652,7 @@ get_friendly_name_fail:
ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, NULL, &size); ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret == ERROR_SUCCESS) if (ret == ERROR_SUCCESS)
{ {
WCHAR *icon = HeapAlloc(GetProcessHeap(), 0, size); WCHAR *icon = heap_alloc(size);
if (icon) if (icon)
{ {
ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size); ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size);
@ -660,7 +660,7 @@ get_friendly_name_fail:
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, strlenW(icon) + 1); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, strlenW(icon) + 1);
else else
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, icon); heap_free(icon);
} }
else else
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
@ -776,7 +776,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetData(IQueryAssociations *iface,
hres = ASSOC_GetValue(This->hkeyProgID, edit_flags, &data, &size); hres = ASSOC_GetValue(This->hkeyProgID, edit_flags, &data, &size);
if(SUCCEEDED(hres) && pcbOut) if(SUCCEEDED(hres) && pcbOut)
hres = ASSOC_ReturnData(pvOut, pcbOut, data, size); hres = ASSOC_ReturnData(pvOut, pcbOut, data, size);
HeapFree(GetProcessHeap(), 0, data); heap_free(data);
return hres; return hres;
default: default:
FIXME("Unsupported ASSOCDATA value: %d\n", assocdata); FIXME("Unsupported ASSOCDATA value: %d\n", assocdata);

View File

@ -130,12 +130,11 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
/* If quickComplete is set and control is pressed, replace the string */ /* If quickComplete is set and control is pressed, replace the string */
control = GetKeyState(VK_CONTROL) & 0x8000; control = GetKeyState(VK_CONTROL) & 0x8000;
if (control && This->quickComplete) { if (control && This->quickComplete) {
hwndQCText = HeapAlloc(GetProcessHeap(), 0, hwndQCText = heap_alloc((lstrlenW(This->quickComplete)+lstrlenW(hwndText))*sizeof(WCHAR));
(lstrlenW(This->quickComplete)+lstrlenW(hwndText))*sizeof(WCHAR));
sel = sprintfW(hwndQCText, This->quickComplete, hwndText); sel = sprintfW(hwndQCText, This->quickComplete, hwndText);
SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText); SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText);
SendMessageW(hwnd, EM_SETSEL, 0, sel); SendMessageW(hwnd, EM_SETSEL, 0, sel);
HeapFree(GetProcessHeap(), 0, hwndQCText); heap_free(hwndQCText);
} }
ShowWindow(This->hwndListBox, SW_HIDE); ShowWindow(This->hwndListBox, SW_HIDE);
@ -173,11 +172,11 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
int len; int len;
len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0); len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0);
msg = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); msg = heap_alloc((len + 1)*sizeof(WCHAR));
SendMessageW(This->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg); SendMessageW(This->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg);
SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg); SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(hwnd, EM_SETSEL, lstrlenW(msg), lstrlenW(msg)); SendMessageW(hwnd, EM_SETSEL, lstrlenW(msg), lstrlenW(msg));
HeapFree(GetProcessHeap(), 0, msg); heap_free(msg);
} else { } else {
SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)This->txtbackup); SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)This->txtbackup);
SendMessageW(hwnd, EM_SETSEL, lstrlenW(This->txtbackup), lstrlenW(This->txtbackup)); SendMessageW(hwnd, EM_SETSEL, lstrlenW(This->txtbackup), lstrlenW(This->txtbackup));
@ -209,9 +208,9 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
SendMessageW(This->hwndListBox, LB_RESETCONTENT, 0, 0); SendMessageW(This->hwndListBox, LB_RESETCONTENT, 0, 0);
HeapFree(GetProcessHeap(), 0, This->txtbackup); heap_free(This->txtbackup);
len = strlenW(hwndText); len = strlenW(hwndText);
This->txtbackup = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR)); This->txtbackup = heap_alloc((len + 1)*sizeof(WCHAR));
lstrcpyW(This->txtbackup, hwndText); lstrcpyW(This->txtbackup, hwndText);
/* Returns if there is no text to search and we doesn't want to display all the entries */ /* Returns if there is no text to search and we doesn't want to display all the entries */
@ -307,12 +306,12 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
if (sel < 0) if (sel < 0)
break; break;
len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0); len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, 0);
msg = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); msg = heap_alloc((len + 1)*sizeof(WCHAR));
SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg); SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg);
SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg); SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(This->hwndEdit, EM_SETSEL, 0, lstrlenW(msg)); SendMessageW(This->hwndEdit, EM_SETSEL, 0, lstrlenW(msg));
ShowWindow(hwnd, SW_HIDE); ShowWindow(hwnd, SW_HIDE);
HeapFree(GetProcessHeap(), 0, msg); heap_free(msg);
break; break;
default: default:
return CallWindowProcW(This->wpOrigLBoxProc, hwnd, uMsg, wParam, lParam); return CallWindowProcW(This->wpOrigLBoxProc, hwnd, uMsg, wParam, lParam);
@ -399,11 +398,11 @@ static ULONG WINAPI IAutoComplete2_fnRelease(
if (!refCount) { if (!refCount) {
TRACE("destroying IAutoComplete(%p)\n", This); TRACE("destroying IAutoComplete(%p)\n", This);
HeapFree(GetProcessHeap(), 0, This->quickComplete); heap_free(This->quickComplete);
HeapFree(GetProcessHeap(), 0, This->txtbackup); heap_free(This->txtbackup);
if (This->enumstr) if (This->enumstr)
IEnumString_Release(This->enumstr); IEnumString_Release(This->enumstr);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return refCount; return refCount;
} }
@ -479,7 +478,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
LONG len; LONG len;
/* pwszRegKeyPath contains the key as well as the value, so we split */ /* pwszRegKeyPath contains the key as well as the value, so we split */
key = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR)); key = heap_alloc((lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR));
strcpyW(key, pwzsRegKeyPath); strcpyW(key, pwzsRegKeyPath);
value = strrchrW(key, '\\'); value = strrchrW(key, '\\');
*value = 0; *value = 0;
@ -493,16 +492,16 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
res = RegQueryValueW(hKey, value, result, &len); res = RegQueryValueW(hKey, value, result, &len);
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
This->quickComplete = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); This->quickComplete = heap_alloc(len*sizeof(WCHAR));
strcpyW(This->quickComplete, result); strcpyW(This->quickComplete, result);
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
HeapFree(GetProcessHeap(), 0, key); heap_free(key);
} }
if ((pwszQuickComplete) && (!This->quickComplete)) { if ((pwszQuickComplete) && (!This->quickComplete)) {
This->quickComplete = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR)); This->quickComplete = heap_alloc((lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR));
lstrcpyW(This->quickComplete, pwszQuickComplete); lstrcpyW(This->quickComplete, pwszQuickComplete);
} }
@ -658,7 +657,7 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO
if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown)) if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
lpac = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAutoCompleteImpl)); lpac = heap_alloc_zero(sizeof(*lpac));
if (!lpac) if (!lpac)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;

View File

@ -951,13 +951,13 @@ static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL
return BrsFolder_OnSetSelectionW(info, selection, is_str); return BrsFolder_OnSetSelectionW(info, selection, is_str);
if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) && if ((length = MultiByteToWideChar(CP_ACP, 0, selection, -1, NULL, 0)) &&
(selectionW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR))) && (selectionW = heap_alloc(length * sizeof(WCHAR))) &&
MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length)) MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length))
{ {
result = BrsFolder_OnSetSelectionW(info, selectionW, is_str); result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
} }
HeapFree(GetProcessHeap(), 0, selectionW); heap_free(selectionW);
return result; return result;
} }
@ -1071,14 +1071,14 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
bi.hwndOwner = lpbi->hwndOwner; bi.hwndOwner = lpbi->hwndOwner;
bi.pidlRoot = lpbi->pidlRoot; bi.pidlRoot = lpbi->pidlRoot;
if (lpbi->pszDisplayName) if (lpbi->pszDisplayName)
bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) ); bi.pszDisplayName = heap_alloc( MAX_PATH * sizeof(WCHAR) );
else else
bi.pszDisplayName = NULL; bi.pszDisplayName = NULL;
if (lpbi->lpszTitle) if (lpbi->lpszTitle)
{ {
len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 ); len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 );
title = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); title = heap_alloc( len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len ); MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len );
} }
else else
@ -1094,9 +1094,9 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
{ {
WideCharToMultiByte( CP_ACP, 0, bi.pszDisplayName, -1, WideCharToMultiByte( CP_ACP, 0, bi.pszDisplayName, -1,
lpbi->pszDisplayName, MAX_PATH, 0, NULL); lpbi->pszDisplayName, MAX_PATH, 0, NULL);
HeapFree( GetProcessHeap(), 0, bi.pszDisplayName ); heap_free( bi.pszDisplayName );
} }
HeapFree(GetProcessHeap(), 0, title); heap_free(title);
lpbi->iImage = bi.iImage; lpbi->iImage = bi.iImage;
return lpid; return lpid;
} }

View File

@ -55,8 +55,8 @@ void Control_UnloadApplet(CPlApplet* applet)
if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L); if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
FreeLibrary(applet->hModule); FreeLibrary(applet->hModule);
list_remove( &applet->entry ); list_remove( &applet->entry );
HeapFree(GetProcessHeap(), 0, applet->cmd); heap_free(applet->cmd);
HeapFree(GetProcessHeap(), 0, applet); heap_free(applet);
} }
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
@ -67,13 +67,13 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
CPLINFO info; CPLINFO info;
NEWCPLINFOW newinfo; NEWCPLINFOW newinfo;
if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet)))) if (!(applet = heap_alloc_zero(sizeof(*applet))))
return applet; return applet;
len = ExpandEnvironmentStringsW(cmd, NULL, 0); len = ExpandEnvironmentStringsW(cmd, NULL, 0);
if (len > 0) if (len > 0)
{ {
if (!(applet->cmd = HeapAlloc(GetProcessHeap(), 0, (len+1) * sizeof(WCHAR)))) if (!(applet->cmd = heap_alloc((len+1) * sizeof(WCHAR))))
{ {
WARN("Cannot allocate memory for applet path\n"); WARN("Cannot allocate memory for applet path\n");
goto theError; goto theError;
@ -180,8 +180,8 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
theError: theError:
FreeLibrary(applet->hModule); FreeLibrary(applet->hModule);
HeapFree(GetProcessHeap(), 0, applet->cmd); heap_free(applet->cmd);
HeapFree(GetProcessHeap(), 0, applet); heap_free(applet);
return NULL; return NULL;
} }
@ -289,7 +289,7 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs)
{ {
for (i = 0; i < applet->count; i++) { for (i = 0; i < applet->count; i++) {
/* set up a CPlItem for this particular subprogram */ /* set up a CPlItem for this particular subprogram */
item = HeapAlloc(GetProcessHeap(), 0, sizeof(CPlItem)); item = heap_alloc(sizeof(CPlItem));
if (!item) if (!item)
continue; continue;
@ -366,7 +366,7 @@ static void Control_FreeCPlItems(HWND hWnd, CPanel *panel)
if (!GetMenuItemInfoW(hSubMenu, i, FALSE, &mii)) if (!GetMenuItemInfoW(hSubMenu, i, FALSE, &mii))
continue; continue;
HeapFree(GetProcessHeap(), 0, (LPVOID) mii.dwItemData); heap_free((void *)mii.dwItemData);
} }
} }
@ -724,7 +724,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
BOOL quoted = FALSE; BOOL quoted = FALSE;
CPlApplet *applet; CPlApplet *applet;
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd)); buffer = heap_alloc((lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
if (!buffer) return; if (!buffer) return;
end = lstrcpyW(buffer, wszCmd); end = lstrcpyW(buffer, wszCmd);
@ -813,7 +813,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
Control_UnloadApplet(applet); Control_UnloadApplet(applet);
} }
HeapFree(GetProcessHeap(), 0, buffer); heap_free(buffer);
} }
/************************************************************************* /*************************************************************************
@ -844,12 +844,12 @@ void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdS
void WINAPI Control_RunDLLA(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow) void WINAPI Control_RunDLLA(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow)
{ {
DWORD len = MultiByteToWideChar(CP_ACP, 0, cmd, -1, NULL, 0 ); DWORD len = MultiByteToWideChar(CP_ACP, 0, cmd, -1, NULL, 0 );
LPWSTR wszCmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); LPWSTR wszCmd = heap_alloc(len * sizeof(WCHAR));
if (wszCmd && MultiByteToWideChar(CP_ACP, 0, cmd, -1, wszCmd, len )) if (wszCmd && MultiByteToWideChar(CP_ACP, 0, cmd, -1, wszCmd, len ))
{ {
Control_RunDLLW(hWnd, hInst, wszCmd, nCmdShow); Control_RunDLLW(hWnd, hInst, wszCmd, nCmdShow);
} }
HeapFree(GetProcessHeap(), 0, wszCmd); heap_free(wszCmd);
} }
/************************************************************************* /*************************************************************************

View File

@ -99,8 +99,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
{ {
TRACE(" destroying IEnumFORMATETC(%p)\n",This); TRACE(" destroying IEnumFORMATETC(%p)\n",This);
SHFree (This->pFmt); SHFree (This->pFmt);
HeapFree(GetProcessHeap(),0,This); heap_free(This);
return 0;
} }
return refCount; return refCount;
} }
@ -173,7 +172,7 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[])
IEnumFORMATETCImpl* ef; IEnumFORMATETCImpl* ef;
DWORD size=cfmt * sizeof(FORMATETC); DWORD size=cfmt * sizeof(FORMATETC);
ef = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumFORMATETCImpl)); ef = heap_alloc_zero(sizeof(*ef));
if(ef) if(ef)
{ {
@ -276,7 +275,7 @@ static ULONG WINAPI IDataObject_fnRelease(IDataObject *iface)
TRACE(" destroying IDataObject(%p)\n",This); TRACE(" destroying IDataObject(%p)\n",This);
_ILFreeaPidl(This->apidl, This->cidl); _ILFreeaPidl(This->apidl, This->cidl);
ILFree(This->pidl), ILFree(This->pidl),
HeapFree(GetProcessHeap(),0,This); heap_free(This);
} }
return refCount; return refCount;
} }
@ -432,7 +431,7 @@ IDataObject* IDataObject_Constructor(HWND hwndOwner,
{ {
IDataObjectImpl* dto; IDataObjectImpl* dto;
dto = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDataObjectImpl)); dto = heap_alloc_zero(sizeof(*dto));
if (dto) if (dto)
{ {

View File

@ -89,7 +89,7 @@ static WCHAR *get_programs_path(const WCHAR *name)
SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs); SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs);
len = lstrlenW(programs) + 1 + lstrlenW(name); len = lstrlenW(programs) + 1 + lstrlenW(name);
path = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*path)); path = heap_alloc((len + 1) * sizeof(*path));
lstrcpyW(path, programs); lstrcpyW(path, programs);
lstrcatW(path, slashW); lstrcatW(path, slashW);
lstrcatW(path, name); lstrcatW(path, name);
@ -112,7 +112,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
WIN32_FIND_DATAW finddata; WIN32_FIND_DATAW finddata;
HANDLE hfind; HANDLE hfind;
int len = 1; int len = 1;
WCHAR *groups_data = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)); WCHAR *groups_data = heap_alloc(sizeof(WCHAR));
char *groups_dataA; char *groups_dataA;
HDDEDATA ret; HDDEDATA ret;
@ -127,7 +127,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
lstrcmpW(finddata.cFileName, dotW) && lstrcmpW(finddata.cFileName, dotdotW)) lstrcmpW(finddata.cFileName, dotW) && lstrcmpW(finddata.cFileName, dotdotW))
{ {
len += lstrlenW(finddata.cFileName) + 2; len += lstrlenW(finddata.cFileName) + 2;
groups_data = HeapReAlloc(GetProcessHeap(), 0, groups_data, len * sizeof(WCHAR)); groups_data = heap_realloc(groups_data, len * sizeof(WCHAR));
lstrcatW(groups_data, finddata.cFileName); lstrcatW(groups_data, finddata.cFileName);
lstrcatW(groups_data, newlineW); lstrcatW(groups_data, newlineW);
} }
@ -136,13 +136,13 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
} }
len = WideCharToMultiByte(CP_ACP, 0, groups_data, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte(CP_ACP, 0, groups_data, -1, NULL, 0, NULL, NULL);
groups_dataA = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); groups_dataA = heap_alloc(len * sizeof(WCHAR));
WideCharToMultiByte(CP_ACP, 0, groups_data, -1, groups_dataA, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, groups_data, -1, groups_dataA, len, NULL, NULL);
ret = DdeCreateDataHandle(dwDDEInst, (BYTE *)groups_dataA, len, 0, hszGroups, uFmt, 0); ret = DdeCreateDataHandle(dwDDEInst, (BYTE *)groups_dataA, len, 0, hszGroups, uFmt, 0);
HeapFree(GetProcessHeap(), 0, groups_dataA); heap_free(groups_dataA);
HeapFree(GetProcessHeap(), 0, groups_data); heap_free(groups_data);
HeapFree(GetProcessHeap(), 0, programs); heap_free(programs);
return ret; return ret;
} }
else if (hszTopic == hszProgmanTopic && hszItem == hszProgmanService && uFmt == CF_TEXT) else if (hszTopic == hszProgmanTopic && hszItem == hszProgmanService && uFmt == CF_TEXT)
@ -184,7 +184,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
CreateDirectoryW(path, NULL); CreateDirectoryW(path, NULL);
ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL); ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
if (last_group) HeapFree(GetProcessHeap(), 0, last_group); if (last_group) heap_free(last_group);
last_group = path; last_group = path;
} }
else if (!strcmpiW(command, delete_groupW)) else if (!strcmpiW(command, delete_groupW))
@ -197,7 +197,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
path = get_programs_path(argv[0]); path = get_programs_path(argv[0]);
path2 = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 2) * sizeof(*path)); path2 = heap_alloc((strlenW(path) + 2) * sizeof(*path));
strcpyW(path2, path); strcpyW(path2, path);
path2[strlenW(path) + 1] = 0; path2[strlenW(path) + 1] = 0;
@ -207,8 +207,8 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
ret = SHFileOperationW(&shfos); ret = SHFileOperationW(&shfos);
HeapFree(GetProcessHeap(), 0, path2); heap_free(path2);
HeapFree(GetProcessHeap(), 0, path); heap_free(path);
if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED; if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED;
} }
@ -224,7 +224,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL); ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
if (last_group) HeapFree(GetProcessHeap(), 0, last_group); if (last_group) heap_free(last_group);
last_group = path; last_group = path;
} }
else if (!strcmpiW(command, add_itemW)) else if (!strcmpiW(command, add_itemW))
@ -247,10 +247,10 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
IShellLinkW_Release(link); IShellLinkW_Release(link);
return DDE_FNOTPROCESSED; return DDE_FNOTPROCESSED;
} }
path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); path = heap_alloc(len * sizeof(WCHAR));
SearchPathW(NULL, argv[0], dotexeW, len, path, NULL); SearchPathW(NULL, argv[0], dotexeW, len, path, NULL);
IShellLinkW_SetPath(link, path); IShellLinkW_SetPath(link, path);
HeapFree(GetProcessHeap(), 0, path); heap_free(path);
if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]); if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]);
if (argc >= 4) IShellLinkW_SetIconLocation(link, argv[2], atoiW(argv[3])); if (argc >= 4) IShellLinkW_SetIconLocation(link, argv[2], atoiW(argv[3]));
@ -270,7 +270,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
} }
if (argc >= 2) if (argc >= 2)
{ {
name = HeapAlloc(GetProcessHeap(), 0, (strlenW(last_group) + 1 + strlenW(argv[1]) + 5) * sizeof(*name)); name = heap_alloc((strlenW(last_group) + 1 + strlenW(argv[1]) + 5) * sizeof(*name));
lstrcpyW(name, last_group); lstrcpyW(name, last_group);
lstrcatW(name, slashW); lstrcatW(name, slashW);
lstrcatW(name, argv[1]); lstrcatW(name, argv[1]);
@ -280,7 +280,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
{ {
const WCHAR *filename = PathFindFileNameW(argv[0]); const WCHAR *filename = PathFindFileNameW(argv[0]);
int len = PathFindExtensionW(filename) - filename; int len = PathFindExtensionW(filename) - filename;
name = HeapAlloc(GetProcessHeap(), 0, (strlenW(last_group) + 1 + len + 5) * sizeof(*name)); name = heap_alloc((strlenW(last_group) + 1 + len + 5) * sizeof(*name));
lstrcpyW(name, last_group); lstrcpyW(name, last_group);
lstrcatW(name, slashW); lstrcatW(name, slashW);
lstrcpynW(name+strlenW(name), filename, len + 1); lstrcpynW(name+strlenW(name), filename, len + 1);
@ -288,7 +288,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
} }
hres = IPersistFile_Save(file, name, TRUE); hres = IPersistFile_Save(file, name, TRUE);
HeapFree(GetProcessHeap(), 0, name); heap_free(name);
IPersistFile_Release(file); IPersistFile_Release(file);
IShellLinkW_Release(link); IShellLinkW_Release(link);
@ -301,7 +301,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
if (argc < 1) return DDE_FNOTPROCESSED; if (argc < 1) return DDE_FNOTPROCESSED;
name = HeapAlloc(GetProcessHeap(), 0, (strlenW(last_group) + 1 + strlenW(argv[0]) + 5) * sizeof(*name)); name = heap_alloc((strlenW(last_group) + 1 + strlenW(argv[0]) + 5) * sizeof(*name));
lstrcpyW(name, last_group); lstrcpyW(name, last_group);
lstrcatW(name, slashW); lstrcatW(name, slashW);
lstrcatW(name, argv[0]); lstrcatW(name, argv[0]);
@ -309,7 +309,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
ret = DeleteFileW(name); ret = DeleteFileW(name);
HeapFree(GetProcessHeap(), 0, name); heap_free(name);
if (!ret) return DDE_FNOTPROCESSED; if (!ret) return DDE_FNOTPROCESSED;
} }
@ -341,7 +341,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
while (*command == '[') while (*command == '[')
{ {
argc = 0; argc = 0;
argv = HeapAlloc(GetProcessHeap(), 0, sizeof(*argv)); argv = heap_alloc(sizeof(*argv));
command++; command++;
while (*command == ' ') command++; while (*command == ' ') command++;
@ -370,7 +370,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
} }
argc++; argc++;
argv = HeapReAlloc(GetProcessHeap(), 0, argv, argc * sizeof(*argv)); argv = heap_realloc(argv, argc * sizeof(*argv));
argv[argc-1] = strndupW(command, p - command); argv[argc-1] = strndupW(command, p - command);
command = p; command = p;
@ -396,9 +396,9 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
ret = DDE_FNOTPROCESSED; ret = DDE_FNOTPROCESSED;
} }
HeapFree(GetProcessHeap(), 0, opcode); heap_free(opcode);
for (i = 0; i < argc; i++) HeapFree(GetProcessHeap(), 0, argv[i]); for (i = 0; i < argc; i++) heap_free(argv[i]);
HeapFree(GetProcessHeap(), 0, argv); heap_free(argv);
if (ret == DDE_FNOTPROCESSED) break; if (ret == DDE_FNOTPROCESSED) break;
} }
@ -407,9 +407,9 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
error: error:
ERR("failed to parse command %s\n", debugstr_w(original)); ERR("failed to parse command %s\n", debugstr_w(original));
HeapFree(GetProcessHeap(), 0, opcode); heap_free(opcode);
for (i = 0; i < argc; i++) HeapFree(GetProcessHeap(), 0, argv[i]); for (i = 0; i < argc; i++) heap_free(argv[i]);
HeapFree(GetProcessHeap(), 0, argv); heap_free(argv);
return DDE_FNOTPROCESSED; return DDE_FNOTPROCESSED;
} }
@ -421,14 +421,14 @@ static DWORD Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata)
len = DdeGetData(hdata, NULL, 0, 0); len = DdeGetData(hdata, NULL, 0, 0);
if (!len) return DDE_FNOTPROCESSED; if (!len) return DDE_FNOTPROCESSED;
command = HeapAlloc(GetProcessHeap(), 0, len); command = heap_alloc(len);
DdeGetData(hdata, (BYTE *)command, len, 0); DdeGetData(hdata, (BYTE *)command, len, 0);
TRACE("conv=%p topic=%s data=%s\n", hconv, debugstr_hsz(hszTopic), debugstr_w(command)); TRACE("conv=%p topic=%s data=%s\n", hconv, debugstr_hsz(hszTopic), debugstr_w(command));
ret = parse_dde_command(hszTopic, command); ret = parse_dde_command(hszTopic, command);
HeapFree(GetProcessHeap(), 0, command); heap_free(command);
return ret; return ret;
} }

View File

@ -121,7 +121,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
WCHAR *dest, *result, *result_end=NULL; WCHAR *dest, *result, *result_end=NULL;
static const WCHAR dotexeW[] = {'.','e','x','e',0}; static const WCHAR dotexeW[] = {'.','e','x','e',0};
result = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(strlenW(cmdline)+5)); result = heap_alloc(sizeof(WCHAR)*(strlenW(cmdline)+5));
src = cmdline; src = cmdline;
dest = result; dest = result;
@ -161,7 +161,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
} }
else else
{ {
HeapFree(GetProcessHeap(), 0, result); heap_free(result);
return NULL; return NULL;
} }
} }
@ -216,7 +216,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
ZeroMemory (&sei, sizeof(sei)) ; ZeroMemory (&sei, sizeof(sei)) ;
sei.cbSize = sizeof(sei) ; sei.cbSize = sizeof(sei) ;
psz = HeapAlloc( GetProcessHeap(), 0, (ic + 1)*sizeof(WCHAR) ); psz = heap_alloc( (ic + 1)*sizeof(WCHAR) );
GetWindowTextW (htxt, psz, ic + 1) ; GetWindowTextW (htxt, psz, ic + 1) ;
/* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a /* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a
@ -233,8 +233,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
if (!ShellExecuteExW( &sei )) if (!ShellExecuteExW( &sei ))
{ {
HeapFree(GetProcessHeap(), 0, psz); heap_free(psz);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
return TRUE ; return TRUE ;
} }
@ -243,8 +243,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ; GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ;
FillList (htxt, (LPSTR)psz, FALSE) ; FillList (htxt, (LPSTR)psz, FALSE) ;
HeapFree(GetProcessHeap(), 0, psz); heap_free(psz);
HeapFree(GetProcessHeap(), 0, parent); heap_free(parent);
EndDialog (hwnd, 0); EndDialog (hwnd, 0);
} }
} }
@ -326,14 +326,14 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
if (icList > 0) if (icList > 0)
{ {
pszList = HeapAlloc( GetProcessHeap(), 0, icList) ; pszList = heap_alloc(icList) ;
if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, (LPBYTE)pszList, &icList)) if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, (LPBYTE)pszList, &icList))
MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ; MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ;
} }
else else
{ {
icList = 1 ; icList = 1 ;
pszList = HeapAlloc( GetProcessHeap(), 0, icList) ; pszList = heap_alloc(icList) ;
pszList[0] = 0 ; pszList[0] = 0 ;
} }
@ -347,9 +347,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, NULL, &icCmd)) if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, NULL, &icCmd))
MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ; MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ;
if( pszCmd ) if( pszCmd )
pszCmd = HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd) ; pszCmd = heap_realloc(pszCmd, icCmd) ;
else else
pszCmd = HeapAlloc(GetProcessHeap(), 0, icCmd) ; pszCmd = heap_alloc(icCmd) ;
if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd)) if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd))
MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ; MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ;
@ -416,9 +416,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
cMatch = ++cMax ; cMatch = ++cMax ;
if( pszList ) if( pszList )
pszList = HeapReAlloc(GetProcessHeap(), 0, pszList, ++icList) ; pszList = heap_realloc(pszList, ++icList) ;
else else
pszList = HeapAlloc(GetProcessHeap(), 0, ++icList) ; pszList = heap_alloc(++icList) ;
memmove (&pszList[1], pszList, icList - 1) ; memmove (&pszList[1], pszList, icList - 1) ;
pszList[0] = cMatch ; pszList[0] = cMatch ;
szIndex[0] = cMatch ; szIndex[0] = cMatch ;
@ -427,9 +427,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
RegSetValueExA (hkey, "MRUList", 0, REG_SZ, (LPBYTE)pszList, strlen (pszList) + 1) ; RegSetValueExA (hkey, "MRUList", 0, REG_SZ, (LPBYTE)pszList, strlen (pszList) + 1) ;
HeapFree( GetProcessHeap(), 0, pszCmd) ; heap_free(pszCmd) ;
HeapFree( GetProcessHeap(), 0, pszList) ; heap_free(pszList) ;
} }
/************************************************************************* /*************************************************************************
* RunFileDlgA [internal] * RunFileDlgA [internal]

View File

@ -112,7 +112,7 @@ static void events_unadvise_all(ExplorerBrowserImpl *This)
TRACE("Removing %p\n", client); TRACE("Removing %p\n", client);
list_remove(&client->entry); list_remove(&client->entry);
IExplorerBrowserEvents_Release(client->pebe); IExplorerBrowserEvents_Release(client->pebe);
HeapFree(GetProcessHeap(), 0, client); heap_free(client);
} }
} }
@ -184,7 +184,7 @@ static void travellog_remove_entry(ExplorerBrowserImpl *This, travellog_entry *e
list_remove(&entry->entry); list_remove(&entry->entry);
ILFree(entry->pidl); ILFree(entry->pidl);
HeapFree(GetProcessHeap(), 0, entry); heap_free(entry);
This->travellog_count--; This->travellog_count--;
} }
@ -216,7 +216,7 @@ static void travellog_add_entry(ExplorerBrowserImpl *This, LPITEMIDLIST pidl)
} }
/* Create and add the new entry */ /* Create and add the new entry */
new = HeapAlloc(GetProcessHeap(), 0, sizeof(travellog_entry)); new = heap_alloc(sizeof(*new));
new->pidl = ILClone(pidl); new->pidl = ILClone(pidl);
list_add_tail(&This->travellog, &new->entry); list_add_tail(&This->travellog, &new->entry);
This->travellog_cursor = new; This->travellog_cursor = new;
@ -851,8 +851,7 @@ static ULONG WINAPI IExplorerBrowser_fnRelease(IExplorerBrowser *iface)
IObjectWithSite_SetSite(&This->IObjectWithSite_iface, NULL); IObjectWithSite_SetSite(&This->IObjectWithSite_iface, NULL);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return 0;
} }
return ref; return ref;
@ -1017,7 +1016,7 @@ static HRESULT WINAPI IExplorerBrowser_fnAdvise(IExplorerBrowser *iface,
event_client *client; event_client *client;
TRACE("%p (%p, %p)\n", This, psbe, pdwCookie); TRACE("%p (%p, %p)\n", This, psbe, pdwCookie);
client = HeapAlloc(GetProcessHeap(), 0, sizeof(event_client)); client = heap_alloc(sizeof(*client));
client->pebe = psbe; client->pebe = psbe;
client->cookie = ++This->events_next_cookie; client->cookie = ++This->events_next_cookie;
@ -1042,7 +1041,7 @@ static HRESULT WINAPI IExplorerBrowser_fnUnadvise(IExplorerBrowser *iface,
{ {
list_remove(&client->entry); list_remove(&client->entry);
IExplorerBrowserEvents_Release(client->pebe); IExplorerBrowserEvents_Release(client->pebe);
HeapFree(GetProcessHeap(), 0, client); heap_free(client);
return S_OK; return S_OK;
} }
} }
@ -2079,7 +2078,7 @@ HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, voi
if(pUnkOuter) if(pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
eb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ExplorerBrowserImpl)); eb = heap_alloc_zero(sizeof(*eb));
eb->ref = 1; eb->ref = 1;
eb->IExplorerBrowser_iface.lpVtbl = &vt_IExplorerBrowser; eb->IExplorerBrowser_iface.lpVtbl = &vt_IExplorerBrowser;
eb->IShellBrowser_iface.lpVtbl = &vt_IShellBrowser; eb->IShellBrowser_iface.lpVtbl = &vt_IShellBrowser;

View File

@ -186,7 +186,7 @@ static ULONG WINAPI IEnumIDList_fnRelease(IEnumIDList *iface)
SHFree(cur->pidl); SHFree(cur->pidl);
SHFree(cur); SHFree(cur);
} }
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return refCount; return refCount;
@ -295,7 +295,7 @@ static const IEnumIDListVtbl eidlvt =
IEnumIDListImpl *IEnumIDList_Constructor(void) IEnumIDListImpl *IEnumIDList_Constructor(void)
{ {
IEnumIDListImpl *lpeidl = HeapAlloc(GetProcessHeap(), 0, sizeof(*lpeidl)); IEnumIDListImpl *lpeidl = heap_alloc(sizeof(*lpeidl));
if (lpeidl) if (lpeidl)
{ {

View File

@ -125,8 +125,7 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface)
{ {
TRACE(" destroying IExtractIcon(%p)\n",This); TRACE(" destroying IExtractIcon(%p)\n",This);
SHFree(This->pidl); SHFree(This->pidl);
HeapFree(GetProcessHeap(),0,This); heap_free(This);
return 0;
} }
return refCount; return refCount;
} }
@ -419,14 +418,14 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(IExtractIconA * iface, UIN
{ {
IExtractIconWImpl *This = impl_from_IExtractIconA(iface); IExtractIconWImpl *This = impl_from_IExtractIconA(iface);
HRESULT ret; HRESULT ret;
LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, cchMax * sizeof(WCHAR)); LPWSTR lpwstrFile = heap_alloc(cchMax * sizeof(WCHAR));
TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags); TRACE("(%p) (flags=%u %p %u %p %p)\n", This, uFlags, szIconFile, cchMax, piIndex, pwFlags);
ret = IExtractIconW_GetIconLocation(&This->IExtractIconW_iface, uFlags, lpwstrFile, cchMax, ret = IExtractIconW_GetIconLocation(&This->IExtractIconW_iface, uFlags, lpwstrFile, cchMax,
piIndex, pwFlags); piIndex, pwFlags);
WideCharToMultiByte(CP_ACP, 0, lpwstrFile, -1, szIconFile, cchMax, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, lpwstrFile, -1, szIconFile, cchMax, NULL, NULL);
HeapFree(GetProcessHeap(), 0, lpwstrFile); heap_free(lpwstrFile);
TRACE("-- %s %x\n", szIconFile, *piIndex); TRACE("-- %s %x\n", szIconFile, *piIndex);
return ret; return ret;
@ -440,14 +439,14 @@ static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszF
IExtractIconWImpl *This = impl_from_IExtractIconA(iface); IExtractIconWImpl *This = impl_from_IExtractIconA(iface);
HRESULT ret; HRESULT ret;
INT len = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0); INT len = MultiByteToWideChar(CP_ACP, 0, pszFile, -1, NULL, 0);
LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); LPWSTR lpwstrFile = heap_alloc(len * sizeof(WCHAR));
TRACE("(%p) (file=%p index=%u %p %p size=%u)\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize); TRACE("(%p) (file=%p index=%u %p %p size=%u)\n", This, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
MultiByteToWideChar(CP_ACP, 0, pszFile, -1, lpwstrFile, len); MultiByteToWideChar(CP_ACP, 0, pszFile, -1, lpwstrFile, len);
ret = IExtractIconW_Extract(&This->IExtractIconW_iface, lpwstrFile, nIconIndex, phiconLarge, ret = IExtractIconW_Extract(&This->IExtractIconW_iface, lpwstrFile, nIconIndex, phiconLarge,
phiconSmall, nIconSize); phiconSmall, nIconSize);
HeapFree(GetProcessHeap(), 0, lpwstrFile); heap_free(lpwstrFile);
return ret; return ret;
} }
@ -537,7 +536,7 @@ static IExtractIconWImpl *extracticon_create(LPCITEMIDLIST pidl)
TRACE("%p\n", pidl); TRACE("%p\n", pidl);
ei = HeapAlloc(GetProcessHeap(), 0, sizeof(*ei)); ei = heap_alloc(sizeof(*ei));
ei->ref=1; ei->ref=1;
ei->IExtractIconW_iface.lpVtbl = &eivt; ei->IExtractIconW_iface.lpVtbl = &eivt;
ei->IExtractIconA_iface.lpVtbl = &eiavt; ei->IExtractIconA_iface.lpVtbl = &eiavt;

View File

@ -316,7 +316,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
lpsice = SHAlloc(sizeof(SIC_ENTRY)); lpsice = SHAlloc(sizeof(SIC_ENTRY));
GetFullPathNameW(sSourceFile, MAX_PATH, path, NULL); GetFullPathNameW(sSourceFile, MAX_PATH, path, NULL);
lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, (strlenW(path)+1)*sizeof(WCHAR) ); lpsice->sSourceFile = heap_alloc( (strlenW(path)+1)*sizeof(WCHAR) );
strcpyW( lpsice->sSourceFile, path ); strcpyW( lpsice->sSourceFile, path );
lpsice->dwSourceIndex = dwSourceIndex; lpsice->dwSourceIndex = dwSourceIndex;
@ -327,7 +327,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
index = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice); index = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice);
if ( INVALID_INDEX == index ) if ( INVALID_INDEX == index )
{ {
HeapFree(GetProcessHeap(), 0, lpsice->sSourceFile); heap_free(lpsice->sSourceFile);
SHFree(lpsice); SHFree(lpsice);
ret = INVALID_INDEX; ret = INVALID_INDEX;
} }
@ -492,7 +492,7 @@ static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context
*/ */
static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam ) static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam )
{ {
HeapFree(GetProcessHeap(), 0, ((LPSIC_ENTRY)ptr)->sSourceFile); heap_free(((LPSIC_ENTRY)ptr)->sSourceFile);
SHFree(ptr); SHFree(ptr);
return TRUE; return TRUE;
} }
@ -746,12 +746,12 @@ static INT Shell_GetCachedImageIndexA(LPCSTR szPath, INT nIndex, BOOL bSimulateD
WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_a(szPath), nIndex, bSimulateDoc); WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_a(szPath), nIndex, bSimulateDoc);
len = MultiByteToWideChar( CP_ACP, 0, szPath, -1, NULL, 0 ); len = MultiByteToWideChar( CP_ACP, 0, szPath, -1, NULL, 0 );
szTemp = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); szTemp = heap_alloc( len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, szPath, -1, szTemp, len ); MultiByteToWideChar( CP_ACP, 0, szPath, -1, szTemp, len );
ret = SIC_GetIconIndex( szTemp, nIndex, 0 ); ret = SIC_GetIconIndex( szTemp, nIndex, 0 );
HeapFree( GetProcessHeap(), 0, szTemp ); heap_free( szTemp );
return ret; return ret;
} }
@ -790,7 +790,7 @@ UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge,
{ {
UINT ret = 0; UINT ret = 0;
INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0); INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0);
LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); LPWSTR lpwstrFile = heap_alloc( len * sizeof(WCHAR));
TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
@ -798,7 +798,7 @@ UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge,
{ {
MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len); MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
ret = ExtractIconExW(lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons); ret = ExtractIconExW(lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
HeapFree(GetProcessHeap(), 0, lpwstrFile); heap_free(lpwstrFile);
} }
return ret; return ret;
} }
@ -818,7 +818,7 @@ HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lp
* lpIconPath itself is supposed to be large enough, so make sure lpIconPathW * lpIconPath itself is supposed to be large enough, so make sure lpIconPathW
* is large enough too. Yes, I am puking too. * is large enough too. Yes, I am puking too.
*/ */
LPWSTR lpIconPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); LPWSTR lpIconPathW = heap_alloc(MAX_PATH * sizeof(WCHAR));
TRACE("%p %s %p\n", hInst, debugstr_a(lpIconPath), lpiIcon); TRACE("%p %s %p\n", hInst, debugstr_a(lpIconPath), lpiIcon);
@ -827,7 +827,7 @@ HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lp
MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, lpIconPathW, len); MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, lpIconPathW, len);
hIcon = ExtractAssociatedIconW(hInst, lpIconPathW, lpiIcon); hIcon = ExtractAssociatedIconW(hInst, lpIconPathW, lpiIcon);
WideCharToMultiByte(CP_ACP, 0, lpIconPathW, -1, lpIconPath, MAX_PATH , NULL, NULL); WideCharToMultiByte(CP_ACP, 0, lpIconPathW, -1, lpIconPath, MAX_PATH , NULL, NULL);
HeapFree(GetProcessHeap(), 0, lpIconPathW); heap_free(lpIconPathW);
} }
return hIcon; return hIcon;
} }
@ -896,13 +896,13 @@ HICON WINAPI ExtractAssociatedIconExA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD
{ {
HICON ret; HICON ret;
INT len = MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, NULL, 0 ); INT len = MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, NULL, 0 );
LPWSTR lpwstrFile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); LPWSTR lpwstrFile = heap_alloc( len * sizeof(WCHAR) );
TRACE("%p %s %p %p)\n", hInst, lpIconPath, lpiIconIdx, lpiIconId); TRACE("%p %s %p %p)\n", hInst, lpIconPath, lpiIconIdx, lpiIconId);
MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, lpwstrFile, len ); MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, lpwstrFile, len );
ret = ExtractAssociatedIconExW(hInst, lpwstrFile, lpiIconIdx, lpiIconId); ret = ExtractAssociatedIconExW(hInst, lpwstrFile, lpiIconIdx, lpiIconId);
HeapFree(GetProcessHeap(), 0, lpwstrFile); heap_free(lpwstrFile);
return ret; return ret;
} }
@ -943,13 +943,13 @@ HRESULT WINAPI SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags,
{ {
HRESULT ret; HRESULT ret;
INT len = MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, NULL, 0); INT len = MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, NULL, 0);
LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); LPWSTR lpwstrFile = heap_alloc(len * sizeof(WCHAR));
TRACE("%s %d 0x%08x %p %p %d\n", pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize); TRACE("%s %d 0x%08x %p %p %d\n", pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, lpwstrFile, len); MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, lpwstrFile, len);
ret = SHDefExtractIconW(lpwstrFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize); ret = SHDefExtractIconW(lpwstrFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
HeapFree(GetProcessHeap(), 0, lpwstrFile); heap_free(lpwstrFile);
return ret; return ret;
} }

View File

@ -1063,13 +1063,13 @@ LPITEMIDLIST SHSimpleIDListFromPathA(LPCSTR lpszPath)
if (lpszPath) if (lpszPath)
{ {
len = MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, NULL, 0);
wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wPath = heap_alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, wPath, len); MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, wPath, len);
} }
_ILParsePathW(wPath, NULL, TRUE, &pidl, NULL); _ILParsePathW(wPath, NULL, TRUE, &pidl, NULL);
HeapFree(GetProcessHeap(), 0, wPath); heap_free(wPath);
TRACE("%s %p\n", debugstr_a(lpszPath), pidl); TRACE("%s %p\n", debugstr_a(lpszPath), pidl);
return pidl; return pidl;
} }

View File

@ -723,8 +723,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
while ((hr = SIC_get_location( psfi->iIcon, file, &size, &icon_idx )) == E_NOT_SUFFICIENT_BUFFER) while ((hr = SIC_get_location( psfi->iIcon, file, &size, &icon_idx )) == E_NOT_SUFFICIENT_BUFFER)
{ {
if (file == buf) file = HeapAlloc( GetProcessHeap(), 0, size ); if (file == buf) file = heap_alloc( size );
else file = HeapReAlloc( GetProcessHeap(), 0, file, size ); else file = heap_realloc( file, size );
if (!file) break; if (!file) break;
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -732,7 +732,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
ret = PrivateExtractIconsW( file, icon_idx, width, height, &psfi->hIcon, 0, 1, 0); ret = PrivateExtractIconsW( file, icon_idx, width, height, &psfi->hIcon, 0, 1, 0);
if (ret == 0 || ret == (UINT)-1) hr = E_FAIL; if (ret == 0 || ret == (UINT)-1) hr = E_FAIL;
} }
if (file != buf) HeapFree( GetProcessHeap(), 0, file ); if (file != buf) heap_free( file );
} }
} }
} }
@ -783,7 +783,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
else else
{ {
len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0);
temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); temppath = heap_alloc(len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len); MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len);
pathW = temppath; pathW = temppath;
} }
@ -816,7 +816,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
} }
} }
HeapFree(GetProcessHeap(), 0, temppath); heap_free(temppath);
return ret; return ret;
} }
@ -855,7 +855,7 @@ HICON WINAPI ExtractIconA(HINSTANCE hInstance, const char *file, UINT nIconIndex
fileW = strdupAtoW(file); fileW = strdupAtoW(file);
ret = ExtractIconW(hInstance, fileW, nIconIndex); ret = ExtractIconW(hInstance, fileW, nIconIndex);
HeapFree(GetProcessHeap(), 0, fileW); heap_free(fileW);
return ret; return ret;
} }
@ -1037,7 +1037,7 @@ static void add_authors( HWND list )
if (!strA) return; if (!strA) return;
sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1; sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1;
if (!(strW = HeapAlloc( GetProcessHeap(), 0, sizeW * sizeof(WCHAR) ))) return; if (!(strW = heap_alloc( sizeW * sizeof(WCHAR) ))) return;
MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW ); MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW );
strW[sizeW - 1] = 0; strW[sizeW - 1] = 0;
@ -1051,7 +1051,7 @@ static void add_authors( HWND list )
SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start ); SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
start = end; start = end;
} }
HeapFree( GetProcessHeap(), 0, strW ); heap_free( strW );
} }
/************************************************************************* /*************************************************************************
@ -1148,20 +1148,20 @@ BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIc
if (szApp) if (szApp)
{ {
len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); appW = heap_alloc( len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len); MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
} }
if (szOtherStuff) if (szOtherStuff)
{ {
len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); otherW = heap_alloc( len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len); MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
} }
ret = ShellAboutW(hWnd, appW, otherW, hIcon); ret = ShellAboutW(hWnd, appW, otherW, hIcon);
HeapFree(GetProcessHeap(), 0, otherW); heap_free(otherW);
HeapFree(GetProcessHeap(), 0, appW); heap_free(appW);
return ret; return ret;
} }

View File

@ -35,6 +35,7 @@
#include "undocshell.h" #include "undocshell.h"
#include "shlobj.h" #include "shlobj.h"
#include "shellapi.h" #include "shellapi.h"
#include "wine/heap.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/list.h" #include "wine/list.h"
@ -232,7 +233,7 @@ static inline WCHAR *strdupW(const WCHAR *src)
{ {
WCHAR *dest; WCHAR *dest;
if (!src) return NULL; if (!src) return NULL;
dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(*dest)); dest = heap_alloc((lstrlenW(src) + 1) * sizeof(*dest));
if (dest) if (dest)
lstrcpyW(dest, src); lstrcpyW(dest, src);
return dest; return dest;
@ -242,7 +243,7 @@ static inline WCHAR *strndupW(const WCHAR *src, DWORD len)
{ {
WCHAR *dest; WCHAR *dest;
if (!src) return NULL; if (!src) return NULL;
dest = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*dest)); dest = heap_alloc((len + 1) * sizeof(*dest));
if (dest) if (dest)
{ {
memcpy(dest, src, len * sizeof(WCHAR)); memcpy(dest, src, len * sizeof(WCHAR));
@ -259,7 +260,7 @@ static inline WCHAR *strdupAtoW(const char *str)
if (!str) return NULL; if (!str) return NULL;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); ret = heap_alloc(len * sizeof(WCHAR));
if (ret) if (ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);

View File

@ -234,7 +234,7 @@ static ULONG WINAPI FolderItemVerbImpl_Release(FolderItemVerb *iface)
{ {
IContextMenu_Release(This->contextmenu); IContextMenu_Release(This->contextmenu);
SysFreeString(This->name); SysFreeString(This->name);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
@ -346,7 +346,7 @@ static HRESULT FolderItemVerb_Constructor(IContextMenu *contextmenu, BSTR name,
TRACE("%p, %s\n", contextmenu, debugstr_w(name)); TRACE("%p, %s\n", contextmenu, debugstr_w(name));
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderItemVerbImpl)); This = heap_alloc(sizeof(*This));
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -404,7 +404,7 @@ static ULONG WINAPI FolderItemVerbsImpl_Release(FolderItemVerbs *iface)
{ {
IContextMenu_Release(This->contextmenu); IContextMenu_Release(This->contextmenu);
DestroyMenu(This->hMenu); DestroyMenu(This->hMenu);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
@ -578,7 +578,7 @@ static HRESULT FolderItemVerbs_Constructor(BSTR path, FolderItemVerbs **verbs)
*verbs = NULL; *verbs = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderItemVerbsImpl)); This = heap_alloc(sizeof(*This));
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -613,7 +613,7 @@ static HRESULT FolderItemVerbs_Constructor(BSTR path, FolderItemVerbs **verbs)
return S_OK; return S_OK;
failed: failed:
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return hr; return hr;
} }
@ -661,8 +661,8 @@ static ULONG WINAPI FolderItemImpl_Release(FolderItem2 *iface)
if (!ref) if (!ref)
{ {
Folder3_Release(&This->folder->Folder3_iface); Folder3_Release(&This->folder->Folder3_iface);
HeapFree(GetProcessHeap(), 0, This->path); heap_free(This->path);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
} }
@ -964,7 +964,7 @@ static HRESULT FolderItem_Constructor(FolderImpl *folder, const WCHAR *path, Fol
*item = NULL; *item = NULL;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This)); This = heap_alloc_zero(sizeof(*This));
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1031,8 +1031,8 @@ static ULONG WINAPI FolderItemsImpl_Release(FolderItems3 *iface)
Folder3_Release(&This->folder->Folder3_iface); Folder3_Release(&This->folder->Folder3_iface);
for (i = 0; i < This->item_count; i++) for (i = 0; i < This->item_count; i++)
SysFreeString(This->item_names[i]); SysFreeString(This->item_names[i]);
HeapFree(GetProcessHeap(), 0, This->item_names); heap_free(This->item_names);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
} }
@ -1285,7 +1285,7 @@ static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
*ret = NULL; *ret = NULL;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This)); This = heap_alloc_zero(sizeof(*This));
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1312,13 +1312,13 @@ static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
LPITEMIDLIST *pidls; LPITEMIDLIST *pidls;
ULONG fetched; ULONG fetched;
pidls = HeapAlloc(GetProcessHeap(), 0, This->item_count * sizeof(*pidls)); pidls = heap_alloc(This->item_count * sizeof(*pidls));
This->item_names = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->item_count * sizeof(*This->item_names)); This->item_names = heap_alloc_zero(This->item_count * sizeof(*This->item_names));
if (!pidls || !This->item_names) if (!pidls || !This->item_names)
{ {
HeapFree(GetProcessHeap(), 0, pidls); heap_free(pidls);
HeapFree(GetProcessHeap(), 0, This->item_names); heap_free(This->item_names);
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
goto failed; goto failed;
} }
@ -1336,7 +1336,7 @@ static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
ILFree(pidls[i]); ILFree(pidls[i]);
} }
HeapFree(GetProcessHeap(), 0, pidls); heap_free(pidls);
} }
IEnumIDList_Release(enumidlist); IEnumIDList_Release(enumidlist);
@ -1397,7 +1397,7 @@ static ULONG WINAPI FolderImpl_Release(Folder3 *iface)
SysFreeString(This->path); SysFreeString(This->path);
IShellFolder2_Release(This->folder); IShellFolder2_Release(This->folder);
IDispatch_Release(This->application); IDispatch_Release(This->application);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
} }
@ -1667,7 +1667,7 @@ static HRESULT Folder_Constructor(IShellFolder2 *folder, LPITEMIDLIST pidl, Fold
*ret = NULL; *ret = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = heap_alloc(sizeof(*This));
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1734,7 +1734,7 @@ static ULONG WINAPI ShellDispatch_Release(IShellDispatch6 *iface)
TRACE("(%p), new refcount=%i\n", iface, ref); TRACE("(%p), new refcount=%i\n", iface, ref);
if (!ref) if (!ref)
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ref; return ref;
} }
@ -2244,7 +2244,7 @@ HRESULT WINAPI IShellDispatch_Constructor(IUnknown *outer, REFIID riid, void **p
if (outer) return CLASS_E_NOAGGREGATION; if (outer) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellDispatch)); This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IShellDispatch6_iface.lpVtbl = &ShellDispatchVtbl; This->IShellDispatch6_iface.lpVtbl = &ShellDispatchVtbl;
This->ref = 1; This->ref = 1;

View File

@ -112,7 +112,7 @@ static ULONG WINAPI ShellItem_Release(IShellItem2 *iface)
if (ref == 0) if (ref == 0)
{ {
ILFree(This->pidl); ILFree(This->pidl);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
@ -551,7 +551,7 @@ HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **p
if (pUnkOuter) return CLASS_E_NOAGGREGATION; if (pUnkOuter) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellItem)); This = heap_alloc(sizeof(*This));
This->IShellItem2_iface.lpVtbl = &ShellItem2_Vtbl; This->IShellItem2_iface.lpVtbl = &ShellItem2_Vtbl;
This->ref = 1; This->ref = 1;
This->pidl = NULL; This->pidl = NULL;
@ -918,7 +918,7 @@ static ULONG WINAPI IEnumShellItems_fnRelease(IEnumShellItems *iface)
{ {
TRACE("Freeing.\n"); TRACE("Freeing.\n");
IShellItemArray_Release(This->array); IShellItemArray_Release(This->array);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return 0; return 0;
} }
@ -1007,7 +1007,7 @@ static HRESULT IEnumShellItems_Constructor(IShellItemArray *array, IEnumShellIte
IEnumShellItemsImpl *This; IEnumShellItemsImpl *This;
HRESULT ret; HRESULT ret;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumShellItemsImpl)); This = heap_alloc(sizeof(*This));
if(!This) if(!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1088,8 +1088,8 @@ static ULONG WINAPI IShellItemArray_fnRelease(IShellItemArray *iface)
for(i = 0; i < This->item_count; i++) for(i = 0; i < This->item_count; i++)
IShellItem_Release(This->array[i]); IShellItem_Release(This->array[i]);
HeapFree(GetProcessHeap(), 0, This->array); heap_free(This->array);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return 0; return 0;
} }
@ -1236,17 +1236,17 @@ static HRESULT create_shellitemarray(IShellItem **items, DWORD count, IShellItem
TRACE("(%p, %d, %p)\n", items, count, ret); TRACE("(%p, %d, %p)\n", items, count, ret);
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IShellItemArrayImpl)); This = heap_alloc(sizeof(*This));
if(!This) if(!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IShellItemArray_iface.lpVtbl = &vt_IShellItemArray; This->IShellItemArray_iface.lpVtbl = &vt_IShellItemArray;
This->ref = 1; This->ref = 1;
This->array = HeapAlloc(GetProcessHeap(), 0, count*sizeof(IShellItem*)); This->array = heap_alloc(count*sizeof(IShellItem*));
if (!This->array) if (!This->array)
{ {
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
memcpy(This->array, items, count*sizeof(IShellItem*)); memcpy(This->array, items, count*sizeof(IShellItem*));
@ -1276,7 +1276,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
if(!ppidl) if(!ppidl)
return E_INVALIDARG; return E_INVALIDARG;
array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cidl*sizeof(IShellItem*)); array = heap_alloc_zero(cidl*sizeof(IShellItem*));
if(!array) if(!array)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1289,7 +1289,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
if(SUCCEEDED(ret)) if(SUCCEEDED(ret))
{ {
ret = create_shellitemarray(array, cidl, ppsiItemArray); ret = create_shellitemarray(array, cidl, ppsiItemArray);
HeapFree(GetProcessHeap(), 0, array); heap_free(array);
if(SUCCEEDED(ret)) if(SUCCEEDED(ret))
return ret; return ret;
} }
@ -1297,7 +1297,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
/* Something failed, clean up. */ /* Something failed, clean up. */
for(i = 0; i < cidl; i++) for(i = 0; i < cidl; i++)
if(array[i]) IShellItem_Release(array[i]); if(array[i]) IShellItem_Release(array[i]);
HeapFree(GetProcessHeap(), 0, array); heap_free(array);
return ret; return ret;
} }
@ -1354,13 +1354,13 @@ HRESULT WINAPI SHCreateShellItemArrayFromDataObject(IDataObject *pdo, REFIID rii
parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]); parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
children = HeapAlloc(GetProcessHeap(), 0, sizeof(LPCITEMIDLIST)*pida->cidl); children = heap_alloc(sizeof(LPCITEMIDLIST)*pida->cidl);
for(i = 0; i < pida->cidl; i++) for(i = 0; i < pida->cidl; i++)
children[i] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i+1]); children[i] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i+1]);
ret = SHCreateShellItemArray(parent_pidl, NULL, pida->cidl, children, &psia); ret = SHCreateShellItemArray(parent_pidl, NULL, pida->cidl, children, &psia);
HeapFree(GetProcessHeap(), 0, children); heap_free(children);
GlobalUnlock(medium.u.hGlobal); GlobalUnlock(medium.u.hGlobal);
GlobalFree(medium.u.hGlobal); GlobalFree(medium.u.hGlobal);
@ -1389,7 +1389,7 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl,
if(cidl == 0) if(cidl == 0)
return E_INVALIDARG; return E_INVALIDARG;
array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cidl*sizeof(IShellItem*)); array = heap_alloc_zero(cidl*sizeof(IShellItem*));
if(!array) if(!array)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1403,14 +1403,14 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl,
if(SUCCEEDED(ret)) if(SUCCEEDED(ret))
{ {
ret = create_shellitemarray(array, cidl, psia); ret = create_shellitemarray(array, cidl, psia);
HeapFree(GetProcessHeap(), 0, array); heap_free(array);
if(SUCCEEDED(ret)) if(SUCCEEDED(ret))
return ret; return ret;
} }
for(i = 0; i < cidl; i++) for(i = 0; i < cidl; i++)
if(array[i]) IShellItem_Release(array[i]); if(array[i]) IShellItem_Release(array[i]);
HeapFree(GetProcessHeap(), 0, array); heap_free(array);
*psia = NULL; *psia = NULL;
return ret; return ret;
} }
@ -1471,7 +1471,7 @@ static ULONG WINAPI CustomDestinationList_Release(ICustomDestinationList *iface)
TRACE("(%p), new refcount=%i\n", This, ref); TRACE("(%p), new refcount=%i\n", This, ref);
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ref; return ref;
} }
@ -1583,7 +1583,7 @@ HRESULT WINAPI CustomDestinationList_Constructor(IUnknown *outer, REFIID riid, v
if (outer) if (outer)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
if(!(list = HeapAlloc(GetProcessHeap(), 0, sizeof(*list)))) if(!(list = heap_alloc(sizeof(*list))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
list->ICustomDestinationList_iface.lpVtbl = &CustomDestinationListVtbl; list->ICustomDestinationList_iface.lpVtbl = &CustomDestinationListVtbl;

View File

@ -208,7 +208,7 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor
static inline LPWSTR heap_strdupAtoW( LPCSTR str) static inline LPWSTR heap_strdupAtoW( LPCSTR str)
{ {
INT len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); INT len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
LPWSTR p = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); LPWSTR p = heap_alloc( len*sizeof (WCHAR) );
if( !p ) if( !p )
return p; return p;
MultiByteToWideChar( CP_ACP, 0, str, -1, p, len ); MultiByteToWideChar( CP_ACP, 0, str, -1, p, len );
@ -287,7 +287,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
IStream_Release( stm ); IStream_Release( stm );
/* update file path */ /* update file path */
HeapFree(GetProcessHeap(), 0, This->filepath); heap_free(This->filepath);
This->filepath = strdupW(pszFileName); This->filepath = strdupW(pszFileName);
This->bDirty = FALSE; This->bDirty = FALSE;
@ -311,7 +311,7 @@ BOOL run_winemenubuilder( const WCHAR *args )
strcatW( app, menubuilder ); strcatW( app, menubuilder );
len = (strlenW( app ) + strlenW( args ) + 1) * sizeof(WCHAR); len = (strlenW( app ) + strlenW( args ) + 1) * sizeof(WCHAR);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = heap_alloc( len );
if( !buffer ) if( !buffer )
return FALSE; return FALSE;
@ -327,7 +327,7 @@ BOOL run_winemenubuilder( const WCHAR *args )
ret = CreateProcessW( app, buffer, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi ); ret = CreateProcessW( app, buffer, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &si, &pi );
Wow64RevertWow64FsRedirection( redir ); Wow64RevertWow64FsRedirection( redir );
HeapFree( GetProcessHeap(), 0, buffer ); heap_free( buffer );
if (ret) if (ret)
{ {
@ -346,13 +346,13 @@ static BOOL StartLinkProcessor( LPCOLESTR szLink )
BOOL ret; BOOL ret;
len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR); len = sizeof(szFormat) + lstrlenW( szLink ) * sizeof(WCHAR);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = heap_alloc( len );
if( !buffer ) if( !buffer )
return FALSE; return FALSE;
wsprintfW( buffer, szFormat, szLink ); wsprintfW( buffer, szFormat, szLink );
ret = run_winemenubuilder( buffer ); ret = run_winemenubuilder( buffer );
HeapFree( GetProcessHeap(), 0, buffer ); heap_free( buffer );
return ret; return ret;
} }
@ -379,7 +379,7 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
StartLinkProcessor( pszFileName ); StartLinkProcessor( pszFileName );
/* update file path */ /* update file path */
HeapFree(GetProcessHeap(), 0, This->filepath); heap_free(This->filepath);
This->filepath = strdupW(pszFileName); This->filepath = strdupW(pszFileName);
This->bDirty = FALSE; This->bDirty = FALSE;
@ -513,14 +513,14 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr )
len *= sizeof (WCHAR); len *= sizeof (WCHAR);
TRACE("reading %d\n", len); TRACE("reading %d\n", len);
temp = HeapAlloc(GetProcessHeap(), 0, len+sizeof(WCHAR)); temp = heap_alloc(len + sizeof(WCHAR));
if( !temp ) if( !temp )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
count = 0; count = 0;
r = IStream_Read(stm, temp, len, &count); r = IStream_Read(stm, temp, len, &count);
if( FAILED (r) || ( count != len ) ) if( FAILED (r) || ( count != len ) )
{ {
HeapFree( GetProcessHeap(), 0, temp ); heap_free( temp );
return E_FAIL; return E_FAIL;
} }
@ -530,14 +530,14 @@ static HRESULT Stream_LoadString( IStream* stm, BOOL unicode, LPWSTR *pstr )
if( !unicode ) if( !unicode )
{ {
count = MultiByteToWideChar( CP_ACP, 0, temp, len, NULL, 0 ); count = MultiByteToWideChar( CP_ACP, 0, temp, len, NULL, 0 );
str = HeapAlloc( GetProcessHeap(), 0, (count+1)*sizeof (WCHAR) ); str = heap_alloc( (count+1)*sizeof (WCHAR) );
if( !str ) if( !str )
{ {
HeapFree( GetProcessHeap(), 0, temp ); heap_free( temp );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
MultiByteToWideChar( CP_ACP, 0, temp, len, str, count ); MultiByteToWideChar( CP_ACP, 0, temp, len, str, count );
HeapFree( GetProcessHeap(), 0, temp ); heap_free( temp );
} }
else else
{ {
@ -567,7 +567,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data )
if( FAILED( r ) || count != sizeof(size) ) if( FAILED( r ) || count != sizeof(size) )
return E_FAIL; return E_FAIL;
chunk = HeapAlloc( GetProcessHeap(), 0, size ); chunk = heap_alloc( size );
if( !chunk ) if( !chunk )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -575,7 +575,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data )
r = IStream_Read( stm, chunk->data, size - sizeof(size), &count ); r = IStream_Read( stm, chunk->data, size - sizeof(size), &count );
if( FAILED( r ) || count != (size - sizeof(size)) ) if( FAILED( r ) || count != (size - sizeof(size)) )
{ {
HeapFree( GetProcessHeap(), 0, chunk ); heap_free( chunk );
return E_FAIL; return E_FAIL;
} }
@ -617,7 +617,7 @@ static LPWSTR Stream_LoadPath( LPCSTR p, DWORD maxlen )
len++; len++;
wlen = MultiByteToWideChar(CP_ACP, 0, p, len, NULL, 0); wlen = MultiByteToWideChar(CP_ACP, 0, p, len, NULL, 0);
path = HeapAlloc(GetProcessHeap(), 0, (wlen+1)*sizeof(WCHAR)); path = heap_alloc((wlen + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, p, len, path, wlen); MultiByteToWideChar(CP_ACP, 0, p, len, path, wlen);
path[wlen] = 0; path[wlen] = 0;
@ -639,7 +639,7 @@ static HRESULT Stream_LoadLocation( IStream *stm,
loc = (LOCATION_INFO*) p; loc = (LOCATION_INFO*) p;
if (loc->dwTotalSize < sizeof(LOCATION_INFO)) if (loc->dwTotalSize < sizeof(LOCATION_INFO))
{ {
HeapFree( GetProcessHeap(), 0, p ); heap_free( p );
return E_FAIL; return E_FAIL;
} }
@ -661,7 +661,7 @@ static HRESULT Stream_LoadLocation( IStream *stm,
TRACE("type %d serial %08x name %s path %s\n", volume->type, TRACE("type %d serial %08x name %s path %s\n", volume->type,
volume->serial, debugstr_w(volume->label), debugstr_w(*path)); volume->serial, debugstr_w(volume->label), debugstr_w(*path));
HeapFree( GetProcessHeap(), 0, p ); heap_free( p );
return S_OK; return S_OK;
} }
@ -715,8 +715,7 @@ static HRESULT Stream_LoadAdvertiseInfo( IStream* stm, LPWSTR *str )
return E_FAIL; return E_FAIL;
} }
*str = HeapAlloc( GetProcessHeap(), 0, *str = heap_alloc((lstrlenW(buffer.szwDarwinID) + 1) * sizeof(WCHAR) );
(lstrlenW(buffer.szwDarwinID)+1) * sizeof(WCHAR) );
lstrcpyW( *str, buffer.szwDarwinID ); lstrcpyW( *str, buffer.szwDarwinID );
return S_OK; return S_OK;
@ -758,21 +757,21 @@ static HRESULT WINAPI IPersistStream_fnLoad(
ILFree(This->pPidl); ILFree(This->pPidl);
This->pPidl = NULL; This->pPidl = NULL;
memset( &This->volume, 0, sizeof This->volume ); memset( &This->volume, 0, sizeof This->volume );
HeapFree(GetProcessHeap(), 0, This->sPath); heap_free(This->sPath);
This->sPath = NULL; This->sPath = NULL;
HeapFree(GetProcessHeap(), 0, This->sDescription); heap_free(This->sDescription);
This->sDescription = NULL; This->sDescription = NULL;
HeapFree(GetProcessHeap(), 0, This->sPathRel); heap_free(This->sPathRel);
This->sPathRel = NULL; This->sPathRel = NULL;
HeapFree(GetProcessHeap(), 0, This->sWorkDir); heap_free(This->sWorkDir);
This->sWorkDir = NULL; This->sWorkDir = NULL;
HeapFree(GetProcessHeap(), 0, This->sArgs); heap_free(This->sArgs);
This->sArgs = NULL; This->sArgs = NULL;
HeapFree(GetProcessHeap(), 0, This->sIcoPath); heap_free(This->sIcoPath);
This->sIcoPath = NULL; This->sIcoPath = NULL;
HeapFree(GetProcessHeap(), 0, This->sProduct); heap_free(This->sProduct);
This->sProduct = NULL; This->sProduct = NULL;
HeapFree(GetProcessHeap(), 0, This->sComponent); heap_free(This->sComponent);
This->sComponent = NULL; This->sComponent = NULL;
This->wHotKey = (WORD)hdr.wHotKey; This->wHotKey = (WORD)hdr.wHotKey;
@ -942,7 +941,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path,
total_size = sizeof *loc + volume_info_size + path_size + final_path_size; total_size = sizeof *loc + volume_info_size + path_size + final_path_size;
/* create pointers to everything */ /* create pointers to everything */
loc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, total_size); loc = heap_alloc_zero(total_size);
vol = (LOCAL_VOLUME_INFO*) &loc[1]; vol = (LOCAL_VOLUME_INFO*) &loc[1];
szLabel = (LPSTR) &vol[1]; szLabel = (LPSTR) &vol[1];
szPath = &szLabel[label_size]; szPath = &szLabel[label_size];
@ -971,7 +970,7 @@ static HRESULT Stream_WriteLocationInfo( IStream* stm, LPCWSTR path,
szFinalPath[0] = 0; szFinalPath[0] = 0;
hr = IStream_Write( stm, loc, total_size, &count ); hr = IStream_Write( stm, loc, total_size, &count );
HeapFree(GetProcessHeap(), 0, loc); heap_free(loc);
return hr; return hr;
} }
@ -1175,7 +1174,7 @@ static HRESULT ShellLink_UpdatePath(LPCWSTR sPathRel, LPCWSTR path, LPCWSTR sWor
if (!*abs_path) if (!*abs_path)
lstrcpyW(abs_path, sPathRel); lstrcpyW(abs_path, sPathRel);
*psPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(abs_path)+1)*sizeof(WCHAR)); *psPath = heap_alloc((lstrlenW(abs_path) + 1) * sizeof(WCHAR));
if (!*psPath) if (!*psPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1352,7 +1351,7 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA *iface, LPCSTR ps
descrW = NULL; descrW = NULL;
hr = IShellLinkW_SetDescription(&This->IShellLinkW_iface, descrW); hr = IShellLinkW_SetDescription(&This->IShellLinkW_iface, descrW);
HeapFree(GetProcessHeap(), 0, descrW); heap_free(descrW);
return hr; return hr;
} }
@ -1385,7 +1384,7 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA *iface, LPCS
if (!dirW) return E_OUTOFMEMORY; if (!dirW) return E_OUTOFMEMORY;
hr = IShellLinkW_SetWorkingDirectory(&This->IShellLinkW_iface, dirW); hr = IShellLinkW_SetWorkingDirectory(&This->IShellLinkW_iface, dirW);
HeapFree(GetProcessHeap(), 0, dirW); heap_free(dirW);
return hr; return hr;
} }
@ -1422,7 +1421,7 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA *iface, LPCSTR pszA
argsW = NULL; argsW = NULL;
hr = IShellLinkW_SetArguments(&This->IShellLinkW_iface, argsW); hr = IShellLinkW_SetArguments(&This->IShellLinkW_iface, argsW);
HeapFree(GetProcessHeap(), 0, argsW); heap_free(argsW);
return hr; return hr;
} }
@ -1481,7 +1480,7 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA *iface, LPCSTR p
if (!pathW) return E_OUTOFMEMORY; if (!pathW) return E_OUTOFMEMORY;
hr = IShellLinkW_SetIconLocation(&This->IShellLinkW_iface, pathW, iIcon); hr = IShellLinkW_SetIconLocation(&This->IShellLinkW_iface, pathW, iIcon);
HeapFree(GetProcessHeap(), 0, pathW); heap_free(pathW);
return hr; return hr;
} }
@ -1499,7 +1498,7 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA *iface, LPCSTR p
if (!pathW) return E_OUTOFMEMORY; if (!pathW) return E_OUTOFMEMORY;
hr = IShellLinkW_SetRelativePath(&This->IShellLinkW_iface, pathW, dwReserved); hr = IShellLinkW_SetRelativePath(&This->IShellLinkW_iface, pathW, dwReserved);
HeapFree(GetProcessHeap(), 0, pathW); heap_free(pathW);
return hr; return hr;
} }
@ -1528,7 +1527,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA *iface, LPCSTR pszFile)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
r = IShellLinkW_SetPath(&This->IShellLinkW_iface, str); r = IShellLinkW_SetPath(&This->IShellLinkW_iface, str);
HeapFree( GetProcessHeap(), 0, str ); heap_free( str );
return r; return r;
} }
@ -1650,15 +1649,15 @@ static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
TRACE("-- destroying IShellLink(%p)\n",This); TRACE("-- destroying IShellLink(%p)\n",This);
HeapFree(GetProcessHeap(), 0, This->sIcoPath); heap_free(This->sIcoPath);
HeapFree(GetProcessHeap(), 0, This->sArgs); heap_free(This->sArgs);
HeapFree(GetProcessHeap(), 0, This->sWorkDir); heap_free(This->sWorkDir);
HeapFree(GetProcessHeap(), 0, This->sDescription); heap_free(This->sDescription);
HeapFree(GetProcessHeap(), 0, This->sPath); heap_free(This->sPath);
HeapFree(GetProcessHeap(), 0, This->sPathRel); heap_free(This->sPathRel);
HeapFree(GetProcessHeap(), 0, This->sProduct); heap_free(This->sProduct);
HeapFree(GetProcessHeap(), 0, This->sComponent); heap_free(This->sComponent);
HeapFree(GetProcessHeap(), 0, This->filepath); heap_free(This->filepath);
if (This->site) if (This->site)
IUnknown_Release( This->site ); IUnknown_Release( This->site );
@ -1752,12 +1751,12 @@ static HRESULT WINAPI IShellLinkW_fnSetIDList(IShellLinkW * iface, LPCITEMIDLIST
if( !This->pPidl ) if( !This->pPidl )
return E_FAIL; return E_FAIL;
HeapFree( GetProcessHeap(), 0, This->sPath ); heap_free( This->sPath );
This->sPath = NULL; This->sPath = NULL;
if ( SHGetPathFromIDListW( pidl, path ) ) if ( SHGetPathFromIDListW( pidl, path ) )
{ {
This->sPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path)+1)*sizeof(WCHAR)); This->sPath = heap_alloc((lstrlenW(path) + 1) * sizeof(WCHAR));
if (!This->sPath) if (!This->sPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1788,11 +1787,10 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR
TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName)); TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
HeapFree(GetProcessHeap(), 0, This->sDescription); heap_free(This->sDescription);
if (pszName) if (pszName)
{ {
This->sDescription = HeapAlloc( GetProcessHeap(), 0, This->sDescription = heap_alloc((lstrlenW( pszName )+1)*sizeof(WCHAR) );
(lstrlenW( pszName )+1)*sizeof(WCHAR) );
if ( !This->sDescription ) if ( !This->sDescription )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1825,9 +1823,8 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC
TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir)); TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
HeapFree(GetProcessHeap(), 0, This->sWorkDir); heap_free(This->sWorkDir);
This->sWorkDir = HeapAlloc( GetProcessHeap(), 0, This->sWorkDir = heap_alloc((lstrlenW( pszDir ) + 1) * sizeof (WCHAR) );
(lstrlenW( pszDir )+1)*sizeof (WCHAR) );
if ( !This->sWorkDir ) if ( !This->sWorkDir )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sWorkDir, pszDir ); lstrcpyW( This->sWorkDir, pszDir );
@ -1856,11 +1853,10 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps
TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs)); TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
HeapFree(GetProcessHeap(), 0, This->sArgs); heap_free(This->sArgs);
if (pszArgs) if (pszArgs)
{ {
This->sArgs = HeapAlloc( GetProcessHeap(), 0, This->sArgs = heap_alloc((lstrlenW( pszArgs )+1)*sizeof (WCHAR) );
(lstrlenW( pszArgs )+1)*sizeof (WCHAR) );
if ( !This->sArgs ) if ( !This->sArgs )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sArgs, pszArgs ); lstrcpyW( This->sArgs, pszArgs );
@ -1940,9 +1936,8 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR
TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon); TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);
HeapFree(GetProcessHeap(), 0, This->sIcoPath); heap_free(This->sIcoPath);
This->sIcoPath = HeapAlloc( GetProcessHeap(), 0, This->sIcoPath = heap_alloc((lstrlenW( pszIconPath )+1)*sizeof (WCHAR) );
(lstrlenW( pszIconPath )+1)*sizeof (WCHAR) );
if ( !This->sIcoPath ) if ( !This->sIcoPath )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sIcoPath, pszIconPath ); lstrcpyW( This->sIcoPath, pszIconPath );
@ -1959,9 +1954,8 @@ static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR
TRACE("(%p)->(path=%s %x)\n",This, debugstr_w(pszPathRel), dwReserved); TRACE("(%p)->(path=%s %x)\n",This, debugstr_w(pszPathRel), dwReserved);
HeapFree(GetProcessHeap(), 0, This->sPathRel); heap_free(This->sPathRel);
This->sPathRel = HeapAlloc( GetProcessHeap(), 0, This->sPathRel = heap_alloc((lstrlenW( pszPathRel )+1) * sizeof (WCHAR) );
(lstrlenW( pszPathRel )+1) * sizeof (WCHAR) );
if ( !This->sPathRel ) if ( !This->sPathRel )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW( This->sPathRel, pszPathRel ); lstrcpyW( This->sPathRel, pszPathRel );
@ -1987,7 +1981,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR
bSuccess = SHGetPathFromIDListW(This->pPidl, buffer); bSuccess = SHGetPathFromIDListW(This->pPidl, buffer);
if (bSuccess && *buffer) { if (bSuccess && *buffer) {
This->sPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(buffer)+1)*sizeof(WCHAR)); This->sPath = heap_alloc((lstrlenW(buffer)+1)*sizeof(WCHAR));
if (!This->sPath) if (!This->sPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1999,7 +1993,7 @@ static HRESULT WINAPI IShellLinkW_fnResolve(IShellLinkW * iface, HWND hwnd, DWOR
} }
if (!This->sIcoPath && This->sPath) { if (!This->sIcoPath && This->sPath) {
This->sIcoPath = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(This->sPath)+1)*sizeof(WCHAR)); This->sIcoPath = heap_alloc((lstrlenW(This->sPath)+1)*sizeof(WCHAR));
if (!This->sIcoPath) if (!This->sIcoPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -2025,7 +2019,7 @@ static LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str)
if( !p ) if( !p )
return NULL; return NULL;
len = p - str; len = p - str;
ret = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR)*(len+1)); ret = heap_alloc(sizeof(WCHAR)*(len+1));
if( !ret ) if( !ret )
return ret; return ret;
memcpy( ret, str, sizeof(WCHAR)*len ); memcpy( ret, str, sizeof(WCHAR)*len );
@ -2133,14 +2127,14 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
/* any other quote marks are invalid */ /* any other quote marks are invalid */
if (strchrW(pszFile, '"')) if (strchrW(pszFile, '"'))
{ {
HeapFree(GetProcessHeap(), 0, unquoted); heap_free(unquoted);
return S_FALSE; return S_FALSE;
} }
HeapFree(GetProcessHeap(), 0, This->sPath); heap_free(This->sPath);
This->sPath = NULL; This->sPath = NULL;
HeapFree(GetProcessHeap(), 0, This->sComponent); heap_free(This->sComponent);
This->sComponent = NULL; This->sComponent = NULL;
if (This->pPidl) if (This->pPidl)
@ -2160,18 +2154,17 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
This->pPidl = SHSimpleIDListFromPathW(pszFile); This->pPidl = SHSimpleIDListFromPathW(pszFile);
ShellLink_GetVolumeInfo(buffer, &This->volume); ShellLink_GetVolumeInfo(buffer, &This->volume);
This->sPath = HeapAlloc( GetProcessHeap(), 0, This->sPath = heap_alloc( (lstrlenW( buffer )+1) * sizeof (WCHAR) );
(lstrlenW( buffer )+1) * sizeof (WCHAR) );
if (!This->sPath) if (!This->sPath)
{ {
HeapFree(GetProcessHeap(), 0, unquoted); heap_free(unquoted);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
lstrcpyW(This->sPath, buffer); lstrcpyW(This->sPath, buffer);
} }
This->bDirty = TRUE; This->bDirty = TRUE;
HeapFree(GetProcessHeap(), 0, unquoted); heap_free(unquoted);
return hr; return hr;
} }
@ -2372,14 +2365,14 @@ ShellLink_ExtInit_Initialize( IShellExtInit* iface, LPCITEMIDLIST pidlFolder,
count = DragQueryFileW( stgm.u.hGlobal, 0, NULL, 0 ); count = DragQueryFileW( stgm.u.hGlobal, 0, NULL, 0 );
count++; count++;
path = HeapAlloc( GetProcessHeap(), 0, count*sizeof(WCHAR) ); path = heap_alloc(count*sizeof(WCHAR) );
if( path ) if( path )
{ {
IPersistFile *pf = &This->IPersistFile_iface; IPersistFile *pf = &This->IPersistFile_iface;
count = DragQueryFileW( stgm.u.hGlobal, 0, path, count ); count = DragQueryFileW( stgm.u.hGlobal, 0, path, count );
r = IPersistFile_Load( pf, path, 0 ); r = IPersistFile_Load( pf, path, 0 );
HeapFree( GetProcessHeap(), 0, path ); heap_free( path );
} }
} }
ReleaseStgMedium( &stgm ); ReleaseStgMedium( &stgm );
@ -2457,11 +2450,11 @@ shelllink_get_msi_component_path( LPWSTR component )
return NULL; return NULL;
sz++; sz++;
path = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) ); path = heap_alloc( sz*sizeof(WCHAR) );
r = CommandLineFromMsiDescriptor( component, path, &sz ); r = CommandLineFromMsiDescriptor( component, path, &sz );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ {
HeapFree( GetProcessHeap(), 0, path ); heap_free( path );
path = NULL; path = NULL;
} }
@ -2516,7 +2509,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
if ( iciex->lpParametersW ) if ( iciex->lpParametersW )
len += lstrlenW( iciex->lpParametersW ); len += lstrlenW( iciex->lpParametersW );
args = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); args = heap_alloc( len*sizeof(WCHAR) );
args[0] = 0; args[0] = 0;
if ( This->sArgs ) if ( This->sArgs )
lstrcatW( args, This->sArgs ); lstrcatW( args, This->sArgs );
@ -2543,8 +2536,8 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
else else
r = E_FAIL; r = E_FAIL;
HeapFree( GetProcessHeap(), 0, args ); heap_free( args );
HeapFree( GetProcessHeap(), 0, path ); heap_free( path );
return r; return r;
} }

View File

@ -391,7 +391,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc
{ {
IDefClFImpl* lpclf; IDefClFImpl* lpclf;
lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl)); lpclf = heap_alloc(sizeof(*lpclf));
lpclf->ref = 1; lpclf->ref = 1;
lpclf->IClassFactory_iface.lpVtbl = &dclfvt; lpclf->IClassFactory_iface.lpVtbl = &dclfvt;
lpclf->lpfnCI = lpfnCI; lpclf->lpfnCI = lpfnCI;
@ -451,9 +451,9 @@ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
if (This->pcRefDll) InterlockedDecrement(This->pcRefDll); if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
TRACE("-- destroying IClassFactory(%p)\n",This); TRACE("-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,This); heap_free(This);
return 0;
} }
return refCount; return refCount;
} }
/****************************************************************************** /******************************************************************************
@ -586,7 +586,7 @@ UINT WINAPI DragQueryFileA(
LPWSTR lpszFileW = NULL; LPWSTR lpszFileW = NULL;
if(lpszFile && lFile != 0xFFFFFFFF) { if(lpszFile && lFile != 0xFFFFFFFF) {
lpszFileW = HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR)); lpszFileW = heap_alloc(lLength*sizeof(WCHAR));
if(lpszFileW == NULL) { if(lpszFileW == NULL) {
goto end; goto end;
} }
@ -595,7 +595,7 @@ UINT WINAPI DragQueryFileA(
if(lpszFileW) { if(lpszFileW) {
WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL); WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL);
HeapFree(GetProcessHeap(), 0, lpszFileW); heap_free(lpszFileW);
} }
goto end; goto end;
} }
@ -641,7 +641,7 @@ UINT WINAPI DragQueryFileW(
LPSTR lpszFileA = NULL; LPSTR lpszFileA = NULL;
if(lpszwFile && lFile != 0xFFFFFFFF) { if(lpszwFile && lFile != 0xFFFFFFFF) {
lpszFileA = HeapAlloc(GetProcessHeap(), 0, lLength); lpszFileA = heap_alloc(lLength);
if(lpszFileA == NULL) { if(lpszFileA == NULL) {
goto end; goto end;
} }
@ -650,7 +650,7 @@ UINT WINAPI DragQueryFileW(
if(lpszFileA) { if(lpszFileA) {
MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength); MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength);
HeapFree(GetProcessHeap(), 0, lpszFileA); heap_free(lpszFileA);
} }
goto end; goto end;
} }
@ -882,7 +882,7 @@ static ULONG WINAPI ShellImageData_Release(IShellImageData *iface)
if (!ref) if (!ref)
{ {
GdipDisposeImage(This->image); GdipDisposeImage(This->image);
HeapFree(GetProcessHeap(), 0, This->path); heap_free(This->path);
SHFree(This); SHFree(This);
} }

View File

@ -1350,7 +1350,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
} }
} }
lpGroups = HeapAlloc(GetProcessHeap(), 0, dwSize); lpGroups = heap_alloc(dwSize);
if (lpGroups == NULL) if (lpGroups == NULL)
{ {
CloseHandle(hToken); CloseHandle(hToken);
@ -1359,7 +1359,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize)) if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize))
{ {
HeapFree(GetProcessHeap(), 0, lpGroups); heap_free(lpGroups);
CloseHandle(hToken); CloseHandle(hToken);
return FALSE; return FALSE;
} }
@ -1369,7 +1369,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
&lpSid)) &lpSid))
{ {
HeapFree(GetProcessHeap(), 0, lpGroups); heap_free(lpGroups);
return FALSE; return FALSE;
} }
@ -1383,7 +1383,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
} }
FreeSid(lpSid); FreeSid(lpSid);
HeapFree(GetProcessHeap(), 0, lpGroups); heap_free(lpGroups);
return bResult; return bResult;
} }
@ -1553,7 +1553,7 @@ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString)
TRACE("(%s, %d)\n", debugstr_a(pszString), cchString); TRACE("(%s, %d)\n", debugstr_a(pszString), cchString);
if ((dst = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(CHAR)))) if ((dst = heap_alloc(cchString * sizeof(CHAR))))
{ {
len = ExpandEnvironmentStringsA(pszString, dst, cchString); len = ExpandEnvironmentStringsA(pszString, dst, cchString);
/* len includes the terminating 0 */ /* len includes the terminating 0 */
@ -1565,7 +1565,7 @@ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString)
else else
len = cchString; len = cchString;
HeapFree(GetProcessHeap(), 0, dst); heap_free(dst);
} }
return MAKELONG(len, res); return MAKELONG(len, res);
} }
@ -1597,7 +1597,7 @@ DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString)
TRACE("(%s, %d)\n", debugstr_w(pszString), cchString); TRACE("(%s, %d)\n", debugstr_w(pszString), cchString);
if ((cchString < MAXLONG) && (dst = HeapAlloc(GetProcessHeap(), 0, cchString * sizeof(WCHAR)))) if ((cchString < MAXLONG) && (dst = heap_alloc(cchString * sizeof(WCHAR))))
{ {
len = ExpandEnvironmentStringsW(pszString, dst, cchString); len = ExpandEnvironmentStringsW(pszString, dst, cchString);
/* len includes the terminating 0 */ /* len includes the terminating 0 */
@ -1609,7 +1609,7 @@ DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString)
else else
len = cchString; len = cchString;
HeapFree(GetProcessHeap(), 0, dst); heap_free(dst);
} }
return MAKELONG(len, res); return MAKELONG(len, res);
} }

View File

@ -1079,7 +1079,7 @@ static ULONG WINAPI ApplicationDestinations_Release(IApplicationDestinations *if
TRACE("(%p), new refcount=%i\n", This, ref); TRACE("(%p), new refcount=%i\n", This, ref);
if (ref == 0) if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ref; return ref;
} }
@ -3575,13 +3575,13 @@ static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
{ {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return NULL; return NULL;
UserInfo = HeapAlloc(GetProcessHeap(), 0, InfoSize); UserInfo = heap_alloc(InfoSize);
if (UserInfo == NULL) if (UserInfo == NULL)
return NULL; return NULL;
if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize, if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize,
&InfoSize)) &InfoSize))
{ {
HeapFree(GetProcessHeap(), 0, UserInfo); heap_free(UserInfo);
return NULL; return NULL;
} }
} }
@ -3590,7 +3590,7 @@ static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
SidStr = NULL; SidStr = NULL;
if (UserInfo != (PTOKEN_USER) InfoBuffer) if (UserInfo != (PTOKEN_USER) InfoBuffer)
HeapFree(GetProcessHeap(), 0, UserInfo); heap_free(UserInfo);
return SidStr; return SidStr;
} }
@ -3939,7 +3939,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA(
TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath); TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
if(pszPath) { if(pszPath) {
pszPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); pszPathW = heap_alloc(MAX_PATH * sizeof(WCHAR));
if(!pszPathW) { if(!pszPathW) {
hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup; goto cleanup;
@ -3953,7 +3953,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA(
*/ */
if (pszSubPath && pszSubPath[0]) { if (pszSubPath && pszSubPath[0]) {
length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0); length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0);
pszSubPathW = HeapAlloc(GetProcessHeap(), 0, length * sizeof(WCHAR)); pszSubPathW = heap_alloc(length * sizeof(WCHAR));
if(!pszSubPathW) { if(!pszSubPathW) {
hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup; goto cleanup;
@ -3967,8 +3967,8 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA(
WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
cleanup: cleanup:
HeapFree(GetProcessHeap(), 0, pszPathW); heap_free(pszPathW);
HeapFree(GetProcessHeap(), 0, pszSubPathW); heap_free(pszSubPathW);
return hr; return hr;
} }
@ -4535,7 +4535,7 @@ static void _SHCreateSymbolicLinks(void)
} }
remove(pszMyStuff); remove(pszMyStuff);
symlink(szMyStuffTarget, pszMyStuff); symlink(szMyStuffTarget, pszMyStuff);
HeapFree(GetProcessHeap(), 0, pszMyStuff); heap_free(pszMyStuff);
} }
/* Last but not least, the Desktop folder */ /* Last but not least, the Desktop folder */
@ -4543,7 +4543,7 @@ static void _SHCreateSymbolicLinks(void)
strcpy(szDesktopTarget, pszHome); strcpy(szDesktopTarget, pszHome);
else else
strcpy(szDesktopTarget, pszPersonal); strcpy(szDesktopTarget, pszPersonal);
HeapFree(GetProcessHeap(), 0, pszPersonal); heap_free(pszPersonal);
xdg_desktop_dir = xdg_results ? xdg_results[num - 1] : NULL; xdg_desktop_dir = xdg_results ? xdg_results[num - 1] : NULL;
if (xdg_desktop_dir || if (xdg_desktop_dir ||
@ -4559,7 +4559,7 @@ static void _SHCreateSymbolicLinks(void)
symlink(xdg_desktop_dir, pszDesktop); symlink(xdg_desktop_dir, pszDesktop);
else else
symlink(szDesktopTarget, pszDesktop); symlink(szDesktopTarget, pszDesktop);
HeapFree(GetProcessHeap(), 0, pszDesktop); heap_free(pszDesktop);
} }
} }
@ -4567,8 +4567,8 @@ static void _SHCreateSymbolicLinks(void)
if (xdg_results) if (xdg_results)
{ {
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
HeapFree(GetProcessHeap(), 0, xdg_results[i]); heap_free(xdg_results[i]);
HeapFree(GetProcessHeap(), 0, xdg_results); heap_free(xdg_results);
} }
} }
@ -5054,7 +5054,7 @@ static HRESULT get_known_folder_registry_path(
lstrcpyW(sGuid, lpStringGuid); lstrcpyW(sGuid, lpStringGuid);
length = lstrlenW(szKnownFolderDescriptions)+51; length = lstrlenW(szKnownFolderDescriptions)+51;
*lpPath = HeapAlloc(GetProcessHeap(), 0, length*sizeof(WCHAR)); *lpPath = heap_alloc(length*sizeof(WCHAR));
if(!(*lpPath)) if(!(*lpPath))
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
@ -5138,7 +5138,7 @@ static HRESULT get_known_folder_redirection_place(
hr = E_FAIL; hr = E_FAIL;
} }
HeapFree(GetProcessHeap(), 0, lpRegistryPath); heap_free(lpRegistryPath);
return hr; return hr;
} }
@ -5166,7 +5166,7 @@ static HRESULT redirect_known_folder(
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath); hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath);
HeapFree(GetProcessHeap(), 0, lpRegistryPath); heap_free(lpRegistryPath);
/* get path to redirection storage */ /* get path to redirection storage */
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
@ -5263,8 +5263,8 @@ static ULONG WINAPI knownfolder_Release(
if (!refs) if (!refs)
{ {
TRACE("destroying %p\n", knownfolder); TRACE("destroying %p\n", knownfolder);
HeapFree( GetProcessHeap(), 0, knownfolder->registryPath); heap_free( knownfolder->registryPath );
HeapFree( GetProcessHeap(), 0, knownfolder ); heap_free( knownfolder );
} }
return refs; return refs;
} }
@ -5322,7 +5322,7 @@ static HRESULT knownfolder_set_id(
else else
{ {
/* This known folder is not registered. To mark it, we set registryPath to NULL */ /* This known folder is not registered. To mark it, we set registryPath to NULL */
HeapFree(GetProcessHeap(), 0, knownfolder->registryPath); heap_free(knownfolder->registryPath);
knownfolder->registryPath = NULL; knownfolder->registryPath = NULL;
hr = S_OK; hr = S_OK;
} }
@ -5402,15 +5402,15 @@ static HRESULT get_known_folder_path(
hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath); hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath);
if(FAILED(hr)) { if(FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, parentRegistryPath); heap_free(parentRegistryPath);
return hr; return hr;
} }
lstrcatW(path, parentPath); lstrcatW(path, parentPath);
lstrcatW(path, sBackslash); lstrcatW(path, sBackslash);
HeapFree(GetProcessHeap(), 0, parentRegistryPath); heap_free(parentRegistryPath);
HeapFree(GetProcessHeap(), 0, parentPath); heap_free(parentPath);
} }
/* check, if folder was redirected */ /* check, if folder was redirected */
@ -5625,7 +5625,7 @@ static HRESULT knownfolder_create( struct knownfolder **knownfolder )
{ {
struct knownfolder *kf; struct knownfolder *kf;
kf = HeapAlloc( GetProcessHeap(), 0, sizeof(*kf) ); kf = heap_alloc( sizeof(*kf) );
if (!kf) return E_OUTOFMEMORY; if (!kf) return E_OUTOFMEMORY;
kf->IKnownFolder_iface.lpVtbl = &knownfolder_vtbl; kf->IKnownFolder_iface.lpVtbl = &knownfolder_vtbl;
@ -5667,8 +5667,8 @@ static ULONG WINAPI foldermanager_Release(
if (!refs) if (!refs)
{ {
TRACE("destroying %p\n", foldermanager); TRACE("destroying %p\n", foldermanager);
HeapFree( GetProcessHeap(), 0, foldermanager->ids ); heap_free( foldermanager->ids );
HeapFree( GetProcessHeap(), 0, foldermanager ); heap_free( foldermanager );
} }
return refs; return refs;
} }
@ -5760,7 +5760,7 @@ static BOOL is_knownfolder( struct foldermanager *fm, const KNOWNFOLDERID *id )
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
{ {
hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryPath, 0, 0, &hKey)); hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryPath, 0, 0, &hKey));
HeapFree(GetProcessHeap(), 0, registryPath); heap_free(registryPath);
} }
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
@ -5820,7 +5820,7 @@ static HRESULT WINAPI foldermanager_GetFolderByName(
if (FAILED( hr )) return hr; if (FAILED( hr )) return hr;
hr = get_known_folder_wstr( path, szName, &name ); hr = get_known_folder_wstr( path, szName, &name );
HeapFree( GetProcessHeap(), 0, path ); heap_free( path );
if (FAILED( hr )) return hr; if (FAILED( hr )) return hr;
found = !strcmpiW( pszCanonicalName, name ); found = !strcmpiW( pszCanonicalName, name );
@ -5894,7 +5894,7 @@ static HRESULT register_folder(const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFI
SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath); SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath);
} }
HeapFree(GetProcessHeap(), 0, registryPath); heap_free(registryPath);
return hr; return hr;
} }
@ -5920,7 +5920,7 @@ static HRESULT WINAPI foldermanager_UnregisterFolder(
if(SUCCEEDED(hr)) if(SUCCEEDED(hr))
hr = HRESULT_FROM_WIN32(SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath)); hr = HRESULT_FROM_WIN32(SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath));
HeapFree(GetProcessHeap(), 0, registryPath); heap_free(registryPath);
return hr; return hr;
} }
@ -5978,7 +5978,7 @@ static HRESULT foldermanager_create( void **ppv )
UINT i, j; UINT i, j;
struct foldermanager *fm; struct foldermanager *fm;
fm = HeapAlloc( GetProcessHeap(), 0, sizeof(*fm) ); fm = heap_alloc( sizeof(*fm) );
if (!fm) return E_OUTOFMEMORY; if (!fm) return E_OUTOFMEMORY;
fm->IKnownFolderManager_iface.lpVtbl = &foldermanager_vtbl; fm->IKnownFolderManager_iface.lpVtbl = &foldermanager_vtbl;
@ -5989,10 +5989,10 @@ static HRESULT foldermanager_create( void **ppv )
{ {
if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++; if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++;
} }
fm->ids = HeapAlloc( GetProcessHeap(), 0, fm->num_ids * sizeof(KNOWNFOLDERID) ); fm->ids = heap_alloc( fm->num_ids * sizeof(KNOWNFOLDERID) );
if (!fm->ids) if (!fm->ids)
{ {
HeapFree( GetProcessHeap(), 0, fm ); heap_free( fm );
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
for (i = j = 0; i < sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]); i++) for (i = j = 0; i < sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]); i++)

View File

@ -1205,7 +1205,7 @@ static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, const LPCITEMIDLIS
int i; int i;
iPathLen = lstrlenW(wszBasePath); iPathLen = lstrlenW(wszBasePath);
wszPathsList = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR)*cidl+1); wszPathsList = heap_alloc(MAX_PATH*sizeof(WCHAR)*cidl+1);
wszListPos = wszPathsList; wszListPos = wszPathsList;
for (i = 0; i < cidl; i++) { for (i = 0; i < cidl; i++) {
@ -1283,7 +1283,7 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
wszCurrentPath += lstrlenW(wszCurrentPath)+1; wszCurrentPath += lstrlenW(wszCurrentPath)+1;
} }
HeapFree(GetProcessHeap(), 0, wszPathsList); heap_free(wszPathsList);
return ret; return ret;
} }
@ -1333,8 +1333,7 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
WARN("Copy failed\n"); WARN("Copy failed\n");
ret = E_FAIL; ret = E_FAIL;
} }
HeapFree(GetProcessHeap(), 0, wszSrcPathsList); heap_free(wszSrcPathsList);
} }
SHFree(pidl); SHFree(pidl);
IPersistFolder2_Release(ppf2); IPersistFolder2_Release(ppf2);

View File

@ -95,7 +95,7 @@ HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid,
if (pUnkOuter) if (pUnkOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
sf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl)); sf = heap_alloc_zero (sizeof (*sf));
if (!sf) if (!sf)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -171,7 +171,7 @@ static ULONG WINAPI ISF_NetworkPlaces_fnRelease (IShellFolder2 * iface)
if (!refCount) { if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This); TRACE ("-- destroying IShellFolder(%p)\n", This);
SHFree (This->pidlRoot); SHFree (This->pidlRoot);
HeapFree (GetProcessHeap(), 0, This); heap_free (This);
} }
return refCount; return refCount;
} }

View File

@ -405,7 +405,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
if (!pszUnixPath) return FALSE; if (!pszUnixPath) return FALSE;
cDriveSymlinkLen = strlen(pszUnixPath); cDriveSymlinkLen = strlen(pszUnixPath);
pElement = realpath(pszUnixPath, szPath); pElement = realpath(pszUnixPath, szPath);
HeapFree(GetProcessHeap(), 0, pszUnixPath); heap_free(pszUnixPath);
if (!pElement) return FALSE; if (!pElement) return FALSE;
if (szPath[strlen(szPath)-1] != '/') strcat(szPath, "/"); if (szPath[strlen(szPath)-1] != '/') strcat(szPath, "/");
@ -432,7 +432,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
if(dospath_end < dospath) if(dospath_end < dospath)
return FALSE; return FALSE;
strcat(szPath, pszUnixPath + cDriveSymlinkLen); strcat(szPath, pszUnixPath + cDriveSymlinkLen);
HeapFree(GetProcessHeap(), 0, pszUnixPath); heap_free(pszUnixPath);
if(has_failed && WideCharToMultiByte(CP_UNIXCP, 0, dospath_end + 1, -1, if(has_failed && WideCharToMultiByte(CP_UNIXCP, 0, dospath_end + 1, -1,
mb_path, FILENAME_MAX, NULL, NULL) > 0){ mb_path, FILENAME_MAX, NULL, NULL) > 0){
@ -800,7 +800,7 @@ static HRESULT UNIXFS_initialize_target_folder(UnixFolder *This, const char *szB
((dos_name = wine_get_dos_file_name(This->m_pszPath)))) ((dos_name = wine_get_dos_file_name(This->m_pszPath))))
{ {
This->m_dwAttributes |= SFGAO_FILESYSTEM; This->m_dwAttributes |= SFGAO_FILESYSTEM;
HeapFree( GetProcessHeap(), 0, dos_name ); heap_free( dos_name );
} }
return S_OK; return S_OK;
@ -831,8 +831,8 @@ static HRESULT UNIXFS_copy(LPCWSTR pwszDosSrc, LPCWSTR pwszDosDst)
iSrcLen = lstrlenW(pwszDosSrc); iSrcLen = lstrlenW(pwszDosSrc);
iDstLen = lstrlenW(pwszDosDst); iDstLen = lstrlenW(pwszDosDst);
pwszSrc = HeapAlloc(GetProcessHeap(), 0, (iSrcLen + 2) * sizeof(WCHAR)); pwszSrc = heap_alloc((iSrcLen + 2) * sizeof(WCHAR));
pwszDst = HeapAlloc(GetProcessHeap(), 0, (iDstLen + 2) * sizeof(WCHAR)); pwszDst = heap_alloc((iDstLen + 2) * sizeof(WCHAR));
if (pwszSrc && pwszDst) { if (pwszSrc && pwszDst) {
lstrcpyW(pwszSrc, pwszDosSrc); lstrcpyW(pwszSrc, pwszDosSrc);
@ -856,8 +856,8 @@ static HRESULT UNIXFS_copy(LPCWSTR pwszDosSrc, LPCWSTR pwszDosDst)
res = S_OK; res = S_OK;
} }
HeapFree(GetProcessHeap(), 0, pwszSrc); heap_free(pwszSrc);
HeapFree(GetProcessHeap(), 0, pwszDst); heap_free(pwszDst);
return res; return res;
} }
@ -1151,7 +1151,7 @@ static HRESULT WINAPI ShellFolder2_GetAttributesOf(IShellFolder2* iface, UINT ci
if (!(dos_name = wine_get_dos_file_name( szAbsolutePath ))) if (!(dos_name = wine_get_dos_file_name( szAbsolutePath )))
*attrs &= ~SFGAO_FILESYSTEM; *attrs &= ~SFGAO_FILESYSTEM;
else else
HeapFree( GetProcessHeap(), 0, dos_name ); heap_free( dos_name );
} }
if (_ILIsFolder(apidl[i])) if (_ILIsFolder(apidl[i]))
*attrs |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | *attrs |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR |
@ -1254,7 +1254,7 @@ static HRESULT WINAPI ShellFolder2_GetDisplayNameOf(IShellFolder2* iface,
if (!lpName->u.pOleStr) return HRESULT_FROM_WIN32(GetLastError()); if (!lpName->u.pOleStr) return HRESULT_FROM_WIN32(GetLastError());
lstrcpyW(lpName->u.pOleStr, pwszDosFileName); lstrcpyW(lpName->u.pOleStr, pwszDosFileName);
PathRemoveBackslashW(lpName->u.pOleStr); PathRemoveBackslashW(lpName->u.pOleStr);
HeapFree(GetProcessHeap(), 0, pwszDosFileName); heap_free(pwszDosFileName);
} }
} else if (_ILIsValue(pidl)) { } else if (_ILIsValue(pidl)) {
STRRET str; STRRET str;
@ -1953,7 +1953,7 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, const LP
lstrcpyA(szAbsolute, This->m_pszPath); lstrcpyA(szAbsolute, This->m_pszPath);
pszRelative = szAbsolute + lstrlenA(szAbsolute); pszRelative = szAbsolute + lstrlenA(szAbsolute);
wszListPos = wszPathsList = HeapAlloc(GetProcessHeap(), 0, cidl*MAX_PATH*sizeof(WCHAR)+1); wszListPos = wszPathsList = heap_alloc(cidl*MAX_PATH*sizeof(WCHAR)+1);
if (wszPathsList == NULL) if (wszPathsList == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
for (i=0; i<cidl; i++) { for (i=0; i<cidl; i++) {
@ -1963,19 +1963,19 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, const LP
continue; continue;
if (!UNIXFS_filename_from_shitemid(apidl[i], pszRelative)) if (!UNIXFS_filename_from_shitemid(apidl[i], pszRelative))
{ {
HeapFree(GetProcessHeap(), 0, wszPathsList); heap_free(wszPathsList);
return E_INVALIDARG; return E_INVALIDARG;
} }
wszDosPath = wine_get_dos_file_name(szAbsolute); wszDosPath = wine_get_dos_file_name(szAbsolute);
if (wszDosPath == NULL || lstrlenW(wszDosPath) >= MAX_PATH) if (wszDosPath == NULL || lstrlenW(wszDosPath) >= MAX_PATH)
{ {
HeapFree(GetProcessHeap(), 0, wszPathsList); heap_free(wszPathsList);
HeapFree(GetProcessHeap(), 0, wszDosPath); heap_free(wszDosPath);
return S_FALSE; return S_FALSE;
} }
lstrcpyW(wszListPos, wszDosPath); lstrcpyW(wszListPos, wszDosPath);
wszListPos += lstrlenW(wszListPos)+1; wszListPos += lstrlenW(wszListPos)+1;
HeapFree(GetProcessHeap(), 0, wszDosPath); heap_free(wszDosPath);
} }
*wszListPos = 0; *wszListPos = 0;
@ -1992,7 +1992,7 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, const LP
else else
ret = S_OK; ret = S_OK;
HeapFree(GetProcessHeap(), 0, wszPathsList); heap_free(wszPathsList);
return ret; return ret;
} }
@ -2108,8 +2108,8 @@ static HRESULT WINAPI SFHelper_CopyItems(ISFHelper* iface, IShellFolder *psfFrom
else else
res = E_OUTOFMEMORY; res = E_OUTOFMEMORY;
HeapFree(GetProcessHeap(), 0, pwszDosSrc); heap_free(pwszDosSrc);
HeapFree(GetProcessHeap(), 0, pwszDosDst); heap_free(pwszDosDst);
if (res != S_OK) if (res != S_OK)
return res; return res;

View File

@ -402,7 +402,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path )
if (!got_path) total += 5; /* we need to create PATH */ if (!got_path) total += 5; /* we need to create PATH */
total++; /* terminating null */ total++; /* terminating null */
if (!(new_env = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) ))) if (!(new_env = heap_alloc( total * sizeof(WCHAR) )))
{ {
FreeEnvironmentStringsW( strings ); FreeEnvironmentStringsW( strings );
return NULL; return NULL;
@ -943,7 +943,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
SHELL_ArgifyW(static_res, sizeof(static_res)/sizeof(WCHAR), exec, lpFile, pidl, szCommandline, &resultLen); SHELL_ArgifyW(static_res, sizeof(static_res)/sizeof(WCHAR), exec, lpFile, pidl, szCommandline, &resultLen);
if (resultLen > sizeof(static_res)/sizeof(WCHAR)) if (resultLen > sizeof(static_res)/sizeof(WCHAR))
{ {
res = dynamic_res = HeapAlloc(GetProcessHeap(), 0, resultLen * sizeof(WCHAR)); res = dynamic_res = heap_alloc(resultLen * sizeof(WCHAR));
SHELL_ArgifyW(dynamic_res, resultLen, exec, lpFile, pidl, szCommandline, NULL); SHELL_ArgifyW(dynamic_res, resultLen, exec, lpFile, pidl, szCommandline, NULL);
} }
else else
@ -959,11 +959,11 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
else else
{ {
DWORD lenA = WideCharToMultiByte(CP_ACP, 0, res, -1, NULL, 0, NULL, NULL); DWORD lenA = WideCharToMultiByte(CP_ACP, 0, res, -1, NULL, 0, NULL, NULL);
char *resA = HeapAlloc(GetProcessHeap(), 0, lenA); char *resA = heap_alloc(lenA);
WideCharToMultiByte(CP_ACP, 0, res, -1, resA, lenA, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, res, -1, resA, lenA, NULL, NULL);
hDdeData = DdeClientTransaction( (LPBYTE)resA, lenA, hConv, 0L, 0, hDdeData = DdeClientTransaction( (LPBYTE)resA, lenA, hConv, 0L, 0,
XTYP_EXECUTE, 10000, &tid ); XTYP_EXECUTE, 10000, &tid );
HeapFree(GetProcessHeap(), 0, resA); heap_free(resA);
} }
if (hDdeData) if (hDdeData)
DdeFreeDataHandle(hDdeData); DdeFreeDataHandle(hDdeData);
@ -971,7 +971,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
WARN("DdeClientTransaction failed with error %04x\n", DdeGetLastError(ddeInst)); WARN("DdeClientTransaction failed with error %04x\n", DdeGetLastError(ddeInst));
ret = 33; ret = 33;
HeapFree(GetProcessHeap(), 0, dynamic_res); heap_free(dynamic_res);
DdeDisconnect(hConv); DdeDisconnect(hConv);
@ -1145,7 +1145,7 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei )
if ( r == ERROR_SUCCESS && type == REG_SZ ) if ( r == ERROR_SUCCESS && type == REG_SZ )
{ {
sz += sizeof (WCHAR); sz += sizeof (WCHAR);
cls = HeapAlloc( GetProcessHeap(), 0, sz ); cls = heap_alloc( sz );
cls[0] = 0; cls[0] = 0;
RegQueryValueExW( hkey, NULL, 0, &type, (LPBYTE) cls, &sz ); RegQueryValueExW( hkey, NULL, 0, &type, (LPBYTE) cls, &sz );
} }
@ -1160,7 +1160,7 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei )
if ( lpClass ) if ( lpClass )
RegOpenKeyW( HKEY_CLASSES_ROOT, lpClass, &hkey ); RegOpenKeyW( HKEY_CLASSES_ROOT, lpClass, &hkey );
HeapFree( GetProcessHeap(), 0, cls ); heap_free( cls );
return hkey; return hkey;
} }
@ -1488,7 +1488,7 @@ static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LP
/* Length of space plus length of parameters */ /* Length of space plus length of parameters */
len += 1 + lstrlenW(wszParameters); len += 1 + lstrlenW(wszParameters);
} }
wszQuotedCmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wszQuotedCmd = heap_alloc(len * sizeof(WCHAR));
/* Must quote to handle case where cmd contains spaces, /* Must quote to handle case where cmd contains spaces,
* else security hole if malicious user creates executable file "C:\\Program" * else security hole if malicious user creates executable file "C:\\Program"
*/ */
@ -1504,7 +1504,7 @@ static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LP
retval = execute_from_key(wszKeyname, wszApplicationName, env, psei->lpParameters, wcmd, execfunc, psei, psei_out); retval = execute_from_key(wszKeyname, wszApplicationName, env, psei->lpParameters, wcmd, execfunc, psei, psei_out);
else else
retval = execfunc(wszQuotedCmd, env, FALSE, psei, psei_out); retval = execfunc(wszQuotedCmd, env, FALSE, psei, psei_out);
HeapFree(GetProcessHeap(), 0, wszQuotedCmd); heap_free(wszQuotedCmd);
return retval; return retval;
} }
@ -1531,7 +1531,7 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI
len += lstrlenW(psei->lpVerb); len += lstrlenW(psei->lpVerb);
else else
len += lstrlenW(wszOpen); len += lstrlenW(wszOpen);
lpstrProtocol = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); lpstrProtocol = heap_alloc(len * sizeof(WCHAR));
memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR)); memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR));
lpstrProtocol[iSize] = '\0'; lpstrProtocol[iSize] = '\0';
strcatW(lpstrProtocol, wShell); strcatW(lpstrProtocol, wShell);
@ -1540,7 +1540,7 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI
retval = execute_from_key(lpstrProtocol, lpFile, NULL, psei->lpParameters, retval = execute_from_key(lpstrProtocol, lpFile, NULL, psei->lpParameters,
wcmd, execfunc, psei, psei_out); wcmd, execfunc, psei, psei_out);
HeapFree(GetProcessHeap(), 0, lpstrProtocol); heap_free(lpstrProtocol);
return retval; return retval;
} }
@ -1596,13 +1596,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
/* make copies of all path/command strings */ /* make copies of all path/command strings */
if (!sei_tmp.lpFile) if (!sei_tmp.lpFile)
{ {
wszApplicationName = HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen*sizeof(WCHAR)); wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR));
*wszApplicationName = '\0'; *wszApplicationName = '\0';
} }
else if (*sei_tmp.lpFile == '\"' && sei_tmp.lpFile[(len = strlenW(sei_tmp.lpFile))-1] == '\"') else if (*sei_tmp.lpFile == '\"' && sei_tmp.lpFile[(len = strlenW(sei_tmp.lpFile))-1] == '\"')
{ {
if(len-1 >= dwApplicationNameLen) dwApplicationNameLen = len; if(len-1 >= dwApplicationNameLen) dwApplicationNameLen = len;
wszApplicationName = HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen*sizeof(WCHAR)); wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR));
memcpy(wszApplicationName, sei_tmp.lpFile+1, len*sizeof(WCHAR)); memcpy(wszApplicationName, sei_tmp.lpFile+1, len*sizeof(WCHAR));
if(len > 2) if(len > 2)
wszApplicationName[len-2] = '\0'; wszApplicationName[len-2] = '\0';
@ -1610,7 +1610,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
} else { } else {
DWORD l = strlenW(sei_tmp.lpFile)+1; DWORD l = strlenW(sei_tmp.lpFile)+1;
if(l > dwApplicationNameLen) dwApplicationNameLen = l+1; if(l > dwApplicationNameLen) dwApplicationNameLen = l+1;
wszApplicationName = HeapAlloc(GetProcessHeap(), 0, dwApplicationNameLen*sizeof(WCHAR)); wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR));
memcpy(wszApplicationName, sei_tmp.lpFile, l*sizeof(WCHAR)); memcpy(wszApplicationName, sei_tmp.lpFile, l*sizeof(WCHAR));
} }
@ -1620,7 +1620,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
len = lstrlenW(sei_tmp.lpParameters) + 1; len = lstrlenW(sei_tmp.lpParameters) + 1;
if (len > parametersLen) if (len > parametersLen)
{ {
wszParameters = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wszParameters = heap_alloc(len * sizeof(WCHAR));
parametersLen = len; parametersLen = len;
} }
strcpyW(wszParameters, sei_tmp.lpParameters); strcpyW(wszParameters, sei_tmp.lpParameters);
@ -1633,7 +1633,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
{ {
len = lstrlenW(sei_tmp.lpDirectory) + 1; len = lstrlenW(sei_tmp.lpDirectory) + 1;
if (len > sizeof(dirBuffer) / sizeof(WCHAR)) if (len > sizeof(dirBuffer) / sizeof(WCHAR))
wszDir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wszDir = heap_alloc(len * sizeof(WCHAR));
strcpyW(wszDir, sei_tmp.lpDirectory); strcpyW(wszDir, sei_tmp.lpDirectory);
} }
else else
@ -1663,11 +1663,11 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
IShellExecuteHookW_Release(pSEH); IShellExecuteHookW_Release(pSEH);
if (hr == S_OK) { if (hr == S_OK) {
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
if (wszParameters != parametersBuffer) if (wszParameters != parametersBuffer)
HeapFree(GetProcessHeap(), 0, wszParameters); heap_free(wszParameters);
if (wszDir != dirBuffer) if (wszDir != dirBuffer)
HeapFree(GetProcessHeap(), 0, wszDir); heap_free(wszDir);
return TRUE; return TRUE;
} }
} }
@ -1679,11 +1679,11 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
if ( ERROR_SUCCESS == ShellExecute_FromContextMenu( &sei_tmp ) ) if ( ERROR_SUCCESS == ShellExecute_FromContextMenu( &sei_tmp ) )
{ {
sei->hInstApp = (HINSTANCE) 33; sei->hInstApp = (HINSTANCE) 33;
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
if (wszParameters != parametersBuffer) if (wszParameters != parametersBuffer)
HeapFree(GetProcessHeap(), 0, wszParameters); heap_free(wszParameters);
if (wszDir != dirBuffer) if (wszDir != dirBuffer)
HeapFree(GetProcessHeap(), 0, wszDir); heap_free(wszDir);
return TRUE; return TRUE;
} }
@ -1693,11 +1693,11 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
execfunc ); execfunc );
if (retval <= 32 && !(sei_tmp.fMask & SEE_MASK_FLAG_NO_UI)) if (retval <= 32 && !(sei_tmp.fMask & SEE_MASK_FLAG_NO_UI))
do_error_dialog(retval, sei_tmp.hwnd); do_error_dialog(retval, sei_tmp.hwnd);
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
if (wszParameters != parametersBuffer) if (wszParameters != parametersBuffer)
HeapFree(GetProcessHeap(), 0, wszParameters); heap_free(wszParameters);
if (wszDir != dirBuffer) if (wszDir != dirBuffer)
HeapFree(GetProcessHeap(), 0, wszDir); heap_free(wszDir);
return retval > 32; return retval > 32;
} }
@ -1717,13 +1717,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
DWORD size; DWORD size;
size = MAX_PATH; size = MAX_PATH;
buf = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); buf = heap_alloc(size * sizeof(WCHAR));
if (!buf || FAILED(PathCreateFromUrlW(sei_tmp.lpFile, buf, &size, 0))) { if (!buf || FAILED(PathCreateFromUrlW(sei_tmp.lpFile, buf, &size, 0))) {
HeapFree(GetProcessHeap(), 0, buf); heap_free(buf);
return SE_ERR_OOM; return SE_ERR_OOM;
} }
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
wszApplicationName = buf; wszApplicationName = buf;
sei_tmp.lpFile = wszApplicationName; sei_tmp.lpFile = wszApplicationName;
} }
@ -1733,10 +1733,10 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
if (len>0) if (len>0)
{ {
LPWSTR buf; LPWSTR buf;
buf = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); buf = heap_alloc((len + 1) * sizeof(WCHAR));
ExpandEnvironmentStringsW(sei_tmp.lpFile, buf, len + 1); ExpandEnvironmentStringsW(sei_tmp.lpFile, buf, len + 1);
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
wszApplicationName = buf; wszApplicationName = buf;
sei_tmp.lpFile = wszApplicationName; sei_tmp.lpFile = wszApplicationName;
@ -1750,10 +1750,10 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
{ {
LPWSTR buf; LPWSTR buf;
len++; len++;
buf = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); buf = heap_alloc(len * sizeof(WCHAR));
ExpandEnvironmentStringsW(sei_tmp.lpDirectory, buf, len); ExpandEnvironmentStringsW(sei_tmp.lpDirectory, buf, len);
if (wszDir != dirBuffer) if (wszDir != dirBuffer)
HeapFree(GetProcessHeap(), 0, wszDir); heap_free(wszDir);
wszDir = buf; wszDir = buf;
sei_tmp.lpDirectory = wszDir; sei_tmp.lpDirectory = wszDir;
} }
@ -1768,7 +1768,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
len += 1 + lstrlenW(wszParameters); len += 1 + lstrlenW(wszParameters);
if (len > wcmdLen) if (len > wcmdLen)
{ {
wcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wcmd = heap_alloc(len * sizeof(WCHAR));
wcmdLen = len; wcmdLen = len;
} }
wcmd[0] = '\"'; wcmd[0] = '\"';
@ -1784,13 +1784,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval = execfunc(wcmd, NULL, FALSE, &sei_tmp, sei); retval = execfunc(wcmd, NULL, FALSE, &sei_tmp, sei);
if (retval > 32) { if (retval > 32) {
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
if (wszParameters != parametersBuffer) if (wszParameters != parametersBuffer)
HeapFree(GetProcessHeap(), 0, wszParameters); heap_free(wszParameters);
if (wszDir != dirBuffer) if (wszDir != dirBuffer)
HeapFree(GetProcessHeap(), 0, wszDir); heap_free(wszDir);
if (wcmd != wcmdBuffer) if (wcmd != wcmdBuffer)
HeapFree(GetProcessHeap(), 0, wcmd); heap_free(wcmd);
return TRUE; return TRUE;
} }
@ -1802,14 +1802,14 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
retval = SHELL_quote_and_execute( wcmd, wszParameters, wszKeyname, retval = SHELL_quote_and_execute( wcmd, wszParameters, wszKeyname,
wszApplicationName, env, &sei_tmp, wszApplicationName, env, &sei_tmp,
sei, execfunc ); sei, execfunc );
HeapFree( GetProcessHeap(), 0, env ); heap_free( env );
} }
else if (PathIsDirectoryW(lpFile)) else if (PathIsDirectoryW(lpFile))
{ {
static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r',0}; static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r',0};
static const WCHAR wQuote[] = {'"',0}; static const WCHAR wQuote[] = {'"',0};
WCHAR wExec[MAX_PATH]; WCHAR wExec[MAX_PATH];
WCHAR * lpQuotedFile = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * (strlenW(lpFile) + 3) ); WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (strlenW(lpFile) + 3) );
if (lpQuotedFile) if (lpQuotedFile)
{ {
@ -1825,9 +1825,9 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
wszKeyname, wszKeyname,
wszApplicationName, env, wszApplicationName, env,
&sei_tmp, sei, execfunc ); &sei_tmp, sei, execfunc );
HeapFree( GetProcessHeap(), 0, env ); heap_free( env );
} }
HeapFree( GetProcessHeap(), 0, lpQuotedFile ); heap_free( lpQuotedFile );
} }
else else
retval = 0; /* Out of memory */ retval = 0; /* Out of memory */
@ -1848,13 +1848,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
TRACE("retval %lu\n", retval); TRACE("retval %lu\n", retval);
HeapFree(GetProcessHeap(), 0, wszApplicationName); heap_free(wszApplicationName);
if (wszParameters != parametersBuffer) if (wszParameters != parametersBuffer)
HeapFree(GetProcessHeap(), 0, wszParameters); heap_free(wszParameters);
if (wszDir != dirBuffer) if (wszDir != dirBuffer)
HeapFree(GetProcessHeap(), 0, wszDir); heap_free(wszDir);
if (wcmd != wcmdBuffer) if (wcmd != wcmdBuffer)
HeapFree(GetProcessHeap(), 0, wcmd); heap_free(wcmd);
sei->hInstApp = (HINSTANCE)(retval > 32 ? 33 : retval); sei->hInstApp = (HINSTANCE)(retval > 32 ? 33 : retval);

View File

@ -322,7 +322,7 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar
if (len < minChars) if (len < minChars)
len = minChars; len = minChars;
*wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); *wPath = heap_alloc(len * sizeof(WCHAR));
if (*wPath) if (*wPath)
{ {
MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len); MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);
@ -331,11 +331,6 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
static void SHELL32_FreeUnicodeBuf(LPWSTR wPath)
{
HeapFree(GetProcessHeap(), 0, wPath);
}
HRESULT WINAPI SHIsFileAvailableOffline(LPCWSTR path, LPDWORD status) HRESULT WINAPI SHIsFileAvailableOffline(LPCWSTR path, LPDWORD status)
{ {
FIXME("(%s, %p) stub\n", debugstr_w(path), status); FIXME("(%s, %p) stub\n", debugstr_w(path), status);
@ -406,7 +401,7 @@ static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec)
if (!retCode) if (!retCode)
{ {
retCode = SHNotifyCreateDirectoryW(wPath, sec); retCode = SHNotifyCreateDirectoryW(wPath, sec);
SHELL32_FreeUnicodeBuf(wPath); heap_free(wPath);
} }
return retCode; return retCode;
} }
@ -460,7 +455,7 @@ static DWORD SHNotifyRemoveDirectoryA(LPCSTR path)
if (!retCode) if (!retCode)
{ {
retCode = SHNotifyRemoveDirectoryW(wPath); retCode = SHNotifyRemoveDirectoryW(wPath);
SHELL32_FreeUnicodeBuf(wPath); heap_free(wPath);
} }
return retCode; return retCode;
} }
@ -524,7 +519,7 @@ static DWORD SHNotifyDeleteFileA(LPCSTR path)
if (!retCode) if (!retCode)
{ {
retCode = SHNotifyDeleteFileW(wPath); retCode = SHNotifyDeleteFileW(wPath);
SHELL32_FreeUnicodeBuf(wPath); heap_free(wPath);
} }
return retCode; return retCode;
} }
@ -720,7 +715,7 @@ int WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES se
if (!retCode) if (!retCode)
{ {
retCode = SHCreateDirectoryExW(hWnd, wPath, sec); retCode = SHCreateDirectoryExW(hWnd, wPath, sec);
SHELL32_FreeUnicodeBuf(wPath); heap_free(wPath);
} }
return retCode; return retCode;
} }
@ -886,12 +881,12 @@ int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
if (ForFree) if (ForFree)
{ {
retCode = SHFileOperationW(&nFileOp); retCode = SHFileOperationW(&nFileOp);
HeapFree(GetProcessHeap(), 0, ForFree); /* we cannot use wString, it was changed */ heap_free(ForFree); /* we cannot use wString, it was changed */
break; break;
} }
else else
{ {
wString = ForFree = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); wString = ForFree = heap_alloc(size * sizeof(WCHAR));
if (ForFree) continue; if (ForFree) continue;
retCode = ERROR_OUTOFMEMORY; retCode = ERROR_OUTOFMEMORY;
nFileOp.fAnyOperationsAborted = TRUE; nFileOp.fAnyOperationsAborted = TRUE;
@ -943,18 +938,18 @@ static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
DWORD dwLen = lstrlenW(szFile) + 1; DWORD dwLen = lstrlenW(szFile) + 1;
LPCWSTR ptr; LPCWSTR ptr;
feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR)); feFile->szFullPath = heap_alloc(dwLen * sizeof(WCHAR));
lstrcpyW(feFile->szFullPath, szFile); lstrcpyW(feFile->szFullPath, szFile);
ptr = StrRChrW(szFile, NULL, '\\'); ptr = StrRChrW(szFile, NULL, '\\');
if (ptr) if (ptr)
{ {
dwLen = ptr - szFile + 1; dwLen = ptr - szFile + 1;
feFile->szDirectory = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR)); feFile->szDirectory = heap_alloc(dwLen * sizeof(WCHAR));
lstrcpynW(feFile->szDirectory, szFile, dwLen); lstrcpynW(feFile->szDirectory, szFile, dwLen);
dwLen = lstrlenW(feFile->szFullPath) - dwLen + 1; dwLen = lstrlenW(feFile->szFullPath) - dwLen + 1;
feFile->szFilename = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR)); feFile->szFilename = heap_alloc(dwLen * sizeof(WCHAR));
lstrcpyW(feFile->szFilename, ptr + 1); /* skip over backslash */ lstrcpyW(feFile->szFilename, ptr + 1); /* skip over backslash */
} }
feFile->bFromWildcard = FALSE; feFile->bFromWildcard = FALSE;
@ -970,7 +965,7 @@ static LPWSTR wildcard_to_file(LPCWSTR szWildCard, LPCWSTR szFileName)
dwDirLen = ptr - szWildCard + 1; dwDirLen = ptr - szWildCard + 1;
dwFullLen = dwDirLen + lstrlenW(szFileName) + 1; dwFullLen = dwDirLen + lstrlenW(szFileName) + 1;
szFullPath = HeapAlloc(GetProcessHeap(), 0, dwFullLen * sizeof(WCHAR)); szFullPath = heap_alloc(dwFullLen * sizeof(WCHAR));
lstrcpynW(szFullPath, szWildCard, dwDirLen + 1); lstrcpynW(szFullPath, szWildCard, dwDirLen + 1);
lstrcatW(szFullPath, szFileName); lstrcatW(szFullPath, szFileName);
@ -998,7 +993,7 @@ static void parse_wildcard_files(FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwL
file->bFromWildcard = TRUE; file->bFromWildcard = TRUE;
file->attributes = wfd.dwFileAttributes; file->attributes = wfd.dwFileAttributes;
if (IsAttribDir(file->attributes)) flList->bAnyDirectories = TRUE; if (IsAttribDir(file->attributes)) flList->bAnyDirectories = TRUE;
HeapFree(GetProcessHeap(), 0, szFullPath); heap_free(szFullPath);
} }
FindClose(hFile); FindClose(hFile);
@ -1024,8 +1019,7 @@ static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
if (!szFiles[0]) if (!szFiles[0])
return ERROR_ACCESS_DENIED; return ERROR_ACCESS_DENIED;
flList->feFiles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, flList->feFiles = heap_alloc_zero(flList->num_alloc * sizeof(FILE_ENTRY));
flList->num_alloc * sizeof(FILE_ENTRY));
while (*ptr) while (*ptr)
{ {
@ -1080,12 +1074,12 @@ static void destroy_file_list(FILE_LIST *flList)
for (i = 0; i < flList->dwNumFiles; i++) for (i = 0; i < flList->dwNumFiles; i++)
{ {
HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szDirectory); heap_free(flList->feFiles[i].szDirectory);
HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFilename); heap_free(flList->feFiles[i].szFilename);
HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFullPath); heap_free(flList->feFiles[i].szFullPath);
} }
HeapFree(GetProcessHeap(), 0, flList->feFiles); heap_free(flList->feFiles);
} }
static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath) static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
@ -1216,9 +1210,9 @@ static int copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, FILE_LIST *fl
/* Free all but the first entry. */ /* Free all but the first entry. */
for (i = 1; i < flTo->dwNumFiles; i++) for (i = 1; i < flTo->dwNumFiles; i++)
{ {
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szDirectory); heap_free(flTo->feFiles[i].szDirectory);
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFilename); heap_free(flTo->feFiles[i].szFilename);
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFullPath); heap_free(flTo->feFiles[i].szFullPath);
} }
flTo->dwNumFiles = 1; flTo->dwNumFiles = 1;
@ -1758,7 +1752,7 @@ HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path
len = 1; len = 1;
else else
len = last_slash - path + 1; len = last_slash - path + 1;
temppath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); temppath = heap_alloc(len * sizeof(WCHAR));
if (!temppath) if (!temppath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
StrCpyNW(temppath, path, len); StrCpyNW(temppath, path, len);
@ -1781,7 +1775,7 @@ HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path
/* check if we can access the directory */ /* check if we can access the directory */
res = GetFileAttributesW(realpath); res = GetFileAttributesW(realpath);
HeapFree(GetProcessHeap(), 0, temppath); heap_free(temppath);
if (res == INVALID_FILE_ATTRIBUTES) if (res == INVALID_FILE_ATTRIBUTES)
{ {

View File

@ -92,7 +92,7 @@ static ULONG WINAPI FileSystemBindData_Release(IFileSystemBindData *iface)
TRACE("(%p)->(%u)\n", This, ref); TRACE("(%p)->(%u)\n", This, ref);
if (!ref) if (!ref)
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ref; return ref;
} }
@ -143,7 +143,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data
*ppV = NULL; *ppV = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IFileSystemBindData_iface.lpVtbl = &FileSystemBindDataVtbl; This->IFileSystemBindData_iface.lpVtbl = &FileSystemBindDataVtbl;
@ -167,6 +167,6 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data
IFileSystemBindData_Release(&This->IFileSystemBindData_iface); IFileSystemBindData_Release(&This->IFileSystemBindData_iface);
} }
else else
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
return ret; return ret;
} }

View File

@ -197,7 +197,7 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
MENUINFO MenuInfo; MENUINFO MenuInfo;
HMENU hMenuPopup = CreatePopupMenu(); HMENU hMenuPopup = CreatePopupMenu();
lpFmMi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); lpFmMi = heap_alloc_zero(sizeof(*lpFmMi));
lpFmMi->pidl = ILCombine(pidl, pidlTemp); lpFmMi->pidl = ILCombine(pidl, pidlTemp);
lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS; lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
@ -268,7 +268,7 @@ HMENU WINAPI FileMenu_Create (
TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x hMenu=%p\n", TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x hMenu=%p\n",
crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu); crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
menudata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO)); menudata = heap_alloc_zero(sizeof(*menudata));
menudata->crBorderColor = crBorderColor; menudata->crBorderColor = crBorderColor;
menudata->nBorderWidth = nBorderWidth; menudata->nBorderWidth = nBorderWidth;
menudata->hBorderBmp = hBorderBmp; menudata->hBorderBmp = hBorderBmp;
@ -298,7 +298,7 @@ void WINAPI FileMenu_Destroy (HMENU hmenu)
menudata = FM_GetMenuInfo(hmenu); menudata = FM_GetMenuInfo(hmenu);
SHFree( menudata->pidl); SHFree( menudata->pidl);
HeapFree(GetProcessHeap(), 0, menudata); heap_free(menudata);
DestroyMenu (hmenu); DestroyMenu (hmenu);
} }
@ -401,11 +401,11 @@ BOOL WINAPI FileMenu_AppendItemAW(
else else
{ {
DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 ); DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 );
LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) ); LPWSTR lpszText = heap_alloc( len*sizeof(WCHAR) );
if (!lpszText) return FALSE; if (!lpszText) return FALSE;
MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len ); MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight); ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
HeapFree( GetProcessHeap(), 0, lpszText ); heap_free( lpszText );
} }
return ret; return ret;
@ -1020,24 +1020,27 @@ static CompositeCMenu* impl_from_IContextMenu3(IContextMenu3* iface)
static HRESULT CompositeCMenu_Constructor(IContextMenu **menus,UINT menu_count, REFIID riid, void **ppv) static HRESULT CompositeCMenu_Constructor(IContextMenu **menus,UINT menu_count, REFIID riid, void **ppv)
{ {
CompositeCMenu *ret = HeapAlloc(GetProcessHeap(),0,sizeof(CompositeCMenu)); CompositeCMenu *ret;
UINT i; UINT i;
TRACE("(%p,%u,%s,%p)\n",menus,menu_count,shdebugstr_guid(riid),ppv); TRACE("(%p,%u,%s,%p)\n",menus,menu_count,shdebugstr_guid(riid),ppv);
ret = heap_alloc(sizeof(*ret));
if(!ret) if(!ret)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
ret->IContextMenu3_iface.lpVtbl = &CompositeCMenuVtbl; ret->IContextMenu3_iface.lpVtbl = &CompositeCMenuVtbl;
ret->menu_count = menu_count; ret->menu_count = menu_count;
ret->menus = HeapAlloc(GetProcessHeap(),0,menu_count*sizeof(IContextMenu*)); ret->menus = heap_alloc(menu_count*sizeof(IContextMenu*));
if(!ret->menus) if(!ret->menus)
{ {
HeapFree(GetProcessHeap(),0,ret); heap_free(ret);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
ret->offsets = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,menu_count*sizeof(UINT)); ret->offsets = heap_alloc_zero(menu_count*sizeof(UINT));
if(!ret->offsets) if(!ret->offsets)
{ {
HeapFree(GetProcessHeap(),0,ret->menus); heap_free(ret->menus);
HeapFree(GetProcessHeap(),0,ret); heap_free(ret);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
ret->refCount=0; ret->refCount=0;
@ -1052,9 +1055,9 @@ static void CompositeCMenu_Destroy(CompositeCMenu *This)
UINT i; UINT i;
for(i=0;i<This->menu_count;i++) for(i=0;i<This->menu_count;i++)
IContextMenu_Release(This->menus[i]); IContextMenu_Release(This->menus[i]);
HeapFree(GetProcessHeap(),0,This->menus); heap_free(This->menus);
HeapFree(GetProcessHeap(),0,This->offsets); heap_free(This->offsets);
HeapFree(GetProcessHeap(),0,This); heap_free(This);
} }
static HRESULT WINAPI CompositeCMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, void **ppv) static HRESULT WINAPI CompositeCMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, void **ppv)

View File

@ -1555,7 +1555,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
} }
/* allocate memory for the pidl array */ /* allocate memory for the pidl array */
pItems = HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST) * count); pItems = heap_alloc(sizeof(LPITEMIDLIST) * count);
/* retrieve all selected items */ /* retrieve all selected items */
i = 0; i = 0;
@ -1581,7 +1581,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
ISFHelper_Release(psfhlp); ISFHelper_Release(psfhlp);
/* free pidl array memory */ /* free pidl array memory */
HeapFree(GetProcessHeap(), 0, pItems); heap_free(pItems);
} }
break; break;
@ -1803,7 +1803,7 @@ static ULONG WINAPI IShellView_fnRelease(IShellView3 *iface)
if(This->pAdvSink) if(This->pAdvSink)
IAdviseSink_Release(This->pAdvSink); IAdviseSink_Release(This->pAdvSink);
HeapFree(GetProcessHeap(),0,This); heap_free(This);
} }
return refCount; return refCount;
} }
@ -3728,7 +3728,7 @@ IShellView *IShellView_Constructor(IShellFolder *folder)
{ {
IShellViewImpl *sv; IShellViewImpl *sv;
sv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl)); sv = heap_alloc_zero(sizeof(*sv));
if (!sv) if (!sv)
return NULL; return NULL;

View File

@ -133,7 +133,7 @@ static ULONG WINAPI ContextMenu_Release(IContextMenu3 *iface)
SHFree(This->pidl); SHFree(This->pidl);
_ILFreeaPidl(This->apidl, This->cidl); _ILFreeaPidl(This->apidl, This->cidl);
HeapFree(GetProcessHeap(), 0, This); heap_free(This);
} }
return ref; return ref;
@ -684,7 +684,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC
HRESULT hr; HRESULT hr;
UINT i; UINT i;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl; This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl;
@ -994,7 +994,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri
ContextMenu *This; ContextMenu *This;
HRESULT hr; HRESULT hr;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl; This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl;

View File

@ -32,6 +32,7 @@
#include "shellapi.h" #include "shellapi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(systray); WINE_DEFAULT_DEBUG_CHANNEL(systray);
@ -180,7 +181,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
if (iconinfo.hbmColor) if (iconinfo.hbmColor)
cbColourBits = (bmColour.bmPlanes * bmColour.bmWidth * bmColour.bmHeight * bmColour.bmBitsPixel + 15) / 16 * 2; cbColourBits = (bmColour.bmPlanes * bmColour.bmWidth * bmColour.bmHeight * bmColour.bmBitsPixel + 15) / 16 * 2;
cds.cbData = sizeof(*data) + cbMaskBits + cbColourBits; cds.cbData = sizeof(*data) + cbMaskBits + cbColourBits;
buffer = HeapAlloc(GetProcessHeap(), 0, cds.cbData); buffer = heap_alloc(cds.cbData);
if (!buffer) if (!buffer)
{ {
DeleteObject(iconinfo.hbmMask); DeleteObject(iconinfo.hbmMask);
@ -240,7 +241,7 @@ noicon:
cds.lpData = data; cds.lpData = data;
ret = SendMessageW(tray, WM_COPYDATA, (WPARAM)nid->hWnd, (LPARAM)&cds); ret = SendMessageW(tray, WM_COPYDATA, (WPARAM)nid->hWnd, (LPARAM)&cds);
if (data != &data_buffer) HeapFree( GetProcessHeap(), 0, data ); if (data != &data_buffer) heap_free( data );
return ret; return ret;
} }

View File

@ -123,7 +123,7 @@ BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
return FALSE; return FALSE;
status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL); status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL);
HeapFree(GetProcessHeap(), 0, unix_path); heap_free(unix_path);
if (status == noErr) if (status == noErr)
status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalogInfo, NULL, status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalogInfo, NULL,
NULL, NULL); NULL, NULL);
@ -145,7 +145,7 @@ BOOL TRASH_TrashFile(LPCWSTR wszPath)
status = FSPathMoveObjectToTrashSync(unix_path, NULL, kFSFileOperationSkipPreflight); status = FSPathMoveObjectToTrashSync(unix_path, NULL, kFSFileOperationSkipPreflight);
HeapFree(GetProcessHeap(), 0, unix_path); heap_free(unix_path);
return (status == noErr); return (status == noErr);
} }
@ -171,7 +171,7 @@ HRESULT TRASH_GetDetails(const char *trash_path, const char *name, WIN32_FIND_DA
memcpy(path+trash_path_length+1, name, name_length+1); memcpy(path+trash_path_length+1, name, name_length+1);
ret = lstat(path, &stats); ret = lstat(path, &stats);
HeapFree(GetProcessHeap(), 0, path); heap_free(path);
if(ret == -1) return S_FALSE; if(ret == -1) return S_FALSE;
memset(data, 0, sizeof(*data)); memset(data, 0, sizeof(*data));
data->nFileSizeHigh = stats.st_size>>32; data->nFileSizeHigh = stats.st_size>>32;
@ -212,7 +212,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL); status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL);
HeapFree(GetProcessHeap(), 0, unix_path); heap_free(unix_path);
if(status != noErr) return E_FAIL; if(status != noErr) return E_FAIL;
status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalog_info, NULL, NULL, NULL); status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalog_info, NULL, NULL, NULL);
if(status != noErr) return E_FAIL; if(status != noErr) return E_FAIL;
@ -222,7 +222,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
if(status != noErr) return E_FAIL; if(status != noErr) return E_FAIL;
if(!(dir = opendir(trash_path))) return E_FAIL; if(!(dir = opendir(trash_path))) return E_FAIL;
ret = HeapAlloc(GetProcessHeap(), 0, ret_size * sizeof(*ret)); ret = heap_alloc(ret_size * sizeof(*ret));
if(!ret) { if(!ret) {
closedir(dir); closedir(dir);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -237,7 +237,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
if(i == ret_size) { if(i == ret_size) {
LPITEMIDLIST *resized; LPITEMIDLIST *resized;
ret_size *= 2; ret_size *= 2;
resized = HeapReAlloc(GetProcessHeap(), 0, ret, ret_size * sizeof(*ret)); resized = heap_realloc(ret, ret_size * sizeof(*ret));
if(!resized) hr = E_OUTOFMEMORY; if(!resized) hr = E_OUTOFMEMORY;
else ret = resized; else ret = resized;
} }
@ -250,7 +250,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
hr = TRASH_CreateSimplePIDL(entry->d_name, &data, ret+i); hr = TRASH_CreateSimplePIDL(entry->d_name, &data, ret+i);
if(FAILED(hr)) { if(FAILED(hr)) {
while(i>0) SHFree(ret+(--i)); while(i>0) SHFree(ret+(--i));
HeapFree(GetProcessHeap(), 0, ret); heap_free(ret);
closedir(dir); closedir(dir);
return hr; return hr;
} }
@ -261,12 +261,12 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
*pidls = SHAlloc(sizeof(**pidls) * i); *pidls = SHAlloc(sizeof(**pidls) * i);
if(!*pidls) { if(!*pidls) {
while(i>0) SHFree(ret+(--i)); while(i>0) SHFree(ret+(--i));
HeapFree(GetProcessHeap(), 0, ret); heap_free(ret);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
*count = i; *count = i;
for(i--; i>=0; i--) (*pidls)[i] = ret[i]; for(i--; i>=0; i--) (*pidls)[i] = ret[i];
HeapFree(GetProcessHeap(), 0, ret); heap_free(ret);
return S_OK; return S_OK;
} }
@ -384,17 +384,16 @@ BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
{ {
struct stat file_stat; struct stat file_stat;
char *unix_path; char *unix_path;
int ret;
TRACE("(%s)\n", debugstr_w(wszPath)); TRACE("(%s)\n", debugstr_w(wszPath));
if (!TRASH_EnsureInitialized()) return FALSE; if (!TRASH_EnsureInitialized()) return FALSE;
if (!(unix_path = wine_get_unix_file_name(wszPath))) if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE; return FALSE;
if (lstat(unix_path, &file_stat)==-1) ret = lstat(unix_path, &file_stat);
{ heap_free(unix_path);
HeapFree(GetProcessHeap(), 0, unix_path); if (ret == -1)
return FALSE; return FALSE;
}
HeapFree(GetProcessHeap(), 0, unix_path);
return file_good_for_bucket(home_trash, &file_stat); return file_good_for_bucket(home_trash, &file_stat);
} }
@ -542,7 +541,7 @@ BOOL TRASH_TrashFile(LPCWSTR wszPath)
if (!(unix_path = wine_get_unix_file_name(wszPath))) if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE; return FALSE;
result = TRASH_MoveFileToBucket(home_trash, unix_path); result = TRASH_MoveFileToBucket(home_trash, unix_path);
HeapFree(GetProcessHeap(), 0, unix_path); heap_free(unix_path);
return result; return result;
} }
@ -760,7 +759,7 @@ HRESULT TRASH_RestoreItem(LPCITEMIDLIST pidl){
else else
WARN("could not erase %s from the trash (errno=%i)\n",filename,errno); WARN("could not erase %s from the trash (errno=%i)\n",filename,errno);
SHFree(file_path); SHFree(file_path);
HeapFree(GetProcessHeap(), 0, restore_path); heap_free(restore_path);
return S_OK; return S_OK;
} }

View File

@ -756,7 +756,7 @@ static HRESULT get_xdg_config_file(char * home_dir, char ** config_file)
config_home = getenv("XDG_CONFIG_HOME"); config_home = getenv("XDG_CONFIG_HOME");
if (!config_home || !config_home[0]) if (!config_home || !config_home[0])
{ {
*config_file = HeapAlloc(GetProcessHeap(), 0, strlen(home_dir) + strlen("/.config/user-dirs.dirs") + 1); *config_file = heap_alloc(strlen(home_dir) + strlen("/.config/user-dirs.dirs") + 1);
if (!*config_file) if (!*config_file)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -765,7 +765,7 @@ static HRESULT get_xdg_config_file(char * home_dir, char ** config_file)
} }
else else
{ {
*config_file = HeapAlloc(GetProcessHeap(), 0, strlen(config_home) + strlen("/user-dirs.dirs") + 1); *config_file = heap_alloc(strlen(config_home) + strlen("/user-dirs.dirs") + 1);
if (!*config_file) if (!*config_file)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -849,7 +849,7 @@ static HRESULT parse_config2(char * p, const char * home_dir, char ** out_ptr)
if (relative) if (relative)
{ {
out = HeapAlloc(GetProcessHeap(), 0, strlen(home_dir) + strlen(p) + 2); out = heap_alloc(strlen(home_dir) + strlen(p) + 2);
if (!out) if (!out)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -858,7 +858,7 @@ static HRESULT parse_config2(char * p, const char * home_dir, char ** out_ptr)
} }
else else
{ {
out = HeapAlloc(GetProcessHeap(), 0, strlen(p) + 1); out = heap_alloc(strlen(p) + 1);
if (!out) if (!out)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
*out = 0; *out = 0;
@ -897,7 +897,7 @@ HRESULT XDG_UserDirLookup(const char * const *xdg_dirs, const unsigned int num_d
unsigned int i; unsigned int i;
HRESULT hr; HRESULT hr;
*out_ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, num_dirs * sizeof(char *)); *out_ptr = heap_alloc_zero(num_dirs * sizeof(char *));
out = *out_ptr; out = *out_ptr;
if (!out) if (!out)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -914,7 +914,7 @@ HRESULT XDG_UserDirLookup(const char * const *xdg_dirs, const unsigned int num_d
goto xdg_user_dir_lookup_error; goto xdg_user_dir_lookup_error;
file = fopen(config_file, "r"); file = fopen(config_file, "r");
HeapFree(GetProcessHeap(), 0, config_file); heap_free(config_file);
if (!file) if (!file)
{ {
hr = E_HANDLE; hr = E_HANDLE;
@ -963,15 +963,16 @@ HRESULT XDG_UserDirLookup(const char * const *xdg_dirs, const unsigned int num_d
continue; continue;
if (!stat(out[i], &statFolder) && S_ISDIR(statFolder.st_mode)) if (!stat(out[i], &statFolder) && S_ISDIR(statFolder.st_mode))
continue; continue;
HeapFree(GetProcessHeap(), 0, out[i]); heap_free(out[i]);
out[i] = NULL; out[i] = NULL;
} }
xdg_user_dir_lookup_error: xdg_user_dir_lookup_error:
if (FAILED(hr)) if (FAILED(hr))
{ {
for (i = 0; i < num_dirs; i++) HeapFree(GetProcessHeap(), 0, out[i]); for (i = 0; i < num_dirs; i++)
HeapFree(GetProcessHeap(), 0, *out_ptr); heap_free(out[i]);
heap_free(*out_ptr);
} }
return hr; return hr;
} }