Owen Rudge : wsdapi: Add initial implementation of IWSDXMLContext and WSDXMLCreateContext.

Alexandre Julliard julliard at winehq.org
Fri May 19 15:59:53 CDT 2017


Module: wine
Branch: master
Commit: f4d3dd2cd6492d2092ec3f08bdbe9d0ff529dc1d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f4d3dd2cd6492d2092ec3f08bdbe9d0ff529dc1d

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Thu May 18 22:38:43 2017 +0100

wsdapi: Add initial implementation of IWSDXMLContext and WSDXMLCreateContext.

Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wsdapi/wsdapi.spec |   2 +-
 dlls/wsdapi/xml.c       | 131 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/wsdxml.idl      |   2 +
 3 files changed, 134 insertions(+), 1 deletion(-)

diff --git a/dlls/wsdapi/wsdapi.spec b/dlls/wsdapi/wsdapi.spec
index 8ee17cb..fd89be7 100644
--- a/dlls/wsdapi/wsdapi.spec
+++ b/dlls/wsdapi/wsdapi.spec
@@ -40,6 +40,6 @@
 @ stdcall WSDXMLAddSibling(ptr ptr)
 @ stdcall WSDXMLBuildAnyForSingleElement(ptr ptr ptr)
 @ stdcall WSDXMLCleanupElement(ptr)
-@ stub WSDXMLCreateContext
+@ stdcall WSDXMLCreateContext(ptr)
 @ stub WSDXMLGetNameFromBuiltinNamespace
 @ stub WSDXMLGetValueFromAny
diff --git a/dlls/wsdapi/xml.c b/dlls/wsdapi/xml.c
index 1cc45b8..4b150d4 100644
--- a/dlls/wsdapi/xml.c
+++ b/dlls/wsdapi/xml.c
@@ -213,3 +213,134 @@ HRESULT WINAPI WSDXMLCleanupElement(WSDXML_ELEMENT *pAny)
     WSDFreeLinkedMemory(pAny);
     return S_OK;
 }
+
+/* IWSDXMLContext implementation */
+
+typedef struct IWSDXMLContextImpl
+{
+    IWSDXMLContext IWSDXMLContext_iface;
+    LONG ref;
+} IWSDXMLContextImpl;
+
+static inline IWSDXMLContextImpl *impl_from_IWSDXMLContext(IWSDXMLContext *iface)
+{
+    return CONTAINING_RECORD(iface, IWSDXMLContextImpl, IWSDXMLContext_iface);
+}
+
+static HRESULT WINAPI IWSDXMLContextImpl_QueryInterface(IWSDXMLContext *iface, REFIID riid, void **ppv)
+{
+    IWSDXMLContextImpl *This = impl_from_IWSDXMLContext(iface);
+
+    TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppv);
+
+    if (!ppv)
+    {
+        WARN("Invalid parameter\n");
+        return E_INVALIDARG;
+    }
+
+    *ppv = NULL;
+
+    if (IsEqualIID(riid, &IID_IUnknown) ||
+        IsEqualIID(riid, &IID_IWSDXMLContext))
+    {
+        *ppv = &This->IWSDXMLContext_iface;
+    }
+    else
+    {
+        WARN("Unknown IID %s\n", debugstr_guid(riid));
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI IWSDXMLContextImpl_AddRef(IWSDXMLContext *iface)
+{
+    IWSDXMLContextImpl *This = impl_from_IWSDXMLContext(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+    return ref;
+}
+
+static ULONG WINAPI IWSDXMLContextImpl_Release(IWSDXMLContext *iface)
+{
+    IWSDXMLContextImpl *This = impl_from_IWSDXMLContext(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if (ref == 0)
+    {
+        WSDFreeLinkedMemory(This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI IWSDXMLContextImpl_AddNamespace(IWSDXMLContext *iface, LPCWSTR pszUri, LPCWSTR pszSuggestedPrefix, WSDXML_NAMESPACE **ppNamespace)
+{
+    FIXME("(%p, %s, %s, %p)\n", iface, debugstr_w(pszUri), debugstr_w(pszSuggestedPrefix), ppNamespace);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IWSDXMLContextImpl_AddNameToNamespace(IWSDXMLContext *iface, LPCWSTR pszUri, LPCWSTR pszName, WSDXML_NAME **ppName)
+{
+    FIXME("(%p, %s, %s, %p)\n", iface, debugstr_w(pszUri), debugstr_w(pszName), ppName);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IWSDXMLContextImpl_SetNamespaces(IWSDXMLContext *iface, const PCWSDXML_NAMESPACE *pNamespaces, WORD wNamespacesCount, BYTE bLayerNumber)
+{
+    FIXME("(%p, %p, %d, %d)\n", iface, pNamespaces, wNamespacesCount, bLayerNumber);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IWSDXMLContextImpl_SetTypes(IWSDXMLContext *iface, const PCWSDXML_TYPE *pTypes, DWORD dwTypesCount, BYTE bLayerNumber)
+{
+    FIXME("(%p, %p, %d, %d)\n", iface, pTypes, dwTypesCount, bLayerNumber);
+    return E_NOTIMPL;
+}
+
+static const IWSDXMLContextVtbl xmlcontext_vtbl =
+{
+    IWSDXMLContextImpl_QueryInterface,
+    IWSDXMLContextImpl_AddRef,
+    IWSDXMLContextImpl_Release,
+    IWSDXMLContextImpl_AddNamespace,
+    IWSDXMLContextImpl_AddNameToNamespace,
+    IWSDXMLContextImpl_SetNamespaces,
+    IWSDXMLContextImpl_SetTypes
+};
+
+HRESULT WINAPI WSDXMLCreateContext(IWSDXMLContext **ppContext)
+{
+    IWSDXMLContextImpl *obj;
+
+    TRACE("(%p)", ppContext);
+
+    if (ppContext == NULL)
+    {
+        WARN("Invalid parameter: ppContext == NULL\n");
+        return E_POINTER;
+    }
+
+    *ppContext = NULL;
+
+    obj = WSDAllocateLinkedMemory(NULL, sizeof(*obj));
+
+    if (!obj)
+    {
+        return E_OUTOFMEMORY;
+    }
+
+    obj->IWSDXMLContext_iface.lpVtbl = &xmlcontext_vtbl;
+    obj->ref = 1;
+
+    *ppContext = &obj->IWSDXMLContext_iface;
+    TRACE("Returning iface %p\n", *ppContext);
+
+    return S_OK;
+}
diff --git a/include/wsdxml.idl b/include/wsdxml.idl
index e86d54b..33bd1d9 100644
--- a/include/wsdxml.idl
+++ b/include/wsdxml.idl
@@ -39,3 +39,5 @@ interface IWSDXMLContext : IUnknown
 
     HRESULT SetTypes([in, size_is(dwTypesCount)] const PCWSDXML_TYPE* pTypes, [in] DWORD dwTypesCount, [in] BYTE bLayerNumber);
 };
+
+cpp_quote("HRESULT WINAPI WSDXMLCreateContext(IWSDXMLContext **ppContext);")




More information about the wine-cvs mailing list