ReactOS 0.4.16-dev-1142-g8029339
CShellLink Class Reference

#include <CShellLink.h>

Inheritance diagram for CShellLink:
Collaboration diagram for CShellLink:

Classes

struct  volume_info
 

Public Types

enum  IDCMD { IDCMD_OPEN = 0 , IDCMD_OPENFILELOCATION }
 
- Public Types inherited from IShellLinkA
enum  SLR_FLAGS {
  SLR_NO_UI = 0x0001 , SLR_ANY_MATCH = 0x0002 , SLR_UPDATE = 0x0004 , SLR_NOUPDATE = 0x0008 ,
  SLR_NOSEARCH = 0x0010 , SLR_NOTRACK = 0x0020 , SLR_NOLINKINFO = 0x0040 , SLR_INVOKE_MSI = 0x0080 ,
  SLR_NO_UI_WITH_MSG_PUMP = 0x0101
}
 
enum  SLGP_FLAGS { SLGP_SHORTPATH = 0x0001 , SLGP_UNCPRIORITY = 0x0002 , SLGP_RAWPATH = 0x0004 }
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IPersistStream
typedef IPersistStreamLPPERSISTSTREAM
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Public Types inherited from IPersistFile
typedef IPersistFileLPPERSISTFILE
 
- Public Types inherited from IShellExtInit
typedef IShellExtInitLPSHELLEXTINIT
 
- Public Types inherited from IContextMenu
typedef IContextMenuLPCONTEXTMENU
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFOLPCMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMInvokeCommandInfoEx CMINVOKECOMMANDINFOEX
 
typedef struct IContextMenu::tagCMInvokeCommandInfoExLPCMINVOKECOMMANDINFOEX
 
- Public Types inherited from IDropTarget
typedef IDropTargetLPDROPTARGET
 
- Public Types inherited from IExtractIconA
typedef IExtractIconALPEXTRACTICONA
 
- Public Types inherited from IExtractIconW
typedef IExtractIconWLPEXTRACTICONW
 
- Public Types inherited from IObjectWithSite
typedef IObjectWithSiteLPOBJECTWITHSITE
 
- Public Types inherited from IShellPropSheetExt
enum  tagSHELLPROPSHEETEXTPAGEID { EXPPS_FILETYPES = 0x1 }
 
typedef UINT EXPPS
 

Public Member Functions

 CShellLink ()
 
 ~CShellLink ()
 
BOOL OnInitDialog (HWND hwndDlg, HWND hwndFocus, LPARAM lParam)
 
void OnCommand (HWND hwndDlg, int id, HWND hwndCtl, UINT codeNotify)
 
LRESULT OnNotify (HWND hwndDlg, int idFrom, LPNMHDR pnmhdr)
 
void OnDestroy (HWND hwndDlg)
 
STDMETHOD() GetClassID (CLSID *pclsid) override
 
STDMETHOD() IsDirty () override
 
STDMETHOD() Load (LPCOLESTR pszFileName, DWORD dwMode) override
 
STDMETHOD() Save (LPCOLESTR pszFileName, BOOL fRemember) override
 
STDMETHOD() SaveCompleted (LPCOLESTR pszFileName) override
 
STDMETHOD() GetCurFile (LPOLESTR *ppszFileName) override
 
STDMETHOD() Load (IStream *stm) override
 
STDMETHOD() Save (IStream *stm, BOOL fClearDirty) override
 
STDMETHOD() GetSizeMax (ULARGE_INTEGER *pcbSize) override
 
STDMETHOD() GetPath (LPSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags) override
 
STDMETHOD() GetIDList (PIDLIST_ABSOLUTE *ppidl) override
 
STDMETHOD() SetIDList (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHOD() GetDescription (LPSTR pszName, INT cchMaxName) override
 
STDMETHOD() SetDescription (LPCSTR pszName) override
 
STDMETHOD() GetWorkingDirectory (LPSTR pszDir, INT cchMaxPath) override
 
STDMETHOD() SetWorkingDirectory (LPCSTR pszDir) override
 
STDMETHOD() GetArguments (LPSTR pszArgs, INT cchMaxPath) override
 
STDMETHOD() SetArguments (LPCSTR pszArgs) override
 
STDMETHOD() GetHotkey (WORD *pwHotkey) override
 
STDMETHOD() SetHotkey (WORD wHotkey) override
 
STDMETHOD() GetShowCmd (INT *piShowCmd) override
 
STDMETHOD() SetShowCmd (INT iShowCmd) override
 
STDMETHOD() GetIconLocation (LPSTR pszIconPath, INT cchIconPath, INT *piIcon) override
 
STDMETHOD() SetIconLocation (LPCSTR pszIconPath, INT iIcon) override
 
STDMETHOD() SetRelativePath (LPCSTR pszPathRel, DWORD dwReserved) override
 
STDMETHOD() Resolve (HWND hwnd, DWORD fFlags) override
 
STDMETHOD() SetPath (LPCSTR pszFile) override
 
STDMETHOD() GetPath (LPWSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags) override
 
STDMETHOD() GetDescription (LPWSTR pszName, INT cchMaxName) override
 
STDMETHOD() SetDescription (LPCWSTR pszName) override
 
STDMETHOD() GetWorkingDirectory (LPWSTR pszDir, INT cchMaxPath) override
 
STDMETHOD() SetWorkingDirectory (LPCWSTR pszDir) override
 
STDMETHOD() GetArguments (LPWSTR pszArgs, INT cchMaxPath) override
 
STDMETHOD() SetArguments (LPCWSTR pszArgs) override
 
STDMETHOD() GetIconLocation (LPWSTR pszIconPath, INT cchIconPath, INT *piIcon) override
 
STDMETHOD() SetIconLocation (LPCWSTR pszIconPath, INT iIcon) override
 
STDMETHOD() SetRelativePath (LPCWSTR pszPathRel, DWORD dwReserved) override
 
STDMETHOD() SetPath (LPCWSTR pszFile) override
 
STDMETHOD() AddDataBlock (void *pDataBlock) override
 
STDMETHOD() CopyDataBlock (DWORD dwSig, void **ppDataBlock) override
 
STDMETHOD() RemoveDataBlock (DWORD dwSig) override
 
STDMETHOD() GetFlags (DWORD *pdwFlags) override
 
STDMETHOD() SetFlags (DWORD dwFlags) override
 
STDMETHOD() Extract (PCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) override
 
STDMETHOD() GetIconLocation (UINT uFlags, PSTR pszIconFile, UINT cchMax, int *piIndex, UINT *pwFlags) override
 
STDMETHOD() Extract (PCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) override
 
STDMETHOD() GetIconLocation (UINT uFlags, PWSTR pszIconFile, UINT cchMax, int *piIndex, UINT *pwFlags) override
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override
 
STDMETHOD() QueryContextMenu (HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
 
STDMETHOD() InvokeCommand (LPCMINVOKECOMMANDINFO lpici) override
 
STDMETHOD() GetCommandString (UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override
 
STDMETHOD() AddPages (LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override
 
STDMETHOD() ReplacePage (UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam) override
 
STDMETHOD() SetSite (IUnknown *punk) override
 
STDMETHOD() GetSite (REFIID iid, void **ppvSite) override
 
STDMETHOD() DragEnter (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHOD() DragOver (DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
 
STDMETHOD() DragLeave () override
 
STDMETHOD() Drop (IDataObject *pDataObject, DWORD dwKeyState, POINTL pt, DWORD *pdwEffect) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IShellLinkA
HRESULT GetPath ([out, size_is(cch)] LPSTR pszFile, [in] int cch, [in, out, unique] WIN32_FIND_DATAA *pfd, [in] DWORD fFlags)
 
HRESULT GetIDList ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT SetIDList ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetDescription ([out, size_is(cch)] LPSTR pszName, [in] int cch)
 
HRESULT SetDescription ([in] LPCSTR pszName)
 
HRESULT GetWorkingDirectory ([out, size_is(cch)] LPSTR pszDir, [in] int cch)
 
HRESULT SetWorkingDirectory ([in] LPCSTR pszDir)
 
HRESULT GetArguments ([out, size_is(cch)] LPSTR pszArgs, [in] int cch)
 
HRESULT SetArguments ([in] LPCSTR pszArgs)
 
HRESULT GetHotkey ([out] WORD *pwHotkey)
 
HRESULT SetHotkey ([in] WORD wHotkey)
 
HRESULT GetShowCmd ([out] int *piShowCmd)
 
HRESULT SetShowCmd ([in] int iShowCmd)
 
HRESULT GetIconLocation ([out, size_is(cch)] LPSTR pszIconPath, [in] int cch, [out] int *piIcon)
 
HRESULT SetIconLocation ([in] LPCSTR pszIconPath, [in] int iIcon)
 
HRESULT SetRelativePath ([in] LPCSTR pszPathRel, [in] DWORD dwReserved)
 
HRESULT Resolve ([in] HWND hwnd, [in] DWORD fFlags)
 
HRESULT SetPath ([in] LPCSTR pszFile)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IShellLinkW
HRESULT GetPath ([out, size_is(cch)] LPWSTR pszFile, [in] int cch, [in, out] WIN32_FIND_DATAW *pfd, [in] DWORD fFlags)
 
HRESULT GetIDList ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT SetIDList ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetDescription ([out, size_is(cch)] LPWSTR pszName, [in] int cch)
 
HRESULT SetDescription ([in] LPCWSTR pszName)
 
HRESULT GetWorkingDirectory ([out, size_is(cch)] LPWSTR pszDir, [in] int cch)
 
HRESULT SetWorkingDirectory ([in] LPCWSTR pszDir)
 
HRESULT GetArguments ([out, size_is(cch)] LPWSTR pszArgs, [in] int cch)
 
HRESULT SetArguments ([in] LPCWSTR pszArgs)
 
HRESULT GetHotkey ([out] WORD *pwHotkey)
 
HRESULT SetHotkey ([in] WORD wHotkey)
 
HRESULT GetShowCmd ([out] int *piShowCmd)
 
HRESULT SetShowCmd ([in] int iShowCmd)
 
HRESULT GetIconLocation ([out, size_is(cch)] LPWSTR pszIconPath, [in] int cch, [out] int *piIcon)
 
HRESULT SetIconLocation ([in] LPCWSTR pszIconPath, [in] int iIcon)
 
HRESULT SetRelativePath ([in] LPCWSTR pszPathRel, [in] DWORD dwReserved)
 
HRESULT Resolve ([in] HWND hwnd, [in] DWORD fFlags)
 
HRESULT SetPath ([in] LPCWSTR pszFile)
 
HRESULT IsDirty ()
 
HRESULT Load ([in, unique] IStream *pStm)
 
HRESULT Save ([in, unique] IStream *pStm, [in] BOOL fClearDirty)
 
HRESULT GetSizeMax ([out] ULARGE_INTEGER *pcbSize)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 
HRESULT IsDirty ()
 
HRESULT Load ([in] LPCOLESTR pszFileName, [in] DWORD dwMode)
 
HRESULT Save ([in, unique] LPCOLESTR pszFileName, [in] BOOL fRemember)
 
HRESULT SaveCompleted ([in, unique] LPCOLESTR pszFileName)
 
HRESULT GetCurFile ([out] LPOLESTR *ppszFileName)
 
HRESULT Initialize ([in] PCIDLIST_ABSOLUTE pidlFolder, [in] IDataObject *pdtobj, [in] HKEY hkeyProgID)
 
HRESULT QueryContextMenu ([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
 
HRESULT InvokeCommand ([in] LPCMINVOKECOMMANDINFO lpici)
 
HRESULT GetCommandString ([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
 
HRESULT DragEnter ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragOver ([in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT DragLeave ()
 
HRESULT Drop ([in, unique] IDataObject *pDataObj, [in] DWORD grfKeyState, [in] POINTL pt, [in, out] DWORD *pdwEffect)
 
HRESULT AddDataBlock ([in] void *pDataBlock)
 
HRESULT CopyDataBlock ([in] DWORD dwSig, [out] void **ppDataBlock)
 
HRESULT RemoveDataBlock ([in] DWORD dwSig)
 
HRESULT GetFlags ([out] DWORD *pdwFlags)
 
HRESULT SetFlags ([in] DWORD dwFlags)
 
- Public Member Functions inherited from IExtractIconA
HRESULT GetIconLocation ([in] UINT uFlags, [out, size_is(cchMax)] LPSTR szIconFile, [in] UINT cchMax, [out] INT *piIndex, [out] UINT *pwFlags)
 
HRESULT Extract ([in] LPCSTR pszFile, [in] UINT nIconIndex, [out] HICON *phiconLarge, [out] HICON *phiconSmall, [in] UINT nIconSize)
 
- Public Member Functions inherited from IExtractIconW
HRESULT GetIconLocation ([in] UINT uFlags, [out, size_is(cchMax)] LPWSTR szIconFile, [in] UINT cchMax, [out] INT *piIndex, [out] UINT *pwFlags)
 
HRESULT Extract ([in] LPCWSTR pszFile, [in] UINT nIconIndex, [out] HICON *phiconLarge, [out] HICON *phiconSmall, [in] UINT nIconSize)
 
- Public Member Functions inherited from IObjectWithSite
HRESULT SetSite ([in] IUnknown *pUnkSite)
 
HRESULT GetSite ([in] REFIID riid, [out, iid_is(riid)] PVOID *ppvSite)
 
- Public Member Functions inherited from IShellPropSheetExt
HRESULT AddPages ([in] LPFNSVADDPROPSHEETPAGE pfnAddPage, [in] LPARAM lParam)
 
HRESULT ReplacePage ([in] EXPPS uPageID, [in] LPFNSVADDPROPSHEETPAGE pfnReplaceWith, [in] LPARAM lParam)
 

Static Public Member Functions

static INT_PTR CALLBACK SH_ShellLinkDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 

Private Member Functions

VOID Reset ()
 
HRESULT GetAdvertiseInfo (LPWSTR *str, DWORD dwSig)
 
HRESULT SetAdvertiseInfo (LPCWSTR str)
 
HRESULT WriteAdvertiseInfo (LPCWSTR string, DWORD dwSig)
 
HRESULT SetTargetFromPIDLOrPath (LPCITEMIDLIST pidl, LPCWSTR pszFile)
 
HICON CreateShortcutIcon (LPCWSTR wszIconPath, INT IconIndex)
 
HRESULT DoOpen (LPCMINVOKECOMMANDINFO lpici)
 
HRESULT DoOpenFileLocation ()
 

Private Attributes

SHELL_LINK_HEADER m_Header
 
LPITEMIDLIST m_pPidl
 
LPWSTR m_sPath
 
volume_info volume
 
LPWSTR m_sDescription
 
LPWSTR m_sPathRel
 
LPWSTR m_sWorkDir
 
LPWSTR m_sArgs
 
LPWSTR m_sIcoPath
 
BOOL m_bRunAs
 
BOOL m_bDirty
 
LPDBLIST m_pDBList
 
BOOL m_bInInit
 
HICON m_hIcon
 
LPWSTR sProduct
 
LPWSTR sComponent
 
LPWSTR m_sLinkPath
 
CComPtr< IUnknownm_site
 
CComPtr< IDropTargetm_DropTarget
 

Additional Inherited Members

- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IDropTarget
const DWORD MK_ALT = 0x20
 
const DWORD DROPEFFECT_NONE = 0
 
const DWORD DROPEFFECT_COPY = 1
 
const DWORD DROPEFFECT_MOVE = 2
 
const DWORD DROPEFFECT_LINK = 4
 
const DWORD DROPEFFECT_SCROLL = 0x80000000
 
const DWORD DD_DEFSCROLLINSET = 11
 
const DWORD DD_DEFSCROLLDELAY = 50
 
const DWORD DD_DEFSCROLLINTERVAL = 50
 
const DWORD DD_DEFDRAGDELAY = 200
 
const DWORD DD_DEFDRAGMINDIST = 2
 
- Static Public Attributes inherited from IContextMenu
static const WCHAR CMDSTR_NEWFOLDERW [] = {'N','e','w','F','o','l','d','e','r',0}
 
static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}
 
static const WCHAR CMDSTR_VIEWDETAILSW [] = {'V','i','e','w','D','e','t','a','i','l','s',0}
 

Detailed Description

Definition at line 28 of file CShellLink.h.

Member Enumeration Documentation

◆ IDCMD

Enumerator
IDCMD_OPEN 
IDCMD_OPENFILELOCATION 

Definition at line 62 of file CShellLink.h.

63 {
64 IDCMD_OPEN = 0,
66 };

Constructor & Destructor Documentation

◆ CShellLink()

CShellLink::CShellLink ( )

Definition at line 266 of file CShellLink.cpp.

267{
268 m_Header.dwSize = sizeof(m_Header);
269 m_Header.clsid = CLSID_ShellLink;
270 m_Header.dwFlags = 0;
271
277
280 m_Header.wHotKey = 0;
281
282 m_pPidl = NULL;
283
284 m_sPath = NULL;
285 ZeroMemory(&volume, sizeof(volume));
286
290 m_sArgs = NULL;
292 m_bRunAs = FALSE;
293 m_bDirty = FALSE;
294 m_pDBList = NULL;
296 m_hIcon = NULL;
297
299
301}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ZeroMemory
Definition: winbase.h:1743
#define SW_SHOWNORMAL
Definition: winuser.h:781

◆ ~CShellLink()

CShellLink::~CShellLink ( )

Definition at line 303 of file CShellLink.cpp.

304{
305 TRACE("-- destroying IShellLink(%p)\n", this);
306
308
310
318}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
VOID WINAPI SHFreeDataBlockList(LPDBLIST lpList)
Definition: clist.c:331
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:1044
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ AddDataBlock()

HRESULT STDMETHODCALLTYPE CShellLink::AddDataBlock ( void pDataBlock)
override

Implements IShellLinkDataList.

Definition at line 2437 of file CShellLink.cpp.

2438{
2439 if (SHAddDataBlock(&m_pDBList, (DATABLOCK_HEADER*)pDataBlock))
2440 {
2441 m_bDirty = TRUE;
2442 return S_OK;
2443 }
2444 return S_FALSE;
2445}
#define TRUE
Definition: types.h:120
BOOL WINAPI SHAddDataBlock(LPDBLIST *lppList, const DATABLOCK_HEADER *lpNewItem)
Definition: clist.c:68
#define S_OK
Definition: intsafe.h:52
#define S_FALSE
Definition: winerror.h:2357

Referenced by SetIconLocation(), SetPath(), and WriteAdvertiseInfo().

◆ AddPages()

HRESULT STDMETHODCALLTYPE CShellLink::AddPages ( LPFNADDPROPSHEETPAGE  pfnAddPage,
LPARAM  lParam 
)
override

Definition at line 3139 of file CShellLink.cpp.

3140{
3142 (LPARAM)this, NULL, &PropSheetPageLifetimeCallback<CShellLink>);
3143 HRESULT hr = AddPropSheetPage(hPage, pfnAddPage, lParam);
3145 return hr;
3146 else
3147 AddRef(); // For PropSheetPageLifetimeCallback
3148 enum { CShellLink_PageIndex_Shortcut = 0 };
3149 return 1 + CShellLink_PageIndex_Shortcut; // Make this page the default (one-based)
3150}
LPARAM lParam
Definition: combotst.c:139
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:68
static HRESULT AddPropSheetPage(HPROPSHEETPAGE hPage, LPFNSVADDPROPSHEETPAGE pfnAddPage, LPARAM lParam)
Definition: precomp.h:151
ULONG AddRef()
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HRESULT hr
Definition: shlfolder.c:183
#define IDD_SHORTCUT_PROPERTIES
Definition: shresdef.h:427
HPROPSHEETPAGE SH_CreatePropertySheetPageEx(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle, LPFNPSPCALLBACK Callback)
Definition: propsheet.cpp:223
LONG_PTR LPARAM
Definition: windef.h:208

◆ CopyDataBlock()

HRESULT STDMETHODCALLTYPE CShellLink::CopyDataBlock ( DWORD  dwSig,
void **  ppDataBlock 
)
override

Implements IShellLinkDataList.

Definition at line 2447 of file CShellLink.cpp.

2448{
2449 DATABLOCK_HEADER* pBlock;
2450 PVOID pDataBlock;
2451
2452 TRACE("%p %08x %p\n", this, dwSig, ppDataBlock);
2453
2454 *ppDataBlock = NULL;
2455
2456 pBlock = SHFindDataBlock(m_pDBList, dwSig);
2457 if (!pBlock)
2458 {
2459 ERR("unknown datablock %08x (not found)\n", dwSig);
2460 return E_FAIL;
2461 }
2462
2463 pDataBlock = LocalAlloc(LMEM_ZEROINIT, pBlock->cbSize);
2464 if (!pDataBlock)
2465 return E_OUTOFMEMORY;
2466
2467 CopyMemory(pDataBlock, pBlock, pBlock->cbSize);
2468
2469 *ppDataBlock = pDataBlock;
2470 return S_OK;
2471}
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
DATABLOCK_HEADER *WINAPI SHFindDataBlock(LPDBLIST lpList, DWORD dwSignature)
Definition: clist.c:424
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
#define LMEM_ZEROINIT
Definition: winbase.h:401
#define CopyMemory
Definition: winbase.h:1741

◆ CreateShortcutIcon()

HICON CShellLink::CreateShortcutIcon ( LPCWSTR  wszIconPath,
INT  IconIndex 
)
private

Definition at line 3254 of file CShellLink.cpp.

3255{
3257 const COLORREF crMask = GetSysColor(COLOR_3DFACE);
3258 WCHAR wszLnkIcon[MAX_PATH];
3259 int lnk_idx;
3260 HDC hDC;
3262 HICON hIcon = NULL, hNewIcon = NULL, hShortcut;
3263
3264 if (HLM_GetIconW(IDI_SHELL_SHORTCUT - 1, wszLnkIcon, _countof(wszLnkIcon), &lnk_idx))
3265 {
3266 ::ExtractIconExW(wszLnkIcon, lnk_idx, &hShortcut, NULL, 1);
3267 }
3268 else
3269 {
3271 IMAGE_ICON, cx, cy, 0);
3272 }
3273
3274 ::ExtractIconExW(wszIconPath, IconIndex, &hIcon, NULL, 1);
3275 if (!hIcon || !hShortcut || !himl)
3276 goto cleanup;
3277
3279 if (hDC)
3280 {
3281 // create 32bpp bitmap
3282 BITMAPINFO bi;
3283 ZeroMemory(&bi, sizeof(bi));
3284 bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
3285 bi.bmiHeader.biWidth = cx;
3286 bi.bmiHeader.biHeight = cy;
3287 bi.bmiHeader.biPlanes = 1;
3288 bi.bmiHeader.biBitCount = 32;
3289 LPVOID pvBits;
3290 HBITMAP hbm = CreateDIBSection(hDC, &bi, DIB_RGB_COLORS, &pvBits, NULL, 0);
3291 if (hbm)
3292 {
3293 // draw the icon image
3294 HGDIOBJ hbmOld = SelectObject(hDC, hbm);
3295 {
3296 HBRUSH hbr = CreateSolidBrush(crMask);
3297 RECT rc = { 0, 0, cx, cy };
3298 FillRect(hDC, &rc, hbr);
3299 DeleteObject(hbr);
3300
3301 DrawIconEx(hDC, 0, 0, hIcon, cx, cy, 0, NULL, DI_NORMAL);
3302 DrawIconEx(hDC, 0, 0, hShortcut, cx, cy, 0, NULL, DI_NORMAL);
3303 }
3304 SelectObject(hDC, hbmOld);
3305
3306 INT iAdded = ImageList_AddMasked(himl, hbm, crMask);
3307 hNewIcon = ImageList_GetIcon(himl, iAdded, ILD_NORMAL | ILD_TRANSPARENT);
3308
3310 }
3311 DeleteDC(hDC);
3312 }
3313
3314cleanup:
3315 if (hIcon)
3317 if (hShortcut)
3318 DestroyIcon(hShortcut);
3319 if (himl)
3321
3322 return hNewIcon;
3323}
static HDC hDC
Definition: 3dtext.c:33
#define shell32_hInstance
HIMAGELIST himl
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
HICON WINAPI ImageList_GetIcon(HIMAGELIST himl, INT i, UINT fStyle)
Definition: imagelist.c:1981
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:573
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
#define MAX_PATH
Definition: compat.h:34
static void cleanup(void)
Definition: main.c:1335
static const WCHAR IconIndex[]
Definition: install.c:52
pKey DeleteObject()
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:855
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define ILD_NORMAL
Definition: commctrl.h:417
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ILC_COLOR32
Definition: commctrl.h:358
#define ILD_TRANSPARENT
Definition: commctrl.h:418
#define ILC_MASK
Definition: commctrl.h:351
#define IDI_SHELL_SHORTCUT
Definition: shresdef.h:608
#define _countof(array)
Definition: sndvol32.h:70
USHORT biBitCount
Definition: precomp.h:46
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
int32_t INT
Definition: typedefs.h:58
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
DWORD COLORREF
Definition: windef.h:300
#define DIB_RGB_COLORS
Definition: wingdi.h:367
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DI_NORMAL
Definition: wingdi.h:72
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2540
#define SM_CYICON
Definition: winuser.h:984
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2365
#define SM_CXICON
Definition: winuser.h:983
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2390
#define COLOR_3DFACE
Definition: winuser.h:940
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by OnCommand().

◆ DoOpen()

HRESULT CShellLink::DoOpen ( LPCMINVOKECOMMANDINFO  lpici)
private

Definition at line 2628 of file CShellLink.cpp.

2629{
2631 const BOOL unicode = IsUnicode(*lpici);
2632
2633 CStringW args;
2634 if (m_sArgs)
2635 args = m_sArgs;
2636
2637 if (unicode)
2638 {
2639 if (!StrIsNullOrEmpty(iciex->lpParametersW))
2640 {
2641 args += L' ';
2642 args += iciex->lpParametersW;
2643 }
2644 }
2645 else
2646 {
2647 CComHeapPtr<WCHAR> pszParams;
2648 if (!StrIsNullOrEmpty(lpici->lpParameters) && __SHCloneStrAtoW(&pszParams, lpici->lpParameters))
2649 {
2650 args += L' ';
2651 args += pszParams;
2652 }
2653 }
2654
2656 SHELLEXECUTEINFOW sei = { sizeof(sei) };
2659 sei.lpDirectory = m_sWorkDir;
2660 if (m_pPidl)
2661 {
2662 sei.lpIDList = m_pPidl;
2664 }
2665 else
2666 {
2667 sei.lpFile = m_sPath;
2669 {
2670 sei.fMask &= ~SEE_MASK_DOENVSUBST; // The link does not want to expand lpFile
2672 sei.lpDirectory = dir;
2673 }
2674 }
2675 sei.lpParameters = args;
2676 sei.lpClass = m_sLinkPath;
2678 if (lpici->nShow != SW_SHOWNORMAL && lpici->nShow != SW_SHOW)
2679 sei.nShow = lpici->nShow; // Allow invoker to override .lnk show mode
2680
2681 // Use the invoker specified working directory if the link did not specify one
2682 if (StrIsNullOrEmpty(sei.lpDirectory) || !PathEnvSubstIsDirectory(sei.lpDirectory))
2683 {
2684 LPCSTR pszDirA = lpici->lpDirectory;
2685 if (unicode && !StrIsNullOrEmpty(iciex->lpDirectoryW))
2686 sei.lpDirectory = iciex->lpDirectoryW;
2687 else if (pszDirA && SHAnsiToUnicode(pszDirA, dir, _countof(dir)))
2688 sei.lpDirectory = dir;
2689 }
2690
2691 sei.dwHotKey = lpici->dwHotKey;
2692 sei.fMask |= CmicFlagsToSeeFlags(lpici->fMask & CMIC_MASK_HOTKEY);
2693 if (m_Header.wHotKey)
2694 {
2696 sei.fMask |= SEE_MASK_HOTKEY;
2697 }
2698 return (ShellExecuteExW(&sei) ? S_OK : E_FAIL);
2699}
unsigned int dir
Definition: maze.c:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define CmicFlagsToSeeFlags(flags)
Definition: precomp.h:190
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
Definition: string.c:2673
unsigned int BOOL
Definition: ntddk_ex.h:94
struct IContextMenu::tagCMInvokeCommandInfoEx * LPCMINVOKECOMMANDINFOEX
if(dx< 0)
Definition: linetemp.h:194
#define L(x)
Definition: ntvdm.h:50
static __inline LPWSTR __SHCloneStrAtoW(WCHAR **target, const char *source)
Definition: shell32_main.h:185
#define SEE_MASK_DOENVSUBST
Definition: shellapi.h:35
#define SEE_MASK_HOTKEY
Definition: shellapi.h:30
#define SEE_MASK_UNICODE
Definition: shellapi.h:37
#define SEE_MASK_ASYNCOK
Definition: shellapi.h:54
#define SEE_MASK_NOASYNC
Definition: shellapi.h:33
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
#define SEE_MASK_FLAG_NO_UI
Definition: shellapi.h:36
#define SEE_MASK_HASLINKNAME
Definition: shellapi.h:49
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2474
@ SLDF_HAS_EXP_SZ
Definition: shlobj.h:1961
LPCWSTR lpDirectory
Definition: shellapi.h:341
LPCWSTR lpParameters
Definition: shellapi.h:340
Definition: match.c:390
#define SW_SHOW
Definition: winuser.h:786
const char * LPCSTR
Definition: xmlstorage.h:183

◆ DoOpenFileLocation()

HRESULT CShellLink::DoOpenFileLocation ( )
private

Definition at line 2578 of file CShellLink.cpp.

2579{
2580 // TODO: SHOpenFolderAndSelectItems
2581 WCHAR szParams[MAX_PATH + 64];
2582 StringCbPrintfW(szParams, sizeof(szParams), L"/select,%s", m_sPath);
2583
2584 INT_PTR ret;
2585 ret = reinterpret_cast<INT_PTR>(ShellExecuteW(NULL, NULL, L"explorer.exe", szParams,
2587 if (ret <= 32)
2588 {
2589 ERR("ret: %08lX\n", ret);
2590 return E_FAIL;
2591 }
2592
2593 return S_OK;
2594}
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2529
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
int32_t INT_PTR
Definition: typedefs.h:64
int ret

Referenced by InvokeCommand().

◆ DragEnter()

HRESULT STDMETHODCALLTYPE CShellLink::DragEnter ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
override

Implements IDropTarget.

Definition at line 3177 of file CShellLink.cpp.

3179{
3180 TRACE("(%p)->(DataObject=%p)\n", this, pDataObject);
3181
3182 if (*pdwEffect == DROPEFFECT_NONE)
3183 return S_OK;
3184
3186 if (SUCCEEDED(hr))
3187 hr = m_DropTarget->DragEnter(pDataObject, dwKeyState, pt, pdwEffect);
3188 else
3189 *pdwEffect = DROPEFFECT_NONE;
3190
3191 return S_OK;
3192}
EXTERN_C HRESULT SHELL_GetUIObjectOfAbsoluteItem(_In_opt_ HWND hWnd, _In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:380
#define pt(x, y)
Definition: drawing.c:79
const DWORD DROPEFFECT_NONE
Definition: oleidl.idl:929
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define IID_PPV_ARG(Itype, ppType)

◆ DragLeave()

HRESULT STDMETHODCALLTYPE CShellLink::DragLeave ( void  )
override

Implements IDropTarget.

Definition at line 3204 of file CShellLink.cpp.

3205{
3206 TRACE("(%p)\n", this);
3207 HRESULT hr = S_OK;
3208 if (m_DropTarget)
3209 {
3210 hr = m_DropTarget->DragLeave();
3212 }
3213
3214 return hr;
3215}
void Release()
Definition: atlcomcli.h:170

◆ DragOver()

HRESULT STDMETHODCALLTYPE CShellLink::DragOver ( DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
override

Implements IDropTarget.

Definition at line 3194 of file CShellLink.cpp.

3196{
3197 TRACE("(%p)\n", this);
3198 HRESULT hr = S_OK;
3199 if (m_DropTarget)
3200 hr = m_DropTarget->DragOver(dwKeyState, pt, pdwEffect);
3201 return hr;
3202}

◆ Drop()

HRESULT STDMETHODCALLTYPE CShellLink::Drop ( IDataObject pDataObject,
DWORD  dwKeyState,
POINTL  pt,
DWORD pdwEffect 
)
override

Implements IDropTarget.

Definition at line 3217 of file CShellLink.cpp.

3219{
3220 TRACE("(%p)\n", this);
3221 HRESULT hr = S_OK;
3222 if (m_DropTarget)
3223 hr = m_DropTarget->Drop(pDataObject, dwKeyState, pt, pdwEffect);
3224
3225 return hr;
3226}

◆ Extract() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::Extract ( PCSTR  pszFile,
UINT  nIconIndex,
HICON phiconLarge,
HICON phiconSmall,
UINT  nIconSize 
)
override

Implements IExtractIconA.

Definition at line 1367 of file CShellLink.cpp.

1368{
1369 TRACE("(%p)->(path=%s iicon=%u)\n", this, pszFile, nIconIndex);
1370
1371 LPWSTR str = NULL;
1372 if (pszFile)
1373 {
1374 str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
1375 if (!str)
1376 return E_OUTOFMEMORY;
1377 }
1378
1379 HRESULT hr = Extract(str, nIconIndex, phiconLarge, phiconSmall, nIconSize);
1380
1381 if (str)
1383
1384 return hr;
1385}
const WCHAR * str
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by Extract().

◆ Extract() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::Extract ( PCWSTR  pszFile,
UINT  nIconIndex,
HICON phiconLarge,
HICON phiconSmall,
UINT  nIconSize 
)
override

Definition at line 1802 of file CShellLink.cpp.

1803{
1804 HRESULT hr = NOERROR;
1805 UINT cxyLarge = LOWORD(nIconSize), cxySmall = HIWORD(nIconSize);
1806
1807 if (phiconLarge)
1808 {
1809 *phiconLarge = NULL;
1810 PrivateExtractIconsW(pszFile, nIconIndex, cxyLarge, cxyLarge, phiconLarge, NULL, 1, 0);
1811
1812 if (*phiconLarge == NULL)
1813 hr = S_FALSE;
1814 }
1815
1816 if (phiconSmall)
1817 {
1818 *phiconSmall = NULL;
1819 PrivateExtractIconsW(pszFile, nIconIndex, cxySmall, cxySmall, phiconSmall, NULL, 1, 0);
1820
1821 if (*phiconSmall == NULL)
1822 hr = S_FALSE;
1823 }
1824
1825 if (hr == S_FALSE)
1826 {
1827 if (phiconLarge && *phiconLarge)
1828 {
1829 DestroyIcon(*phiconLarge);
1830 *phiconLarge = NULL;
1831 }
1832 if (phiconSmall && *phiconSmall)
1833 {
1834 DestroyIcon(*phiconSmall);
1835 *phiconSmall = NULL;
1836 }
1837 }
1838
1839 return hr;
1840}
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define HIWORD(l)
Definition: typedefs.h:247
#define NOERROR
Definition: winerror.h:2354
UINT WINAPI PrivateExtractIconsW(_In_reads_(MAX_PATH) LPCWSTR szFileName, _In_ int nIconIndex, _In_ int cxIcon, _In_ int cyIcon, _Out_writes_opt_(nIcons) HICON *phicon, _Out_writes_opt_(nIcons) UINT *piconid, _In_ UINT nIcons, _In_ UINT flags)

◆ GetAdvertiseInfo()

HRESULT CShellLink::GetAdvertiseInfo ( LPWSTR str,
DWORD  dwSig 
)
private

Definition at line 620 of file CShellLink.cpp.

621{
622 LPEXP_DARWIN_LINK pInfo;
623
624 *str = NULL;
625
627 if (!pInfo)
628 return E_FAIL;
629
630 /* Make sure that the size of the structure is valid */
631 if (pInfo->dbh.cbSize != sizeof(*pInfo))
632 {
633 ERR("Ooops. This structure is not as expected...\n");
634 return E_FAIL;
635 }
636
637 TRACE("dwSig %08x string = '%s'\n", pInfo->dbh.dwSignature, debugstr_w(pInfo->szwDarwinID));
638
639 *str = pInfo->szwDarwinID;
640 return S_OK;
641}
#define debugstr_w
Definition: kernel32.h:32
struct EXP_DARWIN_LINK * LPEXP_DARWIN_LINK

Referenced by Load(), Resolve(), and SetAdvertiseInfo().

◆ GetArguments() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetArguments ( LPSTR  pszArgs,
INT  cchMaxPath 
)
override

Definition at line 1251 of file CShellLink.cpp.

1252{
1253 TRACE("(%p)->(%p len=%u)\n", this, pszArgs, cchMaxPath);
1254
1255 if (cchMaxPath)
1256 *pszArgs = 0;
1257
1258 if (m_sArgs)
1260 pszArgs, cchMaxPath, NULL, NULL);
1261
1262 return S_OK;
1263}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111

◆ GetArguments() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetArguments ( LPWSTR  pszArgs,
INT  cchMaxPath 
)
override

Definition at line 1673 of file CShellLink.cpp.

1674{
1675 TRACE("(%p)->(%p len=%u)\n", this, pszArgs, cchMaxPath);
1676
1677 if (cchMaxPath)
1678 *pszArgs = 0;
1679
1680 if (m_sArgs)
1681 lstrcpynW(pszArgs, m_sArgs, cchMaxPath);
1682
1683 return S_OK;
1684}
#define lstrcpynW
Definition: compat.h:738

◆ GetClassID()

HRESULT STDMETHODCALLTYPE CShellLink::GetClassID ( CLSID pclsid)
override

Implements IPersist.

Definition at line 320 of file CShellLink.cpp.

321{
322 TRACE("%p %p\n", this, pclsid);
323
324 if (pclsid == NULL)
325 return E_POINTER;
326 *pclsid = CLSID_ShellLink;
327 return S_OK;
328}
#define E_POINTER
Definition: winerror.h:2365

◆ GetCommandString()

HRESULT STDMETHODCALLTYPE CShellLink::GetCommandString ( UINT_PTR  idCmd,
UINT  uType,
UINT pwReserved,
LPSTR  pszName,
UINT  cchMax 
)
override

Implements IContextMenu.

Definition at line 2701 of file CShellLink.cpp.

2702{
2703 FIXME("%p %lu %u %p %p %u\n", this, idCmd, uType, pwReserved, pszName, cchMax);
2704 return E_NOTIMPL;
2705}
UINT cchMax
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetCurFile()

HRESULT STDMETHODCALLTYPE CShellLink::GetCurFile ( LPOLESTR ppszFileName)
override

Implements IPersistFile.

Definition at line 408 of file CShellLink.cpp.

409{
410 *ppszFileName = NULL;
411
412 if (!m_sLinkPath)
413 {
414 /* IPersistFile::GetCurFile called before IPersistFile::Save */
415 return S_FALSE;
416 }
417
418 *ppszFileName = (LPOLESTR)CoTaskMemAlloc((wcslen(m_sLinkPath) + 1) * sizeof(WCHAR));
419 if (!*ppszFileName)
420 {
421 /* out of memory */
422 return E_OUTOFMEMORY;
423 }
424
425 /* copy last saved filename */
426 wcscpy(*ppszFileName, m_sLinkPath);
427
428 return S_OK;
429}
wcscpy
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static LPOLESTR
Definition: stg_prop.c:27

◆ GetDescription() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetDescription ( LPSTR  pszName,
INT  cchMaxName 
)
override

Definition at line 1187 of file CShellLink.cpp.

1188{
1189 TRACE("(%p)->(%p len=%u)\n", this, pszName, cchMaxName);
1190
1191 if (cchMaxName)
1192 *pszName = 0;
1193
1194 if (m_sDescription)
1196 pszName, cchMaxName, NULL, NULL);
1197
1198 return S_OK;
1199}

◆ GetDescription() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetDescription ( LPWSTR  pszName,
INT  cchMaxName 
)
override

Definition at line 1613 of file CShellLink.cpp.

1614{
1615 TRACE("(%p)->(%p len=%u)\n", this, pszName, cchMaxName);
1616
1617 *pszName = 0;
1618 if (m_sDescription)
1619 lstrcpynW(pszName, m_sDescription, cchMaxName);
1620
1621 return S_OK;
1622}

◆ GetFlags()

HRESULT STDMETHODCALLTYPE CShellLink::GetFlags ( DWORD pdwFlags)
override

Implements IShellLinkDataList.

Definition at line 2483 of file CShellLink.cpp.

2484{
2485 TRACE("%p %p\n", this, pdwFlags);
2486 *pdwFlags = m_Header.dwFlags;
2487 return S_OK;
2488}

◆ GetHotkey()

HRESULT STDMETHODCALLTYPE CShellLink::GetHotkey ( WORD pwHotkey)
override

Implements IShellLinkA.

Definition at line 1283 of file CShellLink.cpp.

1284{
1285 TRACE("(%p)->(%p)(0x%08x)\n", this, pwHotkey, m_Header.wHotKey);
1286 *pwHotkey = m_Header.wHotKey;
1287 return S_OK;
1288}

◆ GetIconLocation() [1/4]

HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation ( LPSTR  pszIconPath,
INT  cchIconPath,
INT piIcon 
)
override

Definition at line 1317 of file CShellLink.cpp.

1318{
1319 HRESULT hr;
1320 LPWSTR pszIconPathW;
1321
1322 TRACE("(%p)->(%p len=%u iicon=%p)\n", this, pszIconPath, cchIconPath, piIcon);
1323
1324 /* Allocate a temporary UNICODE buffer */
1325 pszIconPathW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cchIconPath * sizeof(WCHAR));
1326 if (!pszIconPathW)
1327 return E_OUTOFMEMORY;
1328
1329 /* Call the UNICODE function */
1330 hr = GetIconLocation(pszIconPathW, cchIconPath, piIcon);
1331
1332 /* Convert the file path back to ANSI */
1333 WideCharToMultiByte(CP_ACP, 0, pszIconPathW, -1,
1334 pszIconPath, cchIconPath, NULL, NULL);
1335
1336 /* Free the temporary buffer */
1337 HeapFree(GetProcessHeap(), 0, pszIconPathW);
1338
1339 return hr;
1340}
#define HeapAlloc
Definition: compat.h:733

Referenced by GetIconLocation().

◆ GetIconLocation() [2/4]

HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation ( LPWSTR  pszIconPath,
INT  cchIconPath,
INT piIcon 
)
override

Definition at line 1704 of file CShellLink.cpp.

1705{
1706 TRACE("(%p)->(%p len=%u iicon=%p)\n", this, pszIconPath, cchIconPath, piIcon);
1707
1708 if (cchIconPath)
1709 *pszIconPath = 0;
1710
1711 *piIcon = 0;
1712
1713 /* Update the original icon path location */
1715 {
1717
1718 /* Search for an icon environment block */
1719 LPEXP_SZ_LINK pInfo;
1721 if (pInfo && (pInfo->cbSize == sizeof(*pInfo)))
1722 {
1724
1725 m_Header.dwFlags &= ~SLDF_HAS_ICONLOCATION;
1727
1729 if (!m_sIcoPath)
1730 return E_OUTOFMEMORY;
1731
1733
1734 m_bDirty = TRUE;
1735 }
1736 }
1737
1738 *piIcon = m_Header.nIconIndex;
1739
1740 if (m_sIcoPath)
1741 lstrcpynW(pszIconPath, m_sIcoPath, cchIconPath);
1742
1743 return S_OK;
1744}
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
LPCWSTR szPath
Definition: env.c:37
@ SLDF_HAS_EXP_ICON_SZ
Definition: shlobj.h:1968
@ SLDF_HAS_ICONLOCATION
Definition: shlobj.h:1958
#define EXP_SZ_ICON_SIG
Definition: shlobj.h:2067
struct EXP_SZ_LINK * LPEXP_SZ_LINK
DWORD WINAPI SHExpandEnvironmentStringsW(LPCWSTR, LPWSTR, DWORD)

◆ GetIconLocation() [3/4]

HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation ( UINT  uFlags,
PSTR  pszIconFile,
UINT  cchMax,
int piIndex,
UINT pwFlags 
)
override

Definition at line 1342 of file CShellLink.cpp.

1343{
1344 HRESULT hr;
1345 LPWSTR pszIconFileW;
1346
1347 TRACE("(%p)->(%u %p len=%u piIndex=%p pwFlags=%p)\n", this, uFlags, pszIconFile, cchMax, piIndex, pwFlags);
1348
1349 /* Allocate a temporary UNICODE buffer */
1350 pszIconFileW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cchMax * sizeof(WCHAR));
1351 if (!pszIconFileW)
1352 return E_OUTOFMEMORY;
1353
1354 /* Call the UNICODE function */
1355 hr = GetIconLocation(uFlags, pszIconFileW, cchMax, piIndex, pwFlags);
1356
1357 /* Convert the file path back to ANSI */
1358 WideCharToMultiByte(CP_ACP, 0, pszIconFileW, -1,
1359 pszIconFile, cchMax, NULL, NULL);
1360
1361 /* Free the temporary buffer */
1362 HeapFree(GetProcessHeap(), 0, pszIconFileW);
1363
1364 return hr;
1365}
UINT uFlags
Definition: api.c:59

◆ GetIconLocation() [4/4]

HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation ( UINT  uFlags,
PWSTR  pszIconFile,
UINT  cchMax,
int piIndex,
UINT pwFlags 
)
override

Definition at line 1760 of file CShellLink.cpp.

1761{
1762 HRESULT hr;
1763
1764 pszIconFile[0] = UNICODE_NULL;
1765
1766 /*
1767 * It is possible for a shell link to point to another shell link,
1768 * and in particular there is the possibility to point to itself.
1769 * Now, suppose we ask such a link to retrieve its associated icon.
1770 * This function would be called, and due to COM would be called again
1771 * recursively. To solve this issue, we forbid calling GetIconLocation()
1772 * with GIL_FORSHORTCUT set in uFlags, as done by Windows (shown by tests).
1773 */
1774 if (uFlags & GIL_FORSHORTCUT)
1775 return E_INVALIDARG;
1776
1777 /*
1778 * Now, we set GIL_FORSHORTCUT so that: i) we allow the icon extractor
1779 * of the target to give us a suited icon, and ii) we protect ourselves
1780 * against recursive call.
1781 */
1782 uFlags |= GIL_FORSHORTCUT;
1783
1784 if (uFlags & GIL_DEFAULTICON)
1785 return S_FALSE;
1786
1787 hr = GetIconLocation(pszIconFile, cchMax, piIndex);
1788 if (FAILED(hr) || pszIconFile[0] == UNICODE_NULL)
1789 {
1790 hr = SHELL_PidlGetIconLocationW(m_pPidl, uFlags, pszIconFile, cchMax, piIndex, pwFlags);
1791 }
1792 else
1793 {
1794 // TODO: If GetIconLocation succeeded, why are we setting GIL_NOTFILENAME? And are we not PERINSTANCE?
1795 *pwFlags = GIL_NOTFILENAME | GIL_PERCLASS;
1796 }
1797
1798 return hr;
1799}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define FAILED(hr)
Definition: intsafe.h:51
#define UNICODE_NULL

◆ GetIDList()

HRESULT STDMETHODCALLTYPE CShellLink::GetIDList ( PIDLIST_ABSOLUTE ppidl)
override

Implements IShellLinkA.

Definition at line 1167 of file CShellLink.cpp.

1168{
1169 TRACE("(%p)->(ppidl=%p)\n", this, ppidl);
1170
1171 if (!m_pPidl)
1172 {
1173 *ppidl = NULL;
1174 return S_FALSE;
1175 }
1176
1177 *ppidl = ILClone(m_pPidl);
1178 return S_OK;
1179}
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237

Referenced by OnInitDialog().

◆ GetPath() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetPath ( LPSTR  pszFile,
INT  cchMaxPath,
WIN32_FIND_DATAA pfd,
DWORD  fFlags 
)
override

Definition at line 1118 of file CShellLink.cpp.

1119{
1120 HRESULT hr;
1121 LPWSTR pszFileW;
1122 WIN32_FIND_DATAW wfd;
1123
1124 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
1125 this, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(m_sPath));
1126
1127 /* Allocate a temporary UNICODE buffer */
1128 pszFileW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, max(cchMaxPath, MAX_PATH) * sizeof(WCHAR));
1129 if (!pszFileW)
1130 return E_OUTOFMEMORY;
1131
1132 /* Call the UNICODE function */
1133 hr = GetPath(pszFileW, cchMaxPath, &wfd, fFlags);
1134
1135 /* Convert the file path back to ANSI */
1136 WideCharToMultiByte(CP_ACP, 0, pszFileW, -1,
1137 pszFile, cchMaxPath, NULL, NULL);
1138
1139 /* Free the temporary buffer */
1140 HeapFree(GetProcessHeap(), 0, pszFileW);
1141
1142 if (pfd)
1143 {
1144 ZeroMemory(pfd, sizeof(*pfd));
1145
1146 /* Copy the file data if a file path was returned */
1147 if (*pszFile)
1148 {
1149 DWORD len;
1150
1151 /* Copy the fixed part */
1152 CopyMemory(pfd, &wfd, FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
1153
1154 /* Convert the file names to ANSI */
1155 len = lstrlenW(wfd.cFileName);
1156 WideCharToMultiByte(CP_ACP, 0, wfd.cFileName, len + 1,
1157 pfd->cFileName, sizeof(pfd->cFileName), NULL, NULL);
1158 len = lstrlenW(wfd.cAlternateFileName);
1159 WideCharToMultiByte(CP_ACP, 0, wfd.cAlternateFileName, len + 1,
1160 pfd->cAlternateFileName, sizeof(pfd->cAlternateFileName), NULL, NULL);
1161 }
1162 }
1163
1164 return hr;
1165}
#define lstrlenW
Definition: compat.h:750
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static PIXELFORMATDESCRIPTOR pfd
Definition: ssstars.c:67
#define max(a, b)
Definition: svc.c:63
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by GetPath(), OnInitDialog(), and Save().

◆ GetPath() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetPath ( LPWSTR  pszFile,
INT  cchMaxPath,
WIN32_FIND_DATAW pfd,
DWORD  fFlags 
)
override

Definition at line 1532 of file CShellLink.cpp.

1533{
1535
1536 TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
1537 this, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(m_sPath));
1538
1539 if (cchMaxPath)
1540 *pszFile = 0;
1541 // FIXME: What if cchMaxPath == 0 , or pszFile == NULL ??
1542
1543 // FIXME: What about Darwin??
1544
1545 /*
1546 * Retrieve the path to the target from the PIDL (if we have one).
1547 * NOTE: Do NOT use the cached path (m_sPath from link info).
1548 */
1550 {
1551 if (fFlags & SLGP_SHORTPATH)
1553 // FIXME: Add support for SLGP_UNCPRIORITY
1554 }
1555 else
1556 {
1557 *buffer = 0;
1558 }
1559
1560 /* If we have a FindData structure, initialize it */
1561 if (pfd)
1562 {
1563 ZeroMemory(pfd, sizeof(*pfd));
1564
1565 /* Copy the file data if the target is a file path */
1566 if (*buffer)
1567 {
1568 pfd->dwFileAttributes = m_Header.dwFileAttributes;
1569 pfd->ftCreationTime = m_Header.ftCreationTime;
1570 pfd->ftLastAccessTime = m_Header.ftLastAccessTime;
1571 pfd->ftLastWriteTime = m_Header.ftLastWriteTime;
1572 pfd->nFileSizeHigh = 0;
1573 pfd->nFileSizeLow = m_Header.nFileSizeLow;
1574
1575 /*
1576 * Build temporarily a short path in pfd->cFileName (of size MAX_PATH),
1577 * then extract and store the short file name in pfd->cAlternateFileName.
1578 */
1579 GetShortPathNameW(buffer, pfd->cFileName, _countof(pfd->cFileName));
1580 lstrcpynW(pfd->cAlternateFileName,
1581 PathFindFileNameW(pfd->cFileName),
1582 _countof(pfd->cAlternateFileName));
1583
1584 /* Now extract and store the long file name in pfd->cFileName */
1585 lstrcpynW(pfd->cFileName,
1587 _countof(pfd->cFileName));
1588 }
1589 }
1590
1591 /* Finally check if we have a raw path the user actually wants to retrieve */
1592 if ((fFlags & SLGP_RAWPATH) && (m_Header.dwFlags & SLDF_HAS_EXP_SZ))
1593 {
1594 /* Search for a target environment block */
1595 LPEXP_SZ_LINK pInfo;
1597 if (pInfo && (pInfo->cbSize == sizeof(*pInfo)))
1598 lstrcpynW(buffer, pInfo->szwTarget, cchMaxPath);
1599 }
1600
1601 /* For diagnostics purposes only... */
1602 // NOTE: SLGP_UNCPRIORITY is unsupported
1603 fFlags &= ~(SLGP_RAWPATH | SLGP_SHORTPATH);
1604 if (fFlags) FIXME("(%p): Unsupported flags %lu\n", this, fFlags);
1605
1606 /* Copy the data back to the user */
1607 if (*buffer)
1608 lstrcpynW(pszFile, buffer, cchMaxPath);
1609
1610 return (*buffer ? S_OK : S_FALSE);
1611}
DWORD WINAPI GetShortPathNameW(IN LPCWSTR lpszLongPath, OUT LPWSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1833
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
GLuint buffer
Definition: glext.h:5915
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1489
#define EXP_SZ_LINK_SIG
Definition: shlobj.h:2059

◆ GetShowCmd()

HRESULT STDMETHODCALLTYPE CShellLink::GetShowCmd ( INT piShowCmd)
override

Definition at line 1300 of file CShellLink.cpp.

1301{
1302 TRACE("(%p)->(%p) %d\n", this, piShowCmd, m_Header.nShowCommand);
1303 *piShowCmd = m_Header.nShowCommand;
1304 return S_OK;
1305}

◆ GetSite()

HRESULT STDMETHODCALLTYPE CShellLink::GetSite ( REFIID  iid,
void **  ppvSite 
)
override

Definition at line 3167 of file CShellLink.cpp.

3168{
3169 TRACE("%p %s %p\n", this, debugstr_guid(&iid), ppvSite);
3170
3171 if (m_site == NULL)
3172 return E_FAIL;
3173
3174 return m_site->QueryInterface(iid, ppvSite);
3175}
#define debugstr_guid
Definition: kernel32.h:35

◆ GetSizeMax()

HRESULT STDMETHODCALLTYPE CShellLink::GetSizeMax ( ULARGE_INTEGER pcbSize)
override

Implements IPersistStream.

Definition at line 1050 of file CShellLink.cpp.

1051{
1052 TRACE("(%p)\n", this);
1053 return E_NOTIMPL;
1054}

◆ GetWorkingDirectory() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetWorkingDirectory ( LPSTR  pszDir,
INT  cchMaxPath 
)
override

Definition at line 1219 of file CShellLink.cpp.

1220{
1221 TRACE("(%p)->(%p len=%u)\n", this, pszDir, cchMaxPath);
1222
1223 if (cchMaxPath)
1224 *pszDir = 0;
1225
1226 if (m_sWorkDir)
1228 pszDir, cchMaxPath, NULL, NULL);
1229
1230 return S_OK;
1231}
_In_ LPCSTR pszDir
Definition: shellapi.h:602

◆ GetWorkingDirectory() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::GetWorkingDirectory ( LPWSTR  pszDir,
INT  cchMaxPath 
)
override

Definition at line 1642 of file CShellLink.cpp.

1643{
1644 TRACE("(%p)->(%p len %u)\n", this, pszDir, cchMaxPath);
1645
1646 if (cchMaxPath)
1647 *pszDir = 0;
1648
1649 if (m_sWorkDir)
1650 lstrcpynW(pszDir, m_sWorkDir, cchMaxPath);
1651
1652 return S_OK;
1653}

◆ Initialize()

HRESULT STDMETHODCALLTYPE CShellLink::Initialize ( PCIDLIST_ABSOLUTE  pidlFolder,
IDataObject pdtobj,
HKEY  hkeyProgID 
)
override

Implements IShellExtInit.

Definition at line 2504 of file CShellLink.cpp.

2505{
2506 TRACE("%p %p %p %p\n", this, pidlFolder, pdtobj, hkeyProgID);
2507
2508 if (!pdtobj)
2509 return E_FAIL;
2510
2511 FORMATETC format;
2512 format.cfFormat = CF_HDROP;
2513 format.ptd = NULL;
2514 format.dwAspect = DVASPECT_CONTENT;
2515 format.lindex = -1;
2516 format.tymed = TYMED_HGLOBAL;
2517
2518 STGMEDIUM stgm;
2519 HRESULT hr = pdtobj->GetData(&format, &stgm);
2520 if (FAILED(hr))
2521 return hr;
2522
2523 UINT count = DragQueryFileW((HDROP)stgm.hGlobal, -1, NULL, 0);
2524 if (count == 1)
2525 {
2526 count = DragQueryFileW((HDROP)stgm.hGlobal, 0, NULL, 0);
2527 count++;
2528 LPWSTR path = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR));
2529 if (path)
2530 {
2531 count = DragQueryFileW((HDROP)stgm.hGlobal, 0, path, count);
2532 hr = Load(path, 0);
2534 }
2535 }
2536 ReleaseStgMedium(&stgm);
2537
2538 return S_OK;
2539}
#define CF_HDROP
Definition: constants.h:410
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, UINT lLength)
Definition: shellole.c:622
GLuint GLuint GLsizei count
Definition: gl.h:1545
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
Definition: format.c:58

◆ InvokeCommand()

HRESULT STDMETHODCALLTYPE CShellLink::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpici)
override

Implements IContextMenu.

Definition at line 2596 of file CShellLink.cpp.

2597{
2598 TRACE("%p %p\n", this, lpici);
2599
2600 if (lpici->cbSize < sizeof(CMINVOKECOMMANDINFO))
2601 return E_INVALIDARG;
2602
2603 // NOTE: We could use lpici->hwnd (certainly in case lpici->fMask doesn't contain CMIC_MASK_FLAG_NO_UI)
2604 // as the parent window handle... ?
2605 /* FIXME: get using interface set from IObjectWithSite?? */
2606 // NOTE: We might need an extended version of Resolve that provides us with paths...
2607 HRESULT hr = Resolve(lpici->hwnd, (lpici->fMask & CMIC_MASK_FLAG_NO_UI) ? SLR_NO_UI : 0);
2608 if (FAILED(hr))
2609 {
2610 TRACE("failed to resolve component error 0x%08x\n", hr);
2611 return hr;
2612 }
2613
2614 UINT idCmd = LOWORD(lpici->lpVerb);
2615 TRACE("idCmd: %d\n", idCmd);
2616
2617 switch (idCmd)
2618 {
2619 case IDCMD_OPEN:
2620 return DoOpen(lpici);
2622 return DoOpenFileLocation();
2623 default:
2624 return E_NOTIMPL;
2625 }
2626}
struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
int DoOpen(void)
Definition: cmds.c:2168

◆ IsDirty()

HRESULT STDMETHODCALLTYPE CShellLink::IsDirty ( void  )
override

Implements IPersistStream.

Definition at line 333 of file CShellLink.cpp.

334{
335 TRACE("(%p)\n", this);
336 return (m_bDirty ? S_OK : S_FALSE);
337}

◆ Load() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::Load ( IStream stm)
override

Implements IPersistStream.

Definition at line 646 of file CShellLink.cpp.

647{
648 TRACE("%p %p\n", this, stm);
649
650 if (!stm)
652
653 /* Free all the old stuff */
654 Reset();
655
656 ULONG dwBytesRead = 0;
657 HRESULT hr = stm->Read(&m_Header, sizeof(m_Header), &dwBytesRead);
658 if (FAILED(hr))
659 return hr;
660
661 if (dwBytesRead != sizeof(m_Header))
662 return E_FAIL;
663 if (m_Header.dwSize != sizeof(m_Header))
664 return E_FAIL;
665 if (!IsEqualIID(m_Header.clsid, CLSID_ShellLink))
666 return E_FAIL;
667
668 /* Load the new data in order */
669
670 if (TRACE_ON(shell))
671 {
672 SYSTEMTIME stCreationTime;
673 SYSTEMTIME stLastAccessTime;
674 SYSTEMTIME stLastWriteTime;
675 WCHAR sTemp[MAX_PATH];
676
680
682 NULL, sTemp, _countof(sTemp));
683 TRACE("-- stCreationTime: %s\n", debugstr_w(sTemp));
685 NULL, sTemp, _countof(sTemp));
686 TRACE("-- stLastAccessTime: %s\n", debugstr_w(sTemp));
688 NULL, sTemp, _countof(sTemp));
689 TRACE("-- stLastWriteTime: %s\n", debugstr_w(sTemp));
690 }
691
692 /* load all the new stuff */
694 {
695 hr = ILLoadFromStream(stm, &m_pPidl);
696 if (FAILED(hr))
697 return hr;
698 }
699 pdump(m_pPidl);
700
701 /* Load the location information... */
703 {
705 if (FAILED(hr))
706 return hr;
707 }
708 /* ... but if it is required not to use it, clear it */
710 {
712 m_sPath = NULL;
713 ZeroMemory(&volume, sizeof(volume));
714 }
715
716 BOOL unicode = !!(m_Header.dwFlags & SLDF_UNICODE);
717
719 {
720 hr = Stream_LoadString(stm, unicode, &m_sDescription);
721 if (FAILED(hr))
722 return hr;
723 TRACE("Description -> %s\n", debugstr_w(m_sDescription));
724 }
725
727 {
728 hr = Stream_LoadString(stm, unicode, &m_sPathRel);
729 if (FAILED(hr))
730 return hr;
731 TRACE("Relative Path-> %s\n", debugstr_w(m_sPathRel));
732 }
733
735 {
736 hr = Stream_LoadString(stm, unicode, &m_sWorkDir);
737 if (FAILED(hr))
738 return hr;
740 TRACE("Working Dir -> %s\n", debugstr_w(m_sWorkDir));
741 }
742
744 {
745 hr = Stream_LoadString(stm, unicode, &m_sArgs);
746 if (FAILED(hr))
747 return hr;
748 TRACE("Arguments -> %s\n", debugstr_w(m_sArgs));
749 }
750
752 {
753 hr = Stream_LoadString(stm, unicode, &m_sIcoPath);
754 if (FAILED(hr))
755 return hr;
756 TRACE("Icon file -> %s\n", debugstr_w(m_sIcoPath));
757 }
758
759 /* Now load the optional data block list */
761 if (FAILED(hr)) // FIXME: Should we fail?
762 return hr;
763
765 if (pSpecial && pSpecial->cbSize == sizeof(*pSpecial) && ILGetSize(m_pPidl) > pSpecial->cbOffset)
766 {
768 {
769 LPITEMIDLIST pidl = ILCombine(folder, (LPITEMIDLIST)((char*)m_pPidl + pSpecial->cbOffset));
770 if (pidl)
771 {
773 m_pPidl = pidl;
774 TRACE("Replaced pidl base with CSIDL %u up to %ub.\n", pSpecial->idSpecialFolder, pSpecial->cbOffset);
775 }
776 ILFree(folder);
777 }
778 }
779
780 if (TRACE_ON(shell))
781 {
782#if (NTDDI_VERSION < NTDDI_LONGHORN)
784 {
785 hr = GetAdvertiseInfo(&sProduct, EXP_LOGO3_ID_SIG);
786 if (SUCCEEDED(hr))
787 TRACE("Product -> %s\n", debugstr_w(sProduct));
788 }
789#endif
791 {
793 if (SUCCEEDED(hr))
794 TRACE("Component -> %s\n", debugstr_w(sComponent));
795 }
796 }
797
799 m_bRunAs = TRUE;
800 else
801 m_bRunAs = FALSE;
802
803 TRACE("OK\n");
804
805 pdump(m_pPidl);
806
807 return S_OK;
808}
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:322
#define TRACE_ON(x)
Definition: compat.h:75
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
HRESULT WINAPI SHReadDataBlockList(IStream *lpStream, LPDBLIST *lppList)
Definition: clist.c:235
HRESULT Read([out, size_is(cb), length_is(*pcbRead)] void *pv, [in] ULONG cb, [out] ULONG *pcbRead)
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:989
#define LOCALE_USER_DEFAULT
LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND hwndOwner, int nFolder, BOOL fCreate)
Definition: pidl.c:445
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:816
HRESULT WINAPI ILLoadFromStream(IStream *pStream, LPITEMIDLIST *ppPidl)
Definition: pidl.c:293
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define ILGetSize
Definition: shellclasses.h:638
#define EXP_DARWIN_ID_SIG
Definition: shlobj.h:2063
@ SLDF_HAS_RELPATH
Definition: shlobj.h:1955
@ SLDF_HAS_ID_LIST
Definition: shlobj.h:1952
@ SLDF_HAS_DARWINID
Definition: shlobj.h:1966
@ SLDF_HAS_LINK_INFO
Definition: shlobj.h:1953
@ SLDF_HAS_WORKINGDIR
Definition: shlobj.h:1956
@ SLDF_HAS_ARGS
Definition: shlobj.h:1957
@ SLDF_FORCE_NO_LINKINFO
Definition: shlobj.h:1960
@ SLDF_RUNAS_USER
Definition: shlobj.h:1967
@ SLDF_UNICODE
Definition: shlobj.h:1959
@ SLDF_HAS_NAME
Definition: shlobj.h:1954
#define EXP_SPECIAL_FOLDER_SIG
Definition: shlobj.h:2062
struct EXP_SPECIAL_FOLDER * LPEXP_SPECIAL_FOLDER
#define PathRemoveBackslash
Definition: shlwapi.h:1058
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
DWORD idSpecialFolder
Definition: shlobj.h:2049
Definition: fci.c:116
uint32_t ULONG
Definition: typedefs.h:59
#define STG_E_INVALIDPOINTER
Definition: winerror.h:2571
#define DATE_SHORTDATE
Definition: winnls.h:198

◆ Load() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::Load ( LPCOLESTR  pszFileName,
DWORD  dwMode 
)
override

Implements IPersistFile.

Definition at line 339 of file CShellLink.cpp.

340{
341 TRACE("(%p, %s, %x)\n", this, debugstr_w(pszFileName), dwMode);
342
343 if (dwMode == 0)
345
348 if (SUCCEEDED(hr))
349 {
352 hr = Load(stm);
354 m_bDirty = FALSE;
355 }
356 TRACE("-- returning hr %08x\n", hr);
357 return hr;
358}
HRESULT WINAPI SHCreateStreamOnFileW(LPCWSTR lpszPath, DWORD dwMode, IStream **lppStream)
Definition: istream.c:484
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:922
#define STGM_READ
Definition: objbase.h:917
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44

Referenced by Initialize(), and Load().

◆ OnCommand()

void CShellLink::OnCommand ( HWND  hwndDlg,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)

Definition at line 2932 of file CShellLink.cpp.

2933{
2934 switch (id)
2935 {
2936 case IDC_SHORTCUT_FIND:
2938 return;
2939
2941 {
2942 SHFILEINFOW fi;
2944 WCHAR wszPath[MAX_PATH];
2945 *wszPath = UNICODE_NULL;
2946
2947 if (!StrIsNullOrEmpty(m_sIcoPath))
2948 {
2949 PWSTR pszPath = m_sIcoPath;
2950 if (*m_sIcoPath == '.') // Extension-only icon location, we need a fake path
2951 {
2952 if (SUCCEEDED(StringCchPrintfW(wszPath, _countof(wszPath), L"x:\\x%s", m_sIcoPath)) &&
2953 SHGetFileInfoW(wszPath, 0, &fi, sizeof(fi), SHGFI_ICONLOCATION | SHGFI_USEFILEATTRIBUTES))
2954 {
2955 pszPath = fi.szDisplayName; // The path is now a generic icon based
2956 IconIndex = fi.iIcon; // on the registry info of the file extension.
2957 }
2958 }
2959
2960 if (FAILED(StringCchCopyW(wszPath, _countof(wszPath), pszPath)))
2961 *wszPath = UNICODE_NULL;
2962 }
2963 else if (!StrIsNullOrEmpty(m_sPath))
2964 {
2965 FindExecutableW(m_sPath, NULL, wszPath);
2966 }
2967
2968 if (!*wszPath && m_pPidl)
2969 {
2970 if (SHGetFileInfoW((PWSTR)m_pPidl, 0, &fi, sizeof(fi), SHGFI_ICONLOCATION | SHGFI_PIDL) &&
2971 SUCCEEDED(StringCchCopyW(wszPath, _countof(wszPath), fi.szDisplayName)))
2972 {
2973 IconIndex = fi.iIcon;
2974 }
2975 }
2976
2977 if (PickIconDlg(hwndDlg, wszPath, _countof(wszPath), &IconIndex))
2978 {
2979 SetIconLocation(wszPath, IconIndex);
2980 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2981
2982 HICON hIconLarge = CreateShortcutIcon(wszPath, IconIndex);
2983 if (hIconLarge)
2984 {
2985 if (m_hIcon)
2987 m_hIcon = hIconLarge;
2989 }
2990 }
2991 return;
2992 }
2993
2995 {
2997 if (result == 1 || result == 0)
2998 {
2999 if (m_bRunAs != result)
3000 {
3001 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3002 }
3003
3004 m_bRunAs = result;
3005 }
3006 return;
3007 }
3008 }
3009 if (codeNotify == EN_CHANGE || codeNotify == CBN_SELCHANGE)
3010 {
3011 if (!m_bInInit)
3012 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3013 }
3014}
BOOL WINAPI PickIconDlg(HWND hWndOwner, LPWSTR lpstrFile, UINT nMaxFile, INT *lpdwIconIndex)
Definition: dialogs.cpp:351
GLuint64EXT * result
Definition: glext.h:11304
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
Definition: shell32_main.c:430
#define SHGFI_ICONLOCATION
Definition: shellapi.h:170
#define SHGFI_USEFILEATTRIBUTES
Definition: shellapi.h:182
#define SHGFI_PIDL
Definition: shellapi.h:181
HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpResult)
Definition: shlexec.cpp:1312
EXTERN_C HRESULT WINAPI SHOpenFolderAndSelectItems(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD dwFlags)
Definition: shlfolder.cpp:540
#define IDC_SHORTCUT_FIND
Definition: shresdef.h:502
#define IDC_SHORTCUT_ADVANCED
Definition: shresdef.h:504
#define IDC_SHORTCUT_ICON
Definition: shresdef.h:486
#define IDC_SHORTCUT_CHANGE_ICON
Definition: shresdef.h:503
#define IDD_SHORTCUT_EXTENDED_PROPERTIES
Definition: shresdef.h:433
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
WCHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:388
uint16_t * PWSTR
Definition: typedefs.h:56
UINT_PTR WPARAM
Definition: windef.h:207
#define STM_SETICON
Definition: winuser.h:2103
#define CBN_SELCHANGE
Definition: winuser.h:1990
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetParent(_In_ HWND)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define EN_CHANGE
Definition: winuser.h:2033

◆ OnDestroy()

void CShellLink::OnDestroy ( HWND  hwndDlg)

Definition at line 3085 of file CShellLink.cpp.

3086{
3087 if (m_hIcon)
3088 {
3090 m_hIcon = NULL;
3091 }
3092}

◆ OnInitDialog()

BOOL CShellLink::OnInitDialog ( HWND  hwndDlg,
HWND  hwndFocus,
LPARAM  lParam 
)

Definition at line 2772 of file CShellLink.cpp.

2773{
2774 TRACE("CShellLink::OnInitDialog(hwnd %p hwndFocus %p lParam %p)\n", hwndDlg, hwndFocus, lParam);
2775
2777
2778 TRACE("m_sArgs: %S sComponent: %S m_sDescription: %S m_sIcoPath: %S m_sPath: %S m_sPathRel: %S sProduct: %S m_sWorkDir: %S\n", m_sArgs, sComponent, m_sDescription,
2780
2781 m_bInInit = TRUE;
2783
2784 /* Get file information */
2785 // FIXME! FIXME! Shouldn't we use m_sIcoPath, m_Header.nIconIndex instead???
2786 SHFILEINFOW fi;
2787 if (!SHGetFileInfoW(m_sLinkPath, 0, &fi, sizeof(fi), SHGFI_TYPENAME | SHGFI_ICON))
2788 {
2789 ERR("SHGetFileInfoW failed for %ls (%lu)\n", m_sLinkPath, GetLastError());
2790 fi.szTypeName[0] = L'\0';
2791 fi.hIcon = NULL;
2792 }
2793
2794 if (fi.hIcon)
2795 {
2796 if (m_hIcon)
2798 m_hIcon = fi.hIcon;
2800 }
2801 else
2802 ERR("ExtractIconW failed %ls %u\n", m_sIcoPath, m_Header.nIconIndex);
2803
2804 if (!SHGetFileInfoW(m_sLinkPath, 0, &fi, sizeof(fi), SHGFI_DISPLAYNAME))
2807
2808 /* Target type */
2809 if (m_sPath)
2810 {
2814 }
2815
2816 /* Target location */
2817 if (m_sPath)
2818 {
2823 }
2824
2825 /* Target path */
2826 if (m_sPath)
2827 {
2828 WCHAR newpath[MAX_PATH * 2];
2829 newpath[0] = UNICODE_NULL;
2830 if (wcschr(m_sPath, ' '))
2831 StringCchPrintfExW(newpath, _countof(newpath), NULL, NULL, 0, L"\"%ls\"", m_sPath);
2832 else
2833 StringCchCopyExW(newpath, _countof(newpath), m_sPath, NULL, NULL, 0);
2834
2835 if (m_sArgs && m_sArgs[0])
2836 {
2837 StringCchCatW(newpath, _countof(newpath), L" ");
2838 StringCchCatW(newpath, _countof(newpath), m_sArgs);
2839 }
2840 SetDlgItemTextW(hwndDlg, IDC_SHORTCUT_TARGET_TEXT, newpath);
2841 }
2842
2843 /* Working dir */
2844 if (m_sWorkDir)
2846
2847 /* Description */
2848 if (m_sDescription)
2850
2851 /* Hot key */
2853
2854 /* Run */
2856 const DWORD runshowcmd[] = { SW_SHOWNORMAL, SW_SHOWMINNOACTIVE, SW_SHOWMAXIMIZED };
2857 HWND hRunCombo = GetDlgItem(hwndDlg, IDC_SHORTCUT_RUN_COMBO);
2858 for (UINT i = 0; i < _countof(runstrings); ++i)
2859 {
2861 if (!LoadStringW(shell32_hInstance, runstrings[i], buf, _countof(buf)))
2862 break;
2863
2864 int index = SendMessageW(hRunCombo, CB_ADDSTRING, 0, (LPARAM)buf);
2865 if (index < 0)
2866 continue;
2867 SendMessageW(hRunCombo, CB_SETITEMDATA, index, runshowcmd[i]);
2868 if (!i || m_Header.nShowCommand == runshowcmd[i])
2869 SendMessageW(hRunCombo, CB_SETCURSEL, index, 0);
2870 }
2871
2872 BOOL disablecontrols = FALSE;
2873 if (darwin)
2874 {
2875 disablecontrols = TRUE;
2878 }
2879 else
2880 {
2881 WCHAR path[MAX_PATH * 2];
2882 path[0] = UNICODE_NULL;
2884 if (FAILED(hr))
2885 hr = GetPath(path, _countof(path), NULL, 0);
2886#if DBG
2887 if (GetKeyState(VK_CONTROL) < 0) // Allow inspection of PIDL parsing path
2888 {
2889 hr = S_OK;
2890 path[0] = UNICODE_NULL;
2891 }
2892#endif
2893 if (hr != S_OK)
2894 {
2895 disablecontrols = TRUE;
2896 LPITEMIDLIST pidl;
2897 if (GetIDList(&pidl) == S_OK)
2898 {
2899 path[0] = UNICODE_NULL;
2900 SHGetNameAndFlagsW(pidl, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING, path, _countof(path), NULL);
2903 ILRemoveLastID(pidl);
2904 path[0] = UNICODE_NULL;
2906 SHGetNameAndFlagsW(pidl, SHGDN_NORMAL, path, _countof(path), NULL);
2908 ILFree(pidl);
2909 }
2912 }
2913 else
2914 {
2915 ASSERT(FAILED(hr) || !(path[0] == ':' && path[1] == ':' && path[2] == '{'));
2916 }
2917 }
2918
2919 HWND hWndTarget = GetDlgItem(hwndDlg, IDC_SHORTCUT_TARGET_TEXT);
2920 EnableWindow(hWndTarget, !disablecontrols);
2921 PostMessage(hWndTarget, EM_SETSEL, 0, -1); // Fix caret bug when first opening the tab [CORE-20016]
2922
2923 /* auto-completion */
2924 SHAutoComplete(hWndTarget, SHACF_DEFAULT);
2926
2927 m_bInInit = FALSE;
2928
2929 return TRUE;
2930}
#define wcschr
Definition: compat.h:17
HRESULT SHGetNameAndFlagsW(_In_ LPCITEMIDLIST pidl, _In_ DWORD dwFlags, _Out_opt_ LPWSTR pszText, _In_ UINT cchBuf, _Inout_opt_ DWORD *pdwAttributes)
Definition: utils.cpp:480
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath)
Definition: path.c:629
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum target
Definition: glext.h:7315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ASSERT(a)
Definition: mode.c:44
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:221
#define HKM_SETHOTKEY
Definition: commctrl.h:2236
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:167
#define SHGFI_ICON
Definition: shellapi.h:165
#define SHGFI_TYPENAME
Definition: shellapi.h:168
HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
Definition: autocomp.cpp:191
#define SHACF_DEFAULT
Definition: shlwapi.h:1956
#define IDS_SHORTCUT_RUN_MAX
Definition: shresdef.h:263
#define IDC_SHORTCUT_RUN_COMBO
Definition: shresdef.h:499
#define IDS_SHORTCUT_RUN_MIN
Definition: shresdef.h:262
#define IDC_SHORTCUT_LOCATION_EDIT
Definition: shresdef.h:491
#define IDC_SHORTCUT_TEXT
Definition: shresdef.h:487
#define IDC_SHORTCUT_TARGET_TEXT
Definition: shresdef.h:493
#define IDC_SHORTCUT_KEY_HOTKEY
Definition: shresdef.h:497
#define IDS_SHORTCUT_RUN_NORMAL
Definition: shresdef.h:261
#define IDC_SHORTCUT_TYPE_EDIT
Definition: shresdef.h:489
#define IDC_SHORTCUT_COMMENT_EDIT
Definition: shresdef.h:501
#define IDC_SHORTCUT_START_IN_EDIT
Definition: shresdef.h:495
STRSAFEAPI StringCchCopyExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:184
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchPrintfExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:585
WCHAR szTypeName[80]
Definition: shellapi.h:389
HICON hIcon
Definition: shellapi.h:385
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SW_SHOWMAXIMIZED
Definition: winuser.h:784
#define CB_SETITEMDATA
Definition: winuser.h:1977
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CB_SETCURSEL
Definition: winuser.h:1972
#define VK_CONTROL
Definition: winuser.h:2214
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define CB_ADDSTRING
Definition: winuser.h:1947
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define EM_SETSEL
Definition: winuser.h:2029
#define PostMessage
Definition: winuser.h:5852
#define SW_SHOWMINNOACTIVE
Definition: winuser.h:788
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)

