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
This commit is contained in:
kichik 2007-03-20 21:33:28 +00:00
parent b3310a3170
commit 08de3671da
4 changed files with 8 additions and 16 deletions

View file

@ -683,10 +683,7 @@ LRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify)
mySetWindowText(pField->hwnd, szBrowsePath); mySetWindowText(pField->hwnd, szBrowsePath);
} }
LPMALLOC pMalloc; CoTaskMemFree(pResult);
if (!SHGetMalloc(&pMalloc)) {
pMalloc->Free(pResult);
}
break; break;
} }

View file

@ -14,6 +14,7 @@ libs = Split("""
gdi32 gdi32
shell32 shell32
comdlg32 comdlg32
ole32
""") """)
examples = Split(""" examples = Split("""

View file

@ -13,6 +13,7 @@ libs = Split("""
user32 user32
gdi32 gdi32
shell32 shell32
ole32
""") """)
examples = Split(""" examples = Split("""

View file

@ -398,20 +398,13 @@ void AddFolderFromReg(int nFolder)
//DWORD idx; //DWORD idx;
WIN32_FIND_DATA FileData; WIN32_FIND_DATA FileData;
HANDLE hSearch; HANDLE hSearch;
LPITEMIDLIST ppidl;
LPMALLOC ppMalloc; buf[0] = 0;
if (SHGetMalloc(&ppMalloc) == NOERROR) if (SHGetSpecialFolderLocation(hwParent, nFolder, &ppidl) == S_OK)
{ {
LPITEMIDLIST ppidl; SHGetPathFromIDList(ppidl, buf);
CoTaskMemFree(ppidl);
buf[0] = 0;
if (SHGetSpecialFolderLocation(hwParent, nFolder, &ppidl) == S_OK)
{
SHGetPathFromIDList(ppidl, buf);
ppMalloc->lpVtbl->Free(ppMalloc, ppidl);
}
ppMalloc->lpVtbl->Release(ppMalloc);
} }
if (!buf[0]) if (!buf[0])