Esme Povirk : diasymreader: Stub ISymUnmanagedDocumentWriter.

Alexandre Julliard julliard at winehq.org
Wed Feb 9 16:03:49 CST 2022


Module: wine
Branch: master
Commit: 0de459d0de38cb928adb1e08522bb1ff5f64bd18
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0de459d0de38cb928adb1e08522bb1ff5f64bd18

Author: Esme Povirk <esme at codeweavers.com>
Date:   Tue Feb  8 13:21:33 2022 -0600

diasymreader: Stub ISymUnmanagedDocumentWriter.

Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/diasymreader/writer.c | 96 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 95 insertions(+), 1 deletion(-)

diff --git a/dlls/diasymreader/writer.c b/dlls/diasymreader/writer.c
index 1820ccb51b0..3c07b77ab81 100644
--- a/dlls/diasymreader/writer.c
+++ b/dlls/diasymreader/writer.c
@@ -45,6 +45,11 @@ typedef struct SymWriter {
     WCHAR pdb_filename[MAX_PATH];
 } SymWriter;
 
+typedef struct SymDocumentWriter {
+    ISymUnmanagedDocumentWriter iface;
+    LONG ref;
+} SymDocumentWriter;
+
 static inline SymWriter *impl_from_ISymUnmanagedWriter5(ISymUnmanagedWriter5 *iface)
 {
     return CONTAINING_RECORD(iface, SymWriter, iface);
@@ -55,6 +60,81 @@ static inline SymWriter *impl_from_IPdbWriter(IPdbWriter *iface)
     return CONTAINING_RECORD(iface, SymWriter, IPdbWriter_iface);
 }
 
+static inline SymDocumentWriter *impl_from_ISymUnmanagedDocumentWriter(ISymUnmanagedDocumentWriter *iface)
+{
+    return CONTAINING_RECORD(iface, SymDocumentWriter, iface);
+}
+
+static HRESULT WINAPI SymDocumentWriter_QueryInterface(ISymUnmanagedDocumentWriter *iface, REFIID iid,
+    void **ppv)
+{
+    SymDocumentWriter *This = impl_from_ISymUnmanagedDocumentWriter(iface);
+
+    TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
+
+    if (IsEqualIID(&IID_IUnknown, iid) ||
+        IsEqualIID(&IID_ISymUnmanagedDocumentWriter, iid))
+    {
+        *ppv = &This->iface;
+    }
+    else
+    {
+        WARN("unknown interface %s\n", debugstr_guid(iid));
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI SymDocumentWriter_AddRef(ISymUnmanagedDocumentWriter *iface)
+{
+    SymDocumentWriter *This = impl_from_ISymUnmanagedDocumentWriter(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) refcount=%lu\n", iface, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI SymDocumentWriter_Release(ISymUnmanagedDocumentWriter *iface)
+{
+    SymDocumentWriter *This = impl_from_ISymUnmanagedDocumentWriter(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) refcount=%lu\n", iface, ref);
+
+    if (ref == 0)
+    {
+        heap_free(This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI SymDocumentWriter_SetSource(ISymUnmanagedDocumentWriter *iface, ULONG32 sourceSize,
+    BYTE source[])
+{
+    FIXME("(%p,%u,%p)\n", iface, sourceSize, source);
+    return S_OK;
+}
+
+static HRESULT WINAPI SymDocumentWriter_SetChecksum(ISymUnmanagedDocumentWriter *iface, GUID algorithmID,
+    ULONG32 checkSumSize, BYTE checkSum[])
+{
+    FIXME("(%p,%s,%u,%p)\n", iface, debugstr_guid(&algorithmID), checkSumSize, checkSum);
+    return S_OK;
+}
+
+static const ISymUnmanagedDocumentWriterVtbl SymDocumentWriter_Vtbl = {
+    SymDocumentWriter_QueryInterface,
+    SymDocumentWriter_AddRef,
+    SymDocumentWriter_Release,
+    SymDocumentWriter_SetSource,
+    SymDocumentWriter_SetChecksum
+};
+
 static HRESULT WINAPI SymWriter_QueryInterface(ISymUnmanagedWriter5 *iface, REFIID iid,
     void **ppv)
 {
@@ -117,9 +197,23 @@ static HRESULT WINAPI SymWriter_DefineDocument(ISymUnmanagedWriter5 *iface, cons
     const GUID *language, const GUID *languageVendor, const GUID *documentType,
     ISymUnmanagedDocumentWriter** pRetVal)
 {
+    SymDocumentWriter *result;
+
     FIXME("(%p,%s,%s,%s,%s,%p)\n", iface, debugstr_w(url), debugstr_guid(language),
         debugstr_guid(languageVendor), debugstr_guid(documentType), pRetVal);
-    return E_NOTIMPL;
+
+    if (!pRetVal)
+        return E_POINTER;
+
+    result = heap_alloc(sizeof(*result));
+    if (!result)
+        return E_OUTOFMEMORY;
+
+    result->iface.lpVtbl = &SymDocumentWriter_Vtbl;
+    result->ref = 1;
+    *pRetVal = &result->iface;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI SymWriter_SetUserEntryPoint(ISymUnmanagedWriter5 *iface, mdMethodDef entryMethod)




More information about the wine-cvs mailing list