Commit e3b200bd authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Use global memory allocation helpers.

parent 0914e5ea
...@@ -253,7 +253,7 @@ static HRESULT WINAPI IQueryAssociations_fnInit( ...@@ -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 * ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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, ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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, ...@@ -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);
......
...@@ -130,12 +130,11 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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 ...@@ -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;
......
...@@ -951,13 +951,13 @@ static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL ...@@ -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) ...@@ -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) ...@@ -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;
} }
......
...@@ -55,8 +55,8 @@ void Control_UnloadApplet(CPlApplet* applet) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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);
} }
/************************************************************************* /*************************************************************************
......
...@@ -99,8 +99,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface) ...@@ -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[]) ...@@ -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) ...@@ -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, ...@@ -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)
{ {
......
...@@ -89,7 +89,7 @@ static WCHAR *get_programs_path(const WCHAR *name) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
} }
......
...@@ -121,7 +121,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) ...@@ -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) ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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]
......
...@@ -112,7 +112,7 @@ static void events_unadvise_all(ExplorerBrowserImpl *This) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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;
......
...@@ -186,7 +186,7 @@ static ULONG WINAPI IEnumIDList_fnRelease(IEnumIDList *iface) ...@@ -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 = ...@@ -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)
{ {
......
...@@ -125,8 +125,7 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface) ...@@ -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 ...@@ -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 ...@@ -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) ...@@ -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;
......
...@@ -316,7 +316,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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, ...@@ -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;
} }
......
...@@ -1063,13 +1063,13 @@ LPITEMIDLIST SHSimpleIDListFromPathA(LPCSTR lpszPath) ...@@ -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;
} }
......
...@@ -723,8 +723,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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;
} }
......
...@@ -35,6 +35,7 @@ ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
......
...@@ -234,7 +234,7 @@ static ULONG WINAPI FolderItemVerbImpl_Release(FolderItemVerb *iface) ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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;
......
...@@ -112,7 +112,7 @@ static ULONG WINAPI ShellItem_Release(IShellItem2 *iface) ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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 ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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 ...@@ -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;
......
...@@ -391,7 +391,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc ...@@ -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) ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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) ...@@ -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);
} }
......
...@@ -1350,7 +1350,7 @@ BOOL WINAPI IsUserAnAdmin(VOID) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
} }
......
...@@ -1079,7 +1079,7 @@ static ULONG WINAPI ApplicationDestinations_Release(IApplicationDestinations *if ...@@ -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) ...@@ -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) ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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( ...@@ -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 ) ...@@ -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( ...@@ -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 ) ...@@ -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( ...@@ -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 ...@@ -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( ...@@ -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 ) ...@@ -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 ) ...@@ -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++)
......
...@@ -1205,7 +1205,7 @@ static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, const LPCITEMIDLIS ...@@ -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) ...@@ -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, ...@@ -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);
......
...@@ -95,7 +95,7 @@ HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid, ...@@ -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) ...@@ -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;
} }
......
...@@ -405,7 +405,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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, ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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;
......
...@@ -322,7 +322,7 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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)
{ {
......
...@@ -92,7 +92,7 @@ static ULONG WINAPI FileSystemBindData_Release(IFileSystemBindData *iface) ...@@ -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 ...@@ -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 ...@@ -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;
} }
...@@ -197,7 +197,7 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl) ...@@ -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 ( ...@@ -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) ...@@ -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( ...@@ -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) ...@@ -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) ...@@ -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)
......
...@@ -1555,7 +1555,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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;
......
...@@ -133,7 +133,7 @@ static ULONG WINAPI ContextMenu_Release(IContextMenu3 *iface) ...@@ -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 ...@@ -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 ...@@ -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;
......
...@@ -32,6 +32,7 @@ ...@@ -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) ...@@ -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: ...@@ -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;
} }
......
...@@ -123,7 +123,7 @@ BOOL TRASH_CanTrashFile(LPCWSTR wszPath) ...@@ -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) ...@@ -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 ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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){ ...@@ -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;
} }
......
...@@ -756,7 +756,7 @@ static HRESULT get_xdg_config_file(char * home_dir, char ** config_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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment