1 /*
2 * Implementation of hyperlinking (hlink.dll)
3 *
4 * Copyright 2005 Aric Stewart for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "hlink_private.h"
22
23 #include "wine/debug.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(hlink);
26
27 static const IHlinkBrowseContextVtbl hlvt;
28
29 typedef struct
30 {
31 const IHlinkBrowseContextVtbl *lpVtbl;
32 LONG ref;
33 HLBWINFO* BrowseWindowInfo;
34 IHlink* CurrentPage;
35 } HlinkBCImpl;
36
37
38 HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
39 LPVOID *ppv)
40 {
41 HlinkBCImpl * hl;
42
43 TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
44 *ppv = NULL;
45
46 if (pUnkOuter)
47 return CLASS_E_NOAGGREGATION;
48
49 hl = heap_alloc_zero(sizeof(HlinkBCImpl));
50 if (!hl)
51 return E_OUTOFMEMORY;
52
53 hl->ref = 1;
54 hl->lpVtbl = &hlvt;
55
56 *ppv = hl;
57 return S_OK;
58 }
59
60 static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
61 REFIID riid, LPVOID* ppvObj)
62 {
63 HlinkBCImpl *This = (HlinkBCImpl*)iface;
64 TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
65
66 if (IsEqualIID(riid, &IID_IUnknown) ||
67 IsEqualIID(riid, &IID_IHlinkBrowseContext))
68 *ppvObj = This;
69
70 if (*ppvObj)
71 {
72 IUnknown_AddRef((IUnknown*)(*ppvObj));
73 return S_OK;
74 }
75 return E_NOINTERFACE;
76 }
77
78 static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
79 {
80 HlinkBCImpl *This = (HlinkBCImpl*)iface;
81 ULONG refCount = InterlockedIncrement(&This->ref);
82
83 TRACE("(%p)->(count=%u)\n", This, refCount - 1);
84
85 return refCount;
86 }
87
88 static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
89 {
90 HlinkBCImpl *This = (HlinkBCImpl*)iface;
91 ULONG refCount = InterlockedDecrement(&This->ref);
92
93 TRACE("(%p)->(count=%u)\n", This, refCount + 1);
94 if (refCount)
95 return refCount;
96
97 TRACE("-- destroying IHlinkBrowseContext (%p)\n", This);
98 heap_free(This->BrowseWindowInfo);
99 if (This->CurrentPage)
100 IHlink_Release(This->CurrentPage);
101 heap_free(This);
102 return 0;
103 }
104
105 static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
106 DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
107 {
108 static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
109 HlinkBCImpl *This = (HlinkBCImpl*)iface;
110 IMoniker *mon;
111 IMoniker *composite;
112 IRunningObjectTable *ROT;
113
114 FIXME("(%p)->(%i %p %p %p)\n", This, dwReserved, piunk, pimk, pdwRegister);
115
116 CreateItemMoniker(NULL, szIdent, &mon);
117 CreateGenericComposite(mon, pimk, &composite);
118
119 GetRunningObjectTable(0, &ROT);
120 IRunningObjectTable_Register(ROT, 0, piunk, composite, pdwRegister);
121
122 IRunningObjectTable_Release(ROT);
123 IMoniker_Release(composite);
124 IMoniker_Release(mon);
125
126 return S_OK;
127 }
128
129 static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* face,
130 IMoniker *pimk, BOOL fBindifRootRegistered, IUnknown **ppiunk)
131 {
132 FIXME("\n");
133 return E_NOTIMPL;
134 }
135
136 static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
137 DWORD dwRegister)
138 {
139 HRESULT r = S_OK;
140 IRunningObjectTable *ROT;
141 HlinkBCImpl *This = (HlinkBCImpl*)iface;
142
143 FIXME("(%p)->(%i)\n", This, dwRegister);
144
145 GetRunningObjectTable(0, &ROT);
146 r = IRunningObjectTable_Revoke(ROT, dwRegister);
147 IRunningObjectTable_Release(ROT);
148
149 return r;
150 }
151
152 static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
153 HLBWINFO *phlbwi)
154 {
155 HlinkBCImpl *This = (HlinkBCImpl*)iface;
156 TRACE("(%p)->(%p)\n", This, phlbwi);
157
158 heap_free(This->BrowseWindowInfo);
159 This->BrowseWindowInfo = heap_alloc(phlbwi->cbSize);
160 memcpy(This->BrowseWindowInfo, phlbwi, phlbwi->cbSize);
161
162 return S_OK;
163 }
164
165 static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
166 HLBWINFO *phlbwi)
167 {
168 FIXME("\n");
169 return E_NOTIMPL;
170 }
171
172 static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
173 IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
174 {
175 HlinkBCImpl *This = (HlinkBCImpl*)iface;
176
177 FIXME("(%p)->(%p %s %s)\n", This, pimkTarget,
178 debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName));
179
180 if (This->CurrentPage)
181 IHlink_Release(This->CurrentPage);
182
183 HlinkCreateFromMoniker(pimkTarget, pwzLocation, pwzFriendlyName, NULL,
184 0, NULL, &IID_IHlink, (LPVOID*) &This->CurrentPage);
185
186 return S_OK;
187 }
188
189 static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
190 DWORD grfHLNF, IMoniker* pmkTarget, LPCWSTR pwzLocation, LPCWSTR
191 pwzFriendlyName, ULONG *puHLID)
192 {
193 HlinkBCImpl *This = (HlinkBCImpl*)iface;
194
195 FIXME("(%p)->(%i %p %s %s %p)\n", This, grfHLNF, pmkTarget,
196 debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID);
197
198 return S_OK;
199 }
200
201 static HRESULT WINAPI IHlinkBC_UpdateHlink(IHlinkBrowseContext* iface,
202 ULONG uHLID, IMoniker* pimkTarget, LPCWSTR pwzLocation,
203 LPCWSTR pwzFriendlyName)
204 {
205 FIXME("\n");
206 return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI IHlinkBC_EnumNavigationStack( IHlinkBrowseContext *iface,
210 DWORD dwReserved, DWORD grfHLFNAMEF, IEnumHLITEM** ppienumhlitem)
211 {
212 FIXME("\n");
213 return E_NOTIMPL;
214 }
215
216 static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
217 DWORD grfHLONG, ULONG uHLID)
218 {
219 FIXME("\n");
220 return E_NOTIMPL;
221 }
222
223 static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
224 ULONG uHLID, IHlink** ppihl)
225 {
226 FIXME("\n");
227 return E_NOTIMPL;
228 }
229
230 static HRESULT WINAPI IHlinkBC_SetCurrentHlink( IHlinkBrowseContext* iface,
231 ULONG uHLID)
232 {
233 FIXME("\n");
234 return E_NOTIMPL;
235 }
236
237 static HRESULT WINAPI IHlinkBC_Clone( IHlinkBrowseContext* iface,
238 IUnknown* piunkOuter, REFIID riid, IUnknown** ppiunkOjb)
239 {
240 FIXME("\n");
241 return E_NOTIMPL;
242 }
243
244 static HRESULT WINAPI IHlinkBC_Close(IHlinkBrowseContext* iface,
245 DWORD reserverd)
246 {
247 FIXME("\n");
248 return E_NOTIMPL;
249 }
250
251 static const IHlinkBrowseContextVtbl hlvt =
252 {
253 IHlinkBC_fnQueryInterface,
254 IHlinkBC_fnAddRef,
255 IHlinkBC_fnRelease,
256 IHlinkBC_Register,
257 IHlinkBC_GetObject,
258 IHlinkBC_Revoke,
259 IHlinkBC_SetBrowseWindowInfo,
260 IHlinkBC_GetBrowseWindowInfo,
261 IHlinkBC_SetInitialHlink,
262 IHlinkBC_OnNavigateHlink,
263 IHlinkBC_UpdateHlink,
264 IHlinkBC_EnumNavigationStack,
265 IHlinkBC_QueryHlink,
266 IHlinkBC_GetHlink,
267 IHlinkBC_SetCurrentHlink,
268 IHlinkBC_Clone,
269 IHlinkBC_Close
270 };
271
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.