◆ OnNotify()

LRESULT CShellLink::OnNotify ( HWND  hwndDlg,
int  idFrom,
LPNMHDR  pnmhdr 
)

Definition at line 3016 of file CShellLink.cpp.

3017{
3018 WCHAR wszBuf[MAX_PATH];
3019 LPPSHNOTIFY lppsn = (LPPSHNOTIFY)pnmhdr;
3020
3021 if (lppsn->hdr.code == PSN_APPLY)
3022 {
3023 /* set working directory */
3024 GetDlgItemTextW(hwndDlg, IDC_SHORTCUT_START_IN_EDIT, wszBuf, _countof(wszBuf));
3025 SetWorkingDirectory(wszBuf);
3026
3027 /* set link destination */
3028 HWND hWndTarget = GetDlgItem(hwndDlg, IDC_SHORTCUT_TARGET_TEXT);
3029 GetWindowTextW(hWndTarget, wszBuf, _countof(wszBuf));
3030 // Only set the path and arguments for filesystem targets (we can't verify other targets)
3031 if (IsWindowEnabled(hWndTarget))
3032 {
3033 LPWSTR lpszArgs = NULL;
3034 LPWSTR unquoted = wszBuf;
3035 StrTrimW(unquoted, L" ");
3036
3037 if (!PathFileExistsW(unquoted))
3038 {
3039 lpszArgs = PathGetArgsW(unquoted);
3040 PathRemoveArgsW(unquoted);
3041 StrTrimW(lpszArgs, L" ");
3042 }
3043 if (unquoted[0] == '"' && unquoted[wcslen(unquoted) - 1] == '"')
3044 PathUnquoteSpacesW(unquoted);
3045
3046 WCHAR *pwszExt = PathFindExtensionW(unquoted);
3047 if (!_wcsicmp(pwszExt, L".lnk"))
3048 {
3049 // TODO: SLDF_ALLOW_LINK_TO_LINK (Win7+)
3050 // FIXME load localized error msg
3051 MessageBoxW(hwndDlg, L"You cannot create a link to a shortcut", NULL, MB_ICONERROR);
3053 return TRUE;
3054 }
3055
3056 if (!PathFileExistsW(unquoted))
3057 {
3058 // FIXME load localized error msg
3059 MessageBoxW(hwndDlg, L"The specified file name in the target box is invalid", NULL, MB_ICONERROR);
3061 return TRUE;
3062 }
3063
3064 SetPath(unquoted);
3065 SetArguments(lpszArgs ? lpszArgs : L"\0");
3066 }
3067
3069
3071 if (index != CB_ERR)
3072 {
3074 }
3075
3076 TRACE("This %p m_sLinkPath %S\n", this, m_sLinkPath);
3080 return TRUE;
3081 }
3082 return FALSE;
3083}
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
void WINAPI PathRemoveArgsW(LPWSTR lpszPath)
Definition: path.c:779
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
BOOL WINAPI PathFileExistsW(LPCWSTR lpszPath)
Definition: path.c:1783
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1040
LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath)
Definition: path.c:506
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1883
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define PSNRET_INVALID_NOCHANGEPAGE
Definition: prsht.h:131
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
struct _PSHNOTIFY * LPPSHNOTIFY
#define HKM_GETHOTKEY
Definition: commctrl.h:2237
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define SHCNE_UPDATEITEM
Definition: shlobj.h:1911
#define SHCNF_PATHW
Definition: shlobj.h:1933
NMHDR hdr
Definition: prsht.h:330
UINT code
Definition: winuser.h:3170
#define SetWindowLongPtr
Definition: treelist.c:70
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define CB_ERR
Definition: winuser.h:2446
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:798
#define CB_GETITEMDATA
Definition: winuser.h:1961
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define CB_GETCURSEL
Definition: winuser.h:1954

