Better handling of custom templates and hooks.

Bug fixes.
This commit is contained in:
Juergen Schmied 2000-11-01 01:50:21 +00:00 committed by Alexandre Julliard
parent 697a621a7c
commit ebcc72c925
6 changed files with 811 additions and 620 deletions

File diff suppressed because it is too large Load Diff

View File

@ -17,50 +17,29 @@
#include "debugtools.h"
#include "cdlg.h"
#define INITGUID
#include "initguid.h"
#include "wine/obj_serviceprovider.h"
DEFAULT_DEBUG_CHANNEL(commdlg);
typedef struct
{
ICOM_VTABLE(IShellBrowser) * lpVtbl;
ICOM_VTABLE(ICommDlgBrowser) * lpVtblCommDlgBrowser;
ICOM_VTABLE(IServiceProvider)* lpVtblServiceProvider;
DWORD ref; /* Reference counter */
HWND hwndOwner; /* Owner dialog of the interface */
} IShellBrowserImpl;
/**************************************************************************
* Structure
* vtable
*/
static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown */
IShellBrowserImpl_QueryInterface,
IShellBrowserImpl_AddRef,
IShellBrowserImpl_Release,
/* IOleWindow */
IShellBrowserImpl_GetWindow,
IShellBrowserImpl_ContextSensitiveHelp,
/* IShellBrowser */
IShellBrowserImpl_InsertMenusSB,
IShellBrowserImpl_SetMenuSB,
IShellBrowserImpl_RemoveMenusSB,
IShellBrowserImpl_SetStatusTextSB,
IShellBrowserImpl_EnableModelessSB,
IShellBrowserImpl_TranslateAcceleratorSB,
IShellBrowserImpl_BrowseObject,
IShellBrowserImpl_GetViewStateStream,
IShellBrowserImpl_GetControlWindow,
IShellBrowserImpl_SendControlMsg,
IShellBrowserImpl_QueryActiveShellView,
IShellBrowserImpl_OnViewWindowActive,
IShellBrowserImpl_SetToolbarItems
};
static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown */
IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
IShellBrowserImpl_ICommDlgBrowser_AddRef,
IShellBrowserImpl_ICommDlgBrowser_Release,
/* ICommDlgBrowser */
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
IShellBrowserImpl_ICommDlgBrowser_IncludeObject
};
static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl;
static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl;
static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl;
/**************************************************************************
* Local Prototypes
@ -91,6 +70,47 @@ extern BOOL FILEDLG95_OnOpen(HWND hwnd);
extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
/*
* Helper functions
*/
/* copied from shell32 to avoid linking to it */
static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
{
TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
switch (src->uType)
{
case STRRET_WSTR:
lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
COMDLG32_SHFree(src->u.pOleStr);
break;
case STRRET_CSTRA:
lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
break;
case STRRET_OFFSETA:
if (pidl)
{
lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
}
break;
default:
FIXME("unknown type!\n");
if (len)
{ *(LPSTR)dest = '\0';
}
return(FALSE);
}
return S_OK;
}
/*
* IShellBrowser
*/
/**************************************************************************
* IShellBrowserImpl_Construct
*/
@ -107,8 +127,8 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
/* Initialisation of the vTables */
sb->lpVtbl = &IShellBrowserImpl_Vtbl;
sb->lpVtbl2 = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
sb->lpVtblCommDlgBrowser = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
sb->lpVtblServiceProvider = &IShellBrowserImpl_IServiceProvider_Vtbl;
COMDLG32_SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
&fodInfos->ShellInfos.pidlAbsCurrent);
@ -117,17 +137,6 @@ IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
return (IShellBrowser *) sb;
}
/**************************************************************************
*
*
* The INTERFACE of the IShellBrowser object
*
*/
/*
* IUnknown
*/
/***************************************************************************
* IShellBrowserImpl_QueryInterface
*/
@ -137,7 +146,7 @@ HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
{
ICOM_THIS(IShellBrowserImpl, iface);
TRACE("(%p)\n", This);
TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid));
*ppvObj = NULL;
@ -153,13 +162,18 @@ HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
}
else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
{ *ppvObj = (ICommDlgBrowser*) &(This->lpVtbl2);
{ *ppvObj = (ICommDlgBrowser*) &(This->lpVtblCommDlgBrowser);
}
else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */
{ *ppvObj = (ICommDlgBrowser*) &(This->lpVtblServiceProvider);
}
if(*ppvObj)
{ IUnknown_AddRef( (IShellBrowser*) *ppvObj);
return S_OK;
}
FIXME("Unknown interface requested\n");
return E_NOINTERFACE;
}
@ -296,7 +310,11 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
psfTmp = GetShellFolderFromPidl(pidlTmp);
}
if(!psfTmp) return E_FAIL;
if(!psfTmp)
{
ERR("could not browse to folder\n");
return E_FAIL;
}
/* If the pidl to browse to is equal to the actual pidl ...
do nothing and pretend you did it*/
@ -304,6 +322,7 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
{
IShellFolder_Release(psfTmp);
COMDLG32_SHFree(pidlTmp);
TRACE("keep current folder\n");
return NOERROR;
}
@ -315,8 +334,9 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
}
/* Create the associated view */
TRACE("create view object\n");
if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
&IID_IShellView, (LPVOID *)&psvTmp))) return hRes;
&IID_IShellView, (LPVOID *)&psvTmp))) goto error;
/* Check if listview has focus */
bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
@ -348,7 +368,7 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
TRACE("create view window\n");
if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
&fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
&fodInfos->ShellInfos.rectView, &hwndView))) return hRes;
&fodInfos->ShellInfos.rectView, &hwndView))) goto error;
fodInfos->ShellInfos.hwndView = hwndView;
@ -364,6 +384,9 @@ HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
SetFocus(fodInfos->ShellInfos.hwndView);
return hRes;
error:
ERR("Failed with error 0x%08lx\n", hRes);
return hRes;
}
/**************************************************************************
@ -406,7 +429,7 @@ HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
{
ICOM_THIS(IShellBrowserImpl, iface);
TRACE("(%p)\n", This);
FIXME("(%p 0x%08lx %p)\n", This, grfMode, ppStrm);
/* Feature not implemented */
return E_NOTIMPL;
@ -566,6 +589,34 @@ HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
return E_NOTIMPL;
}
static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown */
IShellBrowserImpl_QueryInterface,
IShellBrowserImpl_AddRef,
IShellBrowserImpl_Release,
/* IOleWindow */
IShellBrowserImpl_GetWindow,
IShellBrowserImpl_ContextSensitiveHelp,
/* IShellBrowser */
IShellBrowserImpl_InsertMenusSB,
IShellBrowserImpl_SetMenuSB,
IShellBrowserImpl_RemoveMenusSB,
IShellBrowserImpl_SetStatusTextSB,
IShellBrowserImpl_EnableModelessSB,
IShellBrowserImpl_TranslateAcceleratorSB,
IShellBrowserImpl_BrowseObject,
IShellBrowserImpl_GetViewStateStream,
IShellBrowserImpl_GetControlWindow,
IShellBrowserImpl_SendControlMsg,
IShellBrowserImpl_QueryActiveShellView,
IShellBrowserImpl_OnViewWindowActive,
IShellBrowserImpl_SetToolbarItems
};
/*
* ICommDlgBrowser
*/
@ -573,9 +624,10 @@ HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
/***************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_QueryInterface
*/
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
REFIID riid,
LPVOID *ppvObj)
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
ICommDlgBrowser *iface,
REFIID riid,
LPVOID *ppvObj)
{
_ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
@ -689,38 +741,6 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *
return NOERROR;
}
/* copied from shell32 to avoid linking to it */
static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
{
TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
switch (src->uType)
{
case STRRET_WSTR:
lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
COMDLG32_SHFree(src->u.pOleStr);
break;
case STRRET_CSTRA:
lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
break;
case STRRET_OFFSETA:
if (pidl)
{
lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
}
break;
default:
FIXME("unknown type!\n");
if (len)
{ *(LPSTR)dest = '\0';
}
return(FALSE);
}
return S_OK;
}
/**************************************************************************
* IShellBrowserImpl_ICommDlgBrowser_IncludeObject
*/
@ -793,3 +813,104 @@ HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IS
return S_OK;
}
static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown */
IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
IShellBrowserImpl_ICommDlgBrowser_AddRef,
IShellBrowserImpl_ICommDlgBrowser_Release,
/* ICommDlgBrowser */
IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
IShellBrowserImpl_ICommDlgBrowser_IncludeObject
};
/*
* IServiceProvider
*/
/***************************************************************************
* IShellBrowserImpl_IServiceProvider_QueryInterface
*/
HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
IServiceProvider *iface,
REFIID riid,
LPVOID *ppvObj)
{
_ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
FIXME("(%p)\n", This);
return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
}
/**************************************************************************
* IShellBrowserImpl_IServiceProvider_AddRef
*/
ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * iface)
{
_ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
FIXME("(%p)\n", This);
return IShellBrowserImpl_AddRef(This);
}
/**************************************************************************
* IShellBrowserImpl_IServiceProvider_Release
*/
ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface)
{
_ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
FIXME("(%p)\n", This);
return IShellBrowserImpl_Release(This);
}
/**************************************************************************
* IShellBrowserImpl_IServiceProvider_Release
*
* NOTES
* the w2k shellview asks for
* guidService = SID_STopLevelBrowser
* riid = IShellBrowser
*
* FIXME
* this is a hack!
*/
HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
IServiceProvider * iface,
REFGUID guidService,
REFIID riid,
void** ppv)
{
_ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
FIXME("(%p)\n\t%s\n\t%s\n", This,debugstr_guid(guidService), debugstr_guid(riid) );
*ppv = NULL;
if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
{
return IShellBrowserImpl_QueryInterface(This,riid,ppv);
}
FIXME("(%p) unknown interface requested\n", This);
return E_NOINTERFACE;
}
static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown */
IShellBrowserImpl_IServiceProvider_QueryInterface,
IShellBrowserImpl_IServiceProvider_AddRef,
IShellBrowserImpl_IServiceProvider_Release,
/* IServiceProvider */
IShellBrowserImpl_IServiceProvider_QueryService
};

