* Sync to Wine 1.3.37.

svn path=/trunk/; revision=55236
This commit is contained in:
Amine Khaldi 2012-01-27 12:14:01 +00:00
parent 2b0aee28de
commit cdd2116957
12 changed files with 254 additions and 208 deletions

View file

@ -2,6 +2,7 @@
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
set_rc_compiler()
spec2def(hlink.dll hlink.spec)
list(APPEND SOURCE
@ -9,6 +10,7 @@ list(APPEND SOURCE
extserv.c
hlink_main.c
link.c
hlink.rc
${CMAKE_CURRENT_BINARY_DIR}/hlink_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/hlink.def)

View file

@ -24,43 +24,23 @@
WINE_DEFAULT_DEBUG_CHANNEL(hlink);
static const IHlinkBrowseContextVtbl hlvt;
typedef struct
{
const IHlinkBrowseContextVtbl *lpVtbl;
IHlinkBrowseContext IHlinkBrowseContext_iface;
LONG ref;
HLBWINFO* BrowseWindowInfo;
IHlink* CurrentPage;
} HlinkBCImpl;
HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
LPVOID *ppv)
static inline HlinkBCImpl *impl_from_IHlinkBrowseContext(IHlinkBrowseContext *iface)
{
HlinkBCImpl * hl;
TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
*ppv = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
hl = heap_alloc_zero(sizeof(HlinkBCImpl));
if (!hl)
return E_OUTOFMEMORY;
hl->ref = 1;
hl->lpVtbl = &hlvt;
*ppv = hl;
return S_OK;
return CONTAINING_RECORD(iface, HlinkBCImpl, IHlinkBrowseContext_iface);
}
static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
REFIID riid, LPVOID* ppvObj)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
if (IsEqualIID(riid, &IID_IUnknown) ||
@ -77,7 +57,7 @@ static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount - 1);
@ -87,7 +67,7 @@ static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount + 1);
@ -106,7 +86,7 @@ static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
{
static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
IMoniker *mon;
IMoniker *composite;
IRunningObjectTable *ROT;
@ -138,7 +118,7 @@ static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
{
HRESULT r = S_OK;
IRunningObjectTable *ROT;
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
FIXME("(%p)->(%i)\n", This, dwRegister);
@ -152,7 +132,7 @@ static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
HLBWINFO *phlbwi)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE("(%p)->(%p)\n", This, phlbwi);
if(!phlbwi)
@ -168,7 +148,7 @@ static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
HLBWINFO *phlbwi)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE("(%p)->(%p)\n", This, phlbwi);
if(!phlbwi)
@ -185,7 +165,7 @@ static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
FIXME("(%p)->(%p %s %s)\n", This, pimkTarget,
debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName));
@ -203,7 +183,7 @@ static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
DWORD grfHLNF, IMoniker* pmkTarget, LPCWSTR pwzLocation, LPCWSTR
pwzFriendlyName, ULONG *puHLID)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
FIXME("(%p)->(%i %p %s %s %p)\n", This, grfHLNF, pmkTarget,
debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID);
@ -236,7 +216,7 @@ static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
ULONG uHLID, IHlink** ppihl)
{
HlinkBCImpl *This = (HlinkBCImpl*)iface;
HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE("(%p)->(%x %p)\n", This, uHLID, ppihl);
@ -266,7 +246,7 @@ static HRESULT WINAPI IHlinkBC_Clone( IHlinkBrowseContext* iface,
}
static HRESULT WINAPI IHlinkBC_Close(IHlinkBrowseContext* iface,
DWORD reserverd)
DWORD reserved)
{
FIXME("\n");
return E_NOTIMPL;
@ -292,3 +272,24 @@ static const IHlinkBrowseContextVtbl hlvt =
IHlinkBC_Clone,
IHlinkBC_Close
};
HRESULT HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
HlinkBCImpl * hl;
TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
*ppv = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
hl = heap_alloc_zero(sizeof(HlinkBCImpl));
if (!hl)
return E_OUTOFMEMORY;
hl->ref = 1;
hl->IHlinkBrowseContext_iface.lpVtbl = &hlvt;
*ppv = hl;
return S_OK;
}

View file

@ -23,13 +23,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(hlink);
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
typedef struct {
const IUnknownVtbl *lpIUnknownVtbl;
const IAuthenticateVtbl *lpIAuthenticateVtbl;
const IHttpNegotiateVtbl *lpIHttpNegotiateVtbl;
const IExtensionServicesVtbl *lpIExtensionServicesVtbl;
IUnknown IUnknown_iface;
IAuthenticate IAuthenticate_iface;
IHttpNegotiate IHttpNegotiate_iface;
IExtensionServices IExtensionServices_iface;
LONG ref;
IUnknown *outer;
@ -40,31 +38,29 @@ typedef struct {
LPWSTR headers;
} ExtensionService;
#define EXTSERVUNK(x) ((IUnknown*)&(x)->lpIUnknownVtbl)
#define AUTHENTICATE(x) (&(x)->lpIAuthenticateVtbl)
#define HTTPNEGOTIATE(x) (&(x)->lpIHttpNegotiateVtbl)
#define EXTENSIONSERVICES(x) (&(x)->lpIExtensionServicesVtbl)
#define EXTSERVUNK_THIS(iface) DEFINE_THIS(ExtensionService, IUnknown, iface)
static inline ExtensionService *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, ExtensionService, IUnknown_iface);
}
static HRESULT WINAPI ExtServUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
ExtensionService *This = EXTSERVUNK_THIS(iface);
ExtensionService *This = impl_from_IUnknown(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = EXTSERVUNK(This);
*ppv = &This->IUnknown_iface;
}else if(IsEqualGUID(&IID_IAuthenticate, riid)) {
TRACE("(%p)->(IID_IAuthenticate %p)\n", This, ppv);
*ppv = AUTHENTICATE(This);
*ppv = &This->IAuthenticate_iface;
}else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
*ppv = HTTPNEGOTIATE(This);
*ppv = &This->IHttpNegotiate_iface;
}else if(IsEqualGUID(&IID_IExtensionServices, riid)) {
TRACE("(%p)->(IID_IExtensionServices %p)\n", This, ppv);
*ppv = EXTENSIONSERVICES(This);
*ppv = &This->IExtensionServices_iface;
}
if(*ppv) {
@ -78,7 +74,7 @@ static HRESULT WINAPI ExtServUnk_QueryInterface(IUnknown *iface, REFIID riid, vo
static ULONG WINAPI ExtServUnk_AddRef(IUnknown *iface)
{
ExtensionService *This = EXTSERVUNK_THIS(iface);
ExtensionService *This = impl_from_IUnknown(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@ -88,7 +84,7 @@ static ULONG WINAPI ExtServUnk_AddRef(IUnknown *iface)
static ULONG WINAPI ExtServUnk_Release(IUnknown *iface)
{
ExtensionService *This = EXTSERVUNK_THIS(iface);
ExtensionService *This = impl_from_IUnknown(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@ -103,38 +99,39 @@ static ULONG WINAPI ExtServUnk_Release(IUnknown *iface)
return ref;
}
#undef EXTSERVUNK_THIS
static const IUnknownVtbl ExtServUnkVtbl = {
ExtServUnk_QueryInterface,
ExtServUnk_AddRef,
ExtServUnk_Release
};
#define AUTHENTICATE_THIS(iface) DEFINE_THIS(ExtensionService, IAuthenticate, iface)
static inline ExtensionService *impl_from_IAuthenticate(IAuthenticate *iface)
{
return CONTAINING_RECORD(iface, ExtensionService, IAuthenticate_iface);
}
static HRESULT WINAPI Authenticate_QueryInterface(IAuthenticate *iface, REFIID riid, void **ppv)
{
ExtensionService *This = AUTHENTICATE_THIS(iface);
ExtensionService *This = impl_from_IAuthenticate(iface);
return IUnknown_QueryInterface(This->outer, riid, ppv);
}
static ULONG WINAPI Authenticate_AddRef(IAuthenticate *iface)
{
ExtensionService *This = AUTHENTICATE_THIS(iface);
ExtensionService *This = impl_from_IAuthenticate(iface);
return IUnknown_AddRef(This->outer);
}
static ULONG WINAPI Authenticate_Release(IAuthenticate *iface)
{
ExtensionService *This = AUTHENTICATE_THIS(iface);
ExtensionService *This = impl_from_IAuthenticate(iface);
return IUnknown_Release(This->outer);
}
static HRESULT WINAPI Authenticate_Authenticate(IAuthenticate *iface,
HWND *phwnd, LPWSTR *pszUsername, LPWSTR *pszPassword)
{
ExtensionService *This = AUTHENTICATE_THIS(iface);
ExtensionService *This = impl_from_IAuthenticate(iface);
TRACE("(%p)->(%p %p %p)\n", This, phwnd, pszUsername, pszPassword);
@ -148,8 +145,6 @@ static HRESULT WINAPI Authenticate_Authenticate(IAuthenticate *iface,
return S_OK;
}
#undef AUTHENTICATE_THIS
static const IAuthenticateVtbl AuthenticateVtbl = {
Authenticate_QueryInterface,
Authenticate_AddRef,
@ -157,30 +152,33 @@ static const IAuthenticateVtbl AuthenticateVtbl = {
Authenticate_Authenticate
};
#define HTTPNEGOTIATE_THIS(iface) DEFINE_THIS(ExtensionService, IHttpNegotiate, iface)
static inline ExtensionService *impl_from_IHttpNegotiate(IHttpNegotiate *iface)
{
return CONTAINING_RECORD(iface, ExtensionService, IHttpNegotiate_iface);
}
static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface, REFIID riid, void **ppv)
{
ExtensionService *This = HTTPNEGOTIATE_THIS(iface);
ExtensionService *This = impl_from_IHttpNegotiate(iface);
return IUnknown_QueryInterface(This->outer, riid, ppv);
}
static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
{
ExtensionService *This = HTTPNEGOTIATE_THIS(iface);
ExtensionService *This = impl_from_IHttpNegotiate(iface);
return IUnknown_AddRef(This->outer);
}
static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
{
ExtensionService *This = HTTPNEGOTIATE_THIS(iface);
ExtensionService *This = impl_from_IHttpNegotiate(iface);
return IUnknown_Release(This->outer);
}
static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
{
ExtensionService *This = HTTPNEGOTIATE_THIS(iface);
ExtensionService *This = impl_from_IHttpNegotiate(iface);
TRACE("(%p)->(%s %s %x %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders), dwReserved,
pszAdditionalHeaders);
@ -195,7 +193,7 @@ static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface,
static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD dwResponseCode,
LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
{
ExtensionService *This = HTTPNEGOTIATE_THIS(iface);
ExtensionService *This = impl_from_IHttpNegotiate(iface);
TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
@ -204,8 +202,6 @@ static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD dwRe
return S_OK;
}
#undef HTTPNEGOTIATE_THIS
static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
HttpNegotiate_QueryInterface,
HttpNegotiate_AddRef,
@ -214,23 +210,26 @@ static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
HttpNegotiate_OnResponse
};
#define EXTENSIONSERVICES_THIS(iface) DEFINE_THIS(ExtensionService, IExtensionServices, iface)
static inline ExtensionService *impl_from_IExtensionServices(IExtensionServices *iface)
{
return CONTAINING_RECORD(iface, ExtensionService, IExtensionServices_iface);
}
static HRESULT WINAPI ExtServ_QueryInterface(IExtensionServices *iface, REFIID riid, void **ppv)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
ExtensionService *This = impl_from_IExtensionServices(iface);
return IUnknown_QueryInterface(This->outer, riid, ppv);
}
static ULONG WINAPI ExtServ_AddRef(IExtensionServices *iface)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
ExtensionService *This = impl_from_IExtensionServices(iface);
return IUnknown_AddRef(This->outer);
}
static ULONG WINAPI ExtServ_Release(IExtensionServices *iface)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
ExtensionService *This = impl_from_IExtensionServices(iface);
return IUnknown_Release(This->outer);
}
@ -260,7 +259,7 @@ static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR
static HRESULT WINAPI ExtServ_SetAdditionalHeaders(IExtensionServices* iface, LPCWSTR pwzAdditionalHeaders)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
ExtensionService *This = impl_from_IExtensionServices(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzAdditionalHeaders));
@ -281,15 +280,13 @@ static HRESULT ExtServ_ImplSetAuthenticateData(ExtensionService* This, HWND phwn
static HRESULT WINAPI ExtServ_SetAuthenticateData(IExtensionServices* iface, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
ExtensionService *This = impl_from_IExtensionServices(iface);
TRACE("(%p)->(%p %s %s)\n", This, phwnd, debugstr_w(pwzUsername), debugstr_w(pwzPassword));
return ExtServ_ImplSetAuthenticateData(This, phwnd, pwzUsername, pwzPassword);
}
#undef EXTENSIONSERVICES_THIS
static const IExtensionServicesVtbl ExtServVtbl = {
ExtServ_QueryInterface,
ExtServ_AddRef,
@ -314,10 +311,10 @@ HRESULT WINAPI HlinkCreateExtensionServices(LPCWSTR pwzAdditionalHeaders,
ret = heap_alloc(sizeof(*ret));
ret->lpIUnknownVtbl = &ExtServUnkVtbl;
ret->lpIAuthenticateVtbl = &AuthenticateVtbl;
ret->lpIHttpNegotiateVtbl = &HttpNegotiateVtbl;
ret->lpIExtensionServicesVtbl= &ExtServVtbl;
ret->IUnknown_iface.lpVtbl = &ExtServUnkVtbl;
ret->IAuthenticate_iface.lpVtbl = &AuthenticateVtbl;
ret->IHttpNegotiate_iface.lpVtbl = &HttpNegotiateVtbl;
ret->IExtensionServices_iface.lpVtbl = &ExtServVtbl;
ret->ref = 1;
ret->headers = NULL;
ret->hwnd = NULL;
@ -328,14 +325,14 @@ HRESULT WINAPI HlinkCreateExtensionServices(LPCWSTR pwzAdditionalHeaders,
ExtServ_ImplSetAdditionalHeaders(ret, pwzAdditionalHeaders);
if(!punkOuter) {
ret->outer = EXTSERVUNK(ret);
hres = IUnknown_QueryInterface(EXTSERVUNK(ret), riid, ppv);
IUnknown_Release(EXTSERVUNK(ret));
ret->outer = &ret->IUnknown_iface;
hres = IUnknown_QueryInterface(&ret->IUnknown_iface, riid, ppv);
IUnknown_Release(&ret->IUnknown_iface);
}else if(IsEqualGUID(&IID_IUnknown, riid)) {
ret->outer = punkOuter;
*ppv = EXTSERVUNK(ret);
*ppv = &ret->IUnknown_iface;
}else {
IUnknown_Release(EXTSERVUNK(ret));
IUnknown_Release(&ret->IUnknown_iface);
hres = E_INVALIDARG;
}

View file

@ -11,6 +11,7 @@
<file>extserv.c</file>
<file>hlink_main.c</file>
<file>link.c</file>
<file>hlink.rc</file>
<pch>hlink_private.h</pch>
<library>wine</library>
<library>shell32</library>

View file

@ -0,0 +1 @@
1 WINE_REGISTRY hlink.rgs

View file

@ -0,0 +1,17 @@
HKCR
{
NoRemove Interface
{
}
NoRemove CLSID
{
'{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}' = s 'StdHlink'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' }
}
'{79EAC9D1-BAF9-11CE-8C82-00AA004BA90B}' = s 'StdHlinkBrowseContext'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Apartment' }
}
}
}

View file

@ -30,4 +30,4 @@
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
# @ stub -private DllUnregisterServer
@ stdcall -private DllUnregisterServer()

View file

@ -0,0 +1,36 @@
/*
* COM Classes for hlink
*
* Copyright 2010 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
[
threading(apartment),
uuid(79eac9d0-baf9-11ce-8c82-00aa004ba90b)
]
coclass StdHlink
{
interface IHlink;
interface IPersistStream;
interface IDataObject;
}
[
threading(apartment),
uuid(79eac9d1-baf9-11ce-8c82-00aa004ba90b)
]
coclass StdHlinkBrowseContext { interface IHlinkBrowseContext; }

View file

@ -21,20 +21,28 @@
#include "hlink_private.h"
#include "winreg.h"
#include "rpcproxy.h"
#include "hlguids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(hlink);
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
static HINSTANCE instance;
typedef HRESULT (*LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
typedef struct
{
const IClassFactoryVtbl *lpVtbl;
LPFNCREATEINSTANCE lpfnCI;
IClassFactory IClassFactory_iface;
LPFNCREATEINSTANCE lpfnCI;
} CFImpl;
static inline CFImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, CFImpl, IClassFactory_iface);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%p %d %p\n", hinstDLL, fdwReason, lpvReserved);
@ -42,6 +50,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_PROCESS_DETACH:
@ -252,14 +261,16 @@ HRESULT WINAPI HlinkNavigateToStringReference( LPCWSTR pwzTarget,
HRESULT r;
IHlink *hlink = NULL;
FIXME("%s %s %p %08x %p %08x %p %p %p\n",
TRACE("%s %s %p %08x %p %08x %p %p %p\n",
debugstr_w(pwzTarget), debugstr_w(pwzLocation), pihlsite,
dwSiteData, pihlframe, grfHLNF, pibc, pibsc, pihlbc);
r = HlinkCreateFromString( pwzTarget, pwzLocation, NULL, pihlsite,
dwSiteData, NULL, &IID_IHlink, (LPVOID*) &hlink );
if (SUCCEEDED(r))
if (SUCCEEDED(r)) {
r = HlinkNavigate(hlink, pihlframe, grfHLNF, pibc, pibsc, pihlbc);
IHlink_Release(hlink);
}
return r;
}
@ -496,7 +507,7 @@ cleanup:
static HRESULT WINAPI HLinkCF_fnQueryInterface ( LPCLASSFACTORY iface,
REFIID riid, LPVOID *ppvObj)
{
CFImpl *This = (CFImpl *)iface;
CFImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
@ -526,7 +537,7 @@ static ULONG WINAPI HLinkCF_fnRelease(LPCLASSFACTORY iface)
static HRESULT WINAPI HLinkCF_fnCreateInstance( LPCLASSFACTORY iface,
LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
{
CFImpl *This = (CFImpl *)iface;
CFImpl *This = impl_from_IClassFactory(iface);
TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
@ -550,8 +561,8 @@ static const IClassFactoryVtbl hlcfvt =
HLinkCF_fnLockServer
};
static CFImpl HLink_cf = { &hlcfvt, HLink_Constructor };
static CFImpl HLinkBrowseContext_cf = { &hlcfvt, HLinkBrowseContext_Constructor };
static CFImpl HLink_cf = { { &hlcfvt }, HLink_Constructor };
static CFImpl HLinkBrowseContext_cf = { { &hlcfvt }, HLinkBrowseContext_Constructor };
/***********************************************************************
* DllGetClassObject (HLINK.@)
@ -567,55 +578,27 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
*ppv = NULL;
if (IsEqualIID(rclsid, &CLSID_StdHlink))
pcf = (IClassFactory*) &HLink_cf;
pcf = &HLink_cf.IClassFactory_iface;
else if (IsEqualIID(rclsid, &CLSID_StdHlinkBrowseContext))
pcf = (IClassFactory*) &HLinkBrowseContext_cf;
pcf = &HLinkBrowseContext_cf.IClassFactory_iface;
else
return CLASS_E_CLASSNOTAVAILABLE;
return IClassFactory_QueryInterface(pcf, iid, ppv);
}
static HRESULT register_clsid(LPCGUID guid)
{
static const WCHAR clsid[] =
{'C','L','S','I','D','\\',0};
static const WCHAR ips[] =
{'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
static const WCHAR hlink[] =
{'h','l','i','n','k','.','d','l','l',0};
static const WCHAR threading_model[] =
{'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
static const WCHAR apartment[] =
{'A','p','a','r','t','m','e','n','t',0};
WCHAR path[80];
HKEY key = NULL;
LONG r;
lstrcpyW(path, clsid);
StringFromGUID2(guid, &path[6], 80);
lstrcatW(path, ips);
r = RegCreateKeyW(HKEY_CLASSES_ROOT, path, &key);
if (r != ERROR_SUCCESS)
return E_FAIL;
RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)hlink, sizeof hlink);
RegSetValueExW(key, threading_model, 0, REG_SZ, (const BYTE *)apartment, sizeof apartment);
RegCloseKey(key);
return S_OK;
}
/***********************************************************************
* DllRegisterServer (HLINK.@)
* DllRegisterServer (HLINK.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
HRESULT r;
r = register_clsid(&CLSID_StdHlink);
if (SUCCEEDED(r))
r = register_clsid(&CLSID_StdHlinkBrowseContext);
return S_OK;
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (HLINK.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}

View file

@ -29,8 +29,8 @@
#include "wine/unicode.h"
extern HRESULT WINAPI HLink_Constructor(IUnknown*,REFIID,void**);
extern HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown*,REFIID,void**);
extern HRESULT HLink_Constructor(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
extern HRESULT HLinkBrowseContext_Constructor(IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
static inline void *heap_alloc(size_t len)
{

View file

@ -37,17 +37,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(hlink);
/* known flags */
#define HLINK_SAVE_ALL (HLINK_SAVE_TARGET_FRAME_PRESENT|HLINK_SAVE_FRIENDLY_PRESENT|HLINK_SAVE_LOCATION_PRESENT|0x04|HLINK_SAVE_MONIKER_IS_ABSOLUTE|HLINK_SAVE_MONIKER_PRESENT)
static const IHlinkVtbl hlvt;
static const IPersistStreamVtbl psvt;
static const IDataObjectVtbl dovt;
typedef struct
{
const IHlinkVtbl *lpVtbl;
IHlink IHlink_iface;
LONG ref;
const IPersistStreamVtbl *lpPSVtbl;
const IDataObjectVtbl *lpDOVtbl;
IPersistStream IPersistStream_iface;
IDataObject IDataObject_iface;
LPWSTR FriendlyName;
LPWSTR Location;
@ -58,15 +54,20 @@ typedef struct
BOOL absolute;
} HlinkImpl;
static inline HlinkImpl* HlinkImpl_from_IPersistStream( IPersistStream* iface)
static inline HlinkImpl *impl_from_IHlink(IHlink *iface)
{
return (HlinkImpl*) ((CHAR*)iface - FIELD_OFFSET(HlinkImpl, lpPSVtbl));
return CONTAINING_RECORD(iface, HlinkImpl, IHlink_iface);
}
static inline HlinkImpl* HlinkImpl_from_IDataObject( IDataObject* iface)
static inline HlinkImpl* impl_from_IPersistStream( IPersistStream* iface)
{
return (HlinkImpl*) ((CHAR*)iface - FIELD_OFFSET(HlinkImpl, lpDOVtbl));
return CONTAINING_RECORD(iface, HlinkImpl, IPersistStream_iface);
}
static inline HlinkImpl* impl_from_IDataObject( IDataObject* iface)
{
return CONTAINING_RECORD(iface, HlinkImpl, IDataObject_iface);
}
static HRESULT __GetMoniker(HlinkImpl* This, IMoniker** moniker,
@ -105,34 +106,10 @@ static HRESULT __GetMoniker(HlinkImpl* This, IMoniker** moniker,
return S_OK;
}
HRESULT WINAPI HLink_Constructor(IUnknown *pUnkOuter, REFIID riid,
LPVOID *ppv)
{
HlinkImpl * hl;
TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
*ppv = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
hl = heap_alloc_zero(sizeof(HlinkImpl));
if (!hl)
return E_OUTOFMEMORY;
hl->ref = 1;
hl->lpVtbl = &hlvt;
hl->lpPSVtbl = &psvt;
hl->lpDOVtbl = &dovt;
*ppv = hl;
return S_OK;
}
static HRESULT WINAPI IHlink_fnQueryInterface(IHlink* iface, REFIID riid,
LPVOID *ppvObj)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
@ -141,9 +118,9 @@ static HRESULT WINAPI IHlink_fnQueryInterface(IHlink* iface, REFIID riid,
if (IsEqualIID(riid, &IID_IUnknown) || (IsEqualIID(riid, &IID_IHlink)))
*ppvObj = This;
else if (IsEqualIID(riid, &IID_IPersistStream))
*ppvObj = &(This->lpPSVtbl);
*ppvObj = &This->IPersistStream_iface;
else if (IsEqualIID(riid, &IID_IDataObject))
*ppvObj = &(This->lpDOVtbl);
*ppvObj = &This->IDataObject_iface;
if (*ppvObj)
{
@ -155,7 +132,7 @@ static HRESULT WINAPI IHlink_fnQueryInterface(IHlink* iface, REFIID riid,
static ULONG WINAPI IHlink_fnAddRef (IHlink* iface)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount - 1);
@ -165,7 +142,7 @@ static ULONG WINAPI IHlink_fnAddRef (IHlink* iface)
static ULONG WINAPI IHlink_fnRelease (IHlink* iface)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount + 1);
@ -187,7 +164,7 @@ static ULONG WINAPI IHlink_fnRelease (IHlink* iface)
static HRESULT WINAPI IHlink_fnSetHlinkSite( IHlink* iface,
IHlinkSite* pihlSite, DWORD dwSiteData)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p)->(%p %i)\n", This, pihlSite, dwSiteData);
@ -206,7 +183,7 @@ static HRESULT WINAPI IHlink_fnSetHlinkSite( IHlink* iface,
static HRESULT WINAPI IHlink_fnGetHlinkSite( IHlink* iface,
IHlinkSite** ppihlSite, DWORD *pdwSiteData)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p)->(%p %p)\n", This, ppihlSite, pdwSiteData);
@ -223,7 +200,7 @@ static HRESULT WINAPI IHlink_fnGetHlinkSite( IHlink* iface,
static HRESULT WINAPI IHlink_fnSetMonikerReference( IHlink* iface,
DWORD rfHLSETF, IMoniker *pmkTarget, LPCWSTR pwzLocation)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p)->(%i %p %s)\n", This, rfHLSETF, pmkTarget,
debugstr_w(pwzLocation));
@ -259,7 +236,7 @@ static HRESULT WINAPI IHlink_fnSetMonikerReference( IHlink* iface,
static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
DWORD grfHLSETF, LPCWSTR pwzTarget, LPCWSTR pwzLocation)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p)->(%i %s %s)\n", This, grfHLSETF, debugstr_w(pwzTarget),
debugstr_w(pwzLocation));
@ -323,7 +300,7 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
static HRESULT WINAPI IHlink_fnGetMonikerReference(IHlink* iface,
DWORD dwWhichRef, IMoniker **ppimkTarget, LPWSTR *ppwzLocation)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppimkTarget,
ppwzLocation);
@ -348,7 +325,7 @@ static HRESULT WINAPI IHlink_fnGetMonikerReference(IHlink* iface,
static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
DWORD dwWhichRef, LPWSTR *ppwzTarget, LPWSTR *ppwzLocation)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%i %p %p)\n", This, dwWhichRef, ppwzTarget, ppwzLocation);
@ -396,7 +373,7 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
static HRESULT WINAPI IHlink_fnSetFriendlyName (IHlink *iface,
LPCWSTR pwzFriendlyName)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%s)\n", This, debugstr_w(pwzFriendlyName));
@ -409,7 +386,7 @@ static HRESULT WINAPI IHlink_fnSetFriendlyName (IHlink *iface,
static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface,
DWORD grfHLFNAMEF, LPWSTR* ppwzFriendlyName)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p) -> (%i %p)\n", This, grfHLFNAMEF, ppwzFriendlyName);
@ -445,7 +422,7 @@ static HRESULT WINAPI IHlink_fnGetFriendlyName (IHlink* iface,
static HRESULT WINAPI IHlink_fnSetTargetFrameName(IHlink* iface,
LPCWSTR pwzTargetFramename)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzTargetFramename));
heap_free(This->TargetFrameName);
@ -457,10 +434,18 @@ static HRESULT WINAPI IHlink_fnSetTargetFrameName(IHlink* iface,
static HRESULT WINAPI IHlink_fnGetTargetFrameName(IHlink* iface,
LPWSTR *ppwzTargetFrameName)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
TRACE("(%p)->(%p)\n", This, ppwzTargetFrameName);
if(!This->TargetFrameName) {
*ppwzTargetFrameName = NULL;
return S_FALSE;
}
*ppwzTargetFrameName = hlink_co_strdupW( This->TargetFrameName );
if(!*ppwzTargetFrameName)
return E_OUTOFMEMORY;
return S_OK;
}
@ -474,7 +459,7 @@ static HRESULT WINAPI IHlink_fnGetMiscStatus(IHlink* iface, DWORD* pdwStatus)
static HRESULT WINAPI IHlink_fnNavigate(IHlink* iface, DWORD grfHLNF, LPBC pbc,
IBindStatusCallback *pbsc, IHlinkBrowseContext *phbc)
{
HlinkImpl *This = (HlinkImpl*)iface;
HlinkImpl *This = impl_from_IHlink(iface);
IMoniker *mon = NULL;
HRESULT r;
@ -565,23 +550,23 @@ static const IHlinkVtbl hlvt =
static HRESULT WINAPI IDataObject_fnQueryInterface(IDataObject* iface,
REFIID riid, LPVOID *ppvObj)
{
HlinkImpl *This = HlinkImpl_from_IDataObject(iface);
HlinkImpl *This = impl_from_IDataObject(iface);
TRACE("%p\n", This);
return IHlink_QueryInterface((IHlink*)This, riid, ppvObj);
return IHlink_QueryInterface(&This->IHlink_iface, riid, ppvObj);
}
static ULONG WINAPI IDataObject_fnAddRef (IDataObject* iface)
{
HlinkImpl *This = HlinkImpl_from_IDataObject(iface);
HlinkImpl *This = impl_from_IDataObject(iface);
TRACE("%p\n", This);
return IHlink_AddRef((IHlink*)This);
return IHlink_AddRef(&This->IHlink_iface);
}
static ULONG WINAPI IDataObject_fnRelease (IDataObject* iface)
{
HlinkImpl *This = HlinkImpl_from_IDataObject(iface);
HlinkImpl *This = impl_from_IDataObject(iface);
TRACE("%p\n", This);
return IHlink_Release((IHlink*)This);
return IHlink_Release(&This->IHlink_iface);
}
static HRESULT WINAPI IDataObject_fnGetData(IDataObject* iface,
@ -667,29 +652,29 @@ static const IDataObjectVtbl dovt =
static HRESULT WINAPI IPersistStream_fnQueryInterface(IPersistStream* iface,
REFIID riid, LPVOID *ppvObj)
{
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p)\n", This);
return IHlink_QueryInterface((IHlink*)This, riid, ppvObj);
return IHlink_QueryInterface(&This->IHlink_iface, riid, ppvObj);
}
static ULONG WINAPI IPersistStream_fnAddRef (IPersistStream* iface)
{
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p)\n", This);
return IHlink_AddRef((IHlink*)This);
return IHlink_AddRef(&This->IHlink_iface);
}
static ULONG WINAPI IPersistStream_fnRelease (IPersistStream* iface)
{
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p)\n", This);
return IHlink_Release((IHlink*)This);
return IHlink_Release(&This->IHlink_iface);
}
static HRESULT WINAPI IPersistStream_fnGetClassID(IPersistStream* iface,
CLSID* pClassID)
{
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
TRACE("(%p)\n", This);
*pClassID = CLSID_StdHlink;
return S_OK;
@ -763,7 +748,7 @@ static HRESULT WINAPI IPersistStream_fnLoad(IPersistStream* iface,
HRESULT r;
DWORD hdr[2];
DWORD read;
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
r = IStream_Read(pStm, hdr, sizeof(hdr), &read);
if (read != sizeof(hdr) || (hdr[0] != HLINK_SAVE_MAGIC))
@ -816,7 +801,7 @@ static HRESULT WINAPI IPersistStream_fnSave(IPersistStream* iface,
IStream* pStm, BOOL fClearDirty)
{
HRESULT r;
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
DWORD hdr[2];
IMoniker *moniker;
@ -887,7 +872,7 @@ static HRESULT WINAPI IPersistStream_fnGetSizeMax(IPersistStream* iface,
ULARGE_INTEGER* pcbSize)
{
HRESULT r;
HlinkImpl *This = HlinkImpl_from_IPersistStream(iface);
HlinkImpl *This = impl_from_IPersistStream(iface);
IMoniker *moniker;
TRACE("(%p) Moniker(%p)\n", This, This->Moniker);
@ -937,3 +922,26 @@ static const IPersistStreamVtbl psvt =
IPersistStream_fnSave,
IPersistStream_fnGetSizeMax,
};
HRESULT HLink_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
HlinkImpl * hl;
TRACE("unkOut=%p riid=%s\n", pUnkOuter, debugstr_guid(riid));
*ppv = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
hl = heap_alloc_zero(sizeof(HlinkImpl));
if (!hl)
return E_OUTOFMEMORY;
hl->ref = 1;
hl->IHlink_iface.lpVtbl = &hlvt;
hl->IPersistStream_iface.lpVtbl = &psvt;
hl->IDataObject_iface.lpVtbl = &dovt;
*ppv = hl;
return S_OK;
}

View file

@ -63,7 +63,7 @@ reactos/dll/win32/dwmapi # Synced to Wine-1.3.37
reactos/dll/win32/fusion # Synced to Wine-1.3.37
reactos/dll/win32/gdiplus # Autosync
reactos/dll/win32/hhctrl.ocx # Autosync
reactos/dll/win32/hlink # Autosync
reactos/dll/win32/hlink # Synced to Wine-1.3.37
reactos/dll/win32/hnetcfg # Autosync
reactos/dll/win32/httpapi # Synced to Wine-1.3.37
reactos/dll/win32/iccvid # Autosync