◆ QueryContextMenu()

HRESULT STDMETHODCALLTYPE CShellLink::QueryContextMenu ( HMENU  hmenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
override

Implements IContextMenu.

Definition at line 2541 of file CShellLink.cpp.

2542{
2543 INT id = 0;
2544
2545 TRACE("%p %p %u %u %u %u\n", this,
2546 hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
2547
2548 if (!hMenu)
2549 return E_INVALIDARG;
2550
2553
2554 MENUITEMINFOW mii;
2555 ZeroMemory(&mii, sizeof(mii));
2556 mii.cbSize = sizeof(mii);
2558 mii.dwTypeData = strOpen.GetBuffer();
2559 mii.cch = wcslen(mii.dwTypeData);
2560 mii.wID = idCmdFirst + id++;
2562 mii.fType = MFT_STRING;
2563 if (!InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii))
2564 return E_FAIL;
2565
2567 mii.dwTypeData = strOpenFileLoc.GetBuffer();
2568 mii.cch = wcslen(mii.dwTypeData);
2569 mii.wID = idCmdFirst + id++;
2570 mii.fState = MFS_ENABLED;
2571 mii.fType = MFT_STRING;
2572 if (!InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii))
2573 return E_FAIL;
2574
2575 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, id);
2576}
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
#define IDS_OPEN_VERB
Definition: shresdef.h:212
#define IDS_OPENFILELOCATION
Definition: shresdef.h:246
LPWSTR dwTypeData
Definition: winuser.h:3280
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define MIIM_ID
Definition: winuser.h:733
#define MIIM_STATE
Definition: winuser.h:732
#define MFS_DEFAULT
Definition: winuser.h:759
#define MFS_ENABLED
Definition: winuser.h:761
#define MFT_STRING
Definition: winuser.h:757
#define MIIM_TYPE
Definition: winuser.h:736
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)

◆ RemoveDataBlock()

HRESULT STDMETHODCALLTYPE CShellLink::RemoveDataBlock ( DWORD  dwSig)
override

Implements IShellLinkDataList.

Definition at line 2473 of file CShellLink.cpp.

2474{
2475 if (SHRemoveDataBlock(&m_pDBList, dwSig))
2476 {
2477 m_bDirty = TRUE;
2478 return S_OK;
2479 }
2480 return S_FALSE;
2481}
BOOL WINAPI SHRemoveDataBlock(LPDBLIST *lppList, DWORD dwSignature)
Definition: clist.c:355

Referenced by SetIconLocation(), SetPath(), and WriteAdvertiseInfo().

◆ ReplacePage()

HRESULT STDMETHODCALLTYPE CShellLink::ReplacePage ( UINT  uPageID,
LPFNADDPROPSHEETPAGE  pfnReplacePage,
LPARAM  lParam 
)
override

Definition at line 3152 of file CShellLink.cpp.

3153{
3154 TRACE("(%p) (uPageID %u, pfnReplacePage %p lParam %p\n", this, uPageID, pfnReplacePage, lParam);
3155 return E_NOTIMPL;
3156}

◆ Reset()

VOID CShellLink::Reset ( )
private

Definition at line 236 of file CShellLink.cpp.

Referenced by Load().

◆ Resolve()

HRESULT STDMETHODCALLTYPE CShellLink::Resolve ( HWND  hwnd,
DWORD  fFlags 
)
override

Implements IShellLinkA.

Definition at line 1446 of file CShellLink.cpp.

1447{
1448 HRESULT hr = S_OK;
1449 BOOL bSuccess;
1450
1451 TRACE("(%p)->(hwnd=%p flags=%x)\n", this, hwnd, fFlags);
1452
1453 /* FIXME: use IResolveShellLink interface? */
1454
1455 // FIXME: See InvokeCommand().
1456
1457#if (NTDDI_VERSION < NTDDI_LONGHORN)
1458 // NOTE: For Logo3 (EXP_LOGO3_ID_SIG), check also for SHRestricted(REST_NOLOGO3CHANNELNOTIFY)
1460 {
1461 FIXME("Logo3 links are not supported yet!\n");
1462 return E_FAIL;
1463 }
1464#endif
1465
1466 /* Resolve Darwin (MSI) target */
1468 {
1469 LPWSTR component = NULL;
1470 hr = GetAdvertiseInfo(&component, EXP_DARWIN_ID_SIG);
1471 if (FAILED(hr))
1472 return E_FAIL;
1473
1474 /* Clear the cached path */
1477 if (!m_sPath)
1478 return E_FAIL;
1479 }
1480
1481 if (!m_sPath && m_pPidl)
1482 {
1484
1485 bSuccess = SHGetPathFromIDListW(m_pPidl, buffer);
1486 if (bSuccess && *buffer)
1487 {
1489 if (!m_sPath)
1490 return E_OUTOFMEMORY;
1491
1492 m_bDirty = TRUE;
1493 }
1494 else
1495 {
1496 hr = S_OK; /* don't report an error occurred while just caching information */
1497 }
1498 }
1499
1500 // FIXME: Strange to do that here...
1501 if (!m_sIcoPath && m_sPath)
1502 {
1504 if (!m_sIcoPath)
1505 return E_OUTOFMEMORY;
1506
1507 m_Header.nIconIndex = 0;
1508
1509 m_bDirty = TRUE;
1510 }
1511
1512 return hr;
1513}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by InvokeCommand(), and OnInitDialog().

◆ Save() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::Save ( IStream stm,
BOOL  fClearDirty 
)
override

Implements IPersistStream.

Definition at line 909 of file CShellLink.cpp.

910{
911 TRACE("%p %p %x\n", this, stm, fClearDirty);
912
913 m_Header.dwSize = sizeof(m_Header);
914 m_Header.clsid = CLSID_ShellLink;
916
917 /* Store target attributes */
918 WIN32_FIND_DATAW wfd = {};
919 WCHAR FsTarget[MAX_PATH];
920 if (GetPath(FsTarget, _countof(FsTarget), NULL, 0) == S_OK && PathFileExistsW(FsTarget))
921 {
922 HANDLE hFind = FindFirstFileW(FsTarget, &wfd);
923 if (hFind != INVALID_HANDLE_VALUE)
924 FindClose(hFind);
925 }
926 m_Header.dwFileAttributes = wfd.dwFileAttributes;
927 m_Header.ftCreationTime = wfd.ftCreationTime;
928 m_Header.ftLastAccessTime = wfd.ftLastAccessTime;
929 m_Header.ftLastWriteTime = wfd.ftLastWriteTime;
930 m_Header.nFileSizeLow = wfd.nFileSizeLow;
931
932 /*
933 * Reset the flags: keep only the flags related to data blocks as they were
934 * already set in accordance by the different mutator member functions.
935 * The other flags will be determined now by the presence or absence of data.
936 */
937 UINT NT6SimpleFlags = LOBYTE(GetVersion()) > 6 ? (0x00040000 | 0x00400000 | 0x00800000 | 0x02000000) : 0;
939 SLDF_HAS_DARWINID | SLDF_FORCE_NO_LINKINFO | NT6SimpleFlags |
940#if (NTDDI_VERSION < NTDDI_LONGHORN)
942#endif
944 // TODO: When we will support Vista+ functionality, add other flags to this list.
945
946 /* The stored strings are in UNICODE */
948
949 if (m_pPidl)
955 if (m_sPathRel && *m_sPathRel)
957 if (m_sWorkDir && *m_sWorkDir)
959 if (m_sArgs && *m_sArgs)
961 if (m_sIcoPath && *m_sIcoPath)
963 if (m_bRunAs)
965
966 /* Write the shortcut header */
967 ULONG count;
968 HRESULT hr = stm->Write(&m_Header, sizeof(m_Header), &count);
969 if (FAILED(hr))
970 {
971 ERR("Write failed\n");
972 return hr;
973 }
974
975 /* Save the data in order */
976
977 if (m_pPidl)
978 {
979 hr = ILSaveToStream(stm, m_pPidl);
980 if (FAILED(hr))
981 {
982 ERR("Failed to write PIDL\n");
983 return hr;
984 }
985 }
986
988 {
990 if (FAILED(hr))
991 return hr;
992 }
993
995 {
997 if (FAILED(hr))
998 return hr;
999 }
1000
1002 {
1004 if (FAILED(hr))
1005 return hr;
1006 }
1007
1009 {
1011 if (FAILED(hr))
1012 return hr;
1013 }
1014
1016 {
1018 if (FAILED(hr))
1019 return hr;
1020 }
1021
1023 {
1025 if (FAILED(hr))
1026 return hr;
1027 }
1028
1029 /*
1030 * Now save the data block list.
1031 *
1032 * NOTE that both advertised Product and Component are already saved
1033 * inside Logo3 and Darwin data blocks in the m_pDBList list, and the
1034 * m_Header.dwFlags is suitably initialized.
1035 */
1037 if (FAILED(hr))
1038 return hr;
1039
1040 /* Clear the dirty bit if requested */
1041 if (fClearDirty)
1042 m_bDirty = FALSE;
1043
1044 return hr;
1045}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
HRESULT WINAPI SHWriteDataBlockList(IStream *lpStream, LPDBLIST lpList)
Definition: clist.c:179
HRESULT Write([in, size_is(cb)] const void *pv, [in] ULONG cb, [out] ULONG *pcbWritten)
#define LOBYTE(W)
Definition: jmemdos.c:487
HRESULT WINAPI ILSaveToStream(IStream *pStream, LPCITEMIDLIST pPidl)
Definition: pidl.c:353
DWORD WINAPI GetVersion()
Definition: redirtest.c:5
@ SLDF_RUN_IN_SEPARATE
Definition: shlobj.h:1962
@ SLDF_RUN_WITH_SHIMLAYER
Definition: shlobj.h:1971

◆ Save() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::Save ( LPCOLESTR  pszFileName,
BOOL  fRemember 
)
override

Implements IPersistFile.

Definition at line 360 of file CShellLink.cpp.

