Nikolay Sivov : opcservices: Add IOpcPart stub.
Alexandre Julliard
julliard at winehq.org
Mon Sep 3 16:26:09 CDT 2018
Module: wine
Branch: master
Commit: fbe44c5762388351741180d5137c93f248a88644
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fbe44c5762388351741180d5137c93f248a88644
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Sep 3 07:18:25 2018 +0300
opcservices: Add IOpcPart stub.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/opcservices/package.c | 114 ++++++++++++++++++++++++++++++++++++++++++++-
include/opcobjectmodel.idl | 30 +++++++++++-
2 files changed, 142 insertions(+), 2 deletions(-)
diff --git a/dlls/opcservices/package.c b/dlls/opcservices/package.c
index c49c980..a3a2fab 100644
--- a/dlls/opcservices/package.c
+++ b/dlls/opcservices/package.c
@@ -36,6 +36,12 @@ struct opc_package
IOpcPartSet *part_set;
};
+struct opc_part
+{
+ IOpcPart IOpcPart_iface;
+ LONG refcount;
+};
+
struct opc_part_set
{
IOpcPartSet IOpcPartSet_iface;
@@ -52,6 +58,112 @@ static inline struct opc_part_set *impl_from_IOpcPartSet(IOpcPartSet *iface)
return CONTAINING_RECORD(iface, struct opc_part_set, IOpcPartSet_iface);
}
+static inline struct opc_part *impl_from_IOpcPart(IOpcPart *iface)
+{
+ return CONTAINING_RECORD(iface, struct opc_part, IOpcPart_iface);
+}
+
+static HRESULT WINAPI opc_part_QueryInterface(IOpcPart *iface, REFIID iid, void **out)
+{
+ TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
+
+ if (IsEqualIID(iid, &IID_IOpcPart) ||
+ IsEqualIID(iid, &IID_IUnknown))
+ {
+ *out = iface;
+ IOpcPart_AddRef(iface);
+ return S_OK;
+ }
+
+ WARN("Unsupported interface %s.\n", debugstr_guid(iid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI opc_part_AddRef(IOpcPart *iface)
+{
+ struct opc_part *part = impl_from_IOpcPart(iface);
+ ULONG refcount = InterlockedIncrement(&part->refcount);
+
+ TRACE("%p increasing refcount to %u.\n", iface, refcount);
+
+ return refcount;
+}
+
+static ULONG WINAPI opc_part_Release(IOpcPart *iface)
+{
+ struct opc_part *part = impl_from_IOpcPart(iface);
+ ULONG refcount = InterlockedDecrement(&part->refcount);
+
+ TRACE("%p decreasing refcount to %u.\n", iface, refcount);
+
+ if (!refcount)
+ heap_free(part);
+
+ return refcount;
+}
+
+static HRESULT WINAPI opc_part_GetRelationshipSet(IOpcPart *iface, IOpcRelationshipSet **relationship_set)
+{
+ FIXME("iface %p, relationship_set %p stub!\n", iface, relationship_set);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI opc_part_GetContentStream(IOpcPart *iface, IStream **stream)
+{
+ FIXME("iface %p, stream %p stub!\n", iface, stream);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI opc_part_GetName(IOpcPart *iface, IOpcPartUri **name)
+{
+ FIXME("iface %p, name %p stub!\n", iface, name);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI opc_part_GetContentType(IOpcPart *iface, LPWSTR *type)
+{
+ FIXME("iface %p, type %p stub!\n", iface, type);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI opc_part_GetCompressionOptions(IOpcPart *iface, OPC_COMPRESSION_OPTIONS *options)
+{
+ FIXME("iface %p, options %p stub!\n", iface, options);
+
+ return E_NOTIMPL;
+}
+
+static const IOpcPartVtbl opc_part_vtbl =
+{
+ opc_part_QueryInterface,
+ opc_part_AddRef,
+ opc_part_Release,
+ opc_part_GetRelationshipSet,
+ opc_part_GetContentStream,
+ opc_part_GetName,
+ opc_part_GetContentType,
+ opc_part_GetCompressionOptions,
+};
+
+static HRESULT opc_part_create(IOpcPart **out)
+{
+ struct opc_part *part;
+
+ if (!(part = heap_alloc_zero(sizeof(*part))))
+ return E_OUTOFMEMORY;
+
+ part->IOpcPart_iface.lpVtbl = &opc_part_vtbl;
+ part->refcount = 1;
+
+ *out = &part->IOpcPart_iface;
+ TRACE("Created part %p.\n", *out);
+ return S_OK;
+}
+
static HRESULT WINAPI opc_part_set_QueryInterface(IOpcPartSet *iface, REFIID iid, void **out)
{
TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
@@ -104,7 +216,7 @@ static HRESULT WINAPI opc_part_set_CreatePart(IOpcPartSet *iface, IOpcPartUri *n
FIXME("iface %p, name %p, content_type %s, compression_options %#x, part %p stub!\n", iface, name,
debugstr_w(content_type), compression_options, part);
- return E_NOTIMPL;
+ return opc_part_create(part);
}
static HRESULT WINAPI opc_part_set_DeletePart(IOpcPartSet *iface, IOpcPartUri *name)
diff --git a/include/opcobjectmodel.idl b/include/opcobjectmodel.idl
index 45bc8aa..eaf0108 100644
--- a/include/opcobjectmodel.idl
+++ b/include/opcobjectmodel.idl
@@ -20,10 +20,10 @@
#pragma makedep install
#endif
-interface IOpcPart;
interface IOpcPartUri;
interface IOpcUri;
interface IOpcRelationship;
+interface IOpcRelationshipSet;
typedef [v1_enum] enum
{
@@ -40,6 +40,34 @@ typedef [v1_enum] enum
[
object,
+ uuid(42195949-3b79-4fc8-89c6-fc7fb979ee71),
+ pointer_default(ref)
+]
+interface IOpcPart : IUnknown
+{
+ HRESULT GetRelationshipSet(
+ [out, retval] IOpcRelationshipSet **relationship_set
+ );
+
+ HRESULT GetContentStream(
+ [out, retval] IStream **stream
+ );
+
+ HRESULT GetName(
+ [out, retval] IOpcPartUri **name
+ );
+
+ HRESULT GetContentType(
+ [out, string, retval] LPWSTR *type
+ );
+
+ HRESULT GetCompressionOptions(
+ [out, retval] OPC_COMPRESSION_OPTIONS *options
+ );
+}
+
+[
+ object,
uuid(42195949-3b79-4fc8-89c6-fc7fb979ee75),
pointer_default(ref)
]
More information about the wine-cvs
mailing list