2 * Implementation of hyperlinking (hlink.dll)
4 * Copyright 2005 Aric Stewart for CodeWeavers
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.
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.
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
33 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(hlink
);
38 static const IHlinkBrowseContextVtbl hlvt
;
42 const IHlinkBrowseContextVtbl
*lpVtbl
;
44 HLBWINFO
* BrowseWindowInfo
;
49 HRESULT WINAPI
HLinkBrowseContext_Constructor(IUnknown
*pUnkOuter
, REFIID riid
,
54 TRACE("unkOut=%p riid=%s\n", pUnkOuter
, debugstr_guid(riid
));
58 return CLASS_E_NOAGGREGATION
;
60 hl
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(HlinkBCImpl
));
71 static HRESULT WINAPI
IHlinkBC_fnQueryInterface( IHlinkBrowseContext
*iface
,
72 REFIID riid
, LPVOID
* ppvObj
)
74 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
75 TRACE ("(%p)->(%s,%p)\n", This
, debugstr_guid (riid
), ppvObj
);
77 if (IsEqualIID(riid
, &IID_IUnknown
) ||
78 IsEqualIID(riid
, &IID_IHlinkBrowseContext
))
83 IUnknown_AddRef((IUnknown
*)(*ppvObj
));
89 static ULONG WINAPI
IHlinkBC_fnAddRef (IHlinkBrowseContext
* iface
)
91 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
92 ULONG refCount
= InterlockedIncrement(&This
->ref
);
94 TRACE("(%p)->(count=%u)\n", This
, refCount
- 1);
99 static ULONG WINAPI
IHlinkBC_fnRelease (IHlinkBrowseContext
* iface
)
101 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
102 ULONG refCount
= InterlockedDecrement(&This
->ref
);
104 TRACE("(%p)->(count=%u)\n", This
, refCount
+ 1);
108 TRACE("-- destroying IHlinkBrowseContext (%p)\n", This
);
109 HeapFree(GetProcessHeap(), 0, This
->BrowseWindowInfo
);
110 if (This
->CurrentPage
)
111 IHlink_Release(This
->CurrentPage
);
112 HeapFree(GetProcessHeap(), 0, This
);
116 static HRESULT WINAPI
IHlinkBC_Register(IHlinkBrowseContext
* iface
,
117 DWORD dwReserved
, IUnknown
*piunk
, IMoniker
*pimk
, DWORD
*pdwRegister
)
119 static const WCHAR szIdent
[] = {'W','I','N','E','H','L','I','N','K',0};
120 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
123 IRunningObjectTable
*ROT
;
125 FIXME("(%p)->(%i %p %p %p)\n", This
, dwReserved
, piunk
, pimk
, pdwRegister
);
127 CreateItemMoniker(NULL
, szIdent
, &mon
);
128 CreateGenericComposite(mon
, pimk
, &composite
);
130 GetRunningObjectTable(0, &ROT
);
131 IRunningObjectTable_Register(ROT
, 0, piunk
, composite
, pdwRegister
);
133 IRunningObjectTable_Release(ROT
);
134 IMoniker_Release(composite
);
135 IMoniker_Release(mon
);
140 static HRESULT WINAPI
IHlinkBC_GetObject(IHlinkBrowseContext
* face
,
141 IMoniker
*pimk
, BOOL fBindifRootRegistered
, IUnknown
**ppiunk
)
147 static HRESULT WINAPI
IHlinkBC_Revoke(IHlinkBrowseContext
* iface
,
151 IRunningObjectTable
*ROT
;
152 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
154 FIXME("(%p)->(%i)\n", This
, dwRegister
);
156 GetRunningObjectTable(0, &ROT
);
157 r
= IRunningObjectTable_Revoke(ROT
, dwRegister
);
158 IRunningObjectTable_Release(ROT
);
163 static HRESULT WINAPI
IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext
* iface
,
166 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
167 TRACE("(%p)->(%p)\n", This
, phlbwi
);
169 HeapFree(GetProcessHeap(), 0, This
->BrowseWindowInfo
);
170 This
->BrowseWindowInfo
= HeapAlloc(GetProcessHeap(), 0, phlbwi
->cbSize
);
171 memcpy(This
->BrowseWindowInfo
, phlbwi
, phlbwi
->cbSize
);
176 static HRESULT WINAPI
IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext
* iface
,
183 static HRESULT WINAPI
IHlinkBC_SetInitialHlink(IHlinkBrowseContext
* iface
,
184 IMoniker
*pimkTarget
, LPCWSTR pwzLocation
, LPCWSTR pwzFriendlyName
)
186 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
188 FIXME("(%p)->(%p %s %s)\n", This
, pimkTarget
,
189 debugstr_w(pwzLocation
), debugstr_w(pwzFriendlyName
));
191 if (This
->CurrentPage
)
192 IHlink_Release(This
->CurrentPage
);
194 HlinkCreateFromMoniker(pimkTarget
, pwzLocation
, pwzFriendlyName
, NULL
,
195 0, NULL
, &IID_IHlink
, (LPVOID
*) &This
->CurrentPage
);
200 static HRESULT WINAPI
IHlinkBC_OnNavigateHlink(IHlinkBrowseContext
*iface
,
201 DWORD grfHLNF
, IMoniker
* pmkTarget
, LPCWSTR pwzLocation
, LPCWSTR
202 pwzFriendlyName
, ULONG
*puHLID
)
204 HlinkBCImpl
*This
= (HlinkBCImpl
*)iface
;
206 FIXME("(%p)->(%i %p %s %s %p)\n", This
, grfHLNF
, pmkTarget
,
207 debugstr_w(pwzLocation
), debugstr_w(pwzFriendlyName
), puHLID
);
212 static HRESULT WINAPI
IHlinkBC_UpdateHlink(IHlinkBrowseContext
* iface
,
213 ULONG uHLID
, IMoniker
* pimkTarget
, LPCWSTR pwzLocation
,
214 LPCWSTR pwzFriendlyName
)
220 static HRESULT WINAPI
IHlinkBC_EnumNavigationStack( IHlinkBrowseContext
*iface
,
221 DWORD dwReserved
, DWORD grfHLFNAMEF
, IEnumHLITEM
** ppienumhlitem
)
227 static HRESULT WINAPI
IHlinkBC_QueryHlink( IHlinkBrowseContext
* iface
,
228 DWORD grfHLONG
, ULONG uHLID
)
234 static HRESULT WINAPI
IHlinkBC_GetHlink( IHlinkBrowseContext
* iface
,
235 ULONG uHLID
, IHlink
** ppihl
)
241 static HRESULT WINAPI
IHlinkBC_SetCurrentHlink( IHlinkBrowseContext
* iface
,
248 static HRESULT WINAPI
IHlinkBC_Clone( IHlinkBrowseContext
* iface
,
249 IUnknown
* piunkOuter
, REFIID riid
, IUnknown
** ppiunkOjb
)
255 static HRESULT WINAPI
IHlinkBC_Close(IHlinkBrowseContext
* iface
,
262 static const IHlinkBrowseContextVtbl hlvt
=
264 IHlinkBC_fnQueryInterface
,
270 IHlinkBC_SetBrowseWindowInfo
,
271 IHlinkBC_GetBrowseWindowInfo
,
272 IHlinkBC_SetInitialHlink
,
273 IHlinkBC_OnNavigateHlink
,
274 IHlinkBC_UpdateHlink
,
275 IHlinkBC_EnumNavigationStack
,
278 IHlinkBC_SetCurrentHlink
,