361{
362 BOOL bAlreadyExists;
363 WCHAR szFullPath[MAX_PATH];
364
365 TRACE("(%p)->(%s)\n", this, debugstr_w(pszFileName));
366
367 if (!pszFileName)
368 return E_FAIL;
369
370 bAlreadyExists = PathFileExistsW(pszFileName);
371
374 if (SUCCEEDED(hr))
375 {
376 hr = Save(stm, FALSE);
377
378 if (SUCCEEDED(hr))
379 {
380 GetFullPathNameW(pszFileName, _countof(szFullPath), szFullPath, NULL);
381 if (bAlreadyExists)
383 else
385
386 if (m_sLinkPath)
388
390 m_bDirty = FALSE;
391 }
392 else
393 {
395 WARN("Failed to create shortcut %s\n", debugstr_w(pszFileName));
396 }
397 }
398
399 return hr;
400}
#define WARN(fmt,...)
Definition: precomp.h:61
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
#define STGM_CREATE
Definition: objbase.h:926
#define STGM_READWRITE
Definition: objbase.h:919
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:923
#define SHCNE_CREATE
Definition: shlobj.h:1899

Referenced by OnNotify(), and Save().

◆ SaveCompleted()

HRESULT STDMETHODCALLTYPE CShellLink::SaveCompleted ( LPCOLESTR  pszFileName)
override

Implements IPersistFile.

Definition at line 402 of file CShellLink.cpp.

403{
404 FIXME("(%p)->(%s)\n", this, debugstr_w(pszFileName));
405 return S_OK;
406}

◆ SetAdvertiseInfo()

HRESULT CShellLink::SetAdvertiseInfo ( LPCWSTR  str)
private

Definition at line 2146 of file CShellLink.cpp.

2147{
2148 HRESULT hr;
2149 LPCWSTR szComponent = NULL, szProduct = NULL, p;
2150 INT len;
2151 GUID guid;
2152 WCHAR szGuid[38+1];
2153
2155
2156 while (str[0])
2157 {
2158 /* each segment must start with two colons */
2159 if (str[0] != ':' || str[1] != ':')
2160 return E_FAIL;
2161
2162 /* the last segment is just two colons */
2163 if (!str[2])
2164 break;
2165 str += 2;
2166
2167 /* there must be a colon straight after a guid */
2168 p = wcschr(str, L':');
2169 if (!p)
2170 return E_FAIL;
2171 len = p - str;
2172 if (len != 38)
2173 return E_FAIL;
2174
2175 /* get the guid, and check if it's validly formatted */
2176 memcpy(szGuid, str, sizeof(WCHAR)*len);
2177 szGuid[len] = 0;
2178
2180 if (hr != S_OK)
2181 return hr;
2182 str = p + 1;
2183
2184 /* match it up to a guid that we care about */
2185 if (IsEqualGUID(guid, SHELL32_AdvtShortcutComponent) && !szComponent)
2186 szComponent = str; /* Darwin */
2187 else if (IsEqualGUID(guid, SHELL32_AdvtShortcutProduct) && !szProduct)
2188 szProduct = str; /* Logo3 */
2189 else
2190 return E_FAIL;
2191
2192 /* skip to the next field */
2193 str = wcschr(str, L':');
2194 if (!str)
2195 return E_FAIL;
2196 }
2197
2198 /* we have to have a component for an advertised shortcut */
2199 if (!szComponent)
2200 return E_FAIL;
2201
2202 szComponent = GetAdvertisedArg(szComponent);
2203 szProduct = GetAdvertisedArg(szProduct);
2204
2205 hr = WriteAdvertiseInfo(szComponent, EXP_DARWIN_ID_SIG);
2206 // if (FAILED(hr))
2207 // return hr;
2208#if (NTDDI_VERSION < NTDDI_LONGHORN)
2209 hr = WriteAdvertiseInfo(szProduct, EXP_LOGO3_ID_SIG);
2210 // if (FAILED(hr))
2211 // return hr;
2212#endif
2213
2214 HeapFree(GetProcessHeap(), 0, (PVOID)szComponent);
2215 HeapFree(GetProcessHeap(), 0, (PVOID)szProduct);
2216
2217 if (TRACE_ON(shell))
2218 {
2220 TRACE("Component = %s\n", debugstr_w(sComponent));
2221#if (NTDDI_VERSION < NTDDI_LONGHORN)
2222 GetAdvertiseInfo(&sProduct, EXP_LOGO3_ID_SIG);
2223 TRACE("Product = %s\n", debugstr_w(sProduct));
2224#endif
2225 }
2226
2227 return S_OK;
2228}
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
const GUID SHELL32_AdvtShortcutProduct
const GUID SHELL32_AdvtShortcutComponent
GLfloat GLfloat p
Definition: glext.h:8902
const GUID * guid
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR szGuid[]
Definition: rtlstr.c:1892
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by SetPath().

◆ SetArguments() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetArguments ( LPCSTR  pszArgs)
override

Implements IShellLinkA.

Definition at line 1265 of file CShellLink.cpp.

1266{
1267 TRACE("(%p)->(args=%s)\n", this, pszArgs);
1268
1270 m_sArgs = NULL;
1271
1272 if (pszArgs)
1273 {
1274 m_sArgs = HEAP_strdupAtoW(GetProcessHeap(), 0, pszArgs);
1275 if (!m_sArgs)
1276 return E_OUTOFMEMORY;
1277 }
1278 m_bDirty = TRUE;
1279
1280 return S_OK;
1281}

Referenced by OnNotify().

◆ SetArguments() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetArguments ( LPCWSTR  pszArgs)
override

Implements IShellLinkW.

Definition at line 1686 of file CShellLink.cpp.

1687{
1688 TRACE("(%p)->(args=%s)\n", this, debugstr_w(pszArgs));
1689
1691 m_sArgs = NULL;
1692
1693 if (pszArgs)
1694 {
1695 m_sArgs = strdupW(pszArgs);
1696 if (!m_sArgs)
1697 return E_OUTOFMEMORY;
1698 }
1699 m_bDirty = TRUE;
1700
1701 return S_OK;
1702}

◆ SetDescription() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetDescription ( LPCSTR  pszName)
override

Implements IShellLinkA.

Definition at line 1201 of file CShellLink.cpp.

1202{
1203 TRACE("(%p)->(pName=%s)\n", this, pszName);
1204
1207
1208 if (pszName)
1209 {
1211 if (!m_sDescription)
1212 return E_OUTOFMEMORY;
1213 }
1214 m_bDirty = TRUE;
1215
1216 return S_OK;
1217}

◆ SetDescription() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetDescription ( LPCWSTR  pszName)
override

Implements IShellLinkW.

Definition at line 1624 of file CShellLink.cpp.

1625{
1626 TRACE("(%p)->(desc=%s)\n", this, debugstr_w(pszName));
1627
1630
1631 if (pszName)
1632 {
1633 m_sDescription = strdupW(pszName);
1634 if (!m_sDescription)
1635 return E_OUTOFMEMORY;
1636 }
1637 m_bDirty = TRUE;
1638
1639 return S_OK;
1640}

◆ SetFlags()

HRESULT STDMETHODCALLTYPE CShellLink::SetFlags ( DWORD  dwFlags)
override

Implements IShellLinkDataList.

Definition at line 2490 of file CShellLink.cpp.

2491{
2492 if (m_Header.dwFlags == dwFlags)
2493 return S_FALSE;
2495 m_bDirty = TRUE;
2496 return S_OK;
2497}
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ SetHotkey()

HRESULT STDMETHODCALLTYPE CShellLink::SetHotkey ( WORD  wHotkey)
override

Implements IShellLinkA.

Definition at line 1290 of file CShellLink.cpp.

1291{
1292 TRACE("(%p)->(hotkey=%x)\n", this, wHotkey);
1293
1294 m_Header.wHotKey = wHotkey;
1295 m_bDirty = TRUE;
1296
1297 return S_OK;
1298}

◆ SetIconLocation() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation ( LPCSTR  pszIconPath,
INT  iIcon 
)
override

Definition at line 1387 of file CShellLink.cpp.

1388{
1389 TRACE("(%p)->(path=%s iicon=%u)\n", this, pszIconPath, iIcon);
1390
1391 LPWSTR str = NULL;
1392 if (pszIconPath)
1393 {
1394 str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
1395 if (!str)
1396 return E_OUTOFMEMORY;
1397 }
1398
1399 HRESULT hr = SetIconLocation(str, iIcon);
1400
1401 if (str)
1403
1404 return hr;
1405}

Referenced by OnCommand(), and SetIconLocation().

◆ SetIconLocation() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation ( LPCWSTR  pszIconPath,
INT  iIcon 
)
override

Definition at line 1917 of file CShellLink.cpp.

1918{
1919 HRESULT hr = E_FAIL;
1920 WCHAR szIconPath[MAX_PATH];
1921
1922 TRACE("(%p)->(path=%s iicon=%u)\n", this, debugstr_w(pszIconPath), iIcon);
1923
1924 if (pszIconPath)
1925 {
1926 /*
1927 * Check whether the user-given file path contains unexpanded
1928 * environment variables. If so, create a target environment block.
1929 * Note that in this block we will store the user-given path.
1930 * It will contain the unexpanded environment variables, but
1931 * it can also contain already expanded path that the user does
1932 * not want to see them unexpanded (e.g. so that they always
1933 * refer to the same place even if the would-be corresponding
1934 * environment variable could change).
1935 */
1936#ifdef ICON_LINK_WINDOWS_COMPAT
1937 /* Try to fully unexpand the icon path */
1938 // if (PathFullyUnExpandEnvStringsW(pszIconPath, szIconPath, _countof(szIconPath)))
1939 BOOL bSuccess = PathUnExpandEnvStringsW(pszIconPath, szIconPath, _countof(szIconPath));
1940 if (bSuccess && wcscmp(pszIconPath, szIconPath) != 0)
1941#else
1942 /*
1943 * In some situations, described in http://stackoverflow.com/questions/2976489/ishelllinkseticonlocation-translates-my-icon-path-into-program-files-which-i
1944 * the result of PathUnExpandEnvStringsW() could be wrong, and instead
1945 * one would have to store the actual provided icon location path, while
1946 * creating an icon environment block ONLY if that path already contains
1947 * environment variables. This is what the present case is trying to implement.
1948 */
1949 SHExpandEnvironmentStringsW(pszIconPath, szIconPath, _countof(szIconPath));
1950 if (wcscmp(pszIconPath, szIconPath) != 0)
1951#endif
1952 {
1953 /*
1954 * The user-given file path contains unexpanded environment
1955 * variables, so we need an icon environment block.
1956 */
1958 LPEXP_SZ_LINK pInfo;
1959
1960#ifdef ICON_LINK_WINDOWS_COMPAT
1961 /* Make pszIconPath point to the unexpanded path */
1962 LPCWSTR pszOrgIconPath = pszIconPath;
1963 pszIconPath = szIconPath;
1964#endif
1966 if (pInfo)
1967 {
1968 /* Make sure that the size of the structure is valid */
1969 if (pInfo->cbSize != sizeof(*pInfo))
1970 {
1971 ERR("Ooops. This structure is not as expected...\n");
1972
1973 /* Invalid structure, remove it altogether */
1974 m_Header.dwFlags &= ~SLDF_HAS_EXP_ICON_SZ;
1976
1977 /* Reset the pointer and go use the static buffer */
1978 pInfo = NULL;
1979 }
1980 }
1981 if (!pInfo)
1982 {
1983 /* Use the static buffer */
1984 pInfo = &buffer;
1985 buffer.cbSize = sizeof(buffer);
1986 buffer.dwSignature = EXP_SZ_ICON_SIG;
1987 }
1988
1989 lstrcpynW(pInfo->szwTarget, pszIconPath, _countof(pInfo->szwTarget));
1990 WideCharToMultiByte(CP_ACP, 0, pszIconPath, -1,
1991 pInfo->szTarget, _countof(pInfo->szTarget), NULL, NULL);
1992
1993 hr = S_OK;
1994 if (pInfo == &buffer)
1995 hr = AddDataBlock(pInfo);
1996 if (hr == S_OK)
1998
1999#ifdef ICON_LINK_WINDOWS_COMPAT
2000 /* Set pszIconPath back to the original one */
2001 pszIconPath = pszOrgIconPath;
2002#else
2003 /* Now, make pszIconPath point to the expanded path */
2004 pszIconPath = szIconPath;
2005#endif
2006 }
2007 else
2008 {
2009 /*
2010 * The user-given file path does not contain unexpanded environment
2011 * variables, so we need to remove any icon environment block.
2012 */
2013 m_Header.dwFlags &= ~SLDF_HAS_EXP_ICON_SZ;
2015
2016 /* pszIconPath points to the user path */
2017 }
2018 }
2019
2020#ifdef ICON_LINK_WINDOWS_COMPAT
2021 /* Store the original icon path location (may contain unexpanded environment strings) */
2022#endif
2023 if (pszIconPath)
2024 {
2025 m_Header.dwFlags &= ~SLDF_HAS_ICONLOCATION;
2027
2028 m_sIcoPath = strdupW(pszIconPath);
2029 if (!m_sIcoPath)
2030 return E_OUTOFMEMORY;
2031
2033 }
2034
2035 hr = S_OK;
2036
2037 m_Header.nIconIndex = iIcon;
2038 m_bDirty = TRUE;
2039
2040 return hr;
2041}
BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR path, LPWSTR buffer, UINT buf_len)
Definition: path.c:4181
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

◆ SetIDList()

HRESULT STDMETHODCALLTYPE CShellLink::SetIDList ( PCIDLIST_ABSOLUTE  pidl)
override

Implements IShellLinkA.

Definition at line 1181 of file CShellLink.cpp.

1182{
1183 TRACE("(%p)->(pidl=%p)\n", this, pidl);
1184 return SetTargetFromPIDLOrPath(pidl, NULL);
1185}

◆ SetPath() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetPath ( LPCSTR  pszFile)
override

Implements IShellLinkA.

Definition at line 1515 of file CShellLink.cpp.

1516{
1517 TRACE("(%p)->(path=%s)\n", this, pszFile);
1518
1519 if (!pszFile)
1520 return E_INVALIDARG;
1521
1522 LPWSTR str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
1523 if (!str)
1524 return E_OUTOFMEMORY;
1525
1526 HRESULT hr = SetPath(str);
1528
1529 return hr;
1530}

Referenced by OnNotify(), and SetPath().

◆ SetPath() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetPath ( LPCWSTR  pszFile)
override

Implements IShellLinkW.

Definition at line 2310 of file CShellLink.cpp.

2311{
2312 LPWSTR unquoted = NULL;
2313 HRESULT hr = S_OK;
2314
2315 TRACE("(%p)->(path=%s)\n", this, debugstr_w(pszFile));
2316
2317 if (!pszFile)
2318 return E_INVALIDARG;
2319
2320 /*
2321 * Allow upgrading Logo3 shortcuts (m_Header.dwFlags & SLDF_HAS_LOGO3ID),
2322 * but forbid upgrading Darwin ones.
2323 */
2325 return S_FALSE;
2326
2327 /* quotes at the ends of the string are stripped */
2328 SIZE_T len = wcslen(pszFile);
2329 if (pszFile[0] == L'"' && pszFile[len-1] == L'"')
2330 {
2331 unquoted = strdupW(pszFile);
2332 PathUnquoteSpacesW(unquoted);
2333 pszFile = unquoted;
2334 }
2335
2336 /* any other quote marks are invalid */
2337 if (wcschr(pszFile, L'"'))
2338 {
2339 hr = S_FALSE;
2340 goto end;
2341 }
2342
2343 /* Clear the cached path */
2345 m_sPath = NULL;
2346
2347 /* Check for an advertised target (Logo3 or Darwin) */
2348 if (SetAdvertiseInfo(pszFile) != S_OK)
2349 {
2350 /* This is not an advertised target, but a regular path */
2352
2353 /*
2354 * Check whether the user-given file path contains unexpanded
2355 * environment variables. If so, create a target environment block.
2356 * Note that in this block we will store the user-given path.
2357 * It will contain the unexpanded environment variables, but
2358 * it can also contain already expanded path that the user does
2359 * not want to see them unexpanded (e.g. so that they always
2360 * refer to the same place even if the would-be corresponding
2361 * environment variable could change).
2362 */
2363 if (*pszFile)
2365 else
2366 *szPath = L'\0';
2367
2368 if (*pszFile && (wcscmp(pszFile, szPath) != 0))
2369 {
2370 /*
2371 * The user-given file path contains unexpanded environment
2372 * variables, so we need a target environment block.
2373 */
2375 LPEXP_SZ_LINK pInfo;
2376
2378 if (pInfo)
2379 {
2380 /* Make sure that the size of the structure is valid */
2381 if (pInfo->cbSize != sizeof(*pInfo))
2382 {
2383 ERR("Ooops. This structure is not as expected...\n");
2384
2385 /* Invalid structure, remove it altogether */
2386 m_Header.dwFlags &= ~SLDF_HAS_EXP_SZ;
2388
2389 /* Reset the pointer and go use the static buffer */
2390 pInfo = NULL;
2391 }
2392 }
2393 if (!pInfo)
2394 {
2395 /* Use the static buffer */
2396 pInfo = &buffer;
2397 buffer.cbSize = sizeof(buffer);
2398 buffer.dwSignature = EXP_SZ_LINK_SIG;
2399 }
2400
2401 lstrcpynW(pInfo->szwTarget, pszFile, _countof(pInfo->szwTarget));
2402 WideCharToMultiByte(CP_ACP, 0, pszFile, -1,
2403 pInfo->szTarget, _countof(pInfo->szTarget), NULL, NULL);
2404
2405 hr = S_OK;
2406 if (pInfo == &buffer)
2407 hr = AddDataBlock(pInfo);
2408 if (hr == S_OK)
2410
2411 /* Now, make pszFile point to the expanded path */
2412 pszFile = szPath;
2413 }
2414 else
2415 {
2416 /*
2417 * The user-given file path does not contain unexpanded environment
2418 * variables, so we need to remove any target environment block.
2419 */
2420 m_Header.dwFlags &= ~SLDF_HAS_EXP_SZ;
2422
2423 /* pszFile points to the user path */
2424 }
2425
2426 /* Set the target */
2427 hr = SetTargetFromPIDLOrPath(NULL, pszFile);
2428 }
2429
2430 m_bDirty = TRUE;
2431
2432end:
2433 HeapFree(GetProcessHeap(), 0, unquoted);
2434 return hr;
2435}
GLuint GLuint end
Definition: gl.h:1545
ULONG_PTR SIZE_T
Definition: typedefs.h:80

◆ SetRelativePath() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetRelativePath ( LPCSTR  pszPathRel,
DWORD  dwReserved 
)
override

Implements IShellLinkA.

Definition at line 1407 of file CShellLink.cpp.

1408{
1409 TRACE("(%p)->(path=%s %x)\n", this, pszPathRel, dwReserved);
1410
1412 m_sPathRel = NULL;
1413
1414 if (pszPathRel)
1415 {
1416 m_sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
1417 m_bDirty = TRUE;
1418 }
1419
1421}
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95

◆ SetRelativePath() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetRelativePath ( LPCWSTR  pszPathRel,
DWORD  dwReserved 
)
override

Implements IShellLinkW.

Definition at line 2043 of file CShellLink.cpp.

2044{
2045 TRACE("(%p)->(path=%s %x)\n", this, debugstr_w(pszPathRel), dwReserved);
2046
2048 m_sPathRel = NULL;
2049
2050 if (pszPathRel)
2051 {
2052 m_sPathRel = strdupW(pszPathRel);
2053 if (!m_sPathRel)
2054 return E_OUTOFMEMORY;
2055 }
2056 m_bDirty = TRUE;
2057
2059}

◆ SetShowCmd()

HRESULT STDMETHODCALLTYPE CShellLink::SetShowCmd ( INT  iShowCmd)
override

Definition at line 1307 of file CShellLink.cpp.

1308{
1309 TRACE("(%p) %d\n", this, iShowCmd);
1310
1311 m_Header.nShowCommand = iShowCmd;
1312 m_bDirty = TRUE;
1313
1314 return S_OK;
1315}

◆ SetSite()

HRESULT STDMETHODCALLTYPE CShellLink::SetSite ( IUnknown punk)
override

Implements IObjectWithSite.

Definition at line 3158 of file CShellLink.cpp.

3159{
3160 TRACE("%p %p\n", this, punk);
3161
3162 m_site = punk;
3163
3164 return S_OK;
3165}

◆ SetTargetFromPIDLOrPath()

HRESULT CShellLink::SetTargetFromPIDLOrPath ( LPCITEMIDLIST  pidl,
LPCWSTR  pszFile 
)
private

Definition at line 2230 of file CShellLink.cpp.

2231{
2232 HRESULT hr = S_OK;
2233 LPITEMIDLIST pidlNew = NULL;
2235
2236 /*
2237 * Not both 'pidl' and 'pszFile' should be set.
2238 * But either one or both can be NULL.
2239 */
2240 if (pidl && pszFile)
2241 return E_FAIL;
2242
2243 if (pidl)
2244 {
2245 /* Clone the PIDL */
2246 pidlNew = ILClone(pidl);
2247 if (!pidlNew)
2248 return E_FAIL;
2249 }
2250 else if (pszFile)
2251 {
2252 /* Build a PIDL for this path target */
2253 hr = SHILCreateFromPathW(pszFile, &pidlNew, NULL);
2254 if (FAILED(hr))
2255 {
2256 /* This failed, try to resolve the path, then create a simple PIDL */
2257
2260
2262 {
2263 hr = E_INVALIDARG;
2264 szPath[0] = 0;
2265 }
2266 else
2267 {
2268 hr = S_OK;
2270 // NOTE: Don't make it failed here even if pidlNew was NULL.
2271 // We don't fail on purpose even if SHSimpleIDListFromPathW returns NULL.
2272 // This behaviour has been verified with tests.
2273 }
2274 }
2275 }
2276 // else if (!pidl && !pszFile) { pidlNew = NULL; hr = S_OK; }
2277
2278 ILFree(m_pPidl);
2279 m_pPidl = pidlNew;
2280
2281 if (!pszFile)
2282 {
2283 if (SHGetPathFromIDListW(pidlNew, szPath))
2284 pszFile = szPath;
2285 }
2286
2287 // TODO: Fully update link info, tracker, file attribs...
2288
2289 // if (pszFile)
2290 if (!pszFile)
2291 {
2292 *szPath = L'\0';
2293 pszFile = szPath;
2294 }
2295
2296 /* Update the cached path (for link info) */
2298
2299 if (m_sPath)
2301
2302 m_sPath = strdupW(pszFile);
2303 if (!m_sPath)
2304 return E_OUTOFMEMORY;
2305
2306 m_bDirty = TRUE;
2307 return hr;
2308}
#define PRF_TRYPROGRAMEXTENSIONS
Definition: PathResolve.cpp:40
BOOL WINAPI PathResolveW(_Inout_ LPWSTR path, _Inout_opt_ LPCWSTR *dirs, _In_ DWORD flags)
Definition: shellpath.c:1032
BOOL WINAPI PathIsFileSpecW(LPCWSTR lpszPath)
Definition: path.c:2139
HRESULT WINAPI SHILCreateFromPathW(LPCWSTR path, LPITEMIDLIST *ppidl, DWORD *attributes)
Definition: pidl.c:403
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
Definition: pidl.c:1238

Referenced by SetIDList(), and SetPath().

◆ SetWorkingDirectory() [1/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetWorkingDirectory ( LPCSTR  pszDir)
override

Implements IShellLinkA.

Definition at line 1233 of file CShellLink.cpp.

1234{
1235 TRACE("(%p)->(dir=%s)\n", this, pszDir);
1236
1238 m_sWorkDir = NULL;
1239
1240 if (pszDir)
1241 {
1243 if (!m_sWorkDir)
1244 return E_OUTOFMEMORY;
1245 }
1246 m_bDirty = TRUE;
1247
1248 return S_OK;
1249}

Referenced by OnNotify().

◆ SetWorkingDirectory() [2/2]

HRESULT STDMETHODCALLTYPE CShellLink::SetWorkingDirectory ( LPCWSTR  pszDir)
override

Implements IShellLinkW.

Definition at line 1655 of file CShellLink.cpp.

1656{
1657 TRACE("(%p)->(dir=%s)\n", this, debugstr_w(pszDir));
1658
1660 m_sWorkDir = NULL;
1661
1662 if (pszDir)
1663 {
1665 if (!m_sWorkDir)
1666 return E_OUTOFMEMORY;
1667 }
1668 m_bDirty = TRUE;
1669
1670 return S_OK;
1671}

◆ SH_ShellLinkDlgProc()

INT_PTR CALLBACK CShellLink::SH_ShellLinkDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 3101 of file CShellLink.cpp.

3102{
3103 LPPROPSHEETPAGEW ppsp;
3104 CShellLink *pThis = reinterpret_cast<CShellLink *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
3105
3106 switch (uMsg)
3107 {
3108 case WM_INITDIALOG:
3109 ppsp = (LPPROPSHEETPAGEW)lParam;
3110 if (ppsp == NULL)
3111 break;
3112
3113 pThis = reinterpret_cast<CShellLink *>(ppsp->lParam);
3114 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pThis);
3115 return pThis->OnInitDialog(hwndDlg, (HWND)(wParam), lParam);
3116
3117 case WM_NOTIFY:
3118 return pThis->OnNotify(hwndDlg, (int)wParam, (NMHDR *)lParam);
3119
3120 case WM_COMMAND:
3121 pThis->OnCommand(hwndDlg, LOWORD(wParam), (HWND)lParam, HIWORD(wParam));
3122 break;
3123
3124 case WM_DESTROY:
3125 pThis->OnDestroy(hwndDlg);
3126 break;
3127
3128 default:
3129 break;
3130 }
3131
3132 return FALSE;
3133}
WPARAM wParam
Definition: combotst.c:138
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
struct _PROPSHEETPAGEW * LPPROPSHEETPAGEW
#define WM_NOTIFY
Definition: richedit.h:61
LPARAM lParam
Definition: prsht.h:227
#define GetWindowLongPtr
Definition: treelist.c:73
#define DWLP_USER
Definition: winuser.h:883
#define WM_COMMAND
Definition: winuser.h:1751
#define WM_INITDIALOG
Definition: winuser.h:1750
#define WM_DESTROY
Definition: winuser.h:1620

Referenced by AddPages().

◆ WriteAdvertiseInfo()

HRESULT CShellLink::WriteAdvertiseInfo ( LPCWSTR  string,
DWORD  dwSig 
)
private

Definition at line 2080 of file CShellLink.cpp.

2081{
2083 LPEXP_DARWIN_LINK pInfo;
2084
2085 if ( (dwSig != EXP_DARWIN_ID_SIG)
2087 && (dwSig != EXP_LOGO3_ID_SIG)
2088#endif
2089 )
2090 {
2091 return E_INVALIDARG;
2092 }
2093
2094 if (!string)
2095 return S_FALSE;
2096
2098 if (pInfo)
2099 {
2100 /* Make sure that the size of the structure is valid */
2101 if (pInfo->dbh.cbSize != sizeof(*pInfo))
2102 {
2103 ERR("Ooops. This structure is not as expected...\n");
2104
2105 /* Invalid structure, remove it altogether */
2106 if (dwSig == EXP_DARWIN_ID_SIG)
2107 m_Header.dwFlags &= ~SLDF_HAS_DARWINID;
2108#if (NTDDI_VERSION < NTDDI_LONGHORN)
2109 else if (dwSig == EXP_LOGO3_ID_SIG)
2110 m_Header.dwFlags &= ~SLDF_HAS_LOGO3ID;
2111#endif
2112 RemoveDataBlock(dwSig);
2113
2114 /* Reset the pointer and go use the static buffer */
2115 pInfo = NULL;
2116 }
2117 }
2118 if (!pInfo)
2119 {
2120 /* Use the static buffer */
2121 pInfo = &buffer;
2122 buffer.dbh.cbSize = sizeof(buffer);
2123 buffer.dbh.dwSignature = dwSig;
2124 }
2125
2126 lstrcpynW(pInfo->szwDarwinID, string, _countof(pInfo->szwDarwinID));
2127 WideCharToMultiByte(CP_ACP, 0, string, -1,
2128 pInfo->szDarwinID, _countof(pInfo->szDarwinID), NULL, NULL);
2129
2130 HRESULT hr = S_OK;
2131 if (pInfo == &buffer)
2132 hr = AddDataBlock(pInfo);
2133 if (hr == S_OK)
2134 {
2135 if (dwSig == EXP_DARWIN_ID_SIG)
2137#if (NTDDI_VERSION < NTDDI_LONGHORN)
2138 else if (dwSig == EXP_LOGO3_ID_SIG)
2140#endif
2141 }
2142
2143 return hr;
2144}
#define NTDDI_VERSION
Definition: k32.h:33
#define NTDDI_LONGHORN
Definition: sdkddkver.h:102

Referenced by SetAdvertiseInfo().

Member Data Documentation

◆ m_bDirty

◆ m_bInInit

BOOL CShellLink::m_bInInit
private

Definition at line 88 of file CShellLink.h.

Referenced by CShellLink(), OnCommand(), and OnInitDialog().

◆ m_bRunAs

BOOL CShellLink::m_bRunAs
private

Definition at line 85 of file CShellLink.h.

Referenced by CShellLink(), Load(), OnCommand(), Reset(), and Save().

◆ m_DropTarget

CComPtr<IDropTarget> CShellLink::m_DropTarget
private

Definition at line 98 of file CShellLink.h.

Referenced by DragEnter(), DragLeave(), DragOver(), and Drop().

◆ m_Header

◆ m_hIcon

HICON CShellLink::m_hIcon
private

Definition at line 89 of file CShellLink.h.

Referenced by CShellLink(), OnCommand(), OnDestroy(), and OnInitDialog().

◆ m_pDBList

◆ m_pPidl

◆ m_sArgs

LPWSTR CShellLink::m_sArgs
private

◆ m_sDescription

LPWSTR CShellLink::m_sDescription
private

◆ m_sIcoPath

LPWSTR CShellLink::m_sIcoPath
private

◆ m_site

CComPtr<IUnknown> CShellLink::m_site
private

Definition at line 97 of file CShellLink.h.

Referenced by GetSite(), and SetSite().

◆ m_sLinkPath

LPWSTR CShellLink::m_sLinkPath
private

Definition at line 95 of file CShellLink.h.

Referenced by CShellLink(), DoOpen(), GetCurFile(), Load(), OnInitDialog(), OnNotify(), Save(), and ~CShellLink().

◆ m_sPath

◆ m_sPathRel

LPWSTR CShellLink::m_sPathRel
private

Definition at line 81 of file CShellLink.h.

Referenced by CShellLink(), Load(), OnInitDialog(), Reset(), Save(), SetRelativePath(), and ~CShellLink().

◆ m_sWorkDir

LPWSTR CShellLink::m_sWorkDir
private

◆ sComponent

LPWSTR CShellLink::sComponent
private

Definition at line 93 of file CShellLink.h.

Referenced by CShellLink(), Load(), OnInitDialog(), Reset(), and SetAdvertiseInfo().

◆ sProduct

LPWSTR CShellLink::sProduct
private

Definition at line 92 of file CShellLink.h.

Referenced by CShellLink(), Load(), OnInitDialog(), Reset(), and SetAdvertiseInfo().

◆ volume

volume_info CShellLink::volume
private

Definition at line 78 of file CShellLink.h.


The documentation for this class was generated from the following files: