shell32: Use global memory allocation helpers.

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

View File

@ -253,7 +253,7 @@ static HRESULT WINAPI IQueryAssociations_fnInit(
0,
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);

View File

@ -130,12 +130,11 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
/* If quickComplete is set and control is pressed, replace the string */
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;

View File

@ -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;
}

View File

@ -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);
}
/*************************************************************************

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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]

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -723,8 +723,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
while ((hr = SIC_get_location( psfi->iIcon, file, &size, &icon_idx )) == E_NOT_SUFFICIENT_BUFFER)
{
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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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++)

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

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

View File

@ -322,7 +322,7 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar
if (len < minChars)
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)
{

View File

@ -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;
}

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}