From 08de3671dad84a56f684b319b3986eaaab09e4f8 Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 20 Mar 2007 21:33:28 +0000 Subject: [PATCH] size optimization it's official. even msdn now says SHGetMalloc returns the same allocator CoTaskMemFree uses and a little debugging backs this even on Windows 95 git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5004 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/InstallOptions/InstallerOptions.cpp | 5 +---- Contrib/InstallOptions/SConscript | 1 + Contrib/StartMenu/SConscript | 1 + Contrib/StartMenu/StartMenu.c | 17 +++++------------ 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index 73eca1ad..3cb54f93 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -683,10 +683,7 @@ LRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify) mySetWindowText(pField->hwnd, szBrowsePath); } - LPMALLOC pMalloc; - if (!SHGetMalloc(&pMalloc)) { - pMalloc->Free(pResult); - } + CoTaskMemFree(pResult); break; } diff --git a/Contrib/InstallOptions/SConscript b/Contrib/InstallOptions/SConscript index ab986f1f..b0626120 100644 --- a/Contrib/InstallOptions/SConscript +++ b/Contrib/InstallOptions/SConscript @@ -14,6 +14,7 @@ libs = Split(""" gdi32 shell32 comdlg32 + ole32 """) examples = Split(""" diff --git a/Contrib/StartMenu/SConscript b/Contrib/StartMenu/SConscript index 0251c962..5a1c86f7 100644 --- a/Contrib/StartMenu/SConscript +++ b/Contrib/StartMenu/SConscript @@ -13,6 +13,7 @@ libs = Split(""" user32 gdi32 shell32 + ole32 """) examples = Split(""" diff --git a/Contrib/StartMenu/StartMenu.c b/Contrib/StartMenu/StartMenu.c index d5d26e78..c021668f 100644 --- a/Contrib/StartMenu/StartMenu.c +++ b/Contrib/StartMenu/StartMenu.c @@ -398,20 +398,13 @@ void AddFolderFromReg(int nFolder) //DWORD idx; WIN32_FIND_DATA FileData; HANDLE hSearch; + LPITEMIDLIST ppidl; - LPMALLOC ppMalloc; - if (SHGetMalloc(&ppMalloc) == NOERROR) + buf[0] = 0; + if (SHGetSpecialFolderLocation(hwParent, nFolder, &ppidl) == S_OK) { - LPITEMIDLIST ppidl; - - buf[0] = 0; - if (SHGetSpecialFolderLocation(hwParent, nFolder, &ppidl) == S_OK) - { - SHGetPathFromIDList(ppidl, buf); - ppMalloc->lpVtbl->Free(ppMalloc, ppidl); - } - - ppMalloc->lpVtbl->Release(ppMalloc); + SHGetPathFromIDList(ppidl, buf); + CoTaskMemFree(ppidl); } if (!buf[0])