Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4a6c5256
Commit
4a6c5256
authored
Jan 05, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jan 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hlink: Use ifaces instead of vtbl pointers in ExtensionService.
parent
1503a1ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
53 deletions
+50
-53
extserv.c
dlls/hlink/extserv.c
+50
-53
No files found.
dlls/hlink/extserv.c
View file @
4a6c5256
...
...
@@ -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
->
lpIUnknown
Vtbl
=
&
ExtServUnkVtbl
;
ret
->
lpIAuthenticate
Vtbl
=
&
AuthenticateVtbl
;
ret
->
lpIHttpNegotiate
Vtbl
=
&
HttpNegotiateVtbl
;
ret
->
lpIExtensionServicesVtbl
=
&
ExtServVtbl
;
ret
->
IUnknown_iface
.
lp
Vtbl
=
&
ExtServUnkVtbl
;
ret
->
IAuthenticate_iface
.
lp
Vtbl
=
&
AuthenticateVtbl
;
ret
->
IHttpNegotiate_iface
.
lp
Vtbl
=
&
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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment