Nikolay Sivov : shell32: Do not use SHGetMalloc() internally.
Alexandre Julliard
julliard at winehq.org
Mon Jan 27 15:00:22 CST 2020
Module: wine
Branch: master
Commit: 84e06f228973e5dc7b79803d8f3b2a251006bda9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=84e06f228973e5dc7b79803d8f3b2a251006bda9
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Jan 27 11:37:17 2020 +0300
shell32: Do not use SHGetMalloc() internally.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/shell32/shelllink.c | 4 +---
dlls/shell32/shellord.c | 27 ++++++++++-----------------
2 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 0dfb81c6e7..5b044d4be1 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -405,7 +405,6 @@ static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLEST
static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *filename)
{
IShellLinkImpl *This = impl_from_IPersistFile(iface);
- IMalloc *pMalloc;
TRACE("(%p)->(%p)\n", This, filename);
@@ -415,8 +414,7 @@ static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *f
return S_FALSE;
}
- SHGetMalloc(&pMalloc);
- *filename = IMalloc_Alloc(pMalloc, (strlenW(This->filepath)+1)*sizeof(WCHAR));
+ *filename = CoTaskMemAlloc((strlenW(This->filepath) + 1) * sizeof(WCHAR));
if (!*filename) return E_OUTOFMEMORY;
strcpyW(*filename, This->filepath);
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index b04a56e783..e1262accdd 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -760,7 +760,6 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
CHAR link_dir[MAX_PATH];
CHAR new_lnk_filepath[MAX_PATH];
CHAR new_lnk_name[MAX_PATH];
- IMalloc *ppM;
LPITEMIDLIST pidl;
HWND hwnd = 0; /* FIXME: get real window handle */
INT ret;
@@ -815,24 +814,18 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
/* Get path to user's "Recent" directory
*/
- if(SUCCEEDED(SHGetMalloc(&ppM))) {
- if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT,
- &pidl))) {
- SHGetPathFromIDListA(pidl, link_dir);
- IMalloc_Free(ppM, pidl);
- }
- else {
- /* serious issues */
- link_dir[0] = 0;
- ERR("serious issues 1\n");
- }
- IMalloc_Release(ppM);
+ if (SUCCEEDED(SHGetSpecialFolderLocation(hwnd, CSIDL_RECENT, &pidl)))
+ {
+ SHGetPathFromIDListA(pidl, link_dir);
+ ILFree(pidl);
}
- else {
- /* serious issues */
- link_dir[0] = 0;
- ERR("serious issues 2\n");
+ else
+ {
+ /* serious issues */
+ link_dir[0] = 0;
+ ERR("serious issues 1\n");
}
+
TRACE("Users Recent dir %s\n", link_dir);
/* If no input, then go clear the lists */
More information about the wine-cvs
mailing list