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(
0,
KEY_READ,
&This->hkeyProgID);
HeapFree(GetProcessHeap(), 0, progId);
heap_free(progId);
return S_OK;
}
......@@ -278,13 +278,13 @@ static HRESULT ASSOC_GetValue(HKEY hkey, const WCHAR *name, void **data, DWORD *
return HRESULT_FROM_WIN32(ret);
if (!size)
return E_FAIL;
*data = HeapAlloc(GetProcessHeap(), 0, size);
*data = heap_alloc(size);
if (!*data)
return E_OUTOFMEMORY;
ret = RegQueryValueExW(hkey, name, 0, NULL, (LPBYTE)*data, &size);
if (ret != ERROR_SUCCESS)
{
HeapFree(GetProcessHeap(), 0, *data);
heap_free(*data);
return HRESULT_FROM_WIN32(ret);
}
if(data_size)
......@@ -312,7 +312,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
HKEY hkeyFile;
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, filetype, 0, KEY_READ, &hkeyFile);
HeapFree(GetProcessHeap(), 0, filetype);
heap_free(filetype);
if (ret == ERROR_SUCCESS)
{
......@@ -344,7 +344,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
}
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)
{
RegCloseKey(hkeyShell);
......@@ -354,7 +354,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
ret = RegEnumKeyExW(hkeyShell, 0, extra_from_reg, &max_subkey_len, NULL, NULL, NULL, NULL);
if (ret)
{
HeapFree(GetProcessHeap(), 0, extra_from_reg);
heap_free(extra_from_reg);
RegCloseKey(hkeyShell);
return HRESULT_FROM_WIN32(ret);
}
......@@ -364,7 +364,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
/* open verb subkey */
ret = RegOpenKeyExW(hkeyShell, extra, 0, KEY_READ, &hkeyVerb);
HeapFree(GetProcessHeap(), 0, extra_from_reg);
heap_free(extra_from_reg);
RegCloseKey(hkeyShell);
if (ret) return HRESULT_FROM_WIN32(ret);
......@@ -415,7 +415,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
*len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
}
HeapFree(GetProcessHeap(), 0, pszCommand);
heap_free(pszCommand);
if (!*len)
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
return S_OK;
......@@ -530,7 +530,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
if (SUCCEEDED(hr))
{
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, command, strlenW(command) + 1);
HeapFree(GetProcessHeap(), 0, command);
heap_free(command);
}
return hr;
}
......@@ -554,7 +554,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION);
}
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, docName, strlenW(docName) + 1);
HeapFree(GetProcessHeap(), 0, docName);
heap_free(docName);
return hr;
}
......@@ -582,7 +582,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
retval = GetFileVersionInfoSizeW(path, &size);
if (!retval)
goto get_friendly_name_fail;
verinfoW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, retval);
verinfoW = heap_alloc_zero(retval);
if (!verinfoW)
return E_OUTOFMEMORY;
if (!GetFileVersionInfoW(path, 0, retval, verinfoW))
......@@ -601,7 +601,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
len = strlenW(bufW) + 1;
TRACE("found FileDescription: %s\n", debugstr_w(bufW));
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len);
HeapFree(GetProcessHeap(), 0, verinfoW);
heap_free(verinfoW);
return hr;
}
}
......@@ -611,7 +611,7 @@ get_friendly_name_fail:
PathStripPathW(path);
TRACE("using filename: %s\n", debugstr_w(path));
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, path, strlenW(path) + 1);
HeapFree(GetProcessHeap(), 0, verinfoW);
heap_free(verinfoW);
return hr;
}
......@@ -626,7 +626,7 @@ get_friendly_name_fail:
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
contentType = HeapAlloc(GetProcessHeap(), 0, size);
contentType = heap_alloc(size);
if (contentType != NULL)
{
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size);
......@@ -634,7 +634,7 @@ get_friendly_name_fail:
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, strlenW(contentType) + 1);
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, contentType);
heap_free(contentType);
}
else
hr = E_OUTOFMEMORY;
......@@ -652,7 +652,7 @@ get_friendly_name_fail:
ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret == ERROR_SUCCESS)
{
WCHAR *icon = HeapAlloc(GetProcessHeap(), 0, size);
WCHAR *icon = heap_alloc(size);
if (icon)
{
ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size);
......@@ -660,7 +660,7 @@ get_friendly_name_fail:
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, strlenW(icon) + 1);
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, icon);
heap_free(icon);
}
else
hr = E_OUTOFMEMORY;
......@@ -776,7 +776,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetData(IQueryAssociations *iface,
hres = ASSOC_GetValue(This->hkeyProgID, edit_flags, &data, &size);
if(SUCCEEDED(hres) && pcbOut)
hres = ASSOC_ReturnData(pvOut, pcbOut, data, size);
HeapFree(GetProcessHeap(), 0, data);
heap_free(data);
return hres;
default:
FIXME("Unsupported ASSOCDATA value: %d\n", assocdata);
......
......@@ -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 */
control = GetKeyState(VK_CONTROL) & 0x8000;
if (control && This->quickComplete) {
hwndQCText = HeapAlloc(GetProcessHeap(), 0,
(lstrlenW(This->quickComplete)+lstrlenW(hwndText))*sizeof(WCHAR));
hwndQCText = heap_alloc((lstrlenW(This->quickComplete)+lstrlenW(hwndText))*sizeof(WCHAR));
sel = sprintfW(hwndQCText, This->quickComplete, hwndText);
SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText);
SendMessageW(hwnd, EM_SETSEL, 0, sel);
HeapFree(GetProcessHeap(), 0, hwndQCText);
heap_free(hwndQCText);
}
ShowWindow(This->hwndListBox, SW_HIDE);
......@@ -173,11 +172,11 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
int len;
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(hwnd, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(hwnd, EM_SETSEL, lstrlenW(msg), lstrlenW(msg));
HeapFree(GetProcessHeap(), 0, msg);
heap_free(msg);
} else {
SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)This->txtbackup);
SendMessageW(hwnd, EM_SETSEL, lstrlenW(This->txtbackup), lstrlenW(This->txtbackup));
......@@ -209,9 +208,9 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
SendMessageW(This->hwndListBox, LB_RESETCONTENT, 0, 0);
HeapFree(GetProcessHeap(), 0, This->txtbackup);
heap_free(This->txtbackup);
len = strlenW(hwndText);
This->txtbackup = HeapAlloc(GetProcessHeap(), 0, (len + 1)*sizeof(WCHAR));
This->txtbackup = heap_alloc((len + 1)*sizeof(WCHAR));
lstrcpyW(This->txtbackup, hwndText);
/* Returns if there is no text to search and we doesn't want to display all the entries */
......@@ -307,12 +306,12 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
if (sel < 0)
break;
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(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg);
SendMessageW(This->hwndEdit, EM_SETSEL, 0, lstrlenW(msg));
ShowWindow(hwnd, SW_HIDE);
HeapFree(GetProcessHeap(), 0, msg);
heap_free(msg);
break;
default:
return CallWindowProcW(This->wpOrigLBoxProc, hwnd, uMsg, wParam, lParam);
......@@ -399,11 +398,11 @@ static ULONG WINAPI IAutoComplete2_fnRelease(
if (!refCount) {
TRACE("destroying IAutoComplete(%p)\n", This);
HeapFree(GetProcessHeap(), 0, This->quickComplete);
HeapFree(GetProcessHeap(), 0, This->txtbackup);
heap_free(This->quickComplete);
heap_free(This->txtbackup);
if (This->enumstr)
IEnumString_Release(This->enumstr);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return refCount;
}
......@@ -479,7 +478,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
LONG len;
/* 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);
value = strrchrW(key, '\\');
*value = 0;
......@@ -493,16 +492,16 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
if (res == ERROR_SUCCESS) {
res = RegQueryValueW(hKey, value, result, &len);
if (res == ERROR_SUCCESS) {
This->quickComplete = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
This->quickComplete = heap_alloc(len*sizeof(WCHAR));
strcpyW(This->quickComplete, result);
}
RegCloseKey(hKey);
}
HeapFree(GetProcessHeap(), 0, key);
heap_free(key);
}
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);
}
......@@ -658,7 +657,7 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO
if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
return CLASS_E_NOAGGREGATION;
lpac = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAutoCompleteImpl));
lpac = heap_alloc_zero(sizeof(*lpac));
if (!lpac)
return E_OUTOFMEMORY;
......
......@@ -951,13 +951,13 @@ static BOOL BrsFolder_OnSetSelectionA(browse_info *info, LPVOID selection, BOOL
return BrsFolder_OnSetSelectionW(info, selection, is_str);
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))
{
result = BrsFolder_OnSetSelectionW(info, selectionW, is_str);
}
HeapFree(GetProcessHeap(), 0, selectionW);
heap_free(selectionW);
return result;
}
......@@ -1071,14 +1071,14 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
bi.hwndOwner = lpbi->hwndOwner;
bi.pidlRoot = lpbi->pidlRoot;
if (lpbi->pszDisplayName)
bi.pszDisplayName = HeapAlloc( GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR) );
bi.pszDisplayName = heap_alloc( MAX_PATH * sizeof(WCHAR) );
else
bi.pszDisplayName = NULL;
if (lpbi->lpszTitle)
{
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 );
}
else
......@@ -1094,9 +1094,9 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
{
WideCharToMultiByte( CP_ACP, 0, bi.pszDisplayName, -1,
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;
return lpid;
}
......
......@@ -55,8 +55,8 @@ void Control_UnloadApplet(CPlApplet* applet)
if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
FreeLibrary(applet->hModule);
list_remove( &applet->entry );
HeapFree(GetProcessHeap(), 0, applet->cmd);
HeapFree(GetProcessHeap(), 0, applet);
heap_free(applet->cmd);
heap_free(applet);
}
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
......@@ -67,13 +67,13 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
CPLINFO info;
NEWCPLINFOW newinfo;
if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet))))
if (!(applet = heap_alloc_zero(sizeof(*applet))))
return applet;
len = ExpandEnvironmentStringsW(cmd, NULL, 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");
goto theError;
......@@ -180,8 +180,8 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
theError:
FreeLibrary(applet->hModule);
HeapFree(GetProcessHeap(), 0, applet->cmd);
HeapFree(GetProcessHeap(), 0, applet);
heap_free(applet->cmd);
heap_free(applet);
return NULL;
}
......@@ -289,7 +289,7 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs)
{
for (i = 0; i < applet->count; i++) {
/* set up a CPlItem for this particular subprogram */
item = HeapAlloc(GetProcessHeap(), 0, sizeof(CPlItem));
item = heap_alloc(sizeof(CPlItem));
if (!item)
continue;
......@@ -366,7 +366,7 @@ static void Control_FreeCPlItems(HWND hWnd, CPanel *panel)
if (!GetMenuItemInfoW(hSubMenu, i, FALSE, &mii))
continue;
HeapFree(GetProcessHeap(), 0, (LPVOID) mii.dwItemData);
heap_free((void *)mii.dwItemData);
}
}
......@@ -724,7 +724,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
BOOL quoted = FALSE;
CPlApplet *applet;
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
buffer = heap_alloc((lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
if (!buffer) return;
end = lstrcpyW(buffer, wszCmd);
......@@ -813,7 +813,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
Control_UnloadApplet(applet);
}
HeapFree(GetProcessHeap(), 0, buffer);
heap_free(buffer);
}
/*************************************************************************
......@@ -844,12 +844,12 @@ void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdS
void WINAPI Control_RunDLLA(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow)
{
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 ))
{
Control_RunDLLW(hWnd, hInst, wszCmd, nCmdShow);
}
HeapFree(GetProcessHeap(), 0, wszCmd);
heap_free(wszCmd);
}
/*************************************************************************
......
......@@ -99,8 +99,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface)
{
TRACE(" destroying IEnumFORMATETC(%p)\n",This);
SHFree (This->pFmt);
HeapFree(GetProcessHeap(),0,This);
return 0;
heap_free(This);
}
return refCount;
}
......@@ -173,7 +172,7 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[])
IEnumFORMATETCImpl* ef;
DWORD size=cfmt * sizeof(FORMATETC);
ef = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumFORMATETCImpl));
ef = heap_alloc_zero(sizeof(*ef));
if(ef)
{
......@@ -276,7 +275,7 @@ static ULONG WINAPI IDataObject_fnRelease(IDataObject *iface)
TRACE(" destroying IDataObject(%p)\n",This);
_ILFreeaPidl(This->apidl, This->cidl);
ILFree(This->pidl),
HeapFree(GetProcessHeap(),0,This);
heap_free(This);
}
return refCount;
}
......@@ -432,7 +431,7 @@ IDataObject* IDataObject_Constructor(HWND hwndOwner,
{
IDataObjectImpl* dto;
dto = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDataObjectImpl));
dto = heap_alloc_zero(sizeof(*dto));
if (dto)
{
......
......@@ -89,7 +89,7 @@ static WCHAR *get_programs_path(const WCHAR *name)
SHGetKnownFolderPath(&FOLDERID_Programs, 0, NULL, &programs);
len = lstrlenW(programs) + 1 + lstrlenW(name);
path = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*path));
path = heap_alloc((len + 1) * sizeof(*path));
lstrcpyW(path, programs);
lstrcatW(path, slashW);
lstrcatW(path, name);
......@@ -112,7 +112,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
WIN32_FIND_DATAW finddata;
HANDLE hfind;
int len = 1;
WCHAR *groups_data = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR));
WCHAR *groups_data = heap_alloc(sizeof(WCHAR));
char *groups_dataA;
HDDEDATA ret;
......@@ -127,7 +127,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
lstrcmpW(finddata.cFileName, dotW) && lstrcmpW(finddata.cFileName, dotdotW))
{
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, newlineW);
}
......@@ -136,13 +136,13 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
}
len = WideCharToMultiByte(CP_ACP, 0, groups_data, -1, NULL, 0, NULL, NULL);
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);
ret = DdeCreateDataHandle(dwDDEInst, (BYTE *)groups_dataA, len, 0, hszGroups, uFmt, 0);
HeapFree(GetProcessHeap(), 0, groups_dataA);
HeapFree(GetProcessHeap(), 0, groups_data);
HeapFree(GetProcessHeap(), 0, programs);
heap_free(groups_dataA);
heap_free(groups_data);
heap_free(programs);
return ret;
}
else if (hszTopic == hszProgmanTopic && hszItem == hszProgmanService && uFmt == CF_TEXT)
......@@ -184,7 +184,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
CreateDirectoryW(path, NULL);
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;
}
else if (!strcmpiW(command, delete_groupW))
......@@ -197,7 +197,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
path = get_programs_path(argv[0]);
path2 = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 2) * sizeof(*path));
path2 = heap_alloc((strlenW(path) + 2) * sizeof(*path));
strcpyW(path2, path);
path2[strlenW(path) + 1] = 0;
......@@ -207,8 +207,8 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
ret = SHFileOperationW(&shfos);
HeapFree(GetProcessHeap(), 0, path2);
HeapFree(GetProcessHeap(), 0, path);
heap_free(path2);
heap_free(path);
if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED;
}
......@@ -224,7 +224,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
ShellExecuteW(NULL, NULL, path, NULL, NULL, SW_SHOWNORMAL);
if (last_group) HeapFree(GetProcessHeap(), 0, last_group);
if (last_group) heap_free(last_group);
last_group = path;
}
else if (!strcmpiW(command, add_itemW))
......@@ -247,10 +247,10 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
IShellLinkW_Release(link);
return DDE_FNOTPROCESSED;
}
path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
path = heap_alloc(len * sizeof(WCHAR));
SearchPathW(NULL, argv[0], dotexeW, len, path, NULL);
IShellLinkW_SetPath(link, path);
HeapFree(GetProcessHeap(), 0, path);
heap_free(path);
if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]);
if (argc >= 4) IShellLinkW_SetIconLocation(link, argv[2], atoiW(argv[3]));
......@@ -270,7 +270,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
}
if (argc >= 2)
{
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);
lstrcatW(name, slashW);
lstrcatW(name, argv[1]);
......@@ -280,7 +280,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
{
const WCHAR *filename = PathFindFileNameW(argv[0]);
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);
lstrcatW(name, slashW);
lstrcpynW(name+strlenW(name), filename, len + 1);
......@@ -288,7 +288,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
}
hres = IPersistFile_Save(file, name, TRUE);
HeapFree(GetProcessHeap(), 0, name);
heap_free(name);
IPersistFile_Release(file);
IShellLinkW_Release(link);
......@@ -301,7 +301,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
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);
lstrcatW(name, slashW);
lstrcatW(name, argv[0]);
......@@ -309,7 +309,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
ret = DeleteFileW(name);
HeapFree(GetProcessHeap(), 0, name);
heap_free(name);
if (!ret) return DDE_FNOTPROCESSED;
}
......@@ -341,7 +341,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
while (*command == '[')
{
argc = 0;
argv = HeapAlloc(GetProcessHeap(), 0, sizeof(*argv));
argv = heap_alloc(sizeof(*argv));
command++;
while (*command == ' ') command++;
......@@ -370,7 +370,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
}
argc++;
argv = HeapReAlloc(GetProcessHeap(), 0, argv, argc * sizeof(*argv));
argv = heap_realloc(argv, argc * sizeof(*argv));
argv[argc-1] = strndupW(command, p - command);
command = p;
......@@ -396,9 +396,9 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
ret = DDE_FNOTPROCESSED;
}
HeapFree(GetProcessHeap(), 0, opcode);
for (i = 0; i < argc; i++) HeapFree(GetProcessHeap(), 0, argv[i]);
HeapFree(GetProcessHeap(), 0, argv);
heap_free(opcode);
for (i = 0; i < argc; i++) heap_free(argv[i]);
heap_free(argv);
if (ret == DDE_FNOTPROCESSED) break;
}
......@@ -407,9 +407,9 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
error:
ERR("failed to parse command %s\n", debugstr_w(original));
HeapFree(GetProcessHeap(), 0, opcode);
for (i = 0; i < argc; i++) HeapFree(GetProcessHeap(), 0, argv[i]);
HeapFree(GetProcessHeap(), 0, argv);
heap_free(opcode);
for (i = 0; i < argc; i++) heap_free(argv[i]);
heap_free(argv);
return DDE_FNOTPROCESSED;
}
......@@ -421,14 +421,14 @@ static DWORD Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata)
len = DdeGetData(hdata, NULL, 0, 0);
if (!len) return DDE_FNOTPROCESSED;
command = HeapAlloc(GetProcessHeap(), 0, len);
command = heap_alloc(len);
DdeGetData(hdata, (BYTE *)command, len, 0);
TRACE("conv=%p topic=%s data=%s\n", hconv, debugstr_hsz(hszTopic), debugstr_w(command));
ret = parse_dde_command(hszTopic, command);
HeapFree(GetProcessHeap(), 0, command);
heap_free(command);
return ret;
}
......
......@@ -121,7 +121,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
WCHAR *dest, *result, *result_end=NULL;
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;
dest = result;
......@@ -161,7 +161,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
}
else
{
HeapFree(GetProcessHeap(), 0, result);
heap_free(result);
return NULL;
}
}
......@@ -216,7 +216,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
ZeroMemory (&sei, 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) ;
/* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a
......@@ -233,8 +233,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
if (!ShellExecuteExW( &sei ))
{
HeapFree(GetProcessHeap(), 0, psz);
HeapFree(GetProcessHeap(), 0, parent);
heap_free(psz);
heap_free(parent);
SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
return TRUE ;
}
......@@ -243,8 +243,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ;
FillList (htxt, (LPSTR)psz, FALSE) ;
HeapFree(GetProcessHeap(), 0, psz);
HeapFree(GetProcessHeap(), 0, parent);
heap_free(psz);
heap_free(parent);
EndDialog (hwnd, 0);
}
}
......@@ -326,14 +326,14 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
if (icList > 0)
{
pszList = HeapAlloc( GetProcessHeap(), 0, icList) ;
pszList = heap_alloc(icList) ;
if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, (LPBYTE)pszList, &icList))
MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ;
}
else
{
icList = 1 ;
pszList = HeapAlloc( GetProcessHeap(), 0, icList) ;
pszList = heap_alloc(icList) ;
pszList[0] = 0 ;
}
......@@ -347,9 +347,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, NULL, &icCmd))
MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ;
if( pszCmd )
pszCmd = HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd) ;
pszCmd = heap_realloc(pszCmd, icCmd) ;
else
pszCmd = HeapAlloc(GetProcessHeap(), 0, icCmd) ;
pszCmd = heap_alloc(icCmd) ;
if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd))
MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ;
......@@ -416,9 +416,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
cMatch = ++cMax ;
if( pszList )
pszList = HeapReAlloc(GetProcessHeap(), 0, pszList, ++icList) ;
pszList = heap_realloc(pszList, ++icList) ;
else
pszList = HeapAlloc(GetProcessHeap(), 0, ++icList) ;
pszList = heap_alloc(++icList) ;
memmove (&pszList[1], pszList, icList - 1) ;
pszList[0] = cMatch ;
szIndex[0] = cMatch ;
......@@ -427,9 +427,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
RegSetValueExA (hkey, "MRUList", 0, REG_SZ, (LPBYTE)pszList, strlen (pszList) + 1) ;
HeapFree( GetProcessHeap(), 0, pszCmd) ;
HeapFree( GetProcessHeap(), 0, pszList) ;
}
heap_free(pszCmd) ;
heap_free(pszList) ;
}
/*************************************************************************
* RunFileDlgA [internal]
......
......@@ -112,7 +112,7 @@ static void events_unadvise_all(ExplorerBrowserImpl *This)
TRACE("Removing %p\n", client);
list_remove(&client->entry);
IExplorerBrowserEvents_Release(client->pebe);
HeapFree(GetProcessHeap(), 0, client);
heap_free(client);
}
}
......@@ -184,7 +184,7 @@ static void travellog_remove_entry(ExplorerBrowserImpl *This, travellog_entry *e
list_remove(&entry->entry);
ILFree(entry->pidl);
HeapFree(GetProcessHeap(), 0, entry);
heap_free(entry);
This->travellog_count--;
}
......@@ -216,7 +216,7 @@ static void travellog_add_entry(ExplorerBrowserImpl *This, LPITEMIDLIST pidl)
}
/* Create and add the new entry */
new = HeapAlloc(GetProcessHeap(), 0, sizeof(travellog_entry));
new = heap_alloc(sizeof(*new));
new->pidl = ILClone(pidl);
list_add_tail(&This->travellog, &new->entry);
This->travellog_cursor = new;
......@@ -851,8 +851,7 @@ static ULONG WINAPI IExplorerBrowser_fnRelease(IExplorerBrowser *iface)
IObjectWithSite_SetSite(&This->IObjectWithSite_iface, NULL);
HeapFree(GetProcessHeap(), 0, This);
return 0;
heap_free(This);
}
return ref;
......@@ -1017,7 +1016,7 @@ static HRESULT WINAPI IExplorerBrowser_fnAdvise(IExplorerBrowser *iface,
event_client *client;
TRACE("%p (%p, %p)\n", This, psbe, pdwCookie);
client = HeapAlloc(GetProcessHeap(), 0, sizeof(event_client));
client = heap_alloc(sizeof(*client));
client->pebe = psbe;
client->cookie = ++This->events_next_cookie;
......@@ -1042,7 +1041,7 @@ static HRESULT WINAPI IExplorerBrowser_fnUnadvise(IExplorerBrowser *iface,
{
list_remove(&client->entry);
IExplorerBrowserEvents_Release(client->pebe);
HeapFree(GetProcessHeap(), 0, client);
heap_free(client);
return S_OK;
}
}
......@@ -2079,7 +2078,7 @@ HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, voi
if(pUnkOuter)
return CLASS_E_NOAGGREGATION;
eb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ExplorerBrowserImpl));
eb = heap_alloc_zero(sizeof(*eb));
eb->ref = 1;
eb->IExplorerBrowser_iface.lpVtbl = &vt_IExplorerBrowser;
eb->IShellBrowser_iface.lpVtbl = &vt_IShellBrowser;
......
......@@ -186,7 +186,7 @@ static ULONG WINAPI IEnumIDList_fnRelease(IEnumIDList *iface)
SHFree(cur->pidl);
SHFree(cur);
}
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return refCount;
......@@ -295,7 +295,7 @@ static const IEnumIDListVtbl eidlvt =
IEnumIDListImpl *IEnumIDList_Constructor(void)
{
IEnumIDListImpl *lpeidl = HeapAlloc(GetProcessHeap(), 0, sizeof(*lpeidl));
IEnumIDListImpl *lpeidl = heap_alloc(sizeof(*lpeidl));
if (lpeidl)
{
......
......@@ -125,8 +125,7 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface)
{
TRACE(" destroying IExtractIcon(%p)\n",This);
SHFree(This->pidl);
HeapFree(GetProcessHeap(),0,This);
return 0;
heap_free(This);
}
return refCount;
}
......@@ -419,14 +418,14 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(IExtractIconA * iface, UIN
{
IExtractIconWImpl *This = impl_from_IExtractIconA(iface);
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);
ret = IExtractIconW_GetIconLocation(&This->IExtractIconW_iface, uFlags, lpwstrFile, cchMax,
piIndex, pwFlags);
WideCharToMultiByte(CP_ACP, 0, lpwstrFile, -1, szIconFile, cchMax, NULL, NULL);
HeapFree(GetProcessHeap(), 0, lpwstrFile);
heap_free(lpwstrFile);
TRACE("-- %s %x\n", szIconFile, *piIndex);
return ret;
......@@ -440,14 +439,14 @@ static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszF
IExtractIconWImpl *This = impl_from_IExtractIconA(iface);
HRESULT ret;
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);
MultiByteToWideChar(CP_ACP, 0, pszFile, -1, lpwstrFile, len);
ret = IExtractIconW_Extract(&This->IExtractIconW_iface, lpwstrFile, nIconIndex, phiconLarge,
phiconSmall, nIconSize);
HeapFree(GetProcessHeap(), 0, lpwstrFile);
heap_free(lpwstrFile);
return ret;
}
......@@ -537,7 +536,7 @@ static IExtractIconWImpl *extracticon_create(LPCITEMIDLIST pidl)
TRACE("%p\n", pidl);
ei = HeapAlloc(GetProcessHeap(), 0, sizeof(*ei));
ei = heap_alloc(sizeof(*ei));
ei->ref=1;
ei->IExtractIconW_iface.lpVtbl = &eivt;
ei->IExtractIconA_iface.lpVtbl = &eiavt;
......
......@@ -316,7 +316,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
lpsice = SHAlloc(sizeof(SIC_ENTRY));
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 );
lpsice->dwSourceIndex = dwSourceIndex;
......@@ -327,7 +327,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
index = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice);
if ( INVALID_INDEX == index )
{
HeapFree(GetProcessHeap(), 0, lpsice->sSourceFile);
heap_free(lpsice->sSourceFile);
SHFree(lpsice);
ret = INVALID_INDEX;
}
......@@ -492,7 +492,7 @@ static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context
*/
static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam )
{
HeapFree(GetProcessHeap(), 0, ((LPSIC_ENTRY)ptr)->sSourceFile);
heap_free(((LPSIC_ENTRY)ptr)->sSourceFile);
SHFree(ptr);
return TRUE;
}
......@@ -746,12 +746,12 @@ static INT Shell_GetCachedImageIndexA(LPCSTR szPath, INT nIndex, BOOL bSimulateD
WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_a(szPath), nIndex, bSimulateDoc);
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 );
ret = SIC_GetIconIndex( szTemp, nIndex, 0 );
HeapFree( GetProcessHeap(), 0, szTemp );
heap_free( szTemp );
return ret;
}
......@@ -790,7 +790,7 @@ UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge,
{
UINT ret = 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);
......@@ -798,7 +798,7 @@ UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge,
{
MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len);
ret = ExtractIconExW(lpwstrFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
HeapFree(GetProcessHeap(), 0, lpwstrFile);
heap_free(lpwstrFile);
}
return ret;
}
......@@ -818,7 +818,7 @@ HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lp
* lpIconPath itself is supposed to be large enough, so make sure lpIconPathW
* 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);
......@@ -827,7 +827,7 @@ HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lp
MultiByteToWideChar(CP_ACP, 0, lpIconPath, -1, lpIconPathW, len);
hIcon = ExtractAssociatedIconW(hInst, lpIconPathW, lpiIcon);
WideCharToMultiByte(CP_ACP, 0, lpIconPathW, -1, lpIconPath, MAX_PATH , NULL, NULL);
HeapFree(GetProcessHeap(), 0, lpIconPathW);
heap_free(lpIconPathW);
}
return hIcon;
}
......@@ -896,13 +896,13 @@ HICON WINAPI ExtractAssociatedIconExA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD
{
HICON ret;
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);
MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, lpwstrFile, len );
ret = ExtractAssociatedIconExW(hInst, lpwstrFile, lpiIconIdx, lpiIconId);
HeapFree(GetProcessHeap(), 0, lpwstrFile);
heap_free(lpwstrFile);
return ret;
}
......@@ -943,13 +943,13 @@ HRESULT WINAPI SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags,
{
HRESULT ret;
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);
MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, lpwstrFile, len);
ret = SHDefExtractIconW(lpwstrFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize);
HeapFree(GetProcessHeap(), 0, lpwstrFile);
heap_free(lpwstrFile);
return ret;
}
......
......@@ -1063,13 +1063,13 @@ LPITEMIDLIST SHSimpleIDListFromPathA(LPCSTR lpszPath)
if (lpszPath)
{
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);
}
_ILParsePathW(wPath, NULL, TRUE, &pidl, NULL);
HeapFree(GetProcessHeap(), 0, wPath);
heap_free(wPath);
TRACE("%s %p\n", debugstr_a(lpszPath), pidl);
return pidl;
}
......
......@@ -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)
{
if (file == buf) file = HeapAlloc( GetProcessHeap(), 0, size );
else file = HeapReAlloc( GetProcessHeap(), 0, file, size );
if (file == buf) file = heap_alloc( size );
else file = heap_realloc( file, size );
if (!file) break;
}
if (SUCCEEDED(hr))
......@@ -732,7 +732,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
ret = PrivateExtractIconsW( file, icon_idx, width, height, &psfi->hIcon, 0, 1, 0);
if (ret == 0 || ret == (UINT)-1) hr = E_FAIL;
}
if (file != buf) HeapFree( GetProcessHeap(), 0, file );
if (file != buf) heap_free( file );
}
}
}
......@@ -783,7 +783,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
else
{
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);
pathW = temppath;
}
......@@ -816,7 +816,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
}
}
HeapFree(GetProcessHeap(), 0, temppath);
heap_free(temppath);
return ret;
}
......@@ -855,7 +855,7 @@ HICON WINAPI ExtractIconA(HINSTANCE hInstance, const char *file, UINT nIconIndex
fileW = strdupAtoW(file);
ret = ExtractIconW(hInstance, fileW, nIconIndex);
HeapFree(GetProcessHeap(), 0, fileW);
heap_free(fileW);
return ret;
}
......@@ -1037,7 +1037,7 @@ static void add_authors( HWND list )
if (!strA) return;
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 );
strW[sizeW - 1] = 0;
......@@ -1051,7 +1051,7 @@ static void add_authors( HWND list )
SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
start = end;
}
HeapFree( GetProcessHeap(), 0, strW );
heap_free( strW );
}
/*************************************************************************
......@@ -1148,20 +1148,20 @@ BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIc
if (szApp)
{
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);
}
if (szOtherStuff)
{
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);
}
ret = ShellAboutW(hWnd, appW, otherW, hIcon);
HeapFree(GetProcessHeap(), 0, otherW);
HeapFree(GetProcessHeap(), 0, appW);
heap_free(otherW);
heap_free(appW);
return ret;
}
......
......@@ -35,6 +35,7 @@
#include "undocshell.h"
#include "shlobj.h"
#include "shellapi.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "wine/list.h"
......@@ -232,7 +233,7 @@ static inline WCHAR *strdupW(const WCHAR *src)
{
WCHAR *dest;
if (!src) return NULL;
dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(*dest));
dest = heap_alloc((lstrlenW(src) + 1) * sizeof(*dest));
if (dest)
lstrcpyW(dest, src);
return dest;
......@@ -242,7 +243,7 @@ static inline WCHAR *strndupW(const WCHAR *src, DWORD len)
{
WCHAR *dest;
if (!src) return NULL;
dest = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(*dest));
dest = heap_alloc((len + 1) * sizeof(*dest));
if (dest)
{
memcpy(dest, src, len * sizeof(WCHAR));
......@@ -259,7 +260,7 @@ static inline WCHAR *strdupAtoW(const char *str)
if (!str) return NULL;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
ret = heap_alloc(len * sizeof(WCHAR));
if (ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
......
......@@ -234,7 +234,7 @@ static ULONG WINAPI FolderItemVerbImpl_Release(FolderItemVerb *iface)
{
IContextMenu_Release(This->contextmenu);
SysFreeString(This->name);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
......@@ -346,7 +346,7 @@ static HRESULT FolderItemVerb_Constructor(IContextMenu *contextmenu, BSTR name,
TRACE("%p, %s\n", contextmenu, debugstr_w(name));
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderItemVerbImpl));
This = heap_alloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
......@@ -404,7 +404,7 @@ static ULONG WINAPI FolderItemVerbsImpl_Release(FolderItemVerbs *iface)
{
IContextMenu_Release(This->contextmenu);
DestroyMenu(This->hMenu);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
......@@ -578,7 +578,7 @@ static HRESULT FolderItemVerbs_Constructor(BSTR path, FolderItemVerbs **verbs)
*verbs = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(FolderItemVerbsImpl));
This = heap_alloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
......@@ -613,7 +613,7 @@ static HRESULT FolderItemVerbs_Constructor(BSTR path, FolderItemVerbs **verbs)
return S_OK;
failed:
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return hr;
}
......@@ -661,8 +661,8 @@ static ULONG WINAPI FolderItemImpl_Release(FolderItem2 *iface)
if (!ref)
{
Folder3_Release(&This->folder->Folder3_iface);
HeapFree(GetProcessHeap(), 0, This->path);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This->path);
heap_free(This);
}
return ref;
}
......@@ -964,7 +964,7 @@ static HRESULT FolderItem_Constructor(FolderImpl *folder, const WCHAR *path, Fol
*item = NULL;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
This = heap_alloc_zero(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
......@@ -1031,8 +1031,8 @@ static ULONG WINAPI FolderItemsImpl_Release(FolderItems3 *iface)
Folder3_Release(&This->folder->Folder3_iface);
for (i = 0; i < This->item_count; i++)
SysFreeString(This->item_names[i]);
HeapFree(GetProcessHeap(), 0, This->item_names);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This->item_names);
heap_free(This);
}
return ref;
}
......@@ -1285,7 +1285,7 @@ static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
*ret = NULL;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
This = heap_alloc_zero(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
......@@ -1312,13 +1312,13 @@ static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
LPITEMIDLIST *pidls;
ULONG fetched;
pidls = HeapAlloc(GetProcessHeap(), 0, This->item_count * sizeof(*pidls));
This->item_names = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->item_count * sizeof(*This->item_names));
pidls = heap_alloc(This->item_count * sizeof(*pidls));
This->item_names = heap_alloc_zero(This->item_count * sizeof(*This->item_names));
if (!pidls || !This->item_names)
{
HeapFree(GetProcessHeap(), 0, pidls);
HeapFree(GetProcessHeap(), 0, This->item_names);
heap_free(pidls);
heap_free(This->item_names);
hr = E_OUTOFMEMORY;
goto failed;
}
......@@ -1336,7 +1336,7 @@ static HRESULT FolderItems_Constructor(FolderImpl *folder, FolderItems **ret)
ILFree(pidls[i]);
}
HeapFree(GetProcessHeap(), 0, pidls);
heap_free(pidls);
}
IEnumIDList_Release(enumidlist);
......@@ -1397,7 +1397,7 @@ static ULONG WINAPI FolderImpl_Release(Folder3 *iface)
SysFreeString(This->path);
IShellFolder2_Release(This->folder);
IDispatch_Release(This->application);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
}
......@@ -1667,7 +1667,7 @@ static HRESULT Folder_Constructor(IShellFolder2 *folder, LPITEMIDLIST pidl, Fold
*ret = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
......@@ -1734,7 +1734,7 @@ static ULONG WINAPI ShellDispatch_Release(IShellDispatch6 *iface)
TRACE("(%p), new refcount=%i\n", iface, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ref;
}
......@@ -2244,7 +2244,7 @@ HRESULT WINAPI IShellDispatch_Constructor(IUnknown *outer, REFIID riid, void **p
if (outer) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellDispatch));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IShellDispatch6_iface.lpVtbl = &ShellDispatchVtbl;
This->ref = 1;
......
......@@ -112,7 +112,7 @@ static ULONG WINAPI ShellItem_Release(IShellItem2 *iface)
if (ref == 0)
{
ILFree(This->pidl);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
......@@ -551,7 +551,7 @@ HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **p
if (pUnkOuter) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellItem));
This = heap_alloc(sizeof(*This));
This->IShellItem2_iface.lpVtbl = &ShellItem2_Vtbl;
This->ref = 1;
This->pidl = NULL;
......@@ -918,7 +918,7 @@ static ULONG WINAPI IEnumShellItems_fnRelease(IEnumShellItems *iface)
{
TRACE("Freeing.\n");
IShellItemArray_Release(This->array);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return 0;
}
......@@ -1007,7 +1007,7 @@ static HRESULT IEnumShellItems_Constructor(IShellItemArray *array, IEnumShellIte
IEnumShellItemsImpl *This;
HRESULT ret;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumShellItemsImpl));
This = heap_alloc(sizeof(*This));
if(!This)
return E_OUTOFMEMORY;
......@@ -1088,8 +1088,8 @@ static ULONG WINAPI IShellItemArray_fnRelease(IShellItemArray *iface)
for(i = 0; i < This->item_count; i++)
IShellItem_Release(This->array[i]);
HeapFree(GetProcessHeap(), 0, This->array);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This->array);
heap_free(This);
return 0;
}
......@@ -1236,17 +1236,17 @@ static HRESULT create_shellitemarray(IShellItem **items, DWORD count, IShellItem
TRACE("(%p, %d, %p)\n", items, count, ret);
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IShellItemArrayImpl));
This = heap_alloc(sizeof(*This));
if(!This)
return E_OUTOFMEMORY;
This->IShellItemArray_iface.lpVtbl = &vt_IShellItemArray;
This->ref = 1;
This->array = HeapAlloc(GetProcessHeap(), 0, count*sizeof(IShellItem*));
This->array = heap_alloc(count*sizeof(IShellItem*));
if (!This->array)
{
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return E_OUTOFMEMORY;
}
memcpy(This->array, items, count*sizeof(IShellItem*));
......@@ -1276,7 +1276,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
if(!ppidl)
return E_INVALIDARG;
array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cidl*sizeof(IShellItem*));
array = heap_alloc_zero(cidl*sizeof(IShellItem*));
if(!array)
return E_OUTOFMEMORY;
......@@ -1289,7 +1289,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
if(SUCCEEDED(ret))
{
ret = create_shellitemarray(array, cidl, ppsiItemArray);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
if(SUCCEEDED(ret))
return ret;
}
......@@ -1297,7 +1297,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent,
/* Something failed, clean up. */
for(i = 0; i < cidl; i++)
if(array[i]) IShellItem_Release(array[i]);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
return ret;
}
......@@ -1354,13 +1354,13 @@ HRESULT WINAPI SHCreateShellItemArrayFromDataObject(IDataObject *pdo, REFIID rii
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++)
children[i] = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[i+1]);
ret = SHCreateShellItemArray(parent_pidl, NULL, pida->cidl, children, &psia);
HeapFree(GetProcessHeap(), 0, children);
heap_free(children);
GlobalUnlock(medium.u.hGlobal);
GlobalFree(medium.u.hGlobal);
......@@ -1389,7 +1389,7 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl,
if(cidl == 0)
return E_INVALIDARG;
array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cidl*sizeof(IShellItem*));
array = heap_alloc_zero(cidl*sizeof(IShellItem*));
if(!array)
return E_OUTOFMEMORY;
......@@ -1403,14 +1403,14 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl,
if(SUCCEEDED(ret))
{
ret = create_shellitemarray(array, cidl, psia);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
if(SUCCEEDED(ret))
return ret;
}
for(i = 0; i < cidl; i++)
if(array[i]) IShellItem_Release(array[i]);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
*psia = NULL;
return ret;
}
......@@ -1471,7 +1471,7 @@ static ULONG WINAPI CustomDestinationList_Release(ICustomDestinationList *iface)
TRACE("(%p), new refcount=%i\n", This, ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ref;
}
......@@ -1583,7 +1583,7 @@ HRESULT WINAPI CustomDestinationList_Constructor(IUnknown *outer, REFIID riid, v
if (outer)
return CLASS_E_NOAGGREGATION;
if(!(list = HeapAlloc(GetProcessHeap(), 0, sizeof(*list))))
if(!(list = heap_alloc(sizeof(*list))))
return E_OUTOFMEMORY;
list->ICustomDestinationList_iface.lpVtbl = &CustomDestinationListVtbl;
......
......@@ -391,7 +391,7 @@ static IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pc
{
IDefClFImpl* lpclf;
lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
lpclf = heap_alloc(sizeof(*lpclf));
lpclf->ref = 1;
lpclf->IClassFactory_iface.lpVtbl = &dclfvt;
lpclf->lpfnCI = lpfnCI;
......@@ -451,9 +451,9 @@ static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
if (This->pcRefDll) InterlockedDecrement(This->pcRefDll);
TRACE("-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,This);
return 0;
heap_free(This);
}
return refCount;
}
/******************************************************************************
......@@ -586,7 +586,7 @@ UINT WINAPI DragQueryFileA(
LPWSTR lpszFileW = NULL;
if(lpszFile && lFile != 0xFFFFFFFF) {
lpszFileW = HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR));
lpszFileW = heap_alloc(lLength*sizeof(WCHAR));
if(lpszFileW == NULL) {
goto end;
}
......@@ -595,7 +595,7 @@ UINT WINAPI DragQueryFileA(
if(lpszFileW) {
WideCharToMultiByte(CP_ACP, 0, lpszFileW, -1, lpszFile, lLength, 0, NULL);
HeapFree(GetProcessHeap(), 0, lpszFileW);
heap_free(lpszFileW);
}
goto end;
}
......@@ -641,7 +641,7 @@ UINT WINAPI DragQueryFileW(
LPSTR lpszFileA = NULL;
if(lpszwFile && lFile != 0xFFFFFFFF) {
lpszFileA = HeapAlloc(GetProcessHeap(), 0, lLength);
lpszFileA = heap_alloc(lLength);
if(lpszFileA == NULL) {
goto end;
}
......@@ -650,7 +650,7 @@ UINT WINAPI DragQueryFileW(
if(lpszFileA) {
MultiByteToWideChar(CP_ACP, 0, lpszFileA, -1, lpszwFile, lLength);
HeapFree(GetProcessHeap(), 0, lpszFileA);
heap_free(lpszFileA);
}
goto end;
}
......@@ -882,7 +882,7 @@ static ULONG WINAPI ShellImageData_Release(IShellImageData *iface)
if (!ref)
{
GdipDisposeImage(This->image);
HeapFree(GetProcessHeap(), 0, This->path);
heap_free(This->path);
SHFree(This);
}
......
......@@ -1350,7 +1350,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
}
}
lpGroups = HeapAlloc(GetProcessHeap(), 0, dwSize);
lpGroups = heap_alloc(dwSize);
if (lpGroups == NULL)
{
CloseHandle(hToken);
......@@ -1359,7 +1359,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize))
{
HeapFree(GetProcessHeap(), 0, lpGroups);
heap_free(lpGroups);
CloseHandle(hToken);
return FALSE;
}
......@@ -1369,7 +1369,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0,
&lpSid))
{
HeapFree(GetProcessHeap(), 0, lpGroups);
heap_free(lpGroups);
return FALSE;
}
......@@ -1383,7 +1383,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
}
FreeSid(lpSid);
HeapFree(GetProcessHeap(), 0, lpGroups);
heap_free(lpGroups);
return bResult;
}
......@@ -1553,7 +1553,7 @@ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT 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 includes the terminating 0 */
......@@ -1565,7 +1565,7 @@ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString)
else
len = cchString;
HeapFree(GetProcessHeap(), 0, dst);
heap_free(dst);
}
return MAKELONG(len, res);
}
......@@ -1597,7 +1597,7 @@ DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT 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 includes the terminating 0 */
......@@ -1609,7 +1609,7 @@ DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString)
else
len = cchString;
HeapFree(GetProcessHeap(), 0, dst);
heap_free(dst);
}
return MAKELONG(len, res);
}
......
......@@ -1079,7 +1079,7 @@ static ULONG WINAPI ApplicationDestinations_Release(IApplicationDestinations *if
TRACE("(%p), new refcount=%i\n", This, ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ref;
}
......@@ -3575,13 +3575,13 @@ static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
{
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return NULL;
UserInfo = HeapAlloc(GetProcessHeap(), 0, InfoSize);
UserInfo = heap_alloc(InfoSize);
if (UserInfo == NULL)
return NULL;
if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize,
&InfoSize))
{
HeapFree(GetProcessHeap(), 0, UserInfo);
heap_free(UserInfo);
return NULL;
}
}
......@@ -3590,7 +3590,7 @@ static LPWSTR _GetUserSidStringFromToken(HANDLE Token)
SidStr = NULL;
if (UserInfo != (PTOKEN_USER) InfoBuffer)
HeapFree(GetProcessHeap(), 0, UserInfo);
heap_free(UserInfo);
return SidStr;
}
......@@ -3939,7 +3939,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA(
TRACE("%p,%#x,%p,%#x,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
if(pszPath) {
pszPathW = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
pszPathW = heap_alloc(MAX_PATH * sizeof(WCHAR));
if(!pszPathW) {
hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
......@@ -3953,7 +3953,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA(
*/
if (pszSubPath && pszSubPath[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) {
hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY);
goto cleanup;
......@@ -3967,8 +3967,8 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA(
WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
cleanup:
HeapFree(GetProcessHeap(), 0, pszPathW);
HeapFree(GetProcessHeap(), 0, pszSubPathW);
heap_free(pszPathW);
heap_free(pszSubPathW);
return hr;
}
......@@ -4535,7 +4535,7 @@ static void _SHCreateSymbolicLinks(void)
}
remove(pszMyStuff);
symlink(szMyStuffTarget, pszMyStuff);
HeapFree(GetProcessHeap(), 0, pszMyStuff);
heap_free(pszMyStuff);
}
/* Last but not least, the Desktop folder */
......@@ -4543,7 +4543,7 @@ static void _SHCreateSymbolicLinks(void)
strcpy(szDesktopTarget, pszHome);
else
strcpy(szDesktopTarget, pszPersonal);
HeapFree(GetProcessHeap(), 0, pszPersonal);
heap_free(pszPersonal);
xdg_desktop_dir = xdg_results ? xdg_results[num - 1] : NULL;
if (xdg_desktop_dir ||
......@@ -4559,7 +4559,7 @@ static void _SHCreateSymbolicLinks(void)
symlink(xdg_desktop_dir, pszDesktop);
else
symlink(szDesktopTarget, pszDesktop);
HeapFree(GetProcessHeap(), 0, pszDesktop);
heap_free(pszDesktop);
}
}
......@@ -4567,8 +4567,8 @@ static void _SHCreateSymbolicLinks(void)
if (xdg_results)
{
for (i = 0; i < num; i++)
HeapFree(GetProcessHeap(), 0, xdg_results[i]);
HeapFree(GetProcessHeap(), 0, xdg_results);
heap_free(xdg_results[i]);
heap_free(xdg_results);
}
}
......@@ -5054,7 +5054,7 @@ static HRESULT get_known_folder_registry_path(
lstrcpyW(sGuid, lpStringGuid);
length = lstrlenW(szKnownFolderDescriptions)+51;
*lpPath = HeapAlloc(GetProcessHeap(), 0, length*sizeof(WCHAR));
*lpPath = heap_alloc(length*sizeof(WCHAR));
if(!(*lpPath))
hr = E_OUTOFMEMORY;
......@@ -5138,7 +5138,7 @@ static HRESULT get_known_folder_redirection_place(
hr = E_FAIL;
}
HeapFree(GetProcessHeap(), 0, lpRegistryPath);
heap_free(lpRegistryPath);
return hr;
}
......@@ -5166,7 +5166,7 @@ static HRESULT redirect_known_folder(
if(SUCCEEDED(hr))
hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath);
HeapFree(GetProcessHeap(), 0, lpRegistryPath);
heap_free(lpRegistryPath);
/* get path to redirection storage */
if(SUCCEEDED(hr))
......@@ -5263,8 +5263,8 @@ static ULONG WINAPI knownfolder_Release(
if (!refs)
{
TRACE("destroying %p\n", knownfolder);
HeapFree( GetProcessHeap(), 0, knownfolder->registryPath);
HeapFree( GetProcessHeap(), 0, knownfolder );
heap_free( knownfolder->registryPath );
heap_free( knownfolder );
}
return refs;
}
......@@ -5322,7 +5322,7 @@ static HRESULT knownfolder_set_id(
else
{
/* 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;
hr = S_OK;
}
......@@ -5402,15 +5402,15 @@ static HRESULT get_known_folder_path(
hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath);
if(FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, parentRegistryPath);
heap_free(parentRegistryPath);
return hr;
}
lstrcatW(path, parentPath);
lstrcatW(path, sBackslash);
HeapFree(GetProcessHeap(), 0, parentRegistryPath);
HeapFree(GetProcessHeap(), 0, parentPath);
heap_free(parentRegistryPath);
heap_free(parentPath);
}
/* check, if folder was redirected */
......@@ -5625,7 +5625,7 @@ static HRESULT knownfolder_create( struct knownfolder **knownfolder )
{
struct knownfolder *kf;
kf = HeapAlloc( GetProcessHeap(), 0, sizeof(*kf) );
kf = heap_alloc( sizeof(*kf) );
if (!kf) return E_OUTOFMEMORY;
kf->IKnownFolder_iface.lpVtbl = &knownfolder_vtbl;
......@@ -5667,8 +5667,8 @@ static ULONG WINAPI foldermanager_Release(
if (!refs)
{
TRACE("destroying %p\n", foldermanager);
HeapFree( GetProcessHeap(), 0, foldermanager->ids );
HeapFree( GetProcessHeap(), 0, foldermanager );
heap_free( foldermanager->ids );
heap_free( foldermanager );
}
return refs;
}
......@@ -5760,7 +5760,7 @@ static BOOL is_knownfolder( struct foldermanager *fm, const KNOWNFOLDERID *id )
if(SUCCEEDED(hr))
{
hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryPath, 0, 0, &hKey));
HeapFree(GetProcessHeap(), 0, registryPath);
heap_free(registryPath);
}
if(SUCCEEDED(hr))
......@@ -5820,7 +5820,7 @@ static HRESULT WINAPI foldermanager_GetFolderByName(
if (FAILED( hr )) return hr;
hr = get_known_folder_wstr( path, szName, &name );
HeapFree( GetProcessHeap(), 0, path );
heap_free( path );
if (FAILED( hr )) return hr;
found = !strcmpiW( pszCanonicalName, name );
......@@ -5894,7 +5894,7 @@ static HRESULT register_folder(const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFI
SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath);
}
HeapFree(GetProcessHeap(), 0, registryPath);
heap_free(registryPath);
return hr;
}
......@@ -5920,7 +5920,7 @@ static HRESULT WINAPI foldermanager_UnregisterFolder(
if(SUCCEEDED(hr))
hr = HRESULT_FROM_WIN32(SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath));
HeapFree(GetProcessHeap(), 0, registryPath);
heap_free(registryPath);
return hr;
}
......@@ -5978,7 +5978,7 @@ static HRESULT foldermanager_create( void **ppv )
UINT i, j;
struct foldermanager *fm;
fm = HeapAlloc( GetProcessHeap(), 0, sizeof(*fm) );
fm = heap_alloc( sizeof(*fm) );
if (!fm) return E_OUTOFMEMORY;
fm->IKnownFolderManager_iface.lpVtbl = &foldermanager_vtbl;
......@@ -5989,10 +5989,10 @@ static HRESULT foldermanager_create( void **ppv )
{
if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++;
}
fm->ids = HeapAlloc( GetProcessHeap(), 0, fm->num_ids * sizeof(KNOWNFOLDERID) );
fm->ids = heap_alloc( fm->num_ids * sizeof(KNOWNFOLDERID) );
if (!fm->ids)
{
HeapFree( GetProcessHeap(), 0, fm );
heap_free( fm );
return E_OUTOFMEMORY;
}
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
int i;
iPathLen = lstrlenW(wszBasePath);
wszPathsList = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR)*cidl+1);
wszPathsList = heap_alloc(MAX_PATH*sizeof(WCHAR)*cidl+1);
wszListPos = wszPathsList;
for (i = 0; i < cidl; i++) {
......@@ -1283,7 +1283,7 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
wszCurrentPath += lstrlenW(wszCurrentPath)+1;
}
HeapFree(GetProcessHeap(), 0, wszPathsList);
heap_free(wszPathsList);
return ret;
}
......@@ -1333,8 +1333,7 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
WARN("Copy failed\n");
ret = E_FAIL;
}
HeapFree(GetProcessHeap(), 0, wszSrcPathsList);
heap_free(wszSrcPathsList);
}
SHFree(pidl);
IPersistFolder2_Release(ppf2);
......
......@@ -95,7 +95,7 @@ HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid,
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
sf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl));
sf = heap_alloc_zero (sizeof (*sf));
if (!sf)
return E_OUTOFMEMORY;
......@@ -171,7 +171,7 @@ static ULONG WINAPI ISF_NetworkPlaces_fnRelease (IShellFolder2 * iface)
if (!refCount) {
TRACE ("-- destroying IShellFolder(%p)\n", This);
SHFree (This->pidlRoot);
HeapFree (GetProcessHeap(), 0, This);
heap_free (This);
}
return refCount;
}
......
......@@ -405,7 +405,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
if (!pszUnixPath) return FALSE;
cDriveSymlinkLen = strlen(pszUnixPath);
pElement = realpath(pszUnixPath, szPath);
HeapFree(GetProcessHeap(), 0, pszUnixPath);
heap_free(pszUnixPath);
if (!pElement) return FALSE;
if (szPath[strlen(szPath)-1] != '/') strcat(szPath, "/");
......@@ -432,7 +432,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
if(dospath_end < dospath)
return FALSE;
strcat(szPath, pszUnixPath + cDriveSymlinkLen);
HeapFree(GetProcessHeap(), 0, pszUnixPath);
heap_free(pszUnixPath);
if(has_failed && WideCharToMultiByte(CP_UNIXCP, 0, dospath_end + 1, -1,
mb_path, FILENAME_MAX, NULL, NULL) > 0){
......@@ -800,7 +800,7 @@ static HRESULT UNIXFS_initialize_target_folder(UnixFolder *This, const char *szB
((dos_name = wine_get_dos_file_name(This->m_pszPath))))
{
This->m_dwAttributes |= SFGAO_FILESYSTEM;
HeapFree( GetProcessHeap(), 0, dos_name );
heap_free( dos_name );
}
return S_OK;
......@@ -831,8 +831,8 @@ static HRESULT UNIXFS_copy(LPCWSTR pwszDosSrc, LPCWSTR pwszDosDst)
iSrcLen = lstrlenW(pwszDosSrc);
iDstLen = lstrlenW(pwszDosDst);
pwszSrc = HeapAlloc(GetProcessHeap(), 0, (iSrcLen + 2) * sizeof(WCHAR));
pwszDst = HeapAlloc(GetProcessHeap(), 0, (iDstLen + 2) * sizeof(WCHAR));
pwszSrc = heap_alloc((iSrcLen + 2) * sizeof(WCHAR));
pwszDst = heap_alloc((iDstLen + 2) * sizeof(WCHAR));
if (pwszSrc && pwszDst) {
lstrcpyW(pwszSrc, pwszDosSrc);
......@@ -856,8 +856,8 @@ static HRESULT UNIXFS_copy(LPCWSTR pwszDosSrc, LPCWSTR pwszDosDst)
res = S_OK;
}
HeapFree(GetProcessHeap(), 0, pwszSrc);
HeapFree(GetProcessHeap(), 0, pwszDst);
heap_free(pwszSrc);
heap_free(pwszDst);
return res;
}
......@@ -1151,7 +1151,7 @@ static HRESULT WINAPI ShellFolder2_GetAttributesOf(IShellFolder2* iface, UINT ci
if (!(dos_name = wine_get_dos_file_name( szAbsolutePath )))
*attrs &= ~SFGAO_FILESYSTEM;
else
HeapFree( GetProcessHeap(), 0, dos_name );
heap_free( dos_name );
}
if (_ILIsFolder(apidl[i]))
*attrs |= SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR |
......@@ -1254,7 +1254,7 @@ static HRESULT WINAPI ShellFolder2_GetDisplayNameOf(IShellFolder2* iface,
if (!lpName->u.pOleStr) return HRESULT_FROM_WIN32(GetLastError());
lstrcpyW(lpName->u.pOleStr, pwszDosFileName);
PathRemoveBackslashW(lpName->u.pOleStr);
HeapFree(GetProcessHeap(), 0, pwszDosFileName);
heap_free(pwszDosFileName);
}
} else if (_ILIsValue(pidl)) {
STRRET str;
......@@ -1953,7 +1953,7 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, const LP
lstrcpyA(szAbsolute, This->m_pszPath);
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)
return E_OUTOFMEMORY;
for (i=0; i<cidl; i++) {
......@@ -1963,19 +1963,19 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, const LP
continue;
if (!UNIXFS_filename_from_shitemid(apidl[i], pszRelative))
{
HeapFree(GetProcessHeap(), 0, wszPathsList);
heap_free(wszPathsList);
return E_INVALIDARG;
}
wszDosPath = wine_get_dos_file_name(szAbsolute);
if (wszDosPath == NULL || lstrlenW(wszDosPath) >= MAX_PATH)
{
HeapFree(GetProcessHeap(), 0, wszPathsList);
HeapFree(GetProcessHeap(), 0, wszDosPath);
heap_free(wszPathsList);
heap_free(wszDosPath);
return S_FALSE;
}
lstrcpyW(wszListPos, wszDosPath);
wszListPos += lstrlenW(wszListPos)+1;
HeapFree(GetProcessHeap(), 0, wszDosPath);
heap_free(wszDosPath);
}
*wszListPos = 0;
......@@ -1992,7 +1992,7 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, const LP
else
ret = S_OK;
HeapFree(GetProcessHeap(), 0, wszPathsList);
heap_free(wszPathsList);
return ret;
}
......@@ -2108,8 +2108,8 @@ static HRESULT WINAPI SFHelper_CopyItems(ISFHelper* iface, IShellFolder *psfFrom
else
res = E_OUTOFMEMORY;
HeapFree(GetProcessHeap(), 0, pwszDosSrc);
HeapFree(GetProcessHeap(), 0, pwszDosDst);
heap_free(pwszDosSrc);
heap_free(pwszDosDst);
if (res != S_OK)
return res;
......
......@@ -322,7 +322,7 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar
if (len < minChars)
len = minChars;
*wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
*wPath = heap_alloc(len * sizeof(WCHAR));
if (*wPath)
{
MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len);
......@@ -331,11 +331,6 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar
return E_OUTOFMEMORY;
}
static void SHELL32_FreeUnicodeBuf(LPWSTR wPath)
{
HeapFree(GetProcessHeap(), 0, wPath);
}
HRESULT WINAPI SHIsFileAvailableOffline(LPCWSTR path, LPDWORD status)
{
FIXME("(%s, %p) stub\n", debugstr_w(path), status);
......@@ -406,7 +401,7 @@ static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec)
if (!retCode)
{
retCode = SHNotifyCreateDirectoryW(wPath, sec);
SHELL32_FreeUnicodeBuf(wPath);
heap_free(wPath);
}
return retCode;
}
......@@ -460,7 +455,7 @@ static DWORD SHNotifyRemoveDirectoryA(LPCSTR path)
if (!retCode)
{
retCode = SHNotifyRemoveDirectoryW(wPath);
SHELL32_FreeUnicodeBuf(wPath);
heap_free(wPath);
}
return retCode;
}
......@@ -524,7 +519,7 @@ static DWORD SHNotifyDeleteFileA(LPCSTR path)
if (!retCode)
{
retCode = SHNotifyDeleteFileW(wPath);
SHELL32_FreeUnicodeBuf(wPath);
heap_free(wPath);
}
return retCode;
}
......@@ -720,7 +715,7 @@ int WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES se
if (!retCode)
{
retCode = SHCreateDirectoryExW(hWnd, wPath, sec);
SHELL32_FreeUnicodeBuf(wPath);
heap_free(wPath);
}
return retCode;
}
......@@ -886,12 +881,12 @@ int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp)
if (ForFree)
{
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;
}
else
{
wString = ForFree = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
wString = ForFree = heap_alloc(size * sizeof(WCHAR));
if (ForFree) continue;
retCode = ERROR_OUTOFMEMORY;
nFileOp.fAnyOperationsAborted = TRUE;
......@@ -943,18 +938,18 @@ static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile)
DWORD dwLen = lstrlenW(szFile) + 1;
LPCWSTR ptr;
feFile->szFullPath = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
feFile->szFullPath = heap_alloc(dwLen * sizeof(WCHAR));
lstrcpyW(feFile->szFullPath, szFile);
ptr = StrRChrW(szFile, NULL, '\\');
if (ptr)
{
dwLen = ptr - szFile + 1;
feFile->szDirectory = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
feFile->szDirectory = heap_alloc(dwLen * sizeof(WCHAR));
lstrcpynW(feFile->szDirectory, szFile, dwLen);
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 */
}
feFile->bFromWildcard = FALSE;
......@@ -970,7 +965,7 @@ static LPWSTR wildcard_to_file(LPCWSTR szWildCard, LPCWSTR szFileName)
dwDirLen = ptr - szWildCard + 1;
dwFullLen = dwDirLen + lstrlenW(szFileName) + 1;
szFullPath = HeapAlloc(GetProcessHeap(), 0, dwFullLen * sizeof(WCHAR));
szFullPath = heap_alloc(dwFullLen * sizeof(WCHAR));
lstrcpynW(szFullPath, szWildCard, dwDirLen + 1);
lstrcatW(szFullPath, szFileName);
......@@ -998,7 +993,7 @@ static void parse_wildcard_files(FILE_LIST *flList, LPCWSTR szFile, LPDWORD pdwL
file->bFromWildcard = TRUE;
file->attributes = wfd.dwFileAttributes;
if (IsAttribDir(file->attributes)) flList->bAnyDirectories = TRUE;
HeapFree(GetProcessHeap(), 0, szFullPath);
heap_free(szFullPath);
}
FindClose(hFile);
......@@ -1024,8 +1019,7 @@ static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles)
if (!szFiles[0])
return ERROR_ACCESS_DENIED;
flList->feFiles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
flList->num_alloc * sizeof(FILE_ENTRY));
flList->feFiles = heap_alloc_zero(flList->num_alloc * sizeof(FILE_ENTRY));
while (*ptr)
{
......@@ -1080,12 +1074,12 @@ static void destroy_file_list(FILE_LIST *flList)
for (i = 0; i < flList->dwNumFiles; i++)
{
HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szDirectory);
HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFilename);
HeapFree(GetProcessHeap(), 0, flList->feFiles[i].szFullPath);
heap_free(flList->feFiles[i].szDirectory);
heap_free(flList->feFiles[i].szFilename);
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)
......@@ -1216,9 +1210,9 @@ static int copy_files(FILE_OPERATION *op, const FILE_LIST *flFrom, FILE_LIST *fl
/* Free all but the first entry. */
for (i = 1; i < flTo->dwNumFiles; i++)
{
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szDirectory);
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFilename);
HeapFree(GetProcessHeap(), 0, flTo->feFiles[i].szFullPath);
heap_free(flTo->feFiles[i].szDirectory);
heap_free(flTo->feFiles[i].szFilename);
heap_free(flTo->feFiles[i].szFullPath);
}
flTo->dwNumFiles = 1;
......@@ -1758,7 +1752,7 @@ HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path
len = 1;
else
len = last_slash - path + 1;
temppath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
temppath = heap_alloc(len * sizeof(WCHAR));
if (!temppath)
return E_OUTOFMEMORY;
StrCpyNW(temppath, path, len);
......@@ -1781,7 +1775,7 @@ HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path
/* check if we can access the directory */
res = GetFileAttributesW(realpath);
HeapFree(GetProcessHeap(), 0, temppath);
heap_free(temppath);
if (res == INVALID_FILE_ATTRIBUTES)
{
......
......@@ -92,7 +92,7 @@ static ULONG WINAPI FileSystemBindData_Release(IFileSystemBindData *iface)
TRACE("(%p)->(%u)\n", This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ref;
}
......@@ -143,7 +143,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data
*ppV = NULL;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IFileSystemBindData_iface.lpVtbl = &FileSystemBindDataVtbl;
......@@ -167,6 +167,6 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data
IFileSystemBindData_Release(&This->IFileSystemBindData_iface);
}
else
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
return ret;
}
......@@ -197,7 +197,7 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
MENUINFO MenuInfo;
HMENU hMenuPopup = CreatePopupMenu();
lpFmMi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
lpFmMi = heap_alloc_zero(sizeof(*lpFmMi));
lpFmMi->pidl = ILCombine(pidl, pidlTemp);
lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
......@@ -268,7 +268,7 @@ HMENU WINAPI FileMenu_Create (
TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x hMenu=%p\n",
crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
menudata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
menudata = heap_alloc_zero(sizeof(*menudata));
menudata->crBorderColor = crBorderColor;
menudata->nBorderWidth = nBorderWidth;
menudata->hBorderBmp = hBorderBmp;
......@@ -298,7 +298,7 @@ void WINAPI FileMenu_Destroy (HMENU hmenu)
menudata = FM_GetMenuInfo(hmenu);
SHFree( menudata->pidl);
HeapFree(GetProcessHeap(), 0, menudata);
heap_free(menudata);
DestroyMenu (hmenu);
}
......@@ -401,11 +401,11 @@ BOOL WINAPI FileMenu_AppendItemAW(
else
{
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;
MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
HeapFree( GetProcessHeap(), 0, lpszText );
heap_free( lpszText );
}
return ret;
......@@ -1020,24 +1020,27 @@ static CompositeCMenu* impl_from_IContextMenu3(IContextMenu3* iface)
static HRESULT CompositeCMenu_Constructor(IContextMenu **menus,UINT menu_count, REFIID riid, void **ppv)
{
CompositeCMenu *ret = HeapAlloc(GetProcessHeap(),0,sizeof(CompositeCMenu));
CompositeCMenu *ret;
UINT i;
TRACE("(%p,%u,%s,%p)\n",menus,menu_count,shdebugstr_guid(riid),ppv);
ret = heap_alloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->IContextMenu3_iface.lpVtbl = &CompositeCMenuVtbl;
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)
{
HeapFree(GetProcessHeap(),0,ret);
heap_free(ret);
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)
{
HeapFree(GetProcessHeap(),0,ret->menus);
HeapFree(GetProcessHeap(),0,ret);
heap_free(ret->menus);
heap_free(ret);
return E_OUTOFMEMORY;
}
ret->refCount=0;
......@@ -1052,9 +1055,9 @@ static void CompositeCMenu_Destroy(CompositeCMenu *This)
UINT i;
for(i=0;i<This->menu_count;i++)
IContextMenu_Release(This->menus[i]);
HeapFree(GetProcessHeap(),0,This->menus);
HeapFree(GetProcessHeap(),0,This->offsets);
HeapFree(GetProcessHeap(),0,This);
heap_free(This->menus);
heap_free(This->offsets);
heap_free(This);
}
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
}
/* allocate memory for the pidl array */
pItems = HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST) * count);
pItems = heap_alloc(sizeof(LPITEMIDLIST) * count);
/* retrieve all selected items */
i = 0;
......@@ -1581,7 +1581,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
ISFHelper_Release(psfhlp);
/* free pidl array memory */
HeapFree(GetProcessHeap(), 0, pItems);
heap_free(pItems);
}
break;
......@@ -1803,7 +1803,7 @@ static ULONG WINAPI IShellView_fnRelease(IShellView3 *iface)
if(This->pAdvSink)
IAdviseSink_Release(This->pAdvSink);
HeapFree(GetProcessHeap(),0,This);
heap_free(This);
}
return refCount;
}
......@@ -3728,7 +3728,7 @@ IShellView *IShellView_Constructor(IShellFolder *folder)
{
IShellViewImpl *sv;
sv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
sv = heap_alloc_zero(sizeof(*sv));
if (!sv)
return NULL;
......
......@@ -133,7 +133,7 @@ static ULONG WINAPI ContextMenu_Release(IContextMenu3 *iface)
SHFree(This->pidl);
_ILFreeaPidl(This->apidl, This->cidl);
HeapFree(GetProcessHeap(), 0, This);
heap_free(This);
}
return ref;
......@@ -684,7 +684,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC
HRESULT hr;
UINT i;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl;
......@@ -994,7 +994,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri
ContextMenu *This;
HRESULT hr;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
This = heap_alloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl;
......
......@@ -32,6 +32,7 @@
#include "shellapi.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(systray);
......@@ -180,7 +181,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
if (iconinfo.hbmColor)
cbColourBits = (bmColour.bmPlanes * bmColour.bmWidth * bmColour.bmHeight * bmColour.bmBitsPixel + 15) / 16 * 2;
cds.cbData = sizeof(*data) + cbMaskBits + cbColourBits;
buffer = HeapAlloc(GetProcessHeap(), 0, cds.cbData);
buffer = heap_alloc(cds.cbData);
if (!buffer)
{
DeleteObject(iconinfo.hbmMask);
......@@ -240,7 +241,7 @@ noicon:
cds.lpData = data;
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;
}
......
......@@ -123,7 +123,7 @@ BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
return FALSE;
status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL);
HeapFree(GetProcessHeap(), 0, unix_path);
heap_free(unix_path);
if (status == noErr)
status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalogInfo, NULL,
NULL, NULL);
......@@ -145,7 +145,7 @@ BOOL TRASH_TrashFile(LPCWSTR wszPath)
status = FSPathMoveObjectToTrashSync(unix_path, NULL, kFSFileOperationSkipPreflight);
HeapFree(GetProcessHeap(), 0, unix_path);
heap_free(unix_path);
return (status == noErr);
}
......@@ -171,7 +171,7 @@ HRESULT TRASH_GetDetails(const char *trash_path, const char *name, WIN32_FIND_DA
memcpy(path+trash_path_length+1, name, name_length+1);
ret = lstat(path, &stats);
HeapFree(GetProcessHeap(), 0, path);
heap_free(path);
if(ret == -1) return S_FALSE;
memset(data, 0, sizeof(*data));
data->nFileSizeHigh = stats.st_size>>32;
......@@ -212,7 +212,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
return E_OUTOFMEMORY;
status = FSPathMakeRef((UInt8*)unix_path, &ref, NULL);
HeapFree(GetProcessHeap(), 0, unix_path);
heap_free(unix_path);
if(status != noErr) return E_FAIL;
status = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catalog_info, NULL, NULL, NULL);
if(status != noErr) return E_FAIL;
......@@ -222,7 +222,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
if(status != noErr) return E_FAIL;
if(!(dir = opendir(trash_path))) return E_FAIL;
ret = HeapAlloc(GetProcessHeap(), 0, ret_size * sizeof(*ret));
ret = heap_alloc(ret_size * sizeof(*ret));
if(!ret) {
closedir(dir);
return E_OUTOFMEMORY;
......@@ -237,7 +237,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
if(i == ret_size) {
LPITEMIDLIST *resized;
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;
else ret = resized;
}
......@@ -250,7 +250,7 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
hr = TRASH_CreateSimplePIDL(entry->d_name, &data, ret+i);
if(FAILED(hr)) {
while(i>0) SHFree(ret+(--i));
HeapFree(GetProcessHeap(), 0, ret);
heap_free(ret);
closedir(dir);
return hr;
}
......@@ -261,12 +261,12 @@ HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count)
*pidls = SHAlloc(sizeof(**pidls) * i);
if(!*pidls) {
while(i>0) SHFree(ret+(--i));
HeapFree(GetProcessHeap(), 0, ret);
heap_free(ret);
return E_OUTOFMEMORY;
}
*count = i;
for(i--; i>=0; i--) (*pidls)[i] = ret[i];
HeapFree(GetProcessHeap(), 0, ret);
heap_free(ret);
return S_OK;
}
......@@ -384,17 +384,16 @@ BOOL TRASH_CanTrashFile(LPCWSTR wszPath)
{
struct stat file_stat;
char *unix_path;
int ret;
TRACE("(%s)\n", debugstr_w(wszPath));
if (!TRASH_EnsureInitialized()) return FALSE;
if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE;
if (lstat(unix_path, &file_stat)==-1)
{
HeapFree(GetProcessHeap(), 0, unix_path);
ret = lstat(unix_path, &file_stat);
heap_free(unix_path);
if (ret == -1)
return FALSE;
}
HeapFree(GetProcessHeap(), 0, unix_path);
return file_good_for_bucket(home_trash, &file_stat);
}
......@@ -542,7 +541,7 @@ BOOL TRASH_TrashFile(LPCWSTR wszPath)
if (!(unix_path = wine_get_unix_file_name(wszPath)))
return FALSE;
result = TRASH_MoveFileToBucket(home_trash, unix_path);
HeapFree(GetProcessHeap(), 0, unix_path);
heap_free(unix_path);
return result;
}
......@@ -760,7 +759,7 @@ HRESULT TRASH_RestoreItem(LPCITEMIDLIST pidl){
else
WARN("could not erase %s from the trash (errno=%i)\n",filename,errno);
SHFree(file_path);
HeapFree(GetProcessHeap(), 0, restore_path);
heap_free(restore_path);
return S_OK;
}
......
......@@ -756,7 +756,7 @@ static HRESULT get_xdg_config_file(char * home_dir, char ** config_file)
config_home = getenv("XDG_CONFIG_HOME");
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)
return E_OUTOFMEMORY;
......@@ -765,7 +765,7 @@ static HRESULT get_xdg_config_file(char * home_dir, char ** config_file)
}
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)
return E_OUTOFMEMORY;
......@@ -849,7 +849,7 @@ static HRESULT parse_config2(char * p, const char * home_dir, char ** out_ptr)
if (relative)
{
out = HeapAlloc(GetProcessHeap(), 0, strlen(home_dir) + strlen(p) + 2);
out = heap_alloc(strlen(home_dir) + strlen(p) + 2);
if (!out)
return E_OUTOFMEMORY;
......@@ -858,7 +858,7 @@ static HRESULT parse_config2(char * p, const char * home_dir, char ** out_ptr)
}
else
{
out = HeapAlloc(GetProcessHeap(), 0, strlen(p) + 1);
out = heap_alloc(strlen(p) + 1);
if (!out)
return E_OUTOFMEMORY;
*out = 0;
......@@ -897,7 +897,7 @@ HRESULT XDG_UserDirLookup(const char * const *xdg_dirs, const unsigned int num_d
unsigned int i;
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;
if (!out)
return E_OUTOFMEMORY;
......@@ -914,7 +914,7 @@ HRESULT XDG_UserDirLookup(const char * const *xdg_dirs, const unsigned int num_d
goto xdg_user_dir_lookup_error;
file = fopen(config_file, "r");
HeapFree(GetProcessHeap(), 0, config_file);
heap_free(config_file);
if (!file)
{
hr = E_HANDLE;
......@@ -963,15 +963,16 @@ HRESULT XDG_UserDirLookup(const char * const *xdg_dirs, const unsigned int num_d
continue;
if (!stat(out[i], &statFolder) && S_ISDIR(statFolder.st_mode))
continue;
HeapFree(GetProcessHeap(), 0, out[i]);
heap_free(out[i]);
out[i] = NULL;
}
xdg_user_dir_lookup_error:
if (FAILED(hr))
{
for (i = 0; i < num_dirs; i++) HeapFree(GetProcessHeap(), 0, out[i]);
HeapFree(GetProcessHeap(), 0, *out_ptr);
for (i = 0; i < num_dirs; i++)
heap_free(out[i]);
heap_free(*out_ptr);
}
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