47cb0fa8abbe37dea613c5d45bf5d5048182a3ac
[reactos.git] / reactos / dll / win32 / shell32 / shelllink.h
1 /*
2 *
3 * Copyright 1997 Marcus Meissner
4 * Copyright 1998 Juergen Schmied
5 * Copyright 2005 Mike McCormack
6 * Copyright 2009 Andrew Hill
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 *
22 */
23
24 #ifndef _SHELLLINK_H_
25 #define _SHELLLINK_H_
26
27 class CShellLink :
28 public CComCoClass<CShellLink, &CLSID_ShellLink>,
29 public CComObjectRootEx<CComMultiThreadModelNoCS>,
30 public IShellLinkA,
31 public IShellLinkW,
32 public IPersistFile,
33 public IPersistStream,
34 public IShellLinkDataList,
35 public IShellExtInit,
36 public IContextMenu,
37 public IObjectWithSite,
38 public IShellPropSheetExt
39 {
40 public:
41 /* link file formats */
42
43 #include "pshpack1.h"
44
45 struct volume_info
46 {
47 DWORD type;
48 DWORD serial;
49 WCHAR label[12]; /* assume 8.3 */
50 };
51
52 #include "poppack.h"
53
54 private:
55 /* data structures according to the information in the link */
56 LPITEMIDLIST pPidl;
57 WORD wHotKey;
58 SYSTEMTIME time1;
59 SYSTEMTIME time2;
60 SYSTEMTIME time3;
61
62 DWORD iShowCmd;
63 LPWSTR sIcoPath;
64 INT iIcoNdx;
65 LPWSTR sPath;
66 LPWSTR sArgs;
67 LPWSTR sWorkDir;
68 LPWSTR sDescription;
69 LPWSTR sPathRel;
70 LPWSTR sProduct;
71 LPWSTR sComponent;
72 volume_info volume;
73 LPWSTR sLinkPath;
74 BOOL bRunAs;
75 BOOL bDirty;
76 INT iIdOpen; /* id of the "Open" entry in the context menu */
77 CComPtr<IUnknown> site;
78 public:
79 CShellLink();
80 ~CShellLink();
81 LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str);
82 HRESULT ShellLink_SetAdvertiseInfo(LPCWSTR str);
83 static INT_PTR CALLBACK SH_ShellLinkDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
84
85 // IPersistFile
86 virtual HRESULT WINAPI GetClassID(CLSID *pclsid);
87 virtual HRESULT WINAPI IsDirty();
88 virtual HRESULT WINAPI Load(LPCOLESTR pszFileName, DWORD dwMode);
89 virtual HRESULT WINAPI Save(LPCOLESTR pszFileName, BOOL fRemember);
90 virtual HRESULT WINAPI SaveCompleted(LPCOLESTR pszFileName);
91 virtual HRESULT WINAPI GetCurFile(LPOLESTR *ppszFileName);
92
93 // IPersistStream
94 // virtual WINAPI HRESULT GetClassID(CLSID *pclsid);
95 // virtual HRESULT WINAPI IsDirty();
96 virtual HRESULT WINAPI Load(IStream *stm);
97 virtual HRESULT WINAPI Save(IStream *stm, BOOL fClearDirty);
98 virtual HRESULT WINAPI GetSizeMax(ULARGE_INTEGER *pcbSize);
99
100 // IShellLinkA
101 virtual HRESULT WINAPI GetPath(LPSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAA *pfd, DWORD fFlags);
102 virtual HRESULT WINAPI GetIDList(LPITEMIDLIST * ppidl);
103 virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl);
104 virtual HRESULT WINAPI GetDescription(LPSTR pszName,INT cchMaxName);
105 virtual HRESULT WINAPI SetDescription(LPCSTR pszName);
106 virtual HRESULT WINAPI GetWorkingDirectory(LPSTR pszDir,INT cchMaxPath);
107 virtual HRESULT WINAPI SetWorkingDirectory(LPCSTR pszDir);
108 virtual HRESULT WINAPI GetArguments(LPSTR pszArgs,INT cchMaxPath);
109 virtual HRESULT WINAPI SetArguments(LPCSTR pszArgs);
110 virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey);
111 virtual HRESULT WINAPI SetHotkey(WORD wHotkey);
112 virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd);
113 virtual HRESULT WINAPI SetShowCmd(INT iShowCmd);
114 virtual HRESULT WINAPI GetIconLocation(LPSTR pszIconPath,INT cchIconPath,INT *piIcon);
115 virtual HRESULT WINAPI SetIconLocation(LPCSTR pszIconPath,INT iIcon);
116 virtual HRESULT WINAPI SetRelativePath(LPCSTR pszPathRel, DWORD dwReserved);
117 virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags);
118 virtual HRESULT WINAPI SetPath(LPCSTR pszFile);
119
120 // IShellLinkW
121 virtual HRESULT WINAPI GetPath(LPWSTR pszFile, INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags);
122 // virtual HRESULT WINAPI GetIDList(LPITEMIDLIST *ppidl);
123 // virtual HRESULT WINAPI SetIDList(LPCITEMIDLIST pidl);
124 virtual HRESULT WINAPI GetDescription(LPWSTR pszName, INT cchMaxName);
125 virtual HRESULT WINAPI SetDescription(LPCWSTR pszName);
126 virtual HRESULT WINAPI GetWorkingDirectory(LPWSTR pszDir, INT cchMaxPath);
127 virtual HRESULT WINAPI SetWorkingDirectory(LPCWSTR pszDir);
128 virtual HRESULT WINAPI GetArguments(LPWSTR pszArgs,INT cchMaxPath);
129 virtual HRESULT WINAPI SetArguments(LPCWSTR pszArgs);
130 // virtual HRESULT WINAPI GetHotkey(WORD *pwHotkey);
131 // virtual HRESULT WINAPI SetHotkey(WORD wHotkey);
132 // virtual HRESULT WINAPI GetShowCmd(INT *piShowCmd);
133 // virtual HRESULT WINAPI SetShowCmd(INT iShowCmd);
134 virtual HRESULT WINAPI GetIconLocation(LPWSTR pszIconPath,INT cchIconPath,INT *piIcon);
135 virtual HRESULT WINAPI SetIconLocation(LPCWSTR pszIconPath,INT iIcon);
136 virtual HRESULT WINAPI SetRelativePath(LPCWSTR pszPathRel, DWORD dwReserved);
137 // virtual HRESULT WINAPI Resolve(HWND hwnd, DWORD fFlags);
138 virtual HRESULT WINAPI SetPath(LPCWSTR pszFile);
139
140 // IShellLinkDataList
141 virtual HRESULT WINAPI AddDataBlock(void *pDataBlock);
142 virtual HRESULT WINAPI CopyDataBlock(DWORD dwSig, void **ppDataBlock);
143 virtual HRESULT WINAPI RemoveDataBlock(DWORD dwSig);
144 virtual HRESULT WINAPI GetFlags(DWORD *pdwFlags);
145 virtual HRESULT WINAPI SetFlags(DWORD dwFlags);
146
147 // IShellExtInit
148 virtual HRESULT WINAPI Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID);
149
150 // IContextMenu
151 virtual HRESULT WINAPI QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
152 virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
153 virtual HRESULT WINAPI GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax);
154
155 // IShellPropSheetExt
156 virtual HRESULT WINAPI AddPages(LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam);
157 virtual HRESULT WINAPI ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE pfnReplacePage, LPARAM lParam);
158
159 // IObjectWithSite
160 virtual HRESULT WINAPI SetSite(IUnknown *punk);
161 virtual HRESULT WINAPI GetSite(REFIID iid, void **ppvSite);
162
163 DECLARE_REGISTRY_RESOURCEID(IDR_SHELLLINK)
164 DECLARE_NOT_AGGREGATABLE(CShellLink)
165
166 DECLARE_PROTECT_FINAL_CONSTRUCT()
167
168 BEGIN_COM_MAP(CShellLink)
169 COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistFile)
170 COM_INTERFACE_ENTRY_IID(IID_IPersistFile, IPersistFile)
171 COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream)
172 COM_INTERFACE_ENTRY_IID(IID_IShellLinkA, IShellLinkA)
173 COM_INTERFACE_ENTRY_IID(IID_IShellLinkW, IShellLinkW)
174 COM_INTERFACE_ENTRY_IID(IID_IShellLinkDataList, IShellLinkDataList)
175 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
176 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
177 COM_INTERFACE_ENTRY_IID(IID_IShellPropSheetExt, IShellPropSheetExt)
178 COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
179 END_COM_MAP()
180 };
181
182 #endif /* _SHELLLINK_H_ */