No need for ATL

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2738 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-07-18 13:05:53 +00:00
parent e971cc9b40
commit 21d0160dba

View file

@ -9,8 +9,6 @@
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <shlobj.h> #include <shlobj.h>
#include <atlbase.h>
#include <stdio.h>
#include <commdlg.h> #include <commdlg.h>
#include <cderr.h> #include <cderr.h>
#include "resource.h" #include "resource.h"
@ -269,15 +267,14 @@ bool BrowseForFolder(int nControlIdx) {
LPSHELLFOLDER sf; LPSHELLFOLDER sf;
ULONG eaten; ULONG eaten;
LPITEMIDLIST root; LPITEMIDLIST root;
#define _alloca MALLOC int ccRoot = (lstrlen(pFields[nControlIdx].pszRoot) * 2) + 2;
USES_CONVERSION; LPWSTR pwszRoot = (LPWSTR) MALLOC(ccRoot);
LPOLESTR s = A2OLE(pFields[nControlIdx].pszRoot); MultiByteToWideChar(CP_ACP, 0, pFields[nControlIdx].pszRoot, -1, pwszRoot, ccRoot);
#undef _alloca
SHGetDesktopFolder(&sf); SHGetDesktopFolder(&sf);
sf->ParseDisplayName(hConfigWindow, NULL, (unsigned short *)s, &eaten, &root, NULL); sf->ParseDisplayName(hConfigWindow, NULL, pwszRoot, &eaten, &root, NULL);
bi.pidlRoot = root; bi.pidlRoot = root;
sf->Release(); sf->Release();
FREE(s); FREE(pwszRoot);
} }
// CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); // CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
LPITEMIDLIST pResult = SHBrowseForFolder(&bi); LPITEMIDLIST pResult = SHBrowseForFolder(&bi);