Add the IShellLinkDataList interface to the ShellLink object.

This commit is contained in:
Mike McCormack 2005-06-09 12:05:38 +00:00 committed by Alexandre Julliard
parent 00337b9a51
commit fa1b7822a5
1 changed files with 127 additions and 60 deletions

View File

@ -112,21 +112,23 @@ typedef struct volume_info_t
#include "poppack.h" #include "poppack.h"
static const IShellLinkAVtbl slvt; static const IShellLinkAVtbl slvt;
static const IShellLinkWVtbl slvtw; static const IShellLinkWVtbl slvtw;
static const IPersistFileVtbl pfvt; static const IPersistFileVtbl pfvt;
static const IPersistStreamVtbl psvt; static const IPersistStreamVtbl psvt;
static const IShellLinkDataListVtbl dlvt;
/* IShellLink Implementation */ /* IShellLink Implementation */
typedef struct typedef struct
{ {
const IShellLinkAVtbl *lpVtbl; const IShellLinkAVtbl *lpVtbl;
DWORD ref; const IShellLinkWVtbl *lpvtblw;
const IPersistFileVtbl *lpvtblPersistFile;
const IShellLinkWVtbl *lpvtblw;
const IPersistFileVtbl *lpvtblPersistFile;
const IPersistStreamVtbl *lpvtblPersistStream; const IPersistStreamVtbl *lpvtblPersistStream;
const IShellLinkDataListVtbl *lpvtblShellLinkDataList;
DWORD ref;
/* data structures according to the informations in the link */ /* data structures according to the informations in the link */
LPITEMIDLIST pPidl; LPITEMIDLIST pPidl;
@ -151,13 +153,23 @@ typedef struct
} IShellLinkImpl; } IShellLinkImpl;
#define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw))) #define _IShellLinkW_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblw)))
#define _ICOM_THIS_From_IShellLinkW(class, name) class* This = (class*)(((char*)name)-_IShellLinkW_Offset) #define _ICOM_THIS_From_IShellLinkW(class, name) \
class* This = (class*)(((char*)name)-_IShellLinkW_Offset)
#define _IPersistFile_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistFile))) #define _IPersistFile_Offset \
#define _ICOM_THIS_From_IPersistFile(class, name) class* This = (class*)(((char*)name)-_IPersistFile_Offset) ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistFile)))
#define _ICOM_THIS_From_IPersistFile(class, name) \
class* This = (class*)(((char*)name)-_IPersistFile_Offset)
#define _IPersistStream_Offset ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistStream))) #define _IPersistStream_Offset \
#define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset) ((int)(&(((IShellLinkImpl*)0)->lpvtblPersistStream)))
#define _ICOM_THIS_From_IPersistStream(class, name) \
class* This = (class*)(((char*)name)-_IPersistStream_Offset)
#define _IShellLinkDataList_Offset \
((int)(&(((IShellLinkImpl*)0)->lpvtblShellLinkDataList)))
#define _ICOM_THIS_From_IShellLinkDataList(class, name) \
class* This = (class*)(((char*)name)-_IShellLinkDataList_Offset)
static HRESULT ShellLink_UpdatePath(LPWSTR sPathRel, LPCWSTR path, LPCWSTR sWorkDir, LPWSTR* psPath); static HRESULT ShellLink_UpdatePath(LPWSTR sPathRel, LPCWSTR path, LPCWSTR sWorkDir, LPWSTR* psPath);
@ -180,11 +192,8 @@ static HRESULT WINAPI IPersistFile_fnQueryInterface(
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
TRACE("(%p)\n",This);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
} }
/****************************************************************************** /******************************************************************************
@ -192,22 +201,17 @@ static HRESULT WINAPI IPersistFile_fnQueryInterface(
*/ */
static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface) static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile* iface)
{ {
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
return IShellLinkA_AddRef((IShellLinkA*)This);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
return IShellLinkA_AddRef((IShellLinkA*)This);
} }
/****************************************************************************** /******************************************************************************
* IPersistFile_Release * IPersistFile_Release
*/ */
static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface) static ULONG WINAPI IPersistFile_fnRelease(IPersistFile* iface)
{ {
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
return IShellLinkA_Release((IShellLinkA*)This);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
return IShellLinkA_Release((IShellLinkA*)This);
} }
static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID) static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pClassID)
@ -216,6 +220,7 @@ static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile* iface, CLSID *pCla
FIXME("(%p)\n",This); FIXME("(%p)\n",This);
return NOERROR; return NOERROR;
} }
static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface) static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
{ {
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
@ -227,6 +232,7 @@ static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile* iface)
return S_FALSE; return S_FALSE;
} }
static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode) static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
{ {
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
@ -321,6 +327,7 @@ static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLEST
FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName)); FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
return NOERROR; return NOERROR;
} }
static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName) static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *ppszFileName)
{ {
_ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
@ -349,11 +356,8 @@ static HRESULT WINAPI IPersistStream_fnQueryInterface(
REFIID riid, REFIID riid,
VOID** ppvoid) VOID** ppvoid)
{ {
_ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid);
TRACE("(%p)\n",This);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvoid);
} }
/************************************************************************ /************************************************************************
@ -362,11 +366,8 @@ static HRESULT WINAPI IPersistStream_fnQueryInterface(
static ULONG WINAPI IPersistStream_fnRelease( static ULONG WINAPI IPersistStream_fnRelease(
IPersistStream* iface) IPersistStream* iface)
{ {
_ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
return IShellLinkA_Release((IShellLinkA*)This);
TRACE("(%p)\n",This);
return IShellLinkA_Release((IShellLinkA*)This);
} }
/************************************************************************ /************************************************************************
@ -375,11 +376,8 @@ static ULONG WINAPI IPersistStream_fnRelease(
static ULONG WINAPI IPersistStream_fnAddRef( static ULONG WINAPI IPersistStream_fnAddRef(
IPersistStream* iface) IPersistStream* iface)
{ {
_ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface); _ICOM_THIS_From_IPersistStream(IShellLinkImpl, iface);
return IShellLinkA_AddRef((IShellLinkA*)This);
TRACE("(%p)\n",This);
return IShellLinkA_AddRef((IShellLinkA*)This);
} }
/************************************************************************ /************************************************************************
@ -1065,6 +1063,7 @@ HRESULT WINAPI IShellLink_Constructor( IUnknown *pUnkOuter,
sl->lpvtblw = &slvtw; sl->lpvtblw = &slvtw;
sl->lpvtblPersistFile = &pfvt; sl->lpvtblPersistFile = &pfvt;
sl->lpvtblPersistStream = &psvt; sl->lpvtblPersistStream = &psvt;
sl->lpvtblShellLinkDataList = &dlvt;
sl->iShowCmd = SW_SHOWNORMAL; sl->iShowCmd = SW_SHOWNORMAL;
sl->bDirty = FALSE; sl->bDirty = FALSE;
@ -1199,15 +1198,19 @@ static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID
} }
else if(IsEqualIID(riid, &IID_IShellLinkW)) else if(IsEqualIID(riid, &IID_IShellLinkW))
{ {
*ppvObj = (IShellLinkW *)&(This->lpvtblw); *ppvObj = &(This->lpvtblw);
} }
else if(IsEqualIID(riid, &IID_IPersistFile)) else if(IsEqualIID(riid, &IID_IPersistFile))
{ {
*ppvObj = (IPersistFile *)&(This->lpvtblPersistFile); *ppvObj = &(This->lpvtblPersistFile);
} }
else if(IsEqualIID(riid, &IID_IPersistStream)) else if(IsEqualIID(riid, &IID_IPersistStream))
{ {
*ppvObj = (IPersistStream *)&(This->lpvtblPersistStream); *ppvObj = &(This->lpvtblPersistStream);
}
else if(IsEqualIID(riid, &IID_IShellLinkDataList))
{
*ppvObj = &(This->lpvtblShellLinkDataList);
} }
if(*ppvObj) if(*ppvObj)
@ -1216,9 +1219,10 @@ static HRESULT WINAPI IShellLinkA_fnQueryInterface( IShellLinkA * iface, REFIID
TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK; return S_OK;
} }
TRACE("-- Interface: E_NOINTERFACE\n"); ERR("-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE; return E_NOINTERFACE;
} }
/****************************************************************************** /******************************************************************************
* IShellLinkA_AddRef * IShellLinkA_AddRef
*/ */
@ -1231,6 +1235,7 @@ static ULONG WINAPI IShellLinkA_fnAddRef(IShellLinkA * iface)
return refCount; return refCount;
} }
/****************************************************************************** /******************************************************************************
* IShellLinkA_Release * IShellLinkA_Release
*/ */
@ -1319,6 +1324,7 @@ static HRESULT WINAPI IShellLinkA_fnGetDescription(IShellLinkA * iface, LPSTR ps
return S_OK; return S_OK;
} }
static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR pszName) static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR pszName)
{ {
IShellLinkImpl *This = (IShellLinkImpl *)iface; IShellLinkImpl *This = (IShellLinkImpl *)iface;
@ -1608,9 +1614,8 @@ static const IShellLinkAVtbl slvt =
static HRESULT WINAPI IShellLinkW_fnQueryInterface( static HRESULT WINAPI IShellLinkW_fnQueryInterface(
IShellLinkW * iface, REFIID riid, LPVOID *ppvObj) IShellLinkW * iface, REFIID riid, LPVOID *ppvObj)
{ {
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObj);
} }
/****************************************************************************** /******************************************************************************
@ -1618,11 +1623,8 @@ static HRESULT WINAPI IShellLinkW_fnQueryInterface(
*/ */
static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface) static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface)
{ {
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
return IShellLinkA_AddRef((IShellLinkA*)This);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
return IShellLinkA_AddRef((IShellLinkA*)This);
} }
/****************************************************************************** /******************************************************************************
* IShellLinkW_fnRelease * IShellLinkW_fnRelease
@ -1630,11 +1632,8 @@ static ULONG WINAPI IShellLinkW_fnAddRef(IShellLinkW * iface)
static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface) static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
{ {
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface); _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
return IShellLinkA_Release((IShellLinkA*)This);
TRACE("(%p)->(count=%lu)\n",This,This->ref);
return IShellLinkA_Release((IShellLinkA*)This);
} }
static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags) static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags)
@ -2142,3 +2141,71 @@ static const IShellLinkWVtbl slvtw =
IShellLinkW_fnResolve, IShellLinkW_fnResolve,
IShellLinkW_fnSetPath IShellLinkW_fnSetPath
}; };
static HRESULT WINAPI
ShellLink_DataList_QueryInterface( IShellLinkDataList* iface, REFIID riid, void** ppvObject)
{
_ICOM_THIS_From_IShellLinkDataList(IShellLinkImpl, iface);
return IShellLinkA_QueryInterface((IShellLinkA*)This, riid, ppvObject);
}
static ULONG WINAPI
ShellLink_DataList_AddRef( IShellLinkDataList* iface )
{
_ICOM_THIS_From_IShellLinkDataList(IShellLinkImpl, iface);
return IShellLinkA_AddRef((IShellLinkA*)This);
}
static ULONG WINAPI
ShellLink_DataList_Release( IShellLinkDataList* iface )
{
_ICOM_THIS_From_IShellLinkDataList(IShellLinkImpl, iface);
return IShellLinkA_Release((IShellLinkA*)This);
}
static HRESULT WINAPI
ShellLink_AddDataBlock( IShellLinkDataList* iface, void* pDataBlock )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI
ShellLink_CopyDataBlock( IShellLinkDataList* iface, DWORD dwSig, void** ppDataBlock )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI
ShellLink_RemoveDataBlock( IShellLinkDataList* iface, DWORD dwSig )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI
ShellLink_GetFlags( IShellLinkDataList* iface, DWORD* pdwFlags )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI
ShellLink_SetFlags( IShellLinkDataList* iface, DWORD dwFlags )
{
FIXME("\n");
return E_NOTIMPL;
}
static const IShellLinkDataListVtbl dlvt =
{
ShellLink_DataList_QueryInterface,
ShellLink_DataList_AddRef,
ShellLink_DataList_Release,
ShellLink_AddDataBlock,
ShellLink_CopyDataBlock,
ShellLink_RemoveDataBlock,
ShellLink_GetFlags,
ShellLink_SetFlags
};