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