wsdapi: Register default namespaces when creating publisher.
Signed-off-by: Owen Rudge <orudge@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3cd8986e93
commit
1a7df56e56
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "wsdapi_internal.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "guiddef.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
|
||||
|
@ -332,6 +333,7 @@ static const IWSDiscoveryPublisherVtbl publisher_vtbl =
|
|||
HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscoveryPublisher **ppPublisher)
|
||||
{
|
||||
IWSDiscoveryPublisherImpl *obj;
|
||||
HRESULT ret;
|
||||
|
||||
TRACE("(%p, %p)\n", pContext, ppPublisher);
|
||||
|
||||
|
@ -356,11 +358,13 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover
|
|||
|
||||
if (pContext == NULL)
|
||||
{
|
||||
if (FAILED(WSDXMLCreateContext(&obj->xmlContext)))
|
||||
ret = WSDXMLCreateContext(&obj->xmlContext);
|
||||
|
||||
if (FAILED(ret))
|
||||
{
|
||||
WARN("Unable to create XML context\n");
|
||||
HeapFree (GetProcessHeap(), 0, obj);
|
||||
return E_OUTOFMEMORY;
|
||||
heap_free(obj);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -369,6 +373,16 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover
|
|||
IWSDXMLContext_AddRef(pContext);
|
||||
}
|
||||
|
||||
ret = register_namespaces(obj->xmlContext);
|
||||
|
||||
if (FAILED(ret))
|
||||
{
|
||||
WARN("Unable to register default namespaces\n");
|
||||
heap_free(obj);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
list_init(&obj->notificationSinks);
|
||||
|
||||
*ppPublisher = &obj->IWSDiscoveryPublisher_iface;
|
||||
|
|
|
@ -286,6 +286,19 @@ static HRESULT add_child_element(IWSDXMLContext *xml_context, WSDXML_ELEMENT *pa
|
|||
return ret;
|
||||
}
|
||||
|
||||
HRESULT register_namespaces(IWSDXMLContext *xml_context)
|
||||
{
|
||||
HRESULT ret;
|
||||
|
||||
ret = IWSDXMLContext_AddNamespace(xml_context, addressingNsUri, addressingPrefix, NULL);
|
||||
if (FAILED(ret)) return ret;
|
||||
|
||||
ret = IWSDXMLContext_AddNamespace(xml_context, discoveryNsUri, discoveryPrefix, NULL);
|
||||
if (FAILED(ret)) return ret;
|
||||
|
||||
return IWSDXMLContext_AddNamespace(xml_context, envelopeNsUri, envelopePrefix, NULL);
|
||||
}
|
||||
|
||||
static BOOL create_guid(LPWSTR buffer)
|
||||
{
|
||||
const WCHAR formatString[] = { 'u','r','n',':','u','u','i','d',':','%','s', 0 };
|
||||
|
|
|
@ -62,6 +62,8 @@ HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLON
|
|||
const WSD_URI_LIST *xaddrs_list, const WSDXML_ELEMENT *hdr_any, const WSDXML_ELEMENT *ref_param_any,
|
||||
const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any);
|
||||
|
||||
HRESULT register_namespaces(IWSDXMLContext *xml_context);
|
||||
|
||||
/* xml.c */
|
||||
|
||||
LPWSTR duplicate_string(void *parentMemoryBlock, LPCWSTR value);
|
||||
|
|
Loading…
Reference in New Issue