Commit 71097995 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

Moved existing IShellLink class. New stubs for IShellLinkW.

parent 9c68faad
/*
* Shell Folder stuff (...and all the OLE-Objects of SHELL32.DLL)
*
* Copyright 1997 Marcus Meissner
* Copyright 1998 Juergen Schmied
*
* !!! currently work in progress on all classes !!!
* <contact juergen.schmied@metronet.de, 980801>
*/
#include <ctype.h>
......@@ -39,29 +35,6 @@ static ULONG WINAPI IExtractIcon_Release(LPEXTRACTICON);
static HRESULT WINAPI IExtractIcon_GetIconLocation(LPEXTRACTICON, UINT32, LPSTR, UINT32, int *, UINT32 *);
static HRESULT WINAPI IExtractIcon_Extract(LPEXTRACTICON, LPCSTR, UINT32, HICON32 *, HICON32 *, UINT32);
/* IShellLink Implementation */
static HRESULT WINAPI IShellLink_QueryInterface(LPSHELLLINK,REFIID,LPVOID*);
static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK);
static ULONG WINAPI IShellLink_Release(LPSHELLLINK);
static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK, LPSTR,INT32, WIN32_FIND_DATA32A *, DWORD);
static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK, LPITEMIDLIST *);
static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK, LPCITEMIDLIST);
static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK, LPSTR,INT32);
static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK, LPCSTR);
static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK, LPSTR,INT32);
static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK, LPCSTR);
static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK, LPSTR,INT32);
static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK, LPCSTR);
static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK, WORD *);
static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK, WORD);
static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK, INT32 *);
static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK, INT32);
static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK, LPSTR,INT32,INT32 *);
static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK, LPCSTR,INT32);
static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK, LPCSTR, DWORD);
static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK, HWND32, DWORD);
static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK, LPCSTR);
/***********************************************************************
* IExtractIcon implementation
......@@ -158,172 +131,3 @@ static HRESULT WINAPI IExtractIcon_Extract(LPEXTRACTICON this, LPCSTR pszFile, U
return S_OK;
}
/**************************************************************************
* IShellLink Implementation
*/
static struct IShellLink_VTable slvt =
{ IShellLink_QueryInterface,
IShellLink_AddRef,
IShellLink_Release,
IShellLink_GetPath,
IShellLink_GetIDList,
IShellLink_SetIDList,
IShellLink_GetDescription,
IShellLink_SetDescription,
IShellLink_GetWorkingDirectory,
IShellLink_SetWorkingDirectory,
IShellLink_GetArguments,
IShellLink_SetArguments,
IShellLink_GetHotkey,
IShellLink_SetHotkey,
IShellLink_GetShowCmd,
IShellLink_SetShowCmd,
IShellLink_GetIconLocation,
IShellLink_SetIconLocation,
IShellLink_SetRelativePath,
IShellLink_Resolve,
IShellLink_SetPath
};
/**************************************************************************
* IShellLink_Constructor
*/
LPSHELLLINK IShellLink_Constructor()
{ LPSHELLLINK sl;
sl = (LPSHELLLINK)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink));
sl->ref = 1;
sl->lpvtbl = &slvt;
TRACE(shell,"(%p)->()\n",sl);
return sl;
}
/**************************************************************************
* IShellLink::QueryInterface
*/
static HRESULT WINAPI IShellLink_QueryInterface(
LPSHELLLINK this, REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
}
else if(IsEqualIID(riid, &IID_IShellLink)) /*IShellLink*/
{ *ppvObj = (LPSHELLLINK)this;
}
if(*ppvObj)
{ (*(LPSHELLLINK*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/******************************************************************************
* IShellLink_AddRef
*/
static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
return ++(this->ref);
}
/******************************************************************************
* IClassFactory_Release
*/
static ULONG WINAPI IShellLink_Release(LPSHELLLINK this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
if (!--(this->ref))
{ TRACE(shell,"-- destroying IShellLink(%p)\n",this);
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}
static HRESULT WINAPI IShellLink_GetPath(LPSHELLLINK this, LPSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags)
{ FIXME(shell,"(%p)->(pfile=%p len=%u find_data=%p flags=%lu)\n",this, pszFile, cchMaxPath, pfd, fFlags);
strncpy(pszFile,"c:\\foo.bar", cchMaxPath);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetIDList(LPSHELLLINK this, LPITEMIDLIST * ppidl)
{ FIXME(shell,"(%p)->(ppidl=%p)\n",this, ppidl);
*ppidl = _ILCreateDesktop();
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetIDList(LPSHELLLINK this, LPCITEMIDLIST pidl)
{ FIXME(shell,"(%p)->(pidl=%p)\n",this, pidl);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetDescription(LPSHELLLINK this, LPSTR pszName,INT32 cchMaxName)
{ FIXME(shell,"(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
strncpy(pszName,"Description, FIXME",cchMaxName);
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetDescription(LPSHELLLINK this, LPCSTR pszName)
{ FIXME(shell,"(%p)->(desc=%s)\n",this, pszName);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetWorkingDirectory(LPSHELLLINK this, LPSTR pszDir,INT32 cchMaxPath)
{ FIXME(shell,"(%p)->()\n",this);
strncpy(pszDir,"c:\\", cchMaxPath);
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetWorkingDirectory(LPSHELLLINK this, LPCSTR pszDir)
{ FIXME(shell,"(%p)->(dir=%s)\n",this, pszDir);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetArguments(LPSHELLLINK this, LPSTR pszArgs,INT32 cchMaxPath)
{ FIXME(shell,"(%p)->(%p len=%u)\n",this, pszArgs, cchMaxPath);
strncpy(pszArgs, "", cchMaxPath);
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetArguments(LPSHELLLINK this, LPCSTR pszArgs)
{ FIXME(shell,"(%p)->(args=%s)\n",this, pszArgs);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetHotkey(LPSHELLLINK this, WORD *pwHotkey)
{ FIXME(shell,"(%p)->(%p)\n",this, pwHotkey);
*pwHotkey=0x0;
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetHotkey(LPSHELLLINK this, WORD wHotkey)
{ FIXME(shell,"(%p)->(hotkey=%x)\n",this, wHotkey);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetShowCmd(LPSHELLLINK this, INT32 *piShowCmd)
{ FIXME(shell,"(%p)->(%p)\n",this, piShowCmd);
*piShowCmd=0;
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetShowCmd(LPSHELLLINK this, INT32 iShowCmd)
{ FIXME(shell,"(%p)->(showcmd=%x)\n",this, iShowCmd);
return NOERROR;
}
static HRESULT WINAPI IShellLink_GetIconLocation(LPSHELLLINK this, LPSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon)
{ FIXME(shell,"(%p)->(%p len=%u iicon=%p)\n",this, pszIconPath, cchIconPath, piIcon);
strncpy(pszIconPath,"shell32.dll",cchIconPath);
*piIcon=1;
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetIconLocation(LPSHELLLINK this, LPCSTR pszIconPath,INT32 iIcon)
{ FIXME(shell,"(%p)->(path=%s iicon=%u)\n",this, pszIconPath, iIcon);
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetRelativePath(LPSHELLLINK this, LPCSTR pszPathRel, DWORD dwReserved)
{ FIXME(shell,"(%p)->(path=%s %lx)\n",this, pszPathRel, dwReserved);
return NOERROR;
}
static HRESULT WINAPI IShellLink_Resolve(LPSHELLLINK this, HWND32 hwnd, DWORD fFlags)
{ FIXME(shell,"(%p)->(hwnd=%x flags=%lx)\n",this, hwnd, fFlags);
return NOERROR;
}
static HRESULT WINAPI IShellLink_SetPath(LPSHELLLINK this, LPCSTR pszFile)
{ FIXME(shell,"(%p)->(path=%s)\n",this, pszFile);
return NOERROR;
}
......@@ -309,6 +309,9 @@ static HRESULT WINAPI IClassFactory_CreateInstance(
else if (IsEqualIID(riid, &IID_IShellLink))
{ pObj = (IUnknown *)IShellLink_Constructor();
}
else if (IsEqualIID(riid, &IID_IShellLinkW))
{ pObj = (IUnknown *)IShellLinkW_Constructor();
}
else if (IsEqualIID(riid, &IID_IExtractIcon))
{ pObj = (IUnknown *)IExtractIcon_Constructor(NULL);
}
......
......@@ -944,6 +944,53 @@ struct IShellLink {
#undef THIS
#define THIS LPSHELLLINKW this
typedef struct IShellLinkW IShellLinkW,*LPSHELLLINKW;
typedef struct IShellLinkW_VTable
{
/* *** IUnknown methods *** */
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(GetPath)(THIS_ LPWSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE;
STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
STDMETHOD(GetDescription)(THIS_ LPWSTR pszName,INT32 cchMaxName) PURE;
STDMETHOD(SetDescription)(THIS_ LPCWSTR pszName) PURE;
STDMETHOD(GetWorkingDirectory)(THIS_ LPWSTR pszDir,INT32 cchMaxPath) PURE;
STDMETHOD(SetWorkingDirectory)(THIS_ LPCWSTR pszDir) PURE;
STDMETHOD(GetArguments)(THIS_ LPWSTR pszArgs,INT32 cchMaxPath) PURE;
STDMETHOD(SetArguments)(THIS_ LPCWSTR pszArgs) PURE;
STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
STDMETHOD(GetShowCmd)(THIS_ INT32 *piShowCmd) PURE;
STDMETHOD(SetShowCmd)(THIS_ INT32 iShowCmd) PURE;
STDMETHOD(GetIconLocation)(THIS_ LPWSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon) PURE;
STDMETHOD(SetIconLocation)(THIS_ LPCWSTR pszIconPath,INT32 iIcon) PURE;
STDMETHOD(SetRelativePath)(THIS_ LPCWSTR pszPathRel, DWORD dwReserved) PURE;
STDMETHOD(Resolve)(THIS_ HWND32 hwnd, DWORD fFlags) PURE;
STDMETHOD(SetPath)(THIS_ LPCWSTR pszFile) PURE;
} IShellLinkW_VTable,*LPSHELLLINKW_VTABLE;
struct IShellLinkW {
LPSHELLLINKW_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
/****************************************************************************
* IExtractIconinterface
*
......@@ -1067,6 +1114,7 @@ extern LPCONTEXTMENU IContextMenu_Constructor(LPSHELLFOLDER, LPCITEMIDLIST *, UI
extern LPSHELLFOLDER IShellFolder_Constructor(LPSHELLFOLDER,LPITEMIDLIST);
extern LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER, LPCITEMIDLIST);
extern LPSHELLLINK IShellLink_Constructor(void);
extern LPSHELLLINKW IShellLinkW_Constructor(void);
extern LPENUMIDLIST IEnumIDList_Constructor(LPCSTR,DWORD);
extern LPEXTRACTICON IExtractIcon_Constructor(LPITEMIDLIST);
#endif
......
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