Owen Rudge : wsdapi: Register default namespaces when creating publisher.
Alexandre Julliard
julliard at winehq.org
Thu Apr 19 16:54:19 CDT 2018
Module: wine
Branch: master
Commit: 1a7df56e562bf14e99cfb853e3a0a5ab17446240
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1a7df56e562bf14e99cfb853e3a0a5ab17446240
Author: Owen Rudge <orudge at codeweavers.com>
Date: Tue Apr 17 23:04:40 2018 +0100
wsdapi: Register default namespaces when creating publisher.
Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wsdapi/discovery.c | 20 +++++++++++++++++---
dlls/wsdapi/soap.c | 13 +++++++++++++
dlls/wsdapi/wsdapi_internal.h | 2 ++
3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/dlls/wsdapi/discovery.c b/dlls/wsdapi/discovery.c
index 5136a24..fc8acfb 100644
--- a/dlls/wsdapi/discovery.c
+++ b/dlls/wsdapi/discovery.c
@@ -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;
diff --git a/dlls/wsdapi/soap.c b/dlls/wsdapi/soap.c
index ad83a88..96efefd 100644
--- a/dlls/wsdapi/soap.c
+++ b/dlls/wsdapi/soap.c
@@ -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 };
diff --git a/dlls/wsdapi/wsdapi_internal.h b/dlls/wsdapi/wsdapi_internal.h
index dd7931c..57bf58c 100644
--- a/dlls/wsdapi/wsdapi_internal.h
+++ b/dlls/wsdapi/wsdapi_internal.h
@@ -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);
More information about the wine-cvs
mailing list