View File

@ -15,7 +15,11 @@
/***********************************************************************
* Defines and global variables
*/
#define _ICOM_THIS_FromICommDlgBrowser(Class,name) Class* This = (Class*) (((char*)name)-sizeof(void *))
#define _ICommDlgBrowser_Offset ((int)(&(((IShellBrowserImpl*)0)->lpVtblCommDlgBrowser)))
#define _ICOM_THIS_FromICommDlgBrowser(class, name) class* This = (class*)(((char*)name)-_ICommDlgBrowser_Offset);
#define _IServiceProvider_Offset ((int)(&(((IShellBrowserImpl*)0)->lpVtblServiceProvider)))
#define _ICOM_THIS_FromIServiceProvider(class, name) class* This = (class*)(((char*)name)-_IServiceProvider_Offset);
/* dialog internal property */
@ -28,16 +32,6 @@
*/
typedef struct
{
ICOM_VTABLE(IShellBrowser)* lpVtbl; /* IShellBrowser VTable */
ICOM_VTABLE(ICommDlgBrowser)* lpVtbl2; /* ICommDlgBrowser VTable */
DWORD ref; /* Reference counter */
HWND hwndOwner; /* Owner dialog of the interface */
} IShellBrowserImpl;
typedef struct
{
@ -67,6 +61,13 @@ typedef struct
DWORD dwDlgProp;
} DlgInfos;
struct {
UINT fileokstring;
UINT lbselchstring;
UINT helpmsgstring;
UINT sharevistring;
} HookMsg;
} FileOpenDlgInfos;
/***********************************************************************
@ -124,100 +125,6 @@ typedef struct
/* Constructor */
IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner);
/* IUnknown */
HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
REFIID riid,
LPVOID *ppvObj);
ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface);
ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface);
/* IOleWindow */
HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
HWND * phwnd);
HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
BOOL fEnterMode);
/* IShellBrowser */
HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
LPCITEMIDLIST pidl,
UINT wFlags);
HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
BOOL fEnable);
HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
UINT id,
HWND *lphwnd);
HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
DWORD grfMode,
LPSTREAM *ppStrm);
HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
HMENU hmenuShared,
LPOLEMENUGROUPWIDTHS lpMenuWidths);
HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
IShellView *ppshv);
HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
IShellView **ppshv);
HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
HMENU hmenuShared);
HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
UINT id,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT *pret);
HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
HMENU hmenuShared,
HOLEMENU holemenuReserved,
HWND hwndActiveObject);
HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
LPCOLESTR lpszStatusText);
HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
LPTBBUTTON lpButtons,
UINT nButtons,
UINT uFlags);
HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
LPMSG lpmsg,
WORD wID);
/* ICommDlgBrowser */
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
REFIID riid,
LPVOID *ppvObj);
ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface);
ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface);
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
IShellView *ppshv);
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
IShellView *ppshv,
ULONG uChange);
HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
IShellView * ppshv,
LPCITEMIDLIST pidl);
LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex);
UINT GetNumSelected(IDataObject *doSelected);

View File

@ -36,6 +36,8 @@ extern "C" {
#define OFN_LONGNAMES 0x00200000
#define OFN_ENABLEINCLUDENOTIFY 0x00400000
#define OFN_ENABLESIZING 0x00800000
#define OFN_DONTADDTORECENT 0x02000000
#define OFN_FORCESHOWHIDDEN 0x10000000
/* WINE internal flags */
#define OFN_UNICODE 0x40000000 /*to differ between 32W/A hook*/

View File

@ -0,0 +1,47 @@
/*
* Defines the COM interfaces and APIs related to IServiceProvider
*
* Depends on 'obj_base.h'.
*/
#ifndef __WINE_WINE_OBJ_SERVICEPROVIDER_H
#define __WINE_WINE_OBJ_SERVICEPROVIDER_H
#include "wine/obj_base.h"
#include "winbase.h"
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
/*****************************************************************************
* Predeclare the interfaces
*/
DEFINE_GUID(IID_IServiceProvider, 0x6d5140c1, 0x7436, 0x11ce, 0x80, 0x34, 0x00, 0xaa, 0x00, 0x60, 0x09, 0xfa);
typedef struct IServiceProvider IServiceProvider, *LPSERVICEPROVIDER;
/*****************************************************************************
* IServiceProvider interface
*/
#define ICOM_INTERFACE IServiceProvider
#define IServiceProvider_METHODS \
ICOM_METHOD3( HRESULT, QueryService, REFGUID, guidService, REFIID, riid, void**, ppv)
#define IServiceProvider_IMETHODS \
IUnknown_IMETHODS \
IServiceProvider_METHODS
ICOM_DEFINE(IServiceProvider,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IServiceProvider_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
#define IServiceProvider_AddRef(p) ICOM_CALL (AddRef,p)
#define IServiceProvider_Release(p) ICOM_CALL (Release,p)
/*** IServiceProvider methods ***/
#define IServiceProvider_QueryService(p,a,b,c) ICOM_CALL3(QueryService,p,a,b,c)
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
#endif /* __WINE_WINE_OBJ_SERVICEPROVIDER_H */

View File

@ -15,6 +15,8 @@ extern "C" {
#define SID_SShellBrowser IID_IShellBrowser
DEFINE_GUID(SID_STopLevelBrowser, 0x4C96BE40L, 0x915C, 0x11CF, 0x99, 0xD3, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37);
/* targets for GetWindow/SendControlMsg */
#define FCW_STATUS 0x0001
#define FCW_TOOLBAR 0x0002