From: Alex Henrie alexhenrie24@gmail.com
--- dlls/shell32/assoc.c | 36 ++++++------ dlls/shell32/autocomplete.c | 48 ++++++++-------- dlls/shell32/brsfolder.c | 12 ++-- dlls/shell32/control.c | 27 +++++---- dlls/shell32/dataobject.c | 8 +-- dlls/shell32/dialogs.c | 32 +++++------ dlls/shell32/ebrowser.c | 14 ++--- dlls/shell32/enumidlist.c | 4 +- dlls/shell32/folders.c | 12 ++-- dlls/shell32/iconcache.c | 27 +++++---- dlls/shell32/pidl.c | 4 +- dlls/shell32/recyclebin.c | 46 ++++++++-------- dlls/shell32/shell32_main.c | 26 ++++----- dlls/shell32/shellitem.c | 34 ++++++------ dlls/shell32/shelllink.c | 2 +- dlls/shell32/shellord.c | 16 +++--- dlls/shell32/shellpath.c | 74 ++++++++++++------------- dlls/shell32/shfldr_fs.c | 8 +-- dlls/shell32/shfldr_netplaces.c | 4 +- dlls/shell32/shlexec.c | 98 ++++++++++++++++----------------- dlls/shell32/shlfileop.c | 53 +++++++++--------- dlls/shell32/shlfsbind.c | 6 +- dlls/shell32/shlmenu.c | 28 +++++----- dlls/shell32/shlview.c | 8 +-- dlls/shell32/shlview_cmenu.c | 17 +++--- dlls/shell32/systray.c | 5 +- 26 files changed, 319 insertions(+), 330 deletions(-)
diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c index 339be6ac445..37cdc01101a 100644 --- a/dlls/shell32/assoc.c +++ b/dlls/shell32/assoc.c @@ -247,7 +247,7 @@ static HRESULT WINAPI IQueryAssociations_fnInit( 0, KEY_READ, &This->hkeyProgID); - heap_free(progId); + free(progId);
return S_OK; } @@ -272,13 +272,13 @@ static HRESULT ASSOC_GetValue(HKEY hkey, const WCHAR *name, void **data, DWORD * return HRESULT_FROM_WIN32(ret); if (!size) return E_FAIL; - *data = heap_alloc(size); + *data = malloc(size); if (!*data) return E_OUTOFMEMORY; ret = RegQueryValueExW(hkey, name, 0, NULL, (LPBYTE)*data, &size); if (ret != ERROR_SUCCESS) { - heap_free(*data); + free(*data); return HRESULT_FROM_WIN32(ret); } if(data_size) @@ -304,7 +304,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra HKEY hkeyFile;
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, filetype, 0, KEY_READ, &hkeyFile); - heap_free(filetype); + free(filetype);
if (ret == ERROR_SUCCESS) { @@ -336,7 +336,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra }
max_subkey_len++; - extra_from_reg = heap_alloc(max_subkey_len * sizeof(WCHAR)); + extra_from_reg = malloc(max_subkey_len * sizeof(WCHAR)); if (!extra_from_reg) { RegCloseKey(hkeyShell); @@ -346,7 +346,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) { - heap_free(extra_from_reg); + free(extra_from_reg); RegCloseKey(hkeyShell); return HRESULT_FROM_WIN32(ret); } @@ -356,7 +356,7 @@ static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This, const WCHAR *extra
/* open verb subkey */ ret = RegOpenKeyExW(hkeyShell, extra, 0, KEY_READ, &hkeyVerb); - heap_free(extra_from_reg); + free(extra_from_reg); RegCloseKey(hkeyShell); if (ret) return HRESULT_FROM_WIN32(ret);
@@ -407,7 +407,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This, *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL); }
- heap_free(pszCommand); + free(pszCommand); if (!*len) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); return S_OK; @@ -522,7 +522,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( if (SUCCEEDED(hr)) { hr = ASSOC_ReturnString(flags, pszOut, pcchOut, command, lstrlenW(command) + 1); - heap_free(command); + free(command); } return hr; } @@ -546,7 +546,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); } hr = ASSOC_ReturnString(flags, pszOut, pcchOut, docName, lstrlenW(docName) + 1); - heap_free(docName); + free(docName); return hr; }
@@ -565,7 +565,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( retval = GetFileVersionInfoSizeW(path, &size); if (!retval) goto get_friendly_name_fail; - verinfoW = heap_alloc_zero(retval); + verinfoW = calloc(1, retval); if (!verinfoW) return E_OUTOFMEMORY; if (!GetFileVersionInfoW(path, 0, retval, verinfoW)) @@ -584,7 +584,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( len = lstrlenW(bufW) + 1; TRACE("found FileDescription: %s\n", debugstr_w(bufW)); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len); - heap_free(verinfoW); + free(verinfoW); return hr; } } @@ -594,7 +594,7 @@ get_friendly_name_fail: PathStripPathW(path); TRACE("using filename: %s\n", debugstr_w(path)); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, path, lstrlenW(path) + 1); - heap_free(verinfoW); + free(verinfoW); return hr; }
@@ -608,7 +608,7 @@ get_friendly_name_fail: ret = RegGetValueW(This->hkeySource, NULL, L"Content Type", RRF_RT_REG_SZ, NULL, NULL, &size); if (ret != ERROR_SUCCESS) return HRESULT_FROM_WIN32(ret); - contentType = heap_alloc(size); + contentType = malloc(size); if (contentType != NULL) { ret = RegGetValueW(This->hkeySource, NULL, L"Content Type", RRF_RT_REG_SZ, NULL, contentType, &size); @@ -616,7 +616,7 @@ get_friendly_name_fail: hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, lstrlenW(contentType) + 1); else hr = HRESULT_FROM_WIN32(ret); - heap_free(contentType); + free(contentType); } else hr = E_OUTOFMEMORY; @@ -632,7 +632,7 @@ get_friendly_name_fail: ret = RegGetValueW(This->hkeyProgID, L"DefaultIcon", NULL, RRF_RT_REG_SZ, NULL, NULL, &size); if (ret == ERROR_SUCCESS) { - WCHAR *icon = heap_alloc(size); + WCHAR *icon = malloc(size); if (icon) { ret = RegGetValueW(This->hkeyProgID, L"DefaultIcon", NULL, RRF_RT_REG_SZ, NULL, icon, &size); @@ -640,7 +640,7 @@ get_friendly_name_fail: hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, lstrlenW(icon) + 1); else hr = HRESULT_FROM_WIN32(ret); - heap_free(icon); + free(icon); } else hr = E_OUTOFMEMORY; @@ -753,7 +753,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetData(IQueryAssociations *iface, hres = ASSOC_GetValue(This->hkeyProgID, L"EditFlags", &data, &size); if(SUCCEEDED(hres) && pcbOut) hres = ASSOC_ReturnData(pvOut, pcbOut, data, size); - heap_free(data); + free(data); return hres; default: FIXME("Unsupported ASSOCDATA value: %d\n", assocdata); diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index 68901be1265..e8b064c6daf 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -209,7 +209,7 @@ static void enumerate_strings(IAutoCompleteImpl *ac, enum prefix_filtering pfx_f
do { - if ((tmp = heap_realloc(strs, array_size * sizeof(*strs))) == NULL) + if ((tmp = realloc(strs, array_size * sizeof(*strs))) == NULL) goto fail; strs = tmp;
@@ -223,7 +223,7 @@ static void enumerate_strings(IAutoCompleteImpl *ac, enum prefix_filtering pfx_f } while (read != 0);
/* Allocate even if there were zero strings enumerated, to mark it non-NULL */ - if ((tmp = heap_realloc(strs, cur * sizeof(*strs)))) + if ((tmp = realloc(strs, cur * sizeof(*strs)))) { strs = tmp; if (cur > 0) @@ -237,7 +237,7 @@ static void enumerate_strings(IAutoCompleteImpl *ac, enum prefix_filtering pfx_f fail: while (cur--) CoTaskMemFree(strs[cur]); - heap_free(strs); + free(strs); }
static UINT find_matching_enum_str(IAutoCompleteImpl *ac, UINT start, WCHAR *text, @@ -269,7 +269,7 @@ static void free_enum_strs(IAutoCompleteImpl *ac) ac->enum_strs = NULL; while (i--) CoTaskMemFree(strs[i]); - heap_free(strs); + free(strs); } }
@@ -519,7 +519,7 @@ static void autoappend_str(IAutoCompleteImpl *ac, WCHAR *text, UINT len, WCHAR * so merge text and str into a new string */ size = len + lstrlenW(&str[len]) + 1;
- if ((tmp = heap_alloc(size * sizeof(*tmp)))) + if ((tmp = malloc(size * sizeof(*tmp)))) { memcpy(tmp, text, len * sizeof(*tmp)); memcpy(&tmp[len], &str[len], (size - len) * sizeof(*tmp)); @@ -528,7 +528,7 @@ static void autoappend_str(IAutoCompleteImpl *ac, WCHAR *text, UINT len, WCHAR *
set_text_and_selection(ac, hwnd, tmp, len, size - 1); if (tmp != str) - heap_free(tmp); + free(tmp); }
static BOOL display_matching_strs(IAutoCompleteImpl *ac, WCHAR *text, UINT len, @@ -608,7 +608,7 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_ }
size = len + 1; - if (!(text = heap_alloc(size * sizeof(WCHAR)))) + if (!(text = malloc(size * sizeof(WCHAR)))) { /* Reset the listbox to prevent potential crash from ResetEnumerator */ SendMessageW(ac->hwndListBox, LB_RESETCONTENT, 0, 0); @@ -616,7 +616,7 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_ } len = SendMessageW(hwnd, WM_GETTEXT, size, (LPARAM)text); if (len + 1 != size) - text = heap_realloc(text, (len + 1) * sizeof(WCHAR)); + text = realloc(text, (len + 1) * sizeof(WCHAR));
if (ac->aclist) { @@ -634,7 +634,7 @@ static void autocomplete_text(IAutoCompleteImpl *ac, HWND hwnd, enum autoappend_
/* Set txtbackup to point to text itself (which must not be released), and it must be done here since aclist_expand uses it to track changes */ - heap_free(ac->txtbackup); + free(ac->txtbackup); ac->txtbackup = text;
if (!display_matching_strs(ac, text, len, pfx_filter, hwnd, flag)) @@ -676,21 +676,21 @@ static LRESULT ACEditSubclassProc_KeyDown(IAutoCompleteImpl *ac, HWND hwnd, UINT UINT len = SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0); ac->no_fwd_char = '\n'; /* CTRL+RETURN char */
- if (!(text = heap_alloc((len + 1) * sizeof(WCHAR)))) + if (!(text = malloc((len + 1) * sizeof(WCHAR)))) return 0; len = SendMessageW(hwnd, WM_GETTEXT, len + 1, (LPARAM)text); sz = lstrlenW(ac->quickComplete) + 1 + len;
- if ((buf = heap_alloc(sz * sizeof(WCHAR)))) + if ((buf = malloc(sz * sizeof(WCHAR)))) { len = format_quick_complete(buf, ac->quickComplete, text, len); set_text_and_selection(ac, hwnd, buf, 0, len); - heap_free(buf); + free(buf); }
if (ac->options & ACO_AUTOSUGGEST) hide_listbox(ac, ac->hwndListBox, TRUE); - heap_free(text); + free(text); return 0; }
@@ -970,13 +970,13 @@ static ULONG WINAPI IAutoComplete2_fnRelease(
if (!refCount) { TRACE("destroying IAutoComplete(%p)\n", This); - heap_free(This->quickComplete); - heap_free(This->txtbackup); + free(This->quickComplete); + free(This->txtbackup); if (This->enumstr) IEnumString_Release(This->enumstr); if (This->aclist) IACList_Release(This->aclist); - heap_free(This); + free(This); } return refCount; } @@ -1032,7 +1032,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit( }
/* Prevent txtbackup from ever being NULL to simplify aclist_expand */ - if ((This->txtbackup = heap_alloc_zero(sizeof(WCHAR))) == NULL) + if ((This->txtbackup = calloc(1, sizeof(WCHAR))) == NULL) { IEnumString_Release(This->enumstr); This->enumstr = NULL; @@ -1079,7 +1079,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit( value = wcsrchr(pwzsRegKeyPath, '\'); len = value - pwzsRegKeyPath;
- if (value && (key = heap_alloc((len+1) * sizeof(*key))) != NULL) + if (value && (key = malloc((len + 1) * sizeof(*key))) != NULL) { memcpy(key, pwzsRegKeyPath, len * sizeof(*key)); key[len] = '\0'; @@ -1091,29 +1091,29 @@ static HRESULT WINAPI IAutoComplete2_fnInit( continue; sz = MAX_PATH * sizeof(WCHAR);
- while ((qc = heap_alloc(sz)) != NULL) + while ((qc = malloc(sz)) != NULL) { res = RegQueryValueExW(hKey, value, NULL, &type, qc, &sz); if (res == ERROR_SUCCESS && type == REG_SZ) { - This->quickComplete = heap_realloc(qc, sz); + This->quickComplete = realloc(qc, sz); i = ARRAY_SIZE(roots); break; } - heap_free(qc); + free(qc); if (res != ERROR_MORE_DATA || type != REG_SZ) break; } RegCloseKey(hKey); } - heap_free(key); + free(key); } }
if (!This->quickComplete && pwszQuickComplete) { size_t len = lstrlenW(pwszQuickComplete)+1; - if ((This->quickComplete = heap_alloc(len * sizeof(WCHAR))) != NULL) + if ((This->quickComplete = malloc(len * sizeof(WCHAR))) != NULL) memcpy(This->quickComplete, pwszQuickComplete, len * sizeof(WCHAR)); }
@@ -1285,7 +1285,7 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown)) return CLASS_E_NOAGGREGATION;
- lpac = heap_alloc_zero(sizeof(*lpac)); + lpac = calloc(1, sizeof(*lpac)); if (!lpac) return E_OUTOFMEMORY;
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index 7b7a1294cda..63f0a3420dd 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -1000,13 +1000,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 = heap_alloc(length * sizeof(WCHAR))) && + (selectionW = malloc(length * sizeof(WCHAR))) && MultiByteToWideChar(CP_ACP, 0, selection, -1, selectionW, length)) { result = BrsFolder_OnSetSelectionW(info, selectionW, is_str); }
- heap_free(selectionW); + free(selectionW); return result; }
@@ -1173,14 +1173,14 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi) bi.hwndOwner = lpbi->hwndOwner; bi.pidlRoot = lpbi->pidlRoot; if (lpbi->pszDisplayName) - bi.pszDisplayName = heap_alloc( MAX_PATH * sizeof(WCHAR) ); + bi.pszDisplayName = malloc( MAX_PATH * sizeof(WCHAR) ); else bi.pszDisplayName = NULL;
if (lpbi->lpszTitle) { len = MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, NULL, 0 ); - title = heap_alloc( len * sizeof(WCHAR) ); + title = malloc( len * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, lpbi->lpszTitle, -1, title, len ); } else @@ -1196,9 +1196,9 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi) { WideCharToMultiByte( CP_ACP, 0, bi.pszDisplayName, -1, lpbi->pszDisplayName, MAX_PATH, 0, NULL); - heap_free( bi.pszDisplayName ); + free( bi.pszDisplayName ); } - heap_free(title); + free( title ); lpbi->iImage = bi.iImage; return lpid; } diff --git a/dlls/shell32/control.c b/dlls/shell32/control.c index 66987ed3192..8a77ec698ed 100644 --- a/dlls/shell32/control.c +++ b/dlls/shell32/control.c @@ -57,8 +57,8 @@ void Control_UnloadApplet(CPlApplet* applet) DeactivateActCtx(0, applet->cookie); ReleaseActCtx(applet->context); list_remove( &applet->entry ); - heap_free(applet->cmd); - heap_free(applet); + free(applet->cmd); + free(applet); }
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) @@ -71,7 +71,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) NEWCPLINFOW newinfo; ACTCTXW ctx;
- if (!(applet = heap_alloc_zero(sizeof(*applet)))) + if (!(applet = calloc(1, sizeof(*applet)))) return applet;
applet->context = INVALID_HANDLE_VALUE; @@ -79,7 +79,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) len = ExpandEnvironmentStringsW(cmd, NULL, 0); if (len > 0) { - if (!(applet->cmd = heap_alloc((len+1) * sizeof(WCHAR)))) + if (!(applet->cmd = malloc((len + 1) * sizeof(WCHAR)))) { WARN("Cannot allocate memory for applet path\n"); goto theError; @@ -127,8 +127,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) goto theError; }
- applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet, - FIELD_OFFSET( CPlApplet, info[applet->count] )); + applet = _recalloc(applet, 1, FIELD_OFFSET(CPlApplet, info[applet->count]));
for (i = 0; i < applet->count; i++) { ZeroMemory(&newinfo, sizeof(newinfo)); @@ -202,8 +201,8 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) if (applet->context_activated) DeactivateActCtx(0, applet->cookie); ReleaseActCtx(applet->context); - heap_free(applet->cmd); - heap_free(applet); + free(applet->cmd); + free(applet); return NULL; }
@@ -310,7 +309,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 = heap_alloc(sizeof(CPlItem)); + item = malloc(sizeof(CPlItem));
if (!item) continue; @@ -387,7 +386,7 @@ static void Control_FreeCPlItems(HWND hWnd, CPanel *panel) if (!GetMenuItemInfoW(hSubMenu, i, FALSE, &mii)) continue;
- heap_free((void *)mii.dwItemData); + free((void *)mii.dwItemData); } }
@@ -736,7 +735,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd) BOOL quoted = FALSE; CPlApplet *applet;
- buffer = heap_alloc((lstrlenW(wszCmd) + 1) * sizeof(*wszCmd)); + buffer = malloc((wcslen(wszCmd) + 1) * sizeof(*wszCmd)); if (!buffer) return;
end = lstrcpyW(buffer, wszCmd); @@ -825,7 +824,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd) Control_UnloadApplet(applet); }
- heap_free(buffer); + free(buffer); }
/************************************************************************* @@ -856,12 +855,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 = heap_alloc(len * sizeof(WCHAR)); + WCHAR *wszCmd = malloc(len * sizeof(WCHAR)); if (wszCmd && MultiByteToWideChar(CP_ACP, 0, cmd, -1, wszCmd, len )) { Control_RunDLLW(hWnd, hInst, wszCmd, nCmdShow); } - heap_free(wszCmd); + free(wszCmd); }
/************************************************************************* diff --git a/dlls/shell32/dataobject.c b/dlls/shell32/dataobject.c index 3cd86845c42..96b9a0ad5dd 100644 --- a/dlls/shell32/dataobject.c +++ b/dlls/shell32/dataobject.c @@ -96,7 +96,7 @@ static ULONG WINAPI IEnumFORMATETC_fnRelease(LPENUMFORMATETC iface) { TRACE(" destroying IEnumFORMATETC(%p)\n",This); SHFree (This->pFmt); - heap_free(This); + free(This); } return refCount; } @@ -169,7 +169,7 @@ LPENUMFORMATETC IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[]) IEnumFORMATETCImpl* ef; DWORD size=cfmt * sizeof(FORMATETC);
- ef = heap_alloc_zero(sizeof(*ef)); + ef = calloc(1, sizeof(*ef));
if(ef) { @@ -272,7 +272,7 @@ static ULONG WINAPI IDataObject_fnRelease(IDataObject *iface) TRACE(" destroying IDataObject(%p)\n",This); _ILFreeaPidl(This->apidl, This->cidl); ILFree(This->pidl); - heap_free(This); + free(This); } return refCount; } @@ -428,7 +428,7 @@ IDataObject* IDataObject_Constructor(HWND hwndOwner, { IDataObjectImpl* dto;
- dto = heap_alloc_zero(sizeof(*dto)); + dto = calloc(1, sizeof(*dto));
if (dto) { diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c index a2ab99499b5..665c7093953 100644 --- a/dlls/shell32/dialogs.c +++ b/dlls/shell32/dialogs.c @@ -136,7 +136,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) const WCHAR *src; WCHAR *dest, *result, *result_end=NULL;
- result = heap_alloc(sizeof(WCHAR)*(lstrlenW(cmdline)+5)); + result = malloc(sizeof(WCHAR) * (wcslen(cmdline) + 5));
src = cmdline; dest = result; @@ -176,7 +176,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) } else { - heap_free(result); + free(result); return NULL; } } @@ -231,7 +231,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
ZeroMemory (&sei, sizeof(sei)) ; sei.cbSize = sizeof(sei) ; - psz = heap_alloc( (ic + 1)*sizeof(WCHAR) ); + psz = malloc( (ic + 1) * sizeof(WCHAR) ); GetWindowTextW (htxt, psz, ic + 1) ;
/* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a @@ -248,8 +248,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
if (!ShellExecuteExW( &sei )) { - heap_free(psz); - heap_free(parent); + free(psz); + free(parent); SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; return TRUE ; } @@ -258,8 +258,8 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ; FillList (htxt, (LPSTR)psz, FALSE) ;
- heap_free(psz); - heap_free(parent); + free(psz); + free(parent); EndDialog (hwnd, 0); } } @@ -327,14 +327,14 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
if (icList > 0) { - pszList = heap_alloc(icList) ; + pszList = malloc(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 = heap_alloc(icList) ; + pszList = malloc(icList) ; pszList[0] = 0 ; }
@@ -347,10 +347,7 @@ 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 = heap_realloc(pszCmd, icCmd) ; - else - pszCmd = heap_alloc(icCmd) ; + pszCmd = realloc(pszCmd, icCmd) ; if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd)) MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ;
@@ -416,10 +413,7 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
cMatch = ++cMax ; - if( pszList ) - pszList = heap_realloc(pszList, ++icList) ; - else - pszList = heap_alloc(++icList) ; + pszList = realloc(pszList, ++icList) ; memmove (&pszList[1], pszList, icList - 1) ; pszList[0] = cMatch ; szIndex[0] = cMatch ; @@ -428,8 +422,8 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault)
RegSetValueExA (hkey, "MRUList", 0, REG_SZ, (LPBYTE)pszList, strlen (pszList) + 1) ;
- heap_free(pszCmd) ; - heap_free(pszList) ; + free(pszCmd) ; + free(pszList) ; }
/************************************************************************* diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c index 1883e0d2cbe..8ae09d441bb 100644 --- a/dlls/shell32/ebrowser.c +++ b/dlls/shell32/ebrowser.c @@ -110,7 +110,7 @@ static void events_unadvise_all(ExplorerBrowserImpl *This) TRACE("Removing %p\n", client); list_remove(&client->entry); IExplorerBrowserEvents_Release(client->pebe); - heap_free(client); + free(client); } }
@@ -182,7 +182,7 @@ static void travellog_remove_entry(ExplorerBrowserImpl *This, travellog_entry *e
list_remove(&entry->entry); ILFree(entry->pidl); - heap_free(entry); + free(entry); This->travellog_count--; }
@@ -214,7 +214,7 @@ static void travellog_add_entry(ExplorerBrowserImpl *This, LPITEMIDLIST pidl) }
/* Create and add the new entry */ - new = heap_alloc(sizeof(*new)); + new = malloc(sizeof(*new)); new->pidl = ILClone(pidl); list_add_tail(&This->travellog, &new->entry); This->travellog_cursor = new; @@ -827,7 +827,7 @@ static ULONG WINAPI IExplorerBrowser_fnRelease(IExplorerBrowser *iface)
IObjectWithSite_SetSite(&This->IObjectWithSite_iface, NULL);
- heap_free(This); + free(This); }
return ref; @@ -1005,7 +1005,7 @@ static HRESULT WINAPI IExplorerBrowser_fnAdvise(IExplorerBrowser *iface, event_client *client; TRACE("%p (%p, %p)\n", This, psbe, pdwCookie);
- client = heap_alloc(sizeof(*client)); + client = malloc(sizeof(*client)); client->pebe = psbe; client->cookie = ++This->events_next_cookie;
@@ -1030,7 +1030,7 @@ static HRESULT WINAPI IExplorerBrowser_fnUnadvise(IExplorerBrowser *iface, { list_remove(&client->entry); IExplorerBrowserEvents_Release(client->pebe); - heap_free(client); + free(client); return S_OK; } } @@ -2067,7 +2067,7 @@ HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, voi if(pUnkOuter) return CLASS_E_NOAGGREGATION;
- eb = heap_alloc_zero(sizeof(*eb)); + eb = calloc(1, sizeof(*eb)); eb->ref = 1; eb->IExplorerBrowser_iface.lpVtbl = &vt_IExplorerBrowser; eb->IShellBrowser_iface.lpVtbl = &vt_IShellBrowser; diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c index 73f8d32e214..b07bce09bac 100644 --- a/dlls/shell32/enumidlist.c +++ b/dlls/shell32/enumidlist.c @@ -182,7 +182,7 @@ static ULONG WINAPI IEnumIDList_fnRelease(IEnumIDList *iface) SHFree(cur->pidl); SHFree(cur); } - heap_free(This); + free(This); }
return refCount; @@ -291,7 +291,7 @@ static const IEnumIDListVtbl eidlvt =
IEnumIDListImpl *IEnumIDList_Constructor(void) { - IEnumIDListImpl *lpeidl = heap_alloc(sizeof(*lpeidl)); + IEnumIDListImpl *lpeidl = malloc(sizeof(*lpeidl));
if (lpeidl) { diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index 1a30180d05d..896286c0b64 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -121,7 +121,7 @@ static ULONG WINAPI IExtractIconW_fnRelease(IExtractIconW * iface) { TRACE(" destroying IExtractIcon(%p)\n",This); SHFree(This->pidl); - heap_free(This); + free(This); } return refCount; } @@ -401,14 +401,14 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(IExtractIconA * iface, UIN { IExtractIconWImpl *This = impl_from_IExtractIconA(iface); HRESULT ret; - LPWSTR lpwstrFile = heap_alloc(cchMax * sizeof(WCHAR)); + WCHAR *lpwstrFile = malloc(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); - heap_free(lpwstrFile); + free(lpwstrFile);
TRACE("-- %s %x\n", szIconFile, *piIndex); return ret; @@ -422,14 +422,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 = heap_alloc(len * sizeof(WCHAR)); + WCHAR *lpwstrFile = malloc(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); - heap_free(lpwstrFile); + free(lpwstrFile); return ret; }
@@ -519,7 +519,7 @@ static IExtractIconWImpl *extracticon_create(LPCITEMIDLIST pidl)
TRACE("%p\n", pidl);
- ei = heap_alloc(sizeof(*ei)); + ei = malloc(sizeof(*ei)); ei->ref=1; ei->IExtractIconW_iface.lpVtbl = &eivt; ei->IExtractIconA_iface.lpVtbl = &eiavt; diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index d75daa3fa8d..c122c145609 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -300,8 +300,7 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons entry = SHAlloc(sizeof(*entry));
GetFullPathNameW(sourcefile, MAX_PATH, path, NULL); - entry->sSourceFile = heap_alloc( (lstrlenW(path)+1)*sizeof(WCHAR) ); - lstrcpyW( entry->sSourceFile, path ); + entry->sSourceFile = wcsdup(path);
entry->dwSourceIndex = src_index; entry->dwFlags = flags; @@ -311,7 +310,7 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons index = DPA_InsertPtr(sic_hdpa, 0x7fff, entry); if ( INVALID_INDEX == index ) { - heap_free(entry->sSourceFile); + free(entry->sSourceFile); SHFree(entry); ret = INVALID_INDEX; } @@ -492,7 +491,7 @@ static BOOL WINAPI SIC_Initialize( INIT_ONCE *once, void *param, void **context */ static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam ) { - heap_free(((LPSIC_ENTRY)ptr)->sSourceFile); + free(((SIC_ENTRY *)ptr)->sSourceFile); SHFree(ptr); return TRUE; } @@ -745,12 +744,12 @@ INT WINAPI 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 = heap_alloc( len * sizeof(WCHAR) ); + szTemp = malloc( len * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, szPath, -1, szTemp, len );
ret = SIC_GetIconIndex( szTemp, nIndex, 0 );
- heap_free( szTemp ); + free( szTemp );
return ret; } @@ -789,7 +788,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 = heap_alloc( len * sizeof(WCHAR)); + WCHAR *lpwstrFile = malloc( len * sizeof(WCHAR));
TRACE("%s %i %p %p %i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
@@ -797,7 +796,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); - heap_free(lpwstrFile); + free(lpwstrFile); } return ret; } @@ -817,7 +816,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 = heap_alloc(MAX_PATH * sizeof(WCHAR)); + WCHAR *lpIconPathW = malloc(MAX_PATH * sizeof(WCHAR));
TRACE("%p %s %p\n", hInst, debugstr_a(lpIconPath), lpiIcon);
@@ -826,7 +825,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); - heap_free(lpIconPathW); + free(lpIconPathW); } return hIcon; } @@ -895,13 +894,13 @@ HICON WINAPI ExtractAssociatedIconExA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD { HICON ret; INT len = MultiByteToWideChar( CP_ACP, 0, lpIconPath, -1, NULL, 0 ); - LPWSTR lpwstrFile = heap_alloc( len * sizeof(WCHAR) ); + WCHAR *lpwstrFile = malloc( 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); - heap_free(lpwstrFile); + free(lpwstrFile); return ret; }
@@ -942,13 +941,13 @@ HRESULT WINAPI SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags, { HRESULT ret; INT len = MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, NULL, 0); - LPWSTR lpwstrFile = heap_alloc(len * sizeof(WCHAR)); + WCHAR *lpwstrFile = malloc(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); - heap_free(lpwstrFile); + free(lpwstrFile); return ret; }
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 9878ef9811e..668a5bc583a 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -1057,13 +1057,13 @@ LPITEMIDLIST SHSimpleIDListFromPathA(LPCSTR lpszPath) if (lpszPath) { len = MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, NULL, 0); - wPath = heap_alloc(len * sizeof(WCHAR)); + wPath = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, wPath, len); }
_ILParsePathW(wPath, NULL, TRUE, &pidl, NULL);
- heap_free(wPath); + free(wPath); TRACE("%s %p\n", debugstr_a(lpszPath), pidl); return pidl; } diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index 44f00fb15d4..91f13413dce 100644 --- a/dlls/shell32/recyclebin.c +++ b/dlls/shell32/recyclebin.c @@ -97,7 +97,7 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context if (!home) return TRUE; if (is_macos()) { - files = heap_alloc( (lstrlenW(home) + lstrlenW(L"\.Trash") + 1) * sizeof(WCHAR) ); + files = malloc( (wcslen(home) + ARRAY_SIZE(L"\.Trash")) * sizeof(WCHAR) ); lstrcpyW( files, home ); lstrcatW( files, L"\.Trash" ); files[1] = '\'; /* change ??\ to \?\ */ @@ -114,12 +114,12 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context fmt = L"\??\unix%s/Trash"; } len = lstrlenW(home) + lstrlenW(fmt) + 7; - files = heap_alloc( len * sizeof(WCHAR) ); + files = malloc( len * sizeof(WCHAR) ); swprintf( files, len, fmt, home ); files[1] = '\'; /* change ??\ to \?\ */ for (p = files; *p; p++) if (*p == '/') *p = '\'; CreateDirectoryW( files, NULL ); - info = heap_alloc( len * sizeof(WCHAR) ); + info = malloc( len * sizeof(WCHAR) ); lstrcpyW( info, files ); lstrcatW( files, L"\files" ); lstrcatW( info, L"\info" ); @@ -133,8 +133,8 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context return TRUE;
done: - heap_free( files ); - heap_free( info ); + free( files ); + free( info ); return TRUE; }
@@ -201,14 +201,14 @@ static BOOL write_trashinfo_file( HANDLE handle, const WCHAR *orig_path ) if (!(path = wine_get_unix_file_name( orig_path ))) return FALSE; GetLocalTime( &now );
- buffer = heap_alloc( strlen(path) * 3 + 128 ); + buffer = malloc( strlen(path) * 3 + 128 ); strcpy( buffer, "[Trash Info]\nPath=" ); encode( path, buffer + strlen(buffer) ); sprintf( buffer + strlen(buffer), "\nDeletionDate=%04u-%02u-%02uT%02u:%02u:%02u\n", now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond); WriteFile( handle, buffer, strlen(buffer), NULL, NULL ); heap_free( path ); - heap_free( buffer ); + free( buffer ); return TRUE; }
@@ -220,7 +220,7 @@ static void read_trashinfo_file( HANDLE handle, WIN32_FIND_DATAW *data ) int header = 0;
size = GetFileSize( handle, NULL ); - if (!(buffer = heap_alloc( size + 1 ))) return; + if (!(buffer = malloc( size + 1 ))) return; if (!ReadFile( handle, buffer, size, &size, NULL )) size = 0; buffer[size] = 0; next = buffer; @@ -264,7 +264,7 @@ static void read_trashinfo_file( HANDLE handle, WIN32_FIND_DATAW *data ) } } } - heap_free( buffer ); + free( buffer ); }
@@ -278,13 +278,13 @@ BOOL trash_file( const WCHAR *path ) if (!trash_dir) return FALSE;
len = lstrlenW(trash_dir) + lstrlenW(file) + 11; - dest = heap_alloc( len * sizeof(WCHAR) ); + dest = malloc( len * sizeof(WCHAR) );
if (trash_info_dir) { HANDLE handle; ULONG infolen = lstrlenW(trash_info_dir) + lstrlenW(file) + 21; - WCHAR *info = heap_alloc( infolen * sizeof(WCHAR) ); + WCHAR *info = malloc( infolen * sizeof(WCHAR) );
swprintf( info, infolen, L"%s\%s.trashinfo", trash_info_dir, file ); for (i = 0; i < 1000; i++) @@ -316,7 +316,7 @@ BOOL trash_file( const WCHAR *path ) } } if (ret) TRACE( "%s -> %s\n", debugstr_w(path), debugstr_w(dest) ); - heap_free( dest ); + free( dest ); return ret; }
@@ -330,11 +330,11 @@ static BOOL get_trash_item_info( const WCHAR *filename, WIN32_FIND_DATAW *data ) { HANDLE handle; ULONG len = lstrlenW(trash_info_dir) + lstrlenW(filename) + 12; - WCHAR *info = heap_alloc( len * sizeof(WCHAR) ); + WCHAR *info = malloc( len * sizeof(WCHAR) );
swprintf( info, len, L"%s\%s.trashinfo", trash_info_dir, filename ); handle = CreateFileW( info, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); - heap_free( info ); + free( info ); if (handle == INVALID_HANDLE_VALUE) return FALSE; read_trashinfo_file( handle, data ); CloseHandle( handle ); @@ -365,7 +365,7 @@ static HRESULT add_trash_item( WIN32_FIND_DATAW *orig_data, LPITEMIDLIST **pidls LPITEMIDLIST *new;
*size = max( *size * 2, 32 ); - new = heap_realloc( *pidls, *size * sizeof(**pidls) ); + new = realloc( *pidls, *size * sizeof(**pidls) ); if (!new) { SHFree( pidl ); @@ -392,7 +392,7 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) if (!trash_dir) return E_FAIL;
*pidls = NULL; - file = heap_alloc( (lstrlenW(trash_dir) + lstrlenW(L"\*") + 1) * sizeof(WCHAR) ); + file = malloc( (wcslen(trash_dir) + ARRAY_SIZE(L"\*")) * sizeof(WCHAR) ); lstrcpyW( file, trash_dir ); lstrcatW( file, L"\*" ); handle = FindFirstFileW( file, &data ); @@ -413,7 +413,7 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) *pidls = SHAlloc( count * sizeof(**pidls) ); memcpy( *pidls, ret, count * sizeof(**pidls) ); } - heap_free( ret ); + free( ret ); *ret_count = count; return hr; } @@ -425,10 +425,10 @@ static void remove_trashinfo( const WCHAR *filename )
if (!trash_info_dir) return; len = lstrlenW(trash_info_dir) + lstrlenW(filename) + 12; - info = heap_alloc( len * sizeof(WCHAR) ); + info = malloc( len * sizeof(WCHAR) ); swprintf( info, len, L"%s\%s.trashinfo", trash_info_dir, filename ); DeleteFileW( info ); - heap_free( info ); + free( info ); }
static HRESULT restore_trash_item( LPCITEMIDLIST pidl ) @@ -443,11 +443,11 @@ static HRESULT restore_trash_item( LPCITEMIDLIST pidl ) return E_NOTIMPL; } len = lstrlenW(trash_dir) + lstrlenW(filename) + 2; - from = heap_alloc( len * sizeof(WCHAR) ); + from = malloc( len * sizeof(WCHAR) ); swprintf( from, len, L"%s\%s", trash_dir, filename ); if (MoveFileW( from, data->cFileName )) remove_trashinfo( filename ); else WARN( "failed to restore %s to %s\n", debugstr_w(from), debugstr_w(data->cFileName) ); - heap_free( from ); + free( from ); return S_OK; }
@@ -457,10 +457,10 @@ static HRESULT erase_trash_item( LPCITEMIDLIST pidl ) WCHAR *from, *filename = (WCHAR *)(data + 1); ULONG len = lstrlenW(trash_dir) + lstrlenW(filename) + 2;
- from = heap_alloc( len * sizeof(WCHAR) ); + from = malloc( len * sizeof(WCHAR) ); swprintf( from, len, L"%s\%s", trash_dir, filename ); if (DeleteFileW( from )) remove_trashinfo( filename ); - heap_free( from ); + free( from ); return S_OK; }
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index b7ff433bccb..847587c70c9 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -453,8 +453,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 = heap_alloc( size ); - else file = heap_realloc( file, size ); + if (file == buf) file = malloc( size ); + else file = realloc( file, size ); if (!file) break; } if (SUCCEEDED(hr)) @@ -462,7 +462,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) heap_free( file ); + if (file != buf) free( file ); } } } @@ -513,7 +513,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, else { len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0); - temppath = heap_alloc(len*sizeof(WCHAR)); + temppath = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len); pathW = temppath; } @@ -546,7 +546,7 @@ DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, } }
- heap_free(temppath); + free(temppath);
return ret; } @@ -701,7 +701,7 @@ static ULONG WINAPI window_prop_store_Release(IPropertyStore *iface) { struct window_prop_store *store = impl_from_IPropertyStore(iface); LONG ref = InterlockedDecrement(&store->ref); - if (!ref) heap_free(store); + if (!ref) free(store); TRACE("returning %ld\n", ref); return ref; } @@ -773,7 +773,7 @@ static HRESULT create_window_prop_store(IPropertyStore **obj) { struct window_prop_store *store;
- if (!(store = heap_alloc(sizeof(*store)))) return E_OUTOFMEMORY; + if (!(store = malloc(sizeof(*store)))) return E_OUTOFMEMORY; store->IPropertyStore_iface.lpVtbl = &window_prop_store_vtbl; store->ref = 1;
@@ -872,7 +872,7 @@ static void add_authors( HWND list )
if (!strA) return; sizeW = MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, NULL, 0 ) + 1; - if (!(strW = heap_alloc( sizeW * sizeof(WCHAR) ))) return; + if (!(strW = malloc( sizeW * sizeof(WCHAR) ))) return; MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW ); strW[sizeW - 1] = 0;
@@ -886,7 +886,7 @@ static void add_authors( HWND list ) SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start ); start = end; } - heap_free( strW ); + free( strW ); }
/************************************************************************* @@ -987,20 +987,20 @@ BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIc if (szApp) { len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0); - appW = heap_alloc( len * sizeof(WCHAR)); + appW = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len); } if (szOtherStuff) { len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0); - otherW = heap_alloc( len * sizeof(WCHAR)); + otherW = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len); }
ret = ShellAboutW(hWnd, appW, otherW, hIcon);
- heap_free(otherW); - heap_free(appW); + free(otherW); + free(appW); return ret; }
diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c index 66ab51428d3..6f8f52469fc 100644 --- a/dlls/shell32/shellitem.c +++ b/dlls/shell32/shellitem.c @@ -117,7 +117,7 @@ static ULONG WINAPI ShellItem_Release(IShellItem2 *iface) if (ref == 0) { ILFree(This->pidl); - heap_free(This); + free(This); }
return ref; @@ -608,7 +608,7 @@ HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **p
if (pUnkOuter) return CLASS_E_NOAGGREGATION;
- This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); This->IShellItem2_iface.lpVtbl = &ShellItem2_Vtbl; This->ref = 1; This->pidl = NULL; @@ -976,7 +976,7 @@ static ULONG WINAPI IEnumShellItems_fnRelease(IEnumShellItems *iface) { TRACE("Freeing.\n"); IShellItemArray_Release(This->array); - heap_free(This); + free(This); return 0; }
@@ -1065,7 +1065,7 @@ static HRESULT IEnumShellItems_Constructor(IShellItemArray *array, IEnumShellIte IEnumShellItemsImpl *This; HRESULT ret;
- This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if(!This) return E_OUTOFMEMORY;
@@ -1146,8 +1146,8 @@ static ULONG WINAPI IShellItemArray_fnRelease(IShellItemArray *iface) for(i = 0; i < This->item_count; i++) IShellItem_Release(This->array[i]);
- heap_free(This->array); - heap_free(This); + free(This->array); + free(This); return 0; }
@@ -1294,17 +1294,17 @@ static HRESULT create_shellitemarray(IShellItem **items, DWORD count, IShellItem
TRACE("(%p, %ld, %p)\n", items, count, ret);
- This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if(!This) return E_OUTOFMEMORY;
This->IShellItemArray_iface.lpVtbl = &vt_IShellItemArray; This->ref = 1;
- This->array = heap_alloc(count*sizeof(IShellItem*)); + This->array = malloc(count * sizeof(IShellItem*)); if (!This->array) { - heap_free(This); + free(This); return E_OUTOFMEMORY; } memcpy(This->array, items, count*sizeof(IShellItem*)); @@ -1334,7 +1334,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent, if(!ppidl) return E_INVALIDARG;
- array = heap_alloc_zero(cidl*sizeof(IShellItem*)); + array = calloc(cidl, sizeof(IShellItem*)); if(!array) return E_OUTOFMEMORY;
@@ -1354,7 +1354,7 @@ HRESULT WINAPI SHCreateShellItemArray(PCIDLIST_ABSOLUTE pidlParent, for(i = 0; i < cidl; i++) if(array[i]) IShellItem_Release(array[i]); } - heap_free(array); + free(array); return ret; }
@@ -1411,13 +1411,13 @@ HRESULT WINAPI SHCreateShellItemArrayFromDataObject(IDataObject *pdo, REFIID rii
parent_pidl = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
- children = heap_alloc(sizeof(LPCITEMIDLIST)*pida->cidl); + children = malloc(sizeof(const ITEMIDLIST*) * 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);
- heap_free(children); + free(children);
GlobalUnlock(medium.hGlobal); GlobalFree(medium.hGlobal); @@ -1446,7 +1446,7 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl, if(cidl == 0) return E_INVALIDARG;
- array = heap_alloc_zero(cidl*sizeof(IShellItem*)); + array = calloc(cidl, sizeof(IShellItem*)); if(!array) return E_OUTOFMEMORY;
@@ -1468,7 +1468,7 @@ HRESULT WINAPI SHCreateShellItemArrayFromIDLists(UINT cidl, if(array[i]) IShellItem_Release(array[i]); *psia = NULL; } - heap_free(array); + free(array); return ret; }
@@ -1528,7 +1528,7 @@ static ULONG WINAPI CustomDestinationList_Release(ICustomDestinationList *iface) TRACE("(%p), new refcount=%li\n", This, ref);
if (ref == 0) - heap_free(This); + free(This);
return ref; } @@ -1640,7 +1640,7 @@ HRESULT WINAPI CustomDestinationList_Constructor(IUnknown *outer, REFIID riid, v if (outer) return CLASS_E_NOAGGREGATION;
- if(!(list = heap_alloc(sizeof(*list)))) + if(!(list = malloc(sizeof(*list)))) return E_OUTOFMEMORY;
list->ICustomDestinationList_iface.lpVtbl = &CustomDestinationListVtbl; diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index df68f5a14c2..8fe1529891b 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -1516,7 +1516,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA *iface, LPCSTR pszFile) if (!str) return E_OUTOFMEMORY;
r = IShellLinkW_SetPath(&This->IShellLinkW_iface, str); - free( str ); + free(str);
return r; } diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 84ce26fff57..56f386c7944 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -1268,7 +1268,7 @@ BOOL WINAPI IsUserAnAdmin(VOID) } }
- lpGroups = heap_alloc(dwSize); + lpGroups = malloc(dwSize); if (lpGroups == NULL) { CloseHandle(hToken); @@ -1277,7 +1277,7 @@ BOOL WINAPI IsUserAnAdmin(VOID)
if (!GetTokenInformation(hToken, TokenGroups, lpGroups, dwSize, &dwSize)) { - heap_free(lpGroups); + free(lpGroups); CloseHandle(hToken); return FALSE; } @@ -1287,7 +1287,7 @@ BOOL WINAPI IsUserAnAdmin(VOID) DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &lpSid)) { - heap_free(lpGroups); + free(lpGroups); return FALSE; }
@@ -1301,7 +1301,7 @@ BOOL WINAPI IsUserAnAdmin(VOID) }
FreeSid(lpSid); - heap_free(lpGroups); + free(lpGroups); return bResult; }
@@ -1427,7 +1427,7 @@ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString)
TRACE("(%s, %d)\n", debugstr_a(pszString), cchString);
- if ((dst = heap_alloc(cchString * sizeof(CHAR)))) + if ((dst = malloc(cchString * sizeof(CHAR)))) { len = ExpandEnvironmentStringsA(pszString, dst, cchString); /* len includes the terminating 0 */ @@ -1439,7 +1439,7 @@ DWORD WINAPI DoEnvironmentSubstA(LPSTR pszString, UINT cchString) else len = cchString;
- heap_free(dst); + free(dst); } return MAKELONG(len, res); } @@ -1471,7 +1471,7 @@ DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString)
TRACE("(%s, %d)\n", debugstr_w(pszString), cchString);
- if ((cchString < MAXLONG) && (dst = heap_alloc(cchString * sizeof(WCHAR)))) + if ((cchString < MAXLONG) && (dst = malloc(cchString * sizeof(WCHAR)))) { len = ExpandEnvironmentStringsW(pszString, dst, cchString); /* len includes the terminating 0 */ @@ -1483,7 +1483,7 @@ DWORD WINAPI DoEnvironmentSubstW(LPWSTR pszString, UINT cchString) else len = cchString;
- heap_free(dst); + free(dst); } return MAKELONG(len, res); } diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 8328477fc2c..b09b35795fb 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -887,7 +887,7 @@ static ULONG WINAPI ApplicationDestinations_Release(IApplicationDestinations *if TRACE("(%p), new refcount=%li\n", This, ref);
if (ref == 0) - heap_free(This); + free(This);
return ref; } @@ -1006,7 +1006,7 @@ static ULONG WINAPI ApplicationDocumentLists_Release(IApplicationDocumentLists * TRACE("(%p), new refcount=%li\n", This, ref);
if (ref == 0) - heap_free(This); + free(This);
return ref; } @@ -2329,13 +2329,13 @@ static LPWSTR _GetUserSidStringFromToken(HANDLE Token) { if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return NULL; - UserInfo = heap_alloc(InfoSize); + UserInfo = malloc(InfoSize); if (UserInfo == NULL) return NULL; if (! GetTokenInformation(Token, TokenUser, UserInfo, InfoSize, &InfoSize)) { - heap_free(UserInfo); + free(UserInfo); return NULL; } } @@ -2344,7 +2344,7 @@ static LPWSTR _GetUserSidStringFromToken(HANDLE Token) SidStr = NULL;
if (UserInfo != (PTOKEN_USER) InfoBuffer) - heap_free(UserInfo); + free(UserInfo);
return SidStr; } @@ -2656,20 +2656,20 @@ static BOOL WINAPI init_xdg_dirs( INIT_ONCE *once, void *param, void **context ) fmt = L"%s/.config/user-dirs.dirs"; } len = lstrlenW(var) + lstrlenW(fmt); - name = heap_alloc( len * sizeof(WCHAR) ); + name = malloc( len * sizeof(WCHAR) ); swprintf( name, len, fmt, var ); name[1] = '\'; /* change ??\ to \?\ */ for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\';
file = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); - heap_free( name ); + free( name ); if (file != INVALID_HANDLE_VALUE) { len = GetFileSize( file, NULL ); - if (!(xdg_config = heap_alloc( len + 1 ))) return TRUE; + if (!(xdg_config = malloc( len + 1 ))) return TRUE; if (!ReadFile( file, xdg_config, len, &xdg_config_len, NULL )) { - heap_free( xdg_config ); + free( xdg_config ); xdg_config = NULL; } else @@ -2704,7 +2704,7 @@ static char *get_xdg_path( const char *var ) p++; if (*p != '/' && strncmp( p, "$HOME/", 6 )) continue;
- if (!(ret = heap_alloc( strlen(p) + 1 ))) break; + if (!(ret = malloc( strlen(p) + 1 ))) break; for (i = 0; *p && *p != '"'; i++, p++) { if (*p == '\' && p[1]) p++; @@ -2713,7 +2713,7 @@ static char *get_xdg_path( const char *var ) ret[i] = 0; if (*p != '"') { - heap_free( ret ); + free( ret ); ret = NULL; } break; @@ -2727,7 +2727,7 @@ static BOOL link_folder( HANDLE mgr, const UNICODE_STRING *path, const char *lin DWORD len = sizeof(*ioctl) + path->Length + strlen(link) + 1; BOOL ret;
- if (!(ioctl = heap_alloc( len ))) return FALSE; + if (!(ioctl = malloc( len ))) return FALSE; ioctl->create_backup = FALSE; ioctl->folder_offset = sizeof(*ioctl); ioctl->folder_size = path->Length; @@ -2736,7 +2736,7 @@ static BOOL link_folder( HANDLE mgr, const UNICODE_STRING *path, const char *lin strcpy( (char *)ioctl + ioctl->symlink_offset, link );
ret = DeviceIoControl( mgr, IOCTL_MOUNTMGR_DEFINE_SHELL_FOLDER, ioctl, len, NULL, 0, NULL, NULL ); - heap_free( ioctl ); + free( ioctl ); return ret; }
@@ -2771,7 +2771,7 @@ static void create_link( const WCHAR *path, const char *xdg_name, const char *de
done: RtlFreeUnicodeString( &nt_name ); - heap_free( target ); + free( target ); CloseHandle( mgr ); }
@@ -2862,7 +2862,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA( TRACE("%p,%#x,%p,%#lx,%s,%p\n", hwndOwner, nFolder, hToken, dwFlags, debugstr_a(pszSubPath), pszPath);
if(pszPath) { - pszPathW = heap_alloc(MAX_PATH * sizeof(WCHAR)); + pszPathW = malloc(MAX_PATH * sizeof(WCHAR)); if(!pszPathW) { hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); goto cleanup; @@ -2876,7 +2876,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA( */ if (pszSubPath && pszSubPath[0]) { length = MultiByteToWideChar(CP_ACP, 0, pszSubPath, -1, NULL, 0); - pszSubPathW = heap_alloc(length * sizeof(WCHAR)); + pszSubPathW = malloc(length * sizeof(WCHAR)); if(!pszSubPathW) { hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); goto cleanup; @@ -2890,8 +2890,8 @@ HRESULT WINAPI SHGetFolderPathAndSubDirA( WideCharToMultiByte(CP_ACP, 0, pszPathW, -1, pszPath, MAX_PATH, NULL, NULL);
cleanup: - heap_free(pszPathW); - heap_free(pszSubPathW); + free(pszPathW); + free(pszSubPathW); return hr; }
@@ -3616,7 +3616,7 @@ static HRESULT get_known_folder_registry_path( lstrcpyW(sGuid, lpStringGuid);
length = lstrlenW(L"Software\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions")+51; - *lpPath = heap_alloc(length*sizeof(WCHAR)); + *lpPath = malloc(length * sizeof(WCHAR)); if(!(*lpPath)) hr = E_OUTOFMEMORY;
@@ -3697,7 +3697,7 @@ static HRESULT get_known_folder_redirection_place( hr = E_FAIL; }
- heap_free(lpRegistryPath); + free(lpRegistryPath); return hr; }
@@ -3725,7 +3725,7 @@ static HRESULT redirect_known_folder( if(SUCCEEDED(hr)) hr = get_known_folder_path_by_id(rfid, lpRegistryPath, 0, &lpSrcPath);
- heap_free(lpRegistryPath); + free(lpRegistryPath);
/* get path to redirection storage */ if(SUCCEEDED(hr)) @@ -3821,8 +3821,8 @@ static ULONG WINAPI knownfolder_Release( if (!refs) { TRACE("destroying %p\n", knownfolder); - heap_free( knownfolder->registryPath ); - heap_free( knownfolder ); + free( knownfolder->registryPath ); + free( knownfolder ); } return refs; } @@ -3880,7 +3880,7 @@ static HRESULT knownfolder_set_id( else { /* This known folder is not registered. To mark it, we set registryPath to NULL */ - heap_free(knownfolder->registryPath); + free(knownfolder->registryPath); knownfolder->registryPath = NULL; hr = S_OK; } @@ -3959,15 +3959,15 @@ static HRESULT get_known_folder_path(
hr = get_known_folder_path(parentGuid, parentRegistryPath, &parentPath); if(FAILED(hr)) { - heap_free(parentRegistryPath); + free(parentRegistryPath); return hr; }
lstrcatW(path, parentPath); lstrcatW(path, L"\");
- heap_free(parentRegistryPath); - heap_free(parentPath); + free(parentRegistryPath); + free(parentPath); }
/* check, if folder was redirected */ @@ -4182,7 +4182,7 @@ static HRESULT knownfolder_create( struct knownfolder **knownfolder ) { struct knownfolder *kf;
- kf = heap_alloc( sizeof(*kf) ); + kf = malloc( sizeof(*kf) ); if (!kf) return E_OUTOFMEMORY;
kf->IKnownFolder_iface.lpVtbl = &knownfolder_vtbl; @@ -4224,8 +4224,8 @@ static ULONG WINAPI foldermanager_Release( if (!refs) { TRACE("destroying %p\n", foldermanager); - heap_free( foldermanager->ids ); - heap_free( foldermanager ); + free( foldermanager->ids ); + free( foldermanager ); } return refs; } @@ -4317,7 +4317,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)); - heap_free(registryPath); + free(registryPath); }
if(SUCCEEDED(hr)) @@ -4377,7 +4377,7 @@ static HRESULT WINAPI foldermanager_GetFolderByName( if (FAILED( hr )) return hr;
hr = get_known_folder_wstr( path, L"Name", &name ); - heap_free( path ); + free( path ); if (FAILED( hr )) return hr;
found = !wcsicmp( pszCanonicalName, name ); @@ -4451,7 +4451,7 @@ static HRESULT register_folder(const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFI SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath); }
- heap_free(registryPath); + free(registryPath); return hr; }
@@ -4477,7 +4477,7 @@ static HRESULT WINAPI foldermanager_UnregisterFolder( if(SUCCEEDED(hr)) hr = HRESULT_FROM_WIN32(SHDeleteKeyW(HKEY_LOCAL_MACHINE, registryPath));
- heap_free(registryPath); + free(registryPath); return hr; }
@@ -4535,7 +4535,7 @@ static HRESULT foldermanager_create( void **ppv ) UINT i, j; struct foldermanager *fm;
- fm = heap_alloc( sizeof(*fm) ); + fm = malloc( sizeof(*fm) ); if (!fm) return E_OUTOFMEMORY;
fm->IKnownFolderManager_iface.lpVtbl = &foldermanager_vtbl; @@ -4546,10 +4546,10 @@ static HRESULT foldermanager_create( void **ppv ) { if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++; } - fm->ids = heap_alloc( fm->num_ids * sizeof(KNOWNFOLDERID) ); + fm->ids = malloc( fm->num_ids * sizeof(KNOWNFOLDERID) ); if (!fm->ids) { - heap_free( fm ); + free( fm ); return E_OUTOFMEMORY; } for (i = j = 0; i < ARRAY_SIZE(CSIDL_Data); i++) diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index 32de9ab6ef1..54828f99acc 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -807,7 +807,7 @@ static void get_display_name( WCHAR dest[MAX_PATH], const WCHAR *path, LPCITEMID if (!is_unix) { len = WideCharToMultiByte( CP_UNIXCP, 0, path + 8, -1, NULL, 0, NULL, NULL ); - buffer = heap_alloc( len ); + buffer = malloc( len ); len = WideCharToMultiByte( CP_UNIXCP, 0, path + 8, -1, buffer, len, NULL, NULL ); for (i = 0; i < len; i++) if (buffer[i] == '\') buffer[i] = '/'; if ((res = wine_get_dos_file_name( buffer ))) @@ -1232,7 +1232,7 @@ static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, const LPCITEMIDLIS int i;
iPathLen = lstrlenW(wszBasePath); - wszPathsList = heap_alloc(MAX_PATH*sizeof(WCHAR)*cidl+1); + wszPathsList = malloc(MAX_PATH * sizeof(WCHAR) * cidl + 1); wszListPos = wszPathsList;
for (i = 0; i < cidl; i++) { @@ -1310,7 +1310,7 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
wszCurrentPath += lstrlenW(wszCurrentPath)+1; } - heap_free(wszPathsList); + free(wszPathsList); return ret; }
@@ -1360,7 +1360,7 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, WARN("Copy failed\n"); ret = E_FAIL; } - heap_free(wszSrcPathsList); + free(wszSrcPathsList); } SHFree(pidl); IPersistFolder2_Release(ppf2); diff --git a/dlls/shell32/shfldr_netplaces.c b/dlls/shell32/shfldr_netplaces.c index 0a48a000bcd..e478da77c32 100644 --- a/dlls/shell32/shfldr_netplaces.c +++ b/dlls/shell32/shfldr_netplaces.c @@ -88,7 +88,7 @@ HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid, if (pUnkOuter) return CLASS_E_NOAGGREGATION;
- sf = heap_alloc_zero (sizeof (*sf)); + sf = calloc (1, sizeof (*sf)); if (!sf) return E_OUTOFMEMORY;
@@ -164,7 +164,7 @@ static ULONG WINAPI ISF_NetworkPlaces_fnRelease (IShellFolder2 * iface) if (!refCount) { TRACE ("-- destroying IShellFolder(%p)\n", This); SHFree (This->pidlRoot); - heap_free (This); + free (This); } return refCount; } diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index 43e965ca7d5..ae61c923037 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -379,7 +379,7 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) if (!got_path) total += 5; /* we need to create PATH */ total++; /* terminating null */
- if (!(new_env = heap_alloc( total * sizeof(WCHAR) ))) + if (!(new_env = malloc( total * sizeof(WCHAR) ))) { FreeEnvironmentStringsW( strings ); return NULL; @@ -913,7 +913,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec SHELL_ArgifyW(static_res, ARRAY_SIZE(static_res), exec, lpFile, pidl, szCommandline, &resultLen); if (resultLen > ARRAY_SIZE(static_res)) { - res = dynamic_res = heap_alloc(resultLen * sizeof(WCHAR)); + res = dynamic_res = malloc(resultLen * sizeof(WCHAR)); SHELL_ArgifyW(dynamic_res, resultLen, exec, lpFile, pidl, szCommandline, NULL); } else @@ -929,11 +929,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 = heap_alloc(lenA); + char *resA = malloc(lenA); WideCharToMultiByte(CP_ACP, 0, res, -1, resA, lenA, NULL, NULL); hDdeData = DdeClientTransaction( (LPBYTE)resA, lenA, hConv, 0L, 0, XTYP_EXECUTE, 10000, &tid ); - heap_free(resA); + free(resA); } if (hDdeData) DdeFreeDataHandle(hDdeData); @@ -941,7 +941,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec WARN("DdeClientTransaction failed with error %04x\n", DdeGetLastError(ddeInst)); ret = 33;
- heap_free(dynamic_res); + free(dynamic_res);
DdeDisconnect(hConv);
@@ -1113,7 +1113,7 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei ) if ( r == ERROR_SUCCESS && type == REG_SZ ) { sz += sizeof (WCHAR); - cls = heap_alloc( sz ); + cls = malloc( sz ); cls[0] = 0; RegQueryValueExW( hkey, NULL, 0, &type, (LPBYTE) cls, &sz ); } @@ -1128,7 +1128,7 @@ static HKEY ShellExecute_GetClassKey( const SHELLEXECUTEINFOW *sei ) if ( lpClass ) RegOpenKeyW( HKEY_CLASSES_ROOT, lpClass, &hkey );
- heap_free( cls ); + free( cls );
return hkey; } @@ -1448,7 +1448,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 = heap_alloc(len * sizeof(WCHAR)); + wszQuotedCmd = malloc(len * sizeof(WCHAR)); /* Must quote to handle case where cmd contains spaces, * else security hole if malicious user creates executable file "C:\Program" */ @@ -1464,7 +1464,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); - heap_free(wszQuotedCmd); + free(wszQuotedCmd); return retval; }
@@ -1489,7 +1489,7 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI len += lstrlenW(psei->lpVerb); else len += lstrlenW(L"open"); - lpstrProtocol = heap_alloc(len * sizeof(WCHAR)); + lpstrProtocol = malloc(len * sizeof(WCHAR)); memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR)); lpstrProtocol[iSize] = '\0'; lstrcatW(lpstrProtocol, L"\shell\"); @@ -1498,7 +1498,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); - heap_free(lpstrProtocol); + free(lpstrProtocol); return retval; }
@@ -1523,13 +1523,13 @@ static WCHAR *expand_environment( const WCHAR *str ) len = ExpandEnvironmentStringsW(str, NULL, 0); if (!len) return NULL;
- buf = heap_alloc(len * sizeof(WCHAR)); + buf = malloc(len * sizeof(WCHAR)); if (!buf) return NULL;
len = ExpandEnvironmentStringsW(str, buf, len); if (!len) { - heap_free(buf); + free(buf); return NULL; } return buf; @@ -1572,13 +1572,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) /* make copies of all path/command strings */ if (!sei_tmp.lpFile) { - wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); + wszApplicationName = malloc(dwApplicationNameLen * sizeof(WCHAR)); *wszApplicationName = '\0'; } else if (*sei_tmp.lpFile == '"' && sei_tmp.lpFile[(len = lstrlenW(sei_tmp.lpFile))-1] == '"') { if(len-1 >= dwApplicationNameLen) dwApplicationNameLen = len; - wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); + wszApplicationName = malloc(dwApplicationNameLen * sizeof(WCHAR)); memcpy(wszApplicationName, sei_tmp.lpFile+1, len*sizeof(WCHAR)); if(len > 2) wszApplicationName[len-2] = '\0'; @@ -1586,7 +1586,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) } else { DWORD l = lstrlenW(sei_tmp.lpFile)+1; if(l > dwApplicationNameLen) dwApplicationNameLen = l+1; - wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); + wszApplicationName = malloc(dwApplicationNameLen * sizeof(WCHAR)); memcpy(wszApplicationName, sei_tmp.lpFile, l*sizeof(WCHAR)); }
@@ -1596,7 +1596,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) len = lstrlenW(sei_tmp.lpParameters) + 1; if (len > parametersLen) { - wszParameters = heap_alloc(len * sizeof(WCHAR)); + wszParameters = malloc(len * sizeof(WCHAR)); parametersLen = len; } lstrcpyW(wszParameters, sei_tmp.lpParameters); @@ -1609,7 +1609,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) { len = lstrlenW(sei_tmp.lpDirectory) + 1; if (len > ARRAY_SIZE(dirBuffer)) - wszDir = heap_alloc(len * sizeof(WCHAR)); + wszDir = malloc(len * sizeof(WCHAR)); lstrcpyW(wszDir, sei_tmp.lpDirectory); } else @@ -1639,11 +1639,11 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) IShellExecuteHookW_Release(pSEH);
if (hr == S_OK) { - heap_free(wszApplicationName); + free(wszApplicationName); if (wszParameters != parametersBuffer) - heap_free(wszParameters); + free(wszParameters); if (wszDir != dirBuffer) - heap_free(wszDir); + free(wszDir); return TRUE; } } @@ -1662,7 +1662,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) retval = SE_ERR_OOM; goto end; } - heap_free(wszApplicationName); + free(wszApplicationName); sei_tmp.lpFile = wszApplicationName = tmp;
tmp = expand_environment(sei_tmp.lpDirectory); @@ -1672,18 +1672,18 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) goto end; } if (wszDir != dirBuffer) - heap_free(wszDir); + free(wszDir); sei_tmp.lpDirectory = wszDir = tmp; }
if ( ERROR_SUCCESS == ShellExecute_FromContextMenu( &sei_tmp ) ) { sei->hInstApp = (HINSTANCE) 33; - heap_free(wszApplicationName); + free(wszApplicationName); if (wszParameters != parametersBuffer) - heap_free(wszParameters); + free(wszParameters); if (wszDir != dirBuffer) - heap_free(wszDir); + 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); - heap_free(wszApplicationName); + free(wszApplicationName); if (wszParameters != parametersBuffer) - heap_free(wszParameters); + free(wszParameters); if (wszDir != dirBuffer) - heap_free(wszDir); + free(wszDir); return retval > 32; }
@@ -1717,14 +1717,14 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) DWORD size;
size = MAX_PATH; - buf = heap_alloc(size * sizeof(WCHAR)); + buf = malloc(size * sizeof(WCHAR)); if (!buf || FAILED(PathCreateFromUrlW(sei_tmp.lpFile, buf, &size, 0))) { - heap_free(buf); + free(buf); retval = SE_ERR_OOM; goto end; }
- heap_free(wszApplicationName); + free(wszApplicationName); wszApplicationName = buf; sei_tmp.lpFile = wszApplicationName; } @@ -1734,10 +1734,10 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) if (len>0) { LPWSTR buf; - buf = heap_alloc((len + 1) * sizeof(WCHAR)); + buf = malloc((len + 1) * sizeof(WCHAR));
ExpandEnvironmentStringsW(sei_tmp.lpFile, buf, len + 1); - heap_free(wszApplicationName); + free(wszApplicationName); wszApplicationName = buf;
sei_tmp.lpFile = wszApplicationName; @@ -1751,10 +1751,10 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) { LPWSTR buf; len++; - buf = heap_alloc(len * sizeof(WCHAR)); + buf = malloc(len * sizeof(WCHAR)); ExpandEnvironmentStringsW(sei_tmp.lpDirectory, buf, len); if (wszDir != dirBuffer) - heap_free(wszDir); + free(wszDir); wszDir = buf; sei_tmp.lpDirectory = wszDir; } @@ -1769,7 +1769,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) len += 1 + lstrlenW(wszParameters); if (len > wcmdLen) { - wcmd = heap_alloc(len * sizeof(WCHAR)); + wcmd = malloc(len * sizeof(WCHAR)); wcmdLen = len; } lstrcpyW(wcmd, wszApplicationName); @@ -1785,13 +1785,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) wszApplicationName, NULL, &sei_tmp, sei, execfunc ); if (retval > 32) { - heap_free(wszApplicationName); + free(wszApplicationName); if (wszParameters != parametersBuffer) - heap_free(wszParameters); + free(wszParameters); if (wszDir != dirBuffer) - heap_free(wszDir); + free(wszDir); if (wcmd != wcmdBuffer) - heap_free(wcmd); + free(wcmd); return TRUE; }
@@ -1803,12 +1803,12 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) retval = SHELL_quote_and_execute( wcmd, wszParameters, wszKeyname, wszApplicationName, env, &sei_tmp, sei, execfunc ); - heap_free( env ); + free( env ); } else if (PathIsDirectoryW(lpFile)) { WCHAR wExec[MAX_PATH]; - WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (lstrlenW(lpFile) + 3) ); + WCHAR * lpQuotedFile = malloc( sizeof(WCHAR) * (lstrlenW(lpFile) + 3) );
if (lpQuotedFile) { @@ -1824,9 +1824,9 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) wszKeyname, wszApplicationName, env, &sei_tmp, sei, execfunc ); - heap_free( env ); + free( env ); } - heap_free( lpQuotedFile ); + free( lpQuotedFile ); } else retval = 0; /* Out of memory */ @@ -1848,13 +1848,13 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) end: TRACE("retval %Iu\n", retval);
- heap_free(wszApplicationName); + free(wszApplicationName); if (wszParameters != parametersBuffer) - heap_free(wszParameters); + free(wszParameters); if (wszDir != dirBuffer) - heap_free(wszDir); + free(wszDir); if (wcmd != wcmdBuffer) - heap_free(wcmd); + free(wcmd);
sei->hInstApp = (HINSTANCE)(retval > 32 ? 33 : retval);
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index 17a8e7046c7..b4a941187ab 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -316,7 +316,7 @@ static DWORD SHELL32_AnsiToUnicodeBuf(LPCSTR aPath, LPWSTR *wPath, DWORD minChar if (len < minChars) len = minChars;
- *wPath = heap_alloc(len * sizeof(WCHAR)); + *wPath = malloc(len * sizeof(WCHAR)); if (*wPath) { MultiByteToWideChar(CP_ACP, 0, aPath, -1, *wPath, len); @@ -395,7 +395,7 @@ static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec) if (!retCode) { retCode = SHNotifyCreateDirectoryW(wPath, sec); - heap_free(wPath); + free(wPath); } return retCode; } @@ -449,7 +449,7 @@ static DWORD SHNotifyRemoveDirectoryA(LPCSTR path) if (!retCode) { retCode = SHNotifyRemoveDirectoryW(wPath); - heap_free(wPath); + free(wPath); } return retCode; } @@ -513,7 +513,7 @@ static DWORD SHNotifyDeleteFileA(LPCSTR path) if (!retCode) { retCode = SHNotifyDeleteFileW(wPath); - heap_free(wPath); + free(wPath); } return retCode; } @@ -709,7 +709,7 @@ int WINAPI SHCreateDirectoryExA(HWND hWnd, LPCSTR path, LPSECURITY_ATTRIBUTES se if (!retCode) { retCode = SHCreateDirectoryExW(hWnd, wPath, sec); - heap_free(wPath); + free(wPath); } return retCode; } @@ -881,12 +881,12 @@ int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp) if (retCode == ERROR_ACCESS_DENIED && (GetVersion() & 0x80000000)) retCode = S_OK;
- heap_free(ForFree); /* we cannot use wString, it was changed */ + free(ForFree); /* we cannot use wString, it was changed */ break; } else { - wString = ForFree = heap_alloc(size * sizeof(WCHAR)); + wString = ForFree = malloc(size * sizeof(WCHAR)); if (ForFree) continue; retCode = ERROR_OUTOFMEMORY; nFileOp.fAnyOperationsAborted = TRUE; @@ -925,8 +925,7 @@ typedef struct
static inline void grow_list(FILE_LIST *list) { - FILE_ENTRY *new = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, list->feFiles, - list->num_alloc * 2 * sizeof(*new) ); + FILE_ENTRY *new = _recalloc(list->feFiles, list->num_alloc * 2, sizeof(*new)); list->feFiles = new; list->num_alloc *= 2; } @@ -938,18 +937,18 @@ static void add_file_to_entry(FILE_ENTRY *feFile, LPCWSTR szFile) DWORD dwLen = lstrlenW(szFile) + 1; LPCWSTR ptr;
- feFile->szFullPath = heap_alloc(dwLen * sizeof(WCHAR)); + feFile->szFullPath = malloc(dwLen * sizeof(WCHAR)); lstrcpyW(feFile->szFullPath, szFile);
ptr = StrRChrW(szFile, NULL, '\'); if (ptr) { dwLen = ptr - szFile + 1; - feFile->szDirectory = heap_alloc(dwLen * sizeof(WCHAR)); + feFile->szDirectory = malloc(dwLen * sizeof(WCHAR)); lstrcpynW(feFile->szDirectory, szFile, dwLen);
dwLen = lstrlenW(feFile->szFullPath) - dwLen + 1; - feFile->szFilename = heap_alloc(dwLen * sizeof(WCHAR)); + feFile->szFilename = malloc(dwLen * sizeof(WCHAR)); lstrcpyW(feFile->szFilename, ptr + 1); /* skip over backslash */ } feFile->bFromWildcard = FALSE; @@ -965,7 +964,7 @@ static LPWSTR wildcard_to_file(LPCWSTR szWildCard, LPCWSTR szFileName) dwDirLen = ptr - szWildCard + 1;
dwFullLen = dwDirLen + lstrlenW(szFileName) + 1; - szFullPath = heap_alloc(dwFullLen * sizeof(WCHAR)); + szFullPath = malloc(dwFullLen * sizeof(WCHAR));
lstrcpynW(szFullPath, szWildCard, dwDirLen + 1); lstrcatW(szFullPath, szFileName); @@ -993,7 +992,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; - heap_free(szFullPath); + free(szFullPath); }
FindClose(hFile); @@ -1019,8 +1018,8 @@ static HRESULT parse_file_list(FILE_LIST *flList, LPCWSTR szFiles) /* empty list */ if (!szFiles[0]) return ERROR_ACCESS_DENIED; - - flList->feFiles = heap_alloc_zero(flList->num_alloc * sizeof(FILE_ENTRY)); + + flList->feFiles = calloc(flList->num_alloc, sizeof(FILE_ENTRY));
while (*ptr) { @@ -1077,12 +1076,12 @@ static void destroy_file_list(FILE_LIST *flList)
for (i = 0; i < flList->dwNumFiles; i++) { - heap_free(flList->feFiles[i].szDirectory); - heap_free(flList->feFiles[i].szFilename); - heap_free(flList->feFiles[i].szFullPath); + free(flList->feFiles[i].szDirectory); + free(flList->feFiles[i].szFilename); + free(flList->feFiles[i].szFullPath); }
- heap_free(flList->feFiles); + free(flList->feFiles); }
static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWSTR szDestPath) @@ -1211,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++) { - heap_free(flTo->feFiles[i].szDirectory); - heap_free(flTo->feFiles[i].szFilename); - heap_free(flTo->feFiles[i].szFullPath); + free(flTo->feFiles[i].szDirectory); + free(flTo->feFiles[i].szFilename); + free(flTo->feFiles[i].szFullPath); }
flTo->dwNumFiles = 1; @@ -1751,7 +1750,7 @@ HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path len = 1; else len = last_slash - path + 1; - temppath = heap_alloc(len * sizeof(WCHAR)); + temppath = malloc(len * sizeof(WCHAR)); if (!temppath) return E_OUTOFMEMORY; StrCpyNW(temppath, path, len); @@ -1774,7 +1773,7 @@ HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path /* check if we can access the directory */ res = GetFileAttributesW(realpath);
- heap_free(temppath); + free(temppath);
if (res == INVALID_FILE_ATTRIBUTES) { @@ -1849,7 +1848,7 @@ static ULONG WINAPI file_operation_Release(IFileOperation *iface)
if (!ref) { - HeapFree(GetProcessHeap(), 0, operation); + free(operation); }
return ref; @@ -2033,7 +2032,7 @@ HRESULT WINAPI IFileOperation_Constructor(IUnknown *outer, REFIID riid, void **o struct file_operation *object; HRESULT hr;
- object = heap_alloc_zero(sizeof(*object)); + object = calloc(1, sizeof(*object)); if (!object) return E_OUTOFMEMORY;
diff --git a/dlls/shell32/shlfsbind.c b/dlls/shell32/shlfsbind.c index a71c0f82037..75441d01bce 100644 --- a/dlls/shell32/shlfsbind.c +++ b/dlls/shell32/shlfsbind.c @@ -90,7 +90,7 @@ static ULONG WINAPI FileSystemBindData_Release(IFileSystemBindData *iface) TRACE("(%p)->(%lu)\n", This, ref);
if (!ref) - heap_free(This); + free(This);
return ref; } @@ -141,7 +141,7 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data
*ppV = NULL;
- This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY;
This->IFileSystemBindData_iface.lpVtbl = &FileSystemBindDataVtbl; @@ -163,6 +163,6 @@ HRESULT WINAPI IFileSystemBindData_Constructor(const WIN32_FIND_DATAW *find_data IFileSystemBindData_Release(&This->IFileSystemBindData_iface); } else - heap_free(This); + free(This); return ret; } diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c index 8a8e7127359..85ca417a623 100644 --- a/dlls/shell32/shlmenu.c +++ b/dlls/shell32/shlmenu.c @@ -213,7 +213,7 @@ static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl) MENUINFO MenuInfo; HMENU hMenuPopup = CreatePopupMenu();
- lpFmMi = heap_alloc_zero(sizeof(*lpFmMi)); + lpFmMi = calloc(1, sizeof(*lpFmMi));
lpFmMi->pidl = ILCombine(pidl, pidlTemp); lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS; @@ -283,7 +283,7 @@ HMENU WINAPI FileMenu_Create ( TRACE("0x%08lx 0x%08x %p 0x%08x 0x%08x hMenu=%p\n", crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
- menudata = heap_alloc_zero(sizeof(*menudata)); + menudata = calloc(1, sizeof(*menudata)); menudata->crBorderColor = crBorderColor; menudata->nBorderWidth = nBorderWidth; menudata->hBorderBmp = hBorderBmp; @@ -313,7 +313,7 @@ void WINAPI FileMenu_Destroy (HMENU hmenu) menudata = FM_GetMenuInfo(hmenu);
SHFree( menudata->pidl); - heap_free(menudata); + free(menudata);
DestroyMenu (hmenu); } @@ -416,11 +416,11 @@ BOOL WINAPI FileMenu_AppendItemAW( else { DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 ); - LPWSTR lpszText = heap_alloc( len*sizeof(WCHAR) ); + WCHAR *lpszText = malloc(len * sizeof(WCHAR)); if (!lpszText) return FALSE; MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len ); ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight); - heap_free( lpszText ); + free(lpszText); }
return ret; @@ -1040,22 +1040,22 @@ static HRESULT CompositeCMenu_Constructor(IContextMenu **menus,UINT menu_count,
TRACE("(%p,%u,%s,%p)\n",menus,menu_count,shdebugstr_guid(riid),ppv);
- ret = heap_alloc(sizeof(*ret)); + ret = malloc(sizeof(*ret)); if(!ret) return E_OUTOFMEMORY; ret->IContextMenu3_iface.lpVtbl = &CompositeCMenuVtbl; ret->menu_count = menu_count; - ret->menus = heap_alloc(menu_count*sizeof(IContextMenu*)); + ret->menus = malloc(menu_count * sizeof(IContextMenu*)); if(!ret->menus) { - heap_free(ret); + free(ret); return E_OUTOFMEMORY; } - ret->offsets = heap_alloc_zero(menu_count*sizeof(UINT)); + ret->offsets = calloc(menu_count, sizeof(UINT)); if(!ret->offsets) { - heap_free(ret->menus); - heap_free(ret); + free(ret->menus); + free(ret); return E_OUTOFMEMORY; } ret->refCount=0; @@ -1070,9 +1070,9 @@ static void CompositeCMenu_Destroy(CompositeCMenu *This) UINT i; for(i=0;i<This->menu_count;i++) IContextMenu_Release(This->menus[i]); - heap_free(This->menus); - heap_free(This->offsets); - heap_free(This); + free(This->menus); + free(This->offsets); + free(This); }
static HRESULT WINAPI CompositeCMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, void **ppv) diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 4b802df1029..d6b917496c2 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -1577,7 +1577,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn }
/* allocate memory for the pidl array */ - pItems = heap_alloc(sizeof(LPITEMIDLIST) * count); + pItems = malloc(sizeof(ITEMIDLIST*) * count);
/* retrieve all selected items */ i = 0; @@ -1603,7 +1603,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn ISFHelper_Release(psfhlp);
/* free pidl array memory */ - heap_free(pItems); + free(pItems); } break;
@@ -1825,7 +1825,7 @@ static ULONG WINAPI IShellView_fnRelease(IShellView3 *iface) if(This->pAdvSink) IAdviseSink_Release(This->pAdvSink);
- heap_free(This); + free(This); } return refCount; } @@ -3756,7 +3756,7 @@ IShellView *IShellView_Constructor(IShellFolder *folder) { IShellViewImpl *sv;
- sv = heap_alloc_zero(sizeof(*sv)); + sv = calloc(1, sizeof(*sv)); if (!sv) return NULL;
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c index 87d25794898..181ff36787e 100644 --- a/dlls/shell32/shlview_cmenu.c +++ b/dlls/shell32/shlview_cmenu.c @@ -37,7 +37,6 @@ #include "shresdef.h" #include "shlwapi.h"
-#include "wine/heap.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -135,7 +134,7 @@ static ULONG WINAPI ContextMenu_Release(IContextMenu3 *iface) SHFree(This->pidl); _ILFreeaPidl(This->apidl, This->cidl);
- heap_free(This); + free(This); }
return ref; @@ -366,7 +365,7 @@ static BOOL get_program_description(WCHAR *path, WCHAR *buffer, DWORD size) versize = GetFileVersionInfoSizeW(path, NULL); if (!versize) return FALSE;
- data = heap_alloc(versize); + data = malloc(versize); if (!data) return FALSE;
if (!GetFileVersionInfoW(path, 0, versize, data)) @@ -390,7 +389,7 @@ static BOOL get_program_description(WCHAR *path, WCHAR *buffer, DWORD size) }
out: - heap_free(data); + free(data); return ret; }
@@ -566,7 +565,7 @@ static UINT CALLBACK file_properties_callback(HWND hwnd, UINT uMsg, LPPROPSHEETP struct file_properties_info *props = (struct file_properties_info *)page->lParam; if (uMsg == PSPCB_RELEASE) { - heap_free(props); + free(props); } return 1; } @@ -581,7 +580,7 @@ static void init_file_properties_pages(IDataObject *dataobject, LPFNADDPROPSHEET HRESULT hr; WCHAR *p;
- props = heap_alloc(sizeof(*props)); + props = malloc(sizeof(*props)); if (!props) return;
format.cfFormat = CF_HDROP; @@ -632,7 +631,7 @@ static void init_file_properties_pages(IDataObject *dataobject, LPFNADDPROPSHEET return;
error: - heap_free(props); + free(props); }
#define MAX_PROP_PAGES 99 @@ -1014,7 +1013,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC HRESULT hr; UINT i;
- This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl; @@ -1437,7 +1436,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri ContextMenu *This; HRESULT hr;
- This = heap_alloc(sizeof(*This)); + This = malloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl; diff --git a/dlls/shell32/systray.c b/dlls/shell32/systray.c index a1a2fb05537..78717cfcdca 100644 --- a/dlls/shell32/systray.c +++ b/dlls/shell32/systray.c @@ -31,7 +31,6 @@ #include "shell32_main.h"
#include "wine/debug.h" -#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(systray);
@@ -182,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 = heap_alloc(cds.cbData); + buffer = malloc(cds.cbData); if (!buffer) { DeleteObject(iconinfo.hbmMask); @@ -243,7 +242,7 @@ noicon:
cds.lpData = data; ret = SendMessageW(tray, WM_COPYDATA, (WPARAM)nid->hWnd, (LPARAM)&cds); - if (data != &data_buffer) heap_free( data ); + if (data != &data_buffer) free(data); SetLastError(ret ? S_OK : E_FAIL); return ret; }