ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

browse_ctx.c
Go to the documentation of this file.
00001 /*
00002  * Implementation of hyperlinking (hlink.dll)
00003  *
00004  * Copyright 2005 Aric Stewart for CodeWeavers
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include "hlink_private.h"
00022 
00023 #include "wine/debug.h"
00024 
00025 WINE_DEFAULT_DEBUG_CHANNEL(hlink);
00026 
00027 typedef struct
00028 {
00029     IHlinkBrowseContext IHlinkBrowseContext_iface;
00030     LONG        ref;
00031     HLBWINFO*   BrowseWindowInfo;
00032     IHlink*     CurrentPage;
00033 } HlinkBCImpl;
00034 
00035 static inline HlinkBCImpl *impl_from_IHlinkBrowseContext(IHlinkBrowseContext *iface)
00036 {
00037     return CONTAINING_RECORD(iface, HlinkBCImpl, IHlinkBrowseContext_iface);
00038 }
00039 
00040 static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
00041         REFIID riid, LPVOID* ppvObj)
00042 {
00043     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00044     TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
00045 
00046     if (IsEqualIID(riid, &IID_IUnknown) ||
00047         IsEqualIID(riid, &IID_IHlinkBrowseContext))
00048         *ppvObj = This;
00049 
00050     if (*ppvObj)
00051     {
00052         IUnknown_AddRef((IUnknown*)(*ppvObj));
00053         return S_OK;
00054     }
00055     return E_NOINTERFACE;
00056 }
00057 
00058 static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
00059 {
00060     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00061     ULONG refCount = InterlockedIncrement(&This->ref);
00062 
00063     TRACE("(%p)->(count=%u)\n", This, refCount - 1);
00064 
00065     return refCount;
00066 }
00067 
00068 static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
00069 {
00070     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00071     ULONG refCount = InterlockedDecrement(&This->ref);
00072 
00073     TRACE("(%p)->(count=%u)\n", This, refCount + 1);
00074     if (refCount)
00075         return refCount;
00076 
00077     TRACE("-- destroying IHlinkBrowseContext (%p)\n", This);
00078     heap_free(This->BrowseWindowInfo);
00079     if (This->CurrentPage)
00080         IHlink_Release(This->CurrentPage);
00081     heap_free(This);
00082     return 0;
00083 }
00084 
00085 static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
00086         DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
00087 {
00088     static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
00089     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00090     IMoniker *mon;
00091     IMoniker *composite;
00092     IRunningObjectTable *ROT;
00093 
00094     FIXME("(%p)->(%i %p %p %p)\n", This, dwReserved, piunk, pimk, pdwRegister);
00095 
00096     CreateItemMoniker(NULL, szIdent, &mon);
00097     CreateGenericComposite(mon, pimk, &composite);
00098 
00099     GetRunningObjectTable(0, &ROT);
00100     IRunningObjectTable_Register(ROT, 0, piunk, composite, pdwRegister);
00101 
00102     IRunningObjectTable_Release(ROT);
00103     IMoniker_Release(composite);
00104     IMoniker_Release(mon);
00105 
00106     return S_OK;
00107 }
00108 
00109 static HRESULT WINAPI IHlinkBC_GetObject(IHlinkBrowseContext* face,
00110         IMoniker *pimk, BOOL fBindifRootRegistered, IUnknown **ppiunk)
00111 {
00112     FIXME("\n");
00113     return E_NOTIMPL;
00114 }
00115 
00116 static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
00117         DWORD dwRegister)
00118 {
00119     HRESULT r = S_OK;
00120     IRunningObjectTable *ROT;
00121     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00122 
00123     FIXME("(%p)->(%i)\n", This, dwRegister);
00124 
00125     GetRunningObjectTable(0, &ROT);
00126     r = IRunningObjectTable_Revoke(ROT, dwRegister);
00127     IRunningObjectTable_Release(ROT);
00128 
00129     return r;
00130 }
00131 
00132 static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
00133         HLBWINFO *phlbwi)
00134 {
00135     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00136     TRACE("(%p)->(%p)\n", This, phlbwi);
00137 
00138     if(!phlbwi)
00139         return E_INVALIDARG;
00140 
00141     heap_free(This->BrowseWindowInfo);
00142     This->BrowseWindowInfo = heap_alloc(phlbwi->cbSize);
00143     memcpy(This->BrowseWindowInfo, phlbwi, phlbwi->cbSize);
00144 
00145     return S_OK;
00146 }
00147 
00148 static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
00149         HLBWINFO *phlbwi)
00150 {
00151     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00152     TRACE("(%p)->(%p)\n", This, phlbwi);
00153 
00154     if(!phlbwi)
00155         return E_INVALIDARG;
00156 
00157     if(!This->BrowseWindowInfo)
00158         phlbwi->cbSize = 0;
00159     else
00160         memcpy(phlbwi, This->BrowseWindowInfo, This->BrowseWindowInfo->cbSize);
00161 
00162     return S_OK;
00163 }
00164 
00165 static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
00166         IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
00167 {
00168     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00169 
00170     FIXME("(%p)->(%p %s %s)\n", This, pimkTarget,
00171             debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName));
00172 
00173     if (This->CurrentPage)
00174         IHlink_Release(This->CurrentPage);
00175 
00176     HlinkCreateFromMoniker(pimkTarget, pwzLocation, pwzFriendlyName, NULL,
00177             0, NULL, &IID_IHlink, (LPVOID*) &This->CurrentPage);
00178 
00179     return S_OK;
00180 }
00181 
00182 static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
00183         DWORD grfHLNF, IMoniker* pmkTarget, LPCWSTR pwzLocation, LPCWSTR
00184         pwzFriendlyName, ULONG *puHLID)
00185 {
00186     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00187 
00188     FIXME("(%p)->(%i %p %s %s %p)\n", This, grfHLNF, pmkTarget,
00189             debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID);
00190 
00191     return S_OK;
00192 }
00193 
00194 static HRESULT WINAPI IHlinkBC_UpdateHlink(IHlinkBrowseContext* iface,
00195         ULONG uHLID, IMoniker* pimkTarget, LPCWSTR pwzLocation,
00196         LPCWSTR pwzFriendlyName)
00197 {
00198     FIXME("\n");
00199     return E_NOTIMPL;
00200 }
00201 
00202 static HRESULT WINAPI IHlinkBC_EnumNavigationStack( IHlinkBrowseContext *iface,
00203         DWORD dwReserved, DWORD grfHLFNAMEF, IEnumHLITEM** ppienumhlitem)
00204 {
00205     FIXME("\n");
00206     return E_NOTIMPL;
00207 }
00208 
00209 static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
00210         DWORD grfHLONG, ULONG uHLID)
00211 {
00212     FIXME("\n");
00213     return E_NOTIMPL;
00214 }
00215 
00216 static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
00217         ULONG uHLID, IHlink** ppihl)
00218 {
00219     HlinkBCImpl  *This = impl_from_IHlinkBrowseContext(iface);
00220 
00221     TRACE("(%p)->(%x %p)\n", This, uHLID, ppihl);
00222 
00223     if(uHLID != HLID_CURRENT) {
00224         FIXME("Only HLID_CURRENT implemented, given: %x\n", uHLID);
00225         return E_NOTIMPL;
00226     }
00227 
00228     *ppihl = This->CurrentPage;
00229     IHlink_AddRef(*ppihl);
00230 
00231     return S_OK;
00232 }
00233 
00234 static HRESULT WINAPI IHlinkBC_SetCurrentHlink( IHlinkBrowseContext* iface,
00235         ULONG uHLID)
00236 {
00237     FIXME("\n");
00238     return E_NOTIMPL;
00239 }
00240 
00241 static HRESULT WINAPI IHlinkBC_Clone( IHlinkBrowseContext* iface,
00242         IUnknown* piunkOuter, REFIID riid, IUnknown** ppiunkOjb)
00243 {
00244     FIXME("\n");
00245     return E_NOTIMPL;
00246 }
00247 
00248 static HRESULT WINAPI IHlinkBC_Close(IHlinkBrowseContext* iface,
00249         DWORD reserved)
00250 {
00251     FIXME("\n");
00252     return E_NOTIMPL;
00253 }
00254 
00255 static const IHlinkBrowseContextVtbl hlvt =
00256 {
00257     IHlinkBC_fnQueryInterface,
00258     IHlinkBC_fnAddRef,
00259     IHlinkBC_fnRelease,
00260     IHlinkBC_Register,
00261     IHlinkBC_GetObject,
00262     IHlinkBC_Revoke,
00263     IHlinkBC_SetBrowseWindowInfo,
00264     IHlinkBC_GetBrowseWindowInfo,
00265     IHlinkBC_SetInitialHlink,
00266     IHlinkBC_OnNavigateHlink,
00267     IHlinkBC_UpdateHlink,
00268     IHlinkBC_EnumNavigationStack,
00269     IHlinkBC_QueryHlink,
00270     IHlinkBC_GetHlink,
00271     IHlinkBC_SetCurrentHlink,
00272     IHlinkBC_Clone,
00273     IHlinkBC_Close
00274 };
00275 
00276 HRESULT HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
00277 {
00278     HlinkBCImpl * hl;
00279 
00280     TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
00281     *ppv = NULL;
00282 
00283     if (pUnkOuter)
00284         return CLASS_E_NOAGGREGATION;
00285 
00286     hl = heap_alloc_zero(sizeof(HlinkBCImpl));
00287     if (!hl)
00288         return E_OUTOFMEMORY;
00289 
00290     hl->ref = 1;
00291     hl->IHlinkBrowseContext_iface.lpVtbl = &hlvt;
00292 
00293     *ppv = hl;
00294     return S_OK;
00295 }

Generated on Sat May 26 2012 04:22:35 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.