ReactOS 0.4.15-dev-8241-g63935f8
extserv.c File Reference
#include "hlink_private.h"
#include "wine/debug.h"
Include dependency graph for extserv.c:

Go to the source code of this file.

Classes

struct  ExtensionService
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (hlink)
 
static ExtensionServiceimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI ExtServUnk_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ExtServUnk_AddRef (IUnknown *iface)
 
static ULONG WINAPI ExtServUnk_Release (IUnknown *iface)
 
static ExtensionServiceimpl_from_IAuthenticate (IAuthenticate *iface)
 
static HRESULT WINAPI Authenticate_QueryInterface (IAuthenticate *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Authenticate_AddRef (IAuthenticate *iface)
 
static ULONG WINAPI Authenticate_Release (IAuthenticate *iface)
 
static HRESULT WINAPI Authenticate_Authenticate (IAuthenticate *iface, HWND *phwnd, LPWSTR *pszUsername, LPWSTR *pszPassword)
 
static ExtensionServiceimpl_from_IHttpNegotiate (IHttpNegotiate *iface)
 
static HRESULT WINAPI HttpNegotiate_QueryInterface (IHttpNegotiate *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HttpNegotiate_AddRef (IHttpNegotiate *iface)
 
static ULONG WINAPI HttpNegotiate_Release (IHttpNegotiate *iface)
 
static HRESULT WINAPI HttpNegotiate_BeginningTransaction (IHttpNegotiate *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
 
static HRESULT WINAPI HttpNegotiate_OnResponse (IHttpNegotiate *iface, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
 
static ExtensionServiceimpl_from_IExtensionServices (IExtensionServices *iface)
 
static HRESULT WINAPI ExtServ_QueryInterface (IExtensionServices *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ExtServ_AddRef (IExtensionServices *iface)
 
static ULONG WINAPI ExtServ_Release (IExtensionServices *iface)
 
static HRESULT ExtServ_ImplSetAdditionalHeaders (ExtensionService *This, LPCWSTR pwzAdditionalHeaders)
 
static HRESULT WINAPI ExtServ_SetAdditionalHeaders (IExtensionServices *iface, LPCWSTR pwzAdditionalHeaders)
 
static HRESULT ExtServ_ImplSetAuthenticateData (ExtensionService *This, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
 
static HRESULT WINAPI ExtServ_SetAuthenticateData (IExtensionServices *iface, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
 
HRESULT WINAPI HlinkCreateExtensionServices (LPCWSTR pwzAdditionalHeaders, HWND phwnd, LPCWSTR pszUsername, LPCWSTR pszPassword, IUnknown *punkOuter, REFIID riid, void **ppv)
 

Variables

static const IUnknownVtbl ExtServUnkVtbl
 
static const IAuthenticateVtbl AuthenticateVtbl
 
static const IHttpNegotiateVtbl HttpNegotiateVtbl
 
static const IExtensionServicesVtbl ExtServVtbl
 

Function Documentation

◆ Authenticate_AddRef()

static ULONG WINAPI Authenticate_AddRef ( IAuthenticate iface)
static

Definition at line 118 of file extserv.c.

119{
121 return IUnknown_AddRef(This->outer_unk);
122}
static ExtensionService * impl_from_IAuthenticate(IAuthenticate *iface)
Definition: extserv.c:107

◆ Authenticate_Authenticate()

static HRESULT WINAPI Authenticate_Authenticate ( IAuthenticate iface,
HWND phwnd,
LPWSTR pszUsername,
LPWSTR pszPassword 
)
static

Definition at line 130 of file extserv.c.

132{
134
135 TRACE("(%p)->(%p %p %p)\n", This, phwnd, pszUsername, pszPassword);
136
137 if(!phwnd || !pszUsername || !pszPassword)
138 return E_INVALIDARG;
139
140 *phwnd = This->hwnd;
141 *pszUsername = hlink_co_strdupW(This->username);
142 *pszPassword = hlink_co_strdupW(This->password);
143
144 return S_OK;
145}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4

◆ Authenticate_QueryInterface()

static HRESULT WINAPI Authenticate_QueryInterface ( IAuthenticate iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 112 of file extserv.c.

113{
115 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
116}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ Authenticate_Release()

static ULONG WINAPI Authenticate_Release ( IAuthenticate iface)
static

Definition at line 124 of file extserv.c.

125{
127 return IUnknown_Release(This->outer_unk);
128}

◆ ExtServ_AddRef()

static ULONG WINAPI ExtServ_AddRef ( IExtensionServices iface)
static

Definition at line 223 of file extserv.c.

224{
226 return IUnknown_AddRef(This->outer_unk);
227}
static ExtensionService * impl_from_IExtensionServices(IExtensionServices *iface)
Definition: extserv.c:212

◆ ExtServ_ImplSetAdditionalHeaders()

static HRESULT ExtServ_ImplSetAdditionalHeaders ( ExtensionService This,
LPCWSTR  pwzAdditionalHeaders 
)
static

Definition at line 235 of file extserv.c.

236{
237 int len;
238
239 heap_free(This->headers);
240 This->headers = NULL;
241
242 if (!pwzAdditionalHeaders)
243 return S_OK;
244
245 len = lstrlenW(pwzAdditionalHeaders);
246
247 if(len && pwzAdditionalHeaders[len-1] != '\n' && pwzAdditionalHeaders[len-1] != '\r') {
248 static const WCHAR endlW[] = {'\r','\n',0};
249 This->headers = heap_alloc(len*sizeof(WCHAR) + sizeof(endlW));
250 memcpy(This->headers, pwzAdditionalHeaders, len*sizeof(WCHAR));
251 memcpy(This->headers+len, endlW, sizeof(endlW));
252 }else {
253 This->headers = hlink_strdupW(pwzAdditionalHeaders);
254 }
255
256 return S_OK;
257}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define NULL
Definition: types.h:112
#define lstrlenW
Definition: compat.h:750
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ExtServ_SetAdditionalHeaders(), and HlinkCreateExtensionServices().

◆ ExtServ_ImplSetAuthenticateData()

static HRESULT ExtServ_ImplSetAuthenticateData ( ExtensionService This,
HWND  phwnd,
LPCWSTR  pwzUsername,
LPCWSTR  pwzPassword 
)
static

Definition at line 268 of file extserv.c.

269{
270 heap_free(This->username);
271 heap_free(This->password);
272
273 This->hwnd = phwnd;
274 This->username = hlink_strdupW(pwzUsername);
275 This->password = hlink_strdupW(pwzPassword);
276
277 return S_OK;
278}

Referenced by ExtServ_SetAuthenticateData(), and HlinkCreateExtensionServices().

◆ ExtServ_QueryInterface()

static HRESULT WINAPI ExtServ_QueryInterface ( IExtensionServices iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 217 of file extserv.c.

218{
220 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
221}

◆ ExtServ_Release()

static ULONG WINAPI ExtServ_Release ( IExtensionServices iface)
static

Definition at line 229 of file extserv.c.

230{
232 return IUnknown_Release(This->outer_unk);
233}

◆ ExtServ_SetAdditionalHeaders()

static HRESULT WINAPI ExtServ_SetAdditionalHeaders ( IExtensionServices iface,
LPCWSTR  pwzAdditionalHeaders 
)
static

Definition at line 259 of file extserv.c.

260{
262
263 TRACE("(%p)->(%s)\n", This, debugstr_w(pwzAdditionalHeaders));
264
265 return ExtServ_ImplSetAdditionalHeaders(This,pwzAdditionalHeaders);
266}
static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService *This, LPCWSTR pwzAdditionalHeaders)
Definition: extserv.c:235
#define debugstr_w
Definition: kernel32.h:32

◆ ExtServ_SetAuthenticateData()

static HRESULT WINAPI ExtServ_SetAuthenticateData ( IExtensionServices iface,
HWND  phwnd,
LPCWSTR  pwzUsername,
LPCWSTR  pwzPassword 
)
static

Definition at line 280 of file extserv.c.

281{
283
284 TRACE("(%p)->(%p %s %s)\n", This, phwnd, debugstr_w(pwzUsername), debugstr_w(pwzPassword));
285
286 return ExtServ_ImplSetAuthenticateData(This, phwnd, pwzUsername, pwzPassword);
287}
static HRESULT ExtServ_ImplSetAuthenticateData(ExtensionService *This, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
Definition: extserv.c:268

◆ ExtServUnk_AddRef()

static ULONG WINAPI ExtServUnk_AddRef ( IUnknown iface)
static

Definition at line 74 of file extserv.c.

75{
78
79 TRACE("(%p) ref=%d\n", This, ref);
80
81 return ref;
82}
#define InterlockedIncrement
Definition: armddk.h:53
static ExtensionService * impl_from_IUnknown(IUnknown *iface)
Definition: extserv.c:40
long LONG
Definition: pedump.c:60
Definition: send.c:48

◆ ExtServUnk_QueryInterface()

static HRESULT WINAPI ExtServUnk_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 45 of file extserv.c.

46{
48
49 *ppv = NULL;
50
52 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
53 *ppv = &This->IUnknown_inner;
54 }else if(IsEqualGUID(&IID_IAuthenticate, riid)) {
55 TRACE("(%p)->(IID_IAuthenticate %p)\n", This, ppv);
56 *ppv = &This->IAuthenticate_iface;
57 }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
58 TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
59 *ppv = &This->IHttpNegotiate_iface;
60 }else if(IsEqualGUID(&IID_IExtensionServices, riid)) {
61 TRACE("(%p)->(IID_IExtensionServices %p)\n", This, ppv);
62 *ppv = &This->IExtensionServices_iface;
63 }
64
65 if(*ppv) {
66 IUnknown_AddRef((IUnknown*)*ppv);
67 return S_OK;
68 }
69
70 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
71 return E_NOINTERFACE;
72}
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:114
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ExtServUnk_Release()

static ULONG WINAPI ExtServUnk_Release ( IUnknown iface)
static

Definition at line 84 of file extserv.c.

85{
88
89 TRACE("(%p) ref=%d\n", This, ref);
90
91 if(!ref) {
92 heap_free(This->username);
93 heap_free(This->password);
94 heap_free(This->headers);
96 }
97
98 return ref;
99}
#define InterlockedDecrement
Definition: armddk.h:52

◆ HlinkCreateExtensionServices()

HRESULT WINAPI HlinkCreateExtensionServices ( LPCWSTR  pwzAdditionalHeaders,
HWND  phwnd,
LPCWSTR  pszUsername,
LPCWSTR  pszPassword,
IUnknown punkOuter,
REFIID  riid,
void **  ppv 
)

Definition at line 300 of file extserv.c.

303{
305 HRESULT hres = S_OK;
306
307 TRACE("%s %p %s %s %p %s %p\n",debugstr_w(pwzAdditionalHeaders),
308 phwnd, debugstr_w(pszUsername), debugstr_w(pszPassword),
309 punkOuter, debugstr_guid(riid), ppv);
310
311 ret = heap_alloc(sizeof(*ret));
312
313 ret->IUnknown_inner.lpVtbl = &ExtServUnkVtbl;
314 ret->IAuthenticate_iface.lpVtbl = &AuthenticateVtbl;
315 ret->IHttpNegotiate_iface.lpVtbl = &HttpNegotiateVtbl;
316 ret->IExtensionServices_iface.lpVtbl = &ExtServVtbl;
317 ret->ref = 1;
318 ret->headers = NULL;
319 ret->hwnd = NULL;
320 ret->username = NULL;
321 ret->password = NULL;
322
323 ExtServ_ImplSetAuthenticateData(ret, phwnd, pszUsername, pszPassword);
324 ExtServ_ImplSetAdditionalHeaders(ret, pwzAdditionalHeaders);
325
326 if(!punkOuter) {
327 ret->outer_unk = &ret->IUnknown_inner;
328 hres = IUnknown_QueryInterface(&ret->IUnknown_inner, riid, ppv);
329 IUnknown_Release(&ret->IUnknown_inner);
330 }else if(IsEqualGUID(&IID_IUnknown, riid)) {
331 ret->outer_unk = punkOuter;
332 *ppv = &ret->IUnknown_inner;
333 }else {
334 IUnknown_Release(&ret->IUnknown_inner);
336 }
337
338 return hres;
339}
static const IUnknownVtbl ExtServUnkVtbl
Definition: extserv.c:101
static const IExtensionServicesVtbl ExtServVtbl
Definition: extserv.c:289
static const IHttpNegotiateVtbl HttpNegotiateVtbl
Definition: extserv.c:204
static const IAuthenticateVtbl AuthenticateVtbl
Definition: extserv.c:147
HRESULT hres
Definition: protocol.c:465
int ret

Referenced by test_HlinkCreateExtensionServices().

◆ HttpNegotiate_AddRef()

static ULONG WINAPI HttpNegotiate_AddRef ( IHttpNegotiate iface)
static

Definition at line 165 of file extserv.c.

166{
168 return IUnknown_AddRef(This->outer_unk);
169}
static ExtensionService * impl_from_IHttpNegotiate(IHttpNegotiate *iface)
Definition: extserv.c:154

◆ HttpNegotiate_BeginningTransaction()

static HRESULT WINAPI HttpNegotiate_BeginningTransaction ( IHttpNegotiate iface,
LPCWSTR  szURL,
LPCWSTR  szHeaders,
DWORD  dwReserved,
LPWSTR pszAdditionalHeaders 
)
static

Definition at line 177 of file extserv.c.

179{
181
182 TRACE("(%p)->(%s %s %x %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders), dwReserved,
183 pszAdditionalHeaders);
184
185 if(!pszAdditionalHeaders)
186 return E_INVALIDARG;
187
188 *pszAdditionalHeaders = hlink_co_strdupW(This->headers);
189 return S_OK;
190}
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95

◆ HttpNegotiate_OnResponse()

static HRESULT WINAPI HttpNegotiate_OnResponse ( IHttpNegotiate iface,
DWORD  dwResponseCode,
LPCWSTR  szResponseHeaders,
LPCWSTR  szRequestHeaders,
LPWSTR pszAdditionalRequestHeaders 
)
static

Definition at line 192 of file extserv.c.

194{
196
197 TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
198 debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
199
200 *pszAdditionalRequestHeaders = NULL;
201 return S_OK;
202}

◆ HttpNegotiate_QueryInterface()

static HRESULT WINAPI HttpNegotiate_QueryInterface ( IHttpNegotiate iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 159 of file extserv.c.

160{
162 return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
163}

◆ HttpNegotiate_Release()

static ULONG WINAPI HttpNegotiate_Release ( IHttpNegotiate iface)
static

Definition at line 171 of file extserv.c.

172{
174 return IUnknown_Release(This->outer_unk);
175}

◆ impl_from_IAuthenticate()

static ExtensionService * impl_from_IAuthenticate ( IAuthenticate iface)
inlinestatic

Definition at line 107 of file extserv.c.

108{
109 return CONTAINING_RECORD(iface, ExtensionService, IAuthenticate_iface);
110}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by Authenticate_AddRef(), Authenticate_Authenticate(), Authenticate_QueryInterface(), and Authenticate_Release().

◆ impl_from_IExtensionServices()

static ExtensionService * impl_from_IExtensionServices ( IExtensionServices iface)
inlinestatic

Definition at line 212 of file extserv.c.

213{
214 return CONTAINING_RECORD(iface, ExtensionService, IExtensionServices_iface);
215}

Referenced by ExtServ_AddRef(), ExtServ_QueryInterface(), ExtServ_Release(), ExtServ_SetAdditionalHeaders(), and ExtServ_SetAuthenticateData().

◆ impl_from_IHttpNegotiate()

static ExtensionService * impl_from_IHttpNegotiate ( IHttpNegotiate iface)
inlinestatic

◆ impl_from_IUnknown()

static ExtensionService * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 40 of file extserv.c.

41{
42 return CONTAINING_RECORD(iface, ExtensionService, IUnknown_inner);
43}

Referenced by ExtServUnk_AddRef(), ExtServUnk_QueryInterface(), and ExtServUnk_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( hlink  )

Variable Documentation

◆ AuthenticateVtbl

const IAuthenticateVtbl AuthenticateVtbl
static
Initial value:
= {
}
static HRESULT WINAPI Authenticate_QueryInterface(IAuthenticate *iface, REFIID riid, void **ppv)
Definition: extserv.c:112
static ULONG WINAPI Authenticate_AddRef(IAuthenticate *iface)
Definition: extserv.c:118
static HRESULT WINAPI Authenticate_Authenticate(IAuthenticate *iface, HWND *phwnd, LPWSTR *pszUsername, LPWSTR *pszPassword)
Definition: extserv.c:130
static ULONG WINAPI Authenticate_Release(IAuthenticate *iface)
Definition: extserv.c:124

Definition at line 147 of file extserv.c.

Referenced by HlinkCreateExtensionServices().

◆ ExtServUnkVtbl

const IUnknownVtbl ExtServUnkVtbl
static
Initial value:
= {
}
static ULONG WINAPI ExtServUnk_Release(IUnknown *iface)
Definition: extserv.c:84
static HRESULT WINAPI ExtServUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: extserv.c:45
static ULONG WINAPI ExtServUnk_AddRef(IUnknown *iface)
Definition: extserv.c:74

Definition at line 101 of file extserv.c.

Referenced by HlinkCreateExtensionServices().

◆ ExtServVtbl

const IExtensionServicesVtbl ExtServVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ExtServ_SetAdditionalHeaders(IExtensionServices *iface, LPCWSTR pwzAdditionalHeaders)
Definition: extserv.c:259
static ULONG WINAPI ExtServ_Release(IExtensionServices *iface)
Definition: extserv.c:229
static HRESULT WINAPI ExtServ_QueryInterface(IExtensionServices *iface, REFIID riid, void **ppv)
Definition: extserv.c:217
static HRESULT WINAPI ExtServ_SetAuthenticateData(IExtensionServices *iface, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
Definition: extserv.c:280
static ULONG WINAPI ExtServ_AddRef(IExtensionServices *iface)
Definition: extserv.c:223

Definition at line 289 of file extserv.c.

Referenced by HlinkCreateExtensionServices().

◆ HttpNegotiateVtbl

const IHttpNegotiateVtbl HttpNegotiateVtbl
static
Initial value:
= {
}
static ULONG WINAPI HttpNegotiate_AddRef(IHttpNegotiate *iface)
Definition: extserv.c:165
static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
Definition: extserv.c:177
static ULONG WINAPI HttpNegotiate_Release(IHttpNegotiate *iface)
Definition: extserv.c:171
static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
Definition: extserv.c:192
static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate *iface, REFIID riid, void **ppv)
Definition: extserv.c:159

Definition at line 204 of file extserv.c.

Referenced by HlinkCreateExtensionServices().