Commit 09af64cb authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

hlink: Implement IExtensionServices.

parent f4625d1a
......@@ -29,6 +29,7 @@ typedef struct {
const IUnknownVtbl *lpIUnknownVtbl;
const IAuthenticateVtbl *lpIAuthenticateVtbl;
const IHttpNegotiateVtbl *lpIHttpNegotiateVtbl;
const IExtensionServicesVtbl *lpIExtensionServicesVtbl;
LONG ref;
IUnknown *outer;
......@@ -42,6 +43,7 @@ typedef struct {
#define EXTSERVUNK(x) ((IUnknown*) &(x)->lpIUnknownVtbl)
#define AUTHENTICATE(x) ((IAuthenticate*) &(x)->lpIAuthenticateVtbl)
#define HTTPNEGOTIATE(x) ((IHttpNegotiate*) &(x)->lpIHttpNegotiateVtbl)
#define EXTENSIONSERVICES(x) ((IExtensionServices*) &(x)->lpIExtensionServicesVtbl)
#define EXTSERVUNK_THIS(iface) DEFINE_THIS(ExtensionService, IUnknown, iface)
......@@ -60,6 +62,9 @@ static HRESULT WINAPI ExtServUnk_QueryInterface(IUnknown *iface, REFIID riid, vo
}else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
*ppv = HTTPNEGOTIATE(This);
}else if(IsEqualGUID(&IID_IExtensionServices, riid)) {
TRACE("(%p)->(IID_IExtensionServices %p)\n", This, ppv);
*ppv = EXTENSIONSERVICES(This);
}
if(*ppv) {
......@@ -209,6 +214,90 @@ static const IHttpNegotiateVtbl HttpNegotiateVtbl = {
HttpNegotiate_OnResponse
};
#define EXTENSIONSERVICES_THIS(iface) DEFINE_THIS(ExtensionService, IExtensionServices, iface)
static HRESULT WINAPI ExtServ_QueryInterface(IExtensionServices *iface, REFIID riid, void **ppv)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
return IUnknown_QueryInterface(This->outer, riid, ppv);
}
static ULONG WINAPI ExtServ_AddRef(IExtensionServices *iface)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
return IUnknown_AddRef(This->outer);
}
static ULONG WINAPI ExtServ_Release(IExtensionServices *iface)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
return IUnknown_Release(This->outer);
}
static HRESULT ExtServ_ImplSetAdditionalHeaders(ExtensionService* This, LPCWSTR pwzAdditionalHeaders)
{
int len = 0;
heap_free(This->headers);
This->headers = NULL;
if (!pwzAdditionalHeaders)
return S_OK;
len = strlenW(pwzAdditionalHeaders);
if(len && pwzAdditionalHeaders[len-1] != '\n' && pwzAdditionalHeaders[len-1] != '\r') {
static const WCHAR endlW[] = {'\r','\n',0};
This->headers = heap_alloc(len*sizeof(WCHAR) + sizeof(endlW));
memcpy(This->headers, pwzAdditionalHeaders, len*sizeof(WCHAR));
memcpy(This->headers+len, endlW, sizeof(endlW));
}else {
This->headers = hlink_strdupW(pwzAdditionalHeaders);
}
return S_OK;
}
static HRESULT WINAPI ExtServ_SetAdditionalHeaders(IExtensionServices* iface, LPCWSTR pwzAdditionalHeaders)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzAdditionalHeaders));
return ExtServ_ImplSetAdditionalHeaders(This,pwzAdditionalHeaders);
}
static HRESULT ExtServ_ImplSetAuthenticateData(ExtensionService* This, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
{
heap_free(This->username);
heap_free(This->password);
This->hwnd = phwnd;
This->username = hlink_strdupW(pwzUsername);
This->password = hlink_strdupW(pwzPassword);
return S_OK;
}
static HRESULT WINAPI ExtServ_SetAuthenticateData(IExtensionServices* iface, HWND phwnd, LPCWSTR pwzUsername, LPCWSTR pwzPassword)
{
ExtensionService *This = EXTENSIONSERVICES_THIS(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,
ExtServ_Release,
ExtServ_SetAdditionalHeaders,
ExtServ_SetAuthenticateData
};
/***********************************************************************
* HlinkCreateExtensionServices (HLINK.@)
*/
......@@ -217,7 +306,6 @@ HRESULT WINAPI HlinkCreateExtensionServices(LPCWSTR pwzAdditionalHeaders,
IUnknown *punkOuter, REFIID riid, void** ppv)
{
ExtensionService *ret;
int len = 0;
HRESULT hres = S_OK;
TRACE("%s %p %s %s %p %s %p\n",debugstr_w(pwzAdditionalHeaders),
......@@ -229,22 +317,15 @@ HRESULT WINAPI HlinkCreateExtensionServices(LPCWSTR pwzAdditionalHeaders,
ret->lpIUnknownVtbl = &ExtServUnkVtbl;
ret->lpIAuthenticateVtbl = &AuthenticateVtbl;
ret->lpIHttpNegotiateVtbl = &HttpNegotiateVtbl;
ret->lpIExtensionServicesVtbl= &ExtServVtbl;
ret->ref = 1;
ret->hwnd = phwnd;
ret->username = hlink_strdupW(pszUsername);
ret->password = hlink_strdupW(pszPassword);
if(pwzAdditionalHeaders)
len = strlenW(pwzAdditionalHeaders);
ret->headers = NULL;
ret->hwnd = NULL;
ret->username = NULL;
ret->password = NULL;
if(len && pwzAdditionalHeaders[len-1] != '\n' && pwzAdditionalHeaders[len-1] != '\r') {
static const WCHAR endlW[] = {'\r','\n',0};
ret->headers = heap_alloc(len*sizeof(WCHAR) + sizeof(endlW));
memcpy(ret->headers, pwzAdditionalHeaders, len*sizeof(WCHAR));
memcpy(ret->headers+len, endlW, sizeof(endlW));
}else {
ret->headers = hlink_strdupW(pwzAdditionalHeaders);
}
ExtServ_ImplSetAuthenticateData(ret, phwnd, pszUsername, pszPassword);
ExtServ_ImplSetAdditionalHeaders(ret, pwzAdditionalHeaders);
if(!punkOuter) {
ret->outer = EXTSERVUNK(ret);
......
......@@ -25,5 +25,7 @@ DEFINE_GUID(CLSID_StdHlink,
0x79eac9d0, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b);
DEFINE_GUID(CLSID_StdHlinkBrowseContext,
0x79eac9d1, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b);
DEFINE_GUID(CLSID_IID_IExtensionServices,
0x79eac9cb, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b);
#endif
......@@ -416,3 +416,25 @@ interface IHlinkFrame : IUnknown
[in, unique] LPCWSTR pwzLocation,
[in, unique] LPCWSTR pwzFriendlyName);
}
/*****************************************************************************
* IExtensionServices interface
*/
[
object,
uuid(79eac9cb-baf9-11ce-8c82-00aa004ba90b),
pointer_default(unique)
]
interface IExtensionServices: IUnknown
{
typedef IExtensionServices *LPEXTENSIONSERVICES;
HRESULT SetAdditionalHeaders(
[in] LPCWSTR pwzAdditionalHeaders);
HRESULT SetAuthenticateData(
[in] HWND phwnd,
[in] LPCWSTR pwzUsername,
[in] LPCWSTR pwzPassword);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment