From d5db5e7ad707537b82059ef17cfcd4fc26b0786d Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 3 Sep 2018 07:18:24 +0300 Subject: [PATCH] opcservices: Add IOpcPartUri stub. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/opcservices/Makefile.in | 3 +- dlls/opcservices/factory.c | 4 +- dlls/opcservices/opc_private.h | 1 + dlls/opcservices/uri.c | 355 +++++++++++++++++++++++++++++++++ 4 files changed, 360 insertions(+), 3 deletions(-) create mode 100644 dlls/opcservices/uri.c diff --git a/dlls/opcservices/Makefile.in b/dlls/opcservices/Makefile.in index 4a2d2945ae2..651cb411d73 100644 --- a/dlls/opcservices/Makefile.in +++ b/dlls/opcservices/Makefile.in @@ -3,7 +3,8 @@ IMPORTS = uuid C_SRCS = \ factory.c \ - package.c + package.c \ + uri.c IDL_SRCS = \ opcservices.idl diff --git a/dlls/opcservices/factory.c b/dlls/opcservices/factory.c index b2a57c42ec0..7cbe233e9d7 100644 --- a/dlls/opcservices/factory.c +++ b/dlls/opcservices/factory.c @@ -68,9 +68,9 @@ static HRESULT WINAPI opc_factory_CreatePackageRootUri(IOpcFactory *iface, IOpcU static HRESULT WINAPI opc_factory_CreatePartUri(IOpcFactory *iface, LPCWSTR uri, IOpcPartUri **part_uri) { - FIXME("iface %p, uri %s, part_uri %p stub!\n", iface, debugstr_w(uri), part_uri); + TRACE("iface %p, uri %s, part_uri %p.\n", iface, debugstr_w(uri), part_uri); - return E_NOTIMPL; + return opc_part_uri_create(uri, part_uri); } static HRESULT WINAPI opc_factory_CreateStreamOnFile(IOpcFactory *iface, LPCWSTR filename, diff --git a/dlls/opcservices/opc_private.h b/dlls/opcservices/opc_private.h index 492ec912802..4784b6c458f 100644 --- a/dlls/opcservices/opc_private.h +++ b/dlls/opcservices/opc_private.h @@ -20,3 +20,4 @@ #include "wine/heap.h" extern HRESULT opc_package_create(IOpcPackage **package) DECLSPEC_HIDDEN; +extern HRESULT opc_part_uri_create(const WCHAR *uri, IOpcPartUri **part_uri) DECLSPEC_HIDDEN; diff --git a/dlls/opcservices/uri.c b/dlls/opcservices/uri.c new file mode 100644 index 00000000000..60881e865e6 --- /dev/null +++ b/dlls/opcservices/uri.c @@ -0,0 +1,355 @@ +/* + * Copyright 2018 Nikolay Sivov for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include +#include "windef.h" +#include "winbase.h" + +#include "wine/debug.h" + +#include "opc_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msopc); + +struct opc_uri +{ + IOpcPartUri IOpcPartUri_iface; + LONG refcount; +}; + +static inline struct opc_uri *impl_from_IOpcPartUri(IOpcPartUri *iface) +{ + return CONTAINING_RECORD(iface, struct opc_uri, IOpcPartUri_iface); +} + +static HRESULT WINAPI opc_uri_QueryInterface(IOpcPartUri *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualIID(iid, &IID_IOpcPartUri) || + IsEqualIID(iid, &IID_IUnknown)) + { + *out = iface; + IOpcPartUri_AddRef(iface); + return S_OK; + } + + WARN("Unsupported interface %s.\n", debugstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI opc_uri_AddRef(IOpcPartUri *iface) +{ + struct opc_uri *uri = impl_from_IOpcPartUri(iface); + ULONG refcount = InterlockedIncrement(&uri->refcount); + + TRACE("%p increasing refcount to %u.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI opc_uri_Release(IOpcPartUri *iface) +{ + struct opc_uri *uri = impl_from_IOpcPartUri(iface); + ULONG refcount = InterlockedDecrement(&uri->refcount); + + TRACE("%p decreasing refcount to %u.\n", iface, refcount); + + if (!refcount) + heap_free(uri); + + return refcount; +} + +static HRESULT WINAPI opc_uri_GetPropertyBSTR(IOpcPartUri *iface, Uri_PROPERTY property, + BSTR *value, DWORD flags) +{ + FIXME("iface %p, property %d, value %p, flags %#x stub!\n", iface, property, value, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetPropertyLength(IOpcPartUri *iface, Uri_PROPERTY property, + DWORD *length, DWORD flags) +{ + FIXME("iface %p, property %d, length %p, flags %#x stub!\n", iface, property, length, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetPropertyDWORD(IOpcPartUri *iface, Uri_PROPERTY property, + DWORD *value, DWORD flags) +{ + FIXME("iface %p, property %d, value %p, flags %#x stub!\n", iface, property, value, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_HasProperty(IOpcPartUri *iface, Uri_PROPERTY property, + BOOL *has_property) +{ + FIXME("iface %p, property %d, has_property %p stub!\n", iface, property, has_property); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetAbsoluteUri(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetAuthority(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetDisplayUri(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetDomain(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetExtension(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetFragment(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetHost(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetPassword(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetPath(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetPathAndQuery(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetQuery(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetRawUri(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetSchemeName(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetUserInfo(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetUserName(IOpcPartUri *iface, BSTR *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetHostType(IOpcPartUri *iface, DWORD *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetPort(IOpcPartUri *iface, DWORD *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetScheme(IOpcPartUri *iface, DWORD *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetZone(IOpcPartUri *iface, DWORD *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetProperties(IOpcPartUri *iface, DWORD *flags) +{ + FIXME("iface %p, flags %p stub!\n", iface, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_IsEqual(IOpcPartUri *iface, IUri *uri, BOOL *is_equal) +{ + FIXME("iface %p, uri %p, is_equal %p stub!\n", iface, uri, is_equal); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetRelationshipsPartUri(IOpcPartUri *iface, IOpcPartUri **part_uri) +{ + FIXME("iface %p, part_uri %p stub!\n", iface, part_uri); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetRelativeUri(IOpcPartUri *iface, IOpcPartUri *part_uri, + IUri **relative_uri) +{ + FIXME("iface %p, part_uri %p, relative_uri %p stub!\n", iface, part_uri, relative_uri); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_CombinePartUri(IOpcPartUri *iface, IUri *relative_uri, IOpcPartUri **combined) +{ + FIXME("iface %p, relative_uri %p, combined %p stub!\n", iface, relative_uri, combined); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_ComparePartUri(IOpcPartUri *iface, IOpcPartUri *part_uri, + INT32 *result) +{ + FIXME("iface %p, part_uri %p, result %p stub!\n", iface, part_uri, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_GetSourceUri(IOpcPartUri *iface, IOpcUri **source_uri) +{ + FIXME("iface %p, source_uri %p stub!\n", iface, source_uri); + + return E_NOTIMPL; +} + +static HRESULT WINAPI opc_uri_IsRelationshipsPartUri(IOpcPartUri *iface, BOOL *result) +{ + FIXME("iface %p, result %p stub!\n", iface, result); + + return E_NOTIMPL; +} + +static const IOpcPartUriVtbl opc_part_uri_vtbl = +{ + opc_uri_QueryInterface, + opc_uri_AddRef, + opc_uri_Release, + opc_uri_GetPropertyBSTR, + opc_uri_GetPropertyLength, + opc_uri_GetPropertyDWORD, + opc_uri_HasProperty, + opc_uri_GetAbsoluteUri, + opc_uri_GetAuthority, + opc_uri_GetDisplayUri, + opc_uri_GetDomain, + opc_uri_GetExtension, + opc_uri_GetFragment, + opc_uri_GetHost, + opc_uri_GetPassword, + opc_uri_GetPath, + opc_uri_GetPathAndQuery, + opc_uri_GetQuery, + opc_uri_GetRawUri, + opc_uri_GetSchemeName, + opc_uri_GetUserInfo, + opc_uri_GetUserName, + opc_uri_GetHostType, + opc_uri_GetPort, + opc_uri_GetScheme, + opc_uri_GetZone, + opc_uri_GetProperties, + opc_uri_IsEqual, + opc_uri_GetRelationshipsPartUri, + opc_uri_GetRelativeUri, + opc_uri_CombinePartUri, + opc_uri_ComparePartUri, + opc_uri_GetSourceUri, + opc_uri_IsRelationshipsPartUri, +}; + +HRESULT opc_part_uri_create(const WCHAR *str, IOpcPartUri **out) +{ + struct opc_uri *uri; + + if (!(uri = heap_alloc_zero(sizeof(*uri)))) + return E_OUTOFMEMORY; + + uri->IOpcPartUri_iface.lpVtbl = &opc_part_uri_vtbl; + uri->refcount = 1; + + *out = &uri->IOpcPartUri_iface; + TRACE("Created part uri %p.\n", *out); + return S_OK; +}