Commit 725c0261 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comdlg32: Use shell API directly.

parent 8bbb32c9
...@@ -206,19 +206,7 @@ void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText) DECLSPEC_HIDD ...@@ -206,19 +206,7 @@ void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText) DECLSPEC_HIDD
extern BOOL GetFileName31A( OPENFILENAMEA *lpofn, UINT dlgType ) DECLSPEC_HIDDEN; extern BOOL GetFileName31A( OPENFILENAMEA *lpofn, UINT dlgType ) DECLSPEC_HIDDEN;
extern BOOL GetFileName31W( OPENFILENAMEW *lpofn, UINT dlgType ) DECLSPEC_HIDDEN; extern BOOL GetFileName31W( OPENFILENAMEW *lpofn, UINT dlgType ) DECLSPEC_HIDDEN;
/* ITEMIDLIST */
extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST);
extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST);
extern LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST);
extern BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST);
extern BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST);
extern UINT (WINAPI *COMDLG32_PIDL_ILGetSize)(LPCITEMIDLIST);
/* SHELL */ /* SHELL */
extern LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD);
extern DWORD (WINAPI *COMDLG32_SHFree)(LPVOID);
extern BOOL (WINAPI *COMDLG32_SHGetFolderPathW)(HWND,int,HANDLE,DWORD,LPWSTR);
extern LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID); extern LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID);
#define ONOPEN_BROWSE 1 #define ONOPEN_BROWSE 1
......
...@@ -44,20 +44,8 @@ DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance = 0; ...@@ -44,20 +44,8 @@ DECLSPEC_HIDDEN HINSTANCE COMDLG32_hInstance = 0;
static DWORD COMDLG32_TlsIndex = TLS_OUT_OF_INDEXES; static DWORD COMDLG32_TlsIndex = TLS_OUT_OF_INDEXES;
static HINSTANCE SHELL32_hInstance; static HINSTANCE SHELL32_hInstance;
static HINSTANCE SHFOLDER_hInstance;
/* ITEMIDLIST */
LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILClone) (LPCITEMIDLIST) DECLSPEC_HIDDEN;
LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILCombine)(LPCITEMIDLIST,LPCITEMIDLIST) DECLSPEC_HIDDEN;
LPITEMIDLIST (WINAPI *COMDLG32_PIDL_ILGetNext)(LPITEMIDLIST) DECLSPEC_HIDDEN;
BOOL (WINAPI *COMDLG32_PIDL_ILRemoveLastID)(LPCITEMIDLIST) DECLSPEC_HIDDEN;
BOOL (WINAPI *COMDLG32_PIDL_ILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST) DECLSPEC_HIDDEN;
UINT (WINAPI *COMDLG32_PIDL_ILGetSize)(LPCITEMIDLIST) DECLSPEC_HIDDEN;
/* SHELL */ /* SHELL */
LPVOID (WINAPI *COMDLG32_SHAlloc)(DWORD) DECLSPEC_HIDDEN;
DWORD (WINAPI *COMDLG32_SHFree)(LPVOID) DECLSPEC_HIDDEN;
BOOL (WINAPI *COMDLG32_SHGetFolderPathW)(HWND,int,HANDLE,DWORD,LPWSTR) DECLSPEC_HIDDEN;
LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID) DECLSPEC_HIDDEN; LPITEMIDLIST (WINAPI *COMDLG32_SHSimpleIDListFromPathAW)(LPCVOID) DECLSPEC_HIDDEN;
/*********************************************************************** /***********************************************************************
...@@ -89,33 +77,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) ...@@ -89,33 +77,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL"); SHELL32_hInstance = GetModuleHandleA("SHELL32.DLL");
/* ITEMIDLIST */
GPA(COMDLG32_PIDL_ILIsEqual, SHELL32_hInstance, (LPCSTR)21L);
GPA(COMDLG32_PIDL_ILCombine, SHELL32_hInstance, (LPCSTR)25L);
GPA(COMDLG32_PIDL_ILGetNext, SHELL32_hInstance, (LPCSTR)153L);
GPA(COMDLG32_PIDL_ILClone, SHELL32_hInstance, (LPCSTR)18L);
GPA(COMDLG32_PIDL_ILRemoveLastID, SHELL32_hInstance, (LPCSTR)17L);
GPA(COMDLG32_PIDL_ILGetSize, SHELL32_hInstance, (LPCSTR)152L);
/* SHELL */ /* SHELL */
GPA(COMDLG32_SHSimpleIDListFromPathAW, SHELL32_hInstance, (LPCSTR)162); GPA(COMDLG32_SHSimpleIDListFromPathAW, SHELL32_hInstance, (LPCSTR)162);
GPA(COMDLG32_SHAlloc, SHELL32_hInstance, (LPCSTR)196L);
GPA(COMDLG32_SHFree, SHELL32_hInstance, (LPCSTR)195L);
/* for the first versions of shell32 SHGetFolderPathW is in SHFOLDER.DLL */
COMDLG32_SHGetFolderPathW = (void*)GetProcAddress(SHELL32_hInstance,"SHGetFolderPathW");
if (!COMDLG32_SHGetFolderPathW)
{
SHFOLDER_hInstance = LoadLibraryA("SHFOLDER.DLL");
GPA(COMDLG32_SHGetFolderPathW, SHFOLDER_hInstance,"SHGetFolderPathW");
}
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (Reserved) break; if (Reserved) break;
if (COMDLG32_TlsIndex != TLS_OUT_OF_INDEXES) TlsFree(COMDLG32_TlsIndex); if (COMDLG32_TlsIndex != TLS_OUT_OF_INDEXES) TlsFree(COMDLG32_TlsIndex);
if(SHFOLDER_hInstance) FreeLibrary(SHFOLDER_hInstance);
break; break;
} }
return TRUE; return TRUE;
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "shlguid.h" #include "shlguid.h"
#include "servprov.h" #include "servprov.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(commdlg); WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
...@@ -155,7 +156,7 @@ static BOOL COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPCITE ...@@ -155,7 +156,7 @@ static BOOL COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPCITE
{ {
case STRRET_WSTR: case STRRET_WSTR:
lstrcpynW(dest, src->u.pOleStr, len); lstrcpynW(dest, src->u.pOleStr, len);
COMDLG32_SHFree(src->u.pOleStr); CoTaskMemFree(src->u.pOleStr);
break; break;
case STRRET_CSTR: case STRRET_CSTR:
...@@ -194,7 +195,7 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner) ...@@ -194,7 +195,7 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner); FileOpenDlgInfos *fodInfos = get_filedlg_infoptr(hwndOwner);
IShellBrowserImpl *sb; IShellBrowserImpl *sb;
sb = COMDLG32_SHAlloc(sizeof(IShellBrowserImpl)); sb = heap_alloc(sizeof(*sb));
/* Initialisation of the member variables */ /* Initialisation of the member variables */
sb->ref=1; sb->ref=1;
...@@ -267,10 +268,8 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface) ...@@ -267,10 +268,8 @@ static ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
TRACE("(%p,%u)\n", This, ref + 1); TRACE("(%p,%u)\n", This, ref + 1);
if (!ref) if (!ref)
{ heap_free(This);
COMDLG32_SHFree(This);
TRACE("-- destroyed\n");
}
return ref; return ref;
} }
...@@ -363,7 +362,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, ...@@ -363,7 +362,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
return hRes; return hRes;
} }
/* create an absolute pidl */ /* create an absolute pidl */
pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent, pidl); pidlTmp = ILCombine(fodInfos->ShellInfos.pidlAbsCurrent, pidl);
} }
else if(wFlags & SBSP_PARENT) else if(wFlags & SBSP_PARENT)
{ {
...@@ -375,7 +374,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, ...@@ -375,7 +374,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
else /* SBSP_ABSOLUTE is 0x0000 */ else /* SBSP_ABSOLUTE is 0x0000 */
{ {
/* An absolute pidl (relative from the desktop) */ /* An absolute pidl (relative from the desktop) */
pidlTmp = COMDLG32_PIDL_ILClone(pidl); pidlTmp = ILClone(pidl);
psfTmp = GetShellFolderFromPidl(pidlTmp); psfTmp = GetShellFolderFromPidl(pidlTmp);
} }
...@@ -387,10 +386,10 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, ...@@ -387,10 +386,10 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
/* If the pidl to browse to is equal to the actual pidl ... /* If the pidl to browse to is equal to the actual pidl ...
do nothing and pretend you did it*/ do nothing and pretend you did it*/
if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent)) if (ILIsEqual(pidlTmp, fodInfos->ShellInfos.pidlAbsCurrent))
{ {
IShellFolder_Release(psfTmp); IShellFolder_Release(psfTmp);
COMDLG32_SHFree(pidlTmp); ILFree(pidlTmp);
TRACE("keep current folder\n"); TRACE("keep current folder\n");
return NOERROR; return NOERROR;
} }
...@@ -430,7 +429,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, ...@@ -430,7 +429,7 @@ static HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
fodInfos->Shell.FOIShellFolder = psfTmp; fodInfos->Shell.FOIShellFolder = psfTmp;
/* Release old pidlAbsCurrent and update its value */ /* Release old pidlAbsCurrent and update its value */
COMDLG32_SHFree(fodInfos->ShellInfos.pidlAbsCurrent); ILFree(fodInfos->ShellInfos.pidlAbsCurrent);
fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp; fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
COMDLG32_UpdateCurrentDir(fodInfos); COMDLG32_UpdateCurrentDir(fodInfos);
...@@ -784,8 +783,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl ...@@ -784,8 +783,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl
hRes = S_OK; hRes = S_OK;
} }
/* Free memory used by pidl */ ILFree(pidl);
COMDLG32_SHFree(pidl);
return hRes; return hRes;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment