Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/mscoree/corruntimehost.c | 6 +++--- dlls/mscoree/mscoree_private.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index afb5a104ca7..923680a931e 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -1716,7 +1716,7 @@ end:
#define CHARS_IN_GUID 39
-HRESULT create_monodata(REFIID riid, LPVOID *ppObj ) +HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) { static const WCHAR wszFileSlash[] = L"file:///"; static const WCHAR wszCLSIDSlash[] = L"CLSID\"; @@ -1739,7 +1739,7 @@ HRESULT create_monodata(REFIID riid, LPVOID *ppObj ) DWORD dwBufLen = 350;
lstrcpyW(path, wszCLSIDSlash); - StringFromGUID2(riid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID); + StringFromGUID2(clsid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID); lstrcatW(path, wszInprocServer32);
TRACE("Registry key: %s\n", debugstr_w(path)); @@ -1832,7 +1832,7 @@ HRESULT create_monodata(REFIID riid, LPVOID *ppObj ) } else { - if (!try_create_registration_free_com(riid, classname, ARRAY_SIZE(classname), filename, ARRAY_SIZE(filename))) + if (!try_create_registration_free_com(clsid, classname, ARRAY_SIZE(classname), filename, ARRAY_SIZE(filename))) return CLASS_E_CLASSNOTAVAILABLE;
TRACE("classname (%s)\n", debugstr_w(classname)); diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h index 2e72ea5370b..67b37482c5a 100644 --- a/dlls/mscoree/mscoree_private.h +++ b/dlls/mscoree/mscoree_private.h @@ -212,7 +212,7 @@ HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface, LPCWSTR pwzVersion, R
extern HRESULT CorDebug_Create(ICLRRuntimeHost *runtimehost, IUnknown** ppUnk) DECLSPEC_HIDDEN;
-extern HRESULT create_monodata(REFIID riid, LPVOID *ppObj) DECLSPEC_HIDDEN; +extern HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) DECLSPEC_HIDDEN;
extern HRESULT get_file_from_strongname(WCHAR* stringnameW, WCHAR* assemblies_path, int path_length) DECLSPEC_HIDDEN;
Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/mscoree/corruntimehost.c | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c index 923680a931e..3b23ce33e40 100644 --- a/dlls/mscoree/corruntimehost.c +++ b/dlls/mscoree/corruntimehost.c @@ -1747,6 +1747,52 @@ HRESULT create_monodata(REFCLSID clsid, LPVOID *ppObj) res = RegOpenKeyExW(HKEY_CLASSES_ROOT, path, 0, KEY_READ, &key); if (res != ERROR_FILE_NOT_FOUND) { + res = RegOpenKeyExW( key, L"Server", 0, KEY_READ, &subkey ); + if (res == ERROR_SUCCESS) + { + /* Not a managed class, just chain through LoadLibraryShim */ + HMODULE module; + HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID*); + IClassFactory *classfactory; + + dwBufLen = ARRAY_SIZE( filename ); + res = RegGetValueW( subkey, NULL, NULL, RRF_RT_REG_SZ, NULL, filename, &dwBufLen ); + + RegCloseKey( subkey ); + + if (res != ERROR_SUCCESS) + { + WARN("Can't read default value from Server subkey.\n"); + hr = CLASS_E_CLASSNOTAVAILABLE; + goto cleanup; + } + + hr = LoadLibraryShim( filename, L"v4.0.30319", NULL, &module); + if (FAILED(hr)) + { + WARN("Can't load %s.\n", debugstr_w(filename)); + goto cleanup; + } + + pDllGetClassObject = (void*)GetProcAddress( module, "DllGetClassObject" ); + if (!pDllGetClassObject) + { + WARN("Can't get DllGetClassObject from %s.\n", debugstr_w(filename)); + hr = CLASS_E_CLASSNOTAVAILABLE; + goto cleanup; + } + + hr = pDllGetClassObject( clsid, &IID_IClassFactory, (void**)&classfactory ); + if (SUCCEEDED(hr)) + { + hr = IClassFactory_CreateInstance( classfactory, NULL, &IID_IUnknown, ppObj ); + + IClassFactory_Release( classfactory ); + } + + goto cleanup; + } + res = RegGetValueW( key, NULL, L"Class", RRF_RT_REG_SZ, NULL, classname, &dwBufLen); if(res != ERROR_SUCCESS) {
Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/diasymreader/Makefile.in | 4 +- dlls/diasymreader/diasymreader_private.h | 24 ++ dlls/diasymreader/main.c | 147 ++++++++++- dlls/diasymreader/writer.c | 304 +++++++++++++++++++++++ 4 files changed, 476 insertions(+), 3 deletions(-) create mode 100644 dlls/diasymreader/diasymreader_private.h create mode 100644 dlls/diasymreader/writer.c
diff --git a/dlls/diasymreader/Makefile.in b/dlls/diasymreader/Makefile.in index 2ea95048edd..e9d6fee09e8 100644 --- a/dlls/diasymreader/Makefile.in +++ b/dlls/diasymreader/Makefile.in @@ -3,6 +3,8 @@ IMPORTS = uuid
EXTRADLLFLAGS = -Wb,--prefer-native
-C_SRCS = main.c +C_SRCS = \ + main.c \ + writer.c
RC_SRCS = diasymreader.rc diff --git a/dlls/diasymreader/diasymreader_private.h b/dlls/diasymreader/diasymreader_private.h new file mode 100644 index 00000000000..ab2b69c83a1 --- /dev/null +++ b/dlls/diasymreader/diasymreader_private.h @@ -0,0 +1,24 @@ +/* + * Copyright 2022 Esme Povirk + * + * 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 + */ + +#include "corhdr.h" +#include "cordebug.h" +#include "corsym.h" + +HRESULT SymWriter_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; + diff --git a/dlls/diasymreader/main.c b/dlls/diasymreader/main.c index a85d9cd0222..759f210db42 100644 --- a/dlls/diasymreader/main.c +++ b/dlls/diasymreader/main.c @@ -17,6 +17,8 @@
#include <stdarg.h>
+#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winnls.h" @@ -26,10 +28,151 @@
#include "wine/debug.h"
+#include "initguid.h" + +#include "diasymreader_private.h" + WINE_DEFAULT_DEBUG_CHANNEL(diasymreader);
+typedef struct { + REFCLSID classid; + HRESULT (*constructor)(REFIID,void**); +} classinfo; + +static const classinfo classes[] = { + {&CLSID_CorSymWriter_SxS, SymWriter_CreateInstance} +}; + +typedef struct { + IClassFactory IClassFactory_iface; + LONG ref; + const classinfo *info; +} ClassFactoryImpl; + +static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface); +} + +static HRESULT WINAPI ClassFactoryImpl_QueryInterface(IClassFactory *iface, + REFIID iid, void **ppv) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IClassFactory, iid)) + { + *ppv = &This->IClassFactory_iface; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI ClassFactoryImpl_AddRef(IClassFactory *iface) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + HeapFree(GetProcessHeap(), 0, This); + + return ref; +} + +static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, + IUnknown *pUnkOuter, REFIID riid, void **ppv) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + + *ppv = NULL; + + if (pUnkOuter) return CLASS_E_NOAGGREGATION; + + return This->info->constructor(riid, ppv); +} + +static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL lock) +{ + TRACE("(%p, %i): stub\n", iface, lock); + return E_NOTIMPL; +} + +static const IClassFactoryVtbl ClassFactoryImpl_Vtbl = { + ClassFactoryImpl_QueryInterface, + ClassFactoryImpl_AddRef, + ClassFactoryImpl_Release, + ClassFactoryImpl_CreateInstance, + ClassFactoryImpl_LockServer +}; + +static HRESULT ClassFactoryImpl_Constructor(const classinfo *info, REFIID riid, LPVOID *ppv) +{ + ClassFactoryImpl *This; + HRESULT ret; + + *ppv = NULL; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(ClassFactoryImpl)); + if (!This) return E_OUTOFMEMORY; + + This->IClassFactory_iface.lpVtbl = &ClassFactoryImpl_Vtbl; + This->ref = 1; + This->info = info; + + ret = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv); + IClassFactory_Release(&This->IClassFactory_iface); + + return ret; +} + HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { - FIXME("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); - return CLASS_E_CLASSNOTAVAILABLE; + HRESULT ret; + const classinfo *info=NULL; + int i; + + TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + + if (!rclsid || !iid || !ppv) + return E_INVALIDARG; + + *ppv = NULL; + + for (i=0; classes[i].classid; i++) + { + if (IsEqualCLSID(classes[i].classid, rclsid)) + { + info = &classes[i]; + break; + } + } + + if (info) + ret = ClassFactoryImpl_Constructor(info, iid, ppv); + else + ret = CLASS_E_CLASSNOTAVAILABLE; + + TRACE("<-- %08X\n", ret); + return ret; } diff --git a/dlls/diasymreader/writer.c b/dlls/diasymreader/writer.c new file mode 100644 index 00000000000..dc4c3fb0d2b --- /dev/null +++ b/dlls/diasymreader/writer.c @@ -0,0 +1,304 @@ +/* + * Copyright 2022 Esme Povirk + * + * 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 + */ + +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" + +#include "wine/debug.h" +#include "wine/heap.h" + +#include "diasymreader_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(diasymreader); + +typedef struct SymWriter { + ISymUnmanagedWriter iface; + LONG ref; +} SymWriter; + +static inline SymWriter *impl_from_ISymUnmanagedWriter(ISymUnmanagedWriter *iface) +{ + return CONTAINING_RECORD(iface, SymWriter, iface); +} + +static HRESULT WINAPI SymWriter_QueryInterface(ISymUnmanagedWriter *iface, REFIID iid, + void **ppv) +{ + SymWriter *This = impl_from_ISymUnmanagedWriter(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_ISymUnmanagedWriter, 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 SymWriter_AddRef(ISymUnmanagedWriter *iface) +{ + SymWriter *This = impl_from_ISymUnmanagedWriter(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI SymWriter_Release(ISymUnmanagedWriter *iface) +{ + SymWriter *This = impl_from_ISymUnmanagedWriter(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI SymWriter_DefineDocument(ISymUnmanagedWriter *iface, const WCHAR *url, + const GUID *language, const GUID *languageVendor, const GUID *documentType, + ISymUnmanagedDocumentWriter** pRetVal) +{ + 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; +} + +static HRESULT WINAPI SymWriter_SetUserEntryPoint(ISymUnmanagedWriter *iface, mdMethodDef entryMethod) +{ + FIXME("(%p,0x%x)\n", iface, entryMethod); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_OpenMethod(ISymUnmanagedWriter *iface, mdMethodDef method) +{ + FIXME("(%p,0x%x)\n", iface, method); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_CloseMethod(ISymUnmanagedWriter *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_OpenScope(ISymUnmanagedWriter *iface, ULONG32 startOffset, + ULONG32 *pRetVal) +{ + FIXME("(%p,%u,%p)\n", iface, startOffset, pRetVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_CloseScope(ISymUnmanagedWriter *iface, ULONG32 endOffset) +{ + FIXME("(%p,%u)\n", iface, endOffset); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_SetScopeRange(ISymUnmanagedWriter *iface, ULONG32 scopeID, ULONG32 startOffset, + ULONG32 endOffset) +{ + FIXME("(%p,%u,%u,%u)\n", iface, scopeID, startOffset, endOffset); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineLocalVariable(ISymUnmanagedWriter *iface, const WCHAR *name, + ULONG32 attributes, ULONG32 cSig, unsigned char signature[], ULONG32 addrKind, + ULONG32 addr1, ULONG32 addr2, ULONG32 addr3, ULONG32 startOffset, ULONG32 endOffset) +{ + FIXME("(%p,%s,0x%x,%u,%u)\n", iface, debugstr_w(name), attributes, cSig, addrKind); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineParameter(ISymUnmanagedWriter *iface, const WCHAR *name, + ULONG32 attributes, ULONG32 sequence, ULONG32 addrKind, + ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) +{ + FIXME("(%p,%s,0x%x,%u,%u)\n", iface, debugstr_w(name), attributes, sequence, addrKind); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineField(ISymUnmanagedWriter *iface, mdTypeDef parent, + const WCHAR *name, ULONG32 attributes, ULONG32 cSig, unsigned char signature[], ULONG32 addrKind, + ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) +{ + FIXME("(%p,0x%x,%s,0x%x,%u,%u)\n", iface, parent, debugstr_w(name), attributes, cSig, addrKind); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineGlobalVariable(ISymUnmanagedWriter *iface, const WCHAR *name, + ULONG32 attributes, ULONG32 cSig, unsigned char signature[], ULONG32 addrKind, + ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) +{ + FIXME("(%p,%s,0x%x,%u,%u)\n", iface, debugstr_w(name), attributes, cSig, addrKind); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_Close(ISymUnmanagedWriter *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_SetSymAttributes(ISymUnmanagedWriter *iface, mdToken parent, + const WCHAR *name, ULONG32 cData, unsigned char data[]) +{ + FIXME("(%p,0x%x,%s,%u)\n", iface, parent, debugstr_w(name), cData); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_OpenNamespace(ISymUnmanagedWriter *iface, const WCHAR *name) +{ + FIXME("(%p,%s)\n", iface, debugstr_w(name)); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_CloseNamespace(ISymUnmanagedWriter *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_UsingNamespace(ISymUnmanagedWriter *iface, const WCHAR *fullName) +{ + FIXME("(%p,%s)\n", iface, debugstr_w(fullName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_SetMethodSourceRange(ISymUnmanagedWriter *iface, ISymUnmanagedDocumentWriter *startDoc, + ULONG32 startLine, ULONG32 startColumn, ISymUnmanagedDocumentWriter *endDoc, ULONG32 endLine, ULONG32 endColumn) +{ + FIXME("(%p,%p,%u,%u,%p,%u,%u)\n", iface, startDoc, startLine, startColumn, endDoc, endLine, endColumn); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_Initialize(ISymUnmanagedWriter *iface, IUnknown *emitter, const WCHAR *filename, + IStream *pIStream, BOOL fFullBuild) +{ + FIXME("(%p,%p,%s,%p,%u)\n", iface, emitter, debugstr_w(filename), pIStream, fFullBuild); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_GetDebugInfo(ISymUnmanagedWriter *iface, IMAGE_DEBUG_DIRECTORY *pIDD, DWORD cData, + DWORD *pcData, BYTE data[]) +{ + FIXME("(%p,%p,%u,%p,%p)\n", iface, pIDD, cData, pcData, data); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineSequencePoints(ISymUnmanagedWriter *iface, ISymUnmanagedDocumentWriter *document, + ULONG32 spCount, ULONG32 offsets[], ULONG32 lines[], ULONG32 columns[], ULONG32 endLines[], ULONG32 endColumns[]) +{ + FIXME("(%p,%p,%u)\n", iface, document, spCount); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_RemapToken(ISymUnmanagedWriter *iface, mdToken oldToken, mdToken newToken) +{ + FIXME("(%p,0x%x,0x%x)\n", iface, oldToken, newToken); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_Initialize2(ISymUnmanagedWriter *iface, IUnknown *emitter, const WCHAR *tempFilename, + IStream *pIStream, BOOL fFullBuild, const WCHAR *finalFilename) +{ + FIXME("(%p,%p,%s,%p,%u,%s)\n", iface, emitter, debugstr_w(tempFilename), pIStream, fFullBuild, debugstr_w(finalFilename)); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineConstant(ISymUnmanagedWriter *iface, const WCHAR *name, VARIANT value, ULONG32 cSig, + unsigned char signature[]) +{ + FIXME("(%p,%s,%s,%u,%p)\n", iface, debugstr_w(name), debugstr_variant(&value), cSig, signature); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_Abort(ISymUnmanagedWriter *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static const ISymUnmanagedWriterVtbl SymWriter_Vtbl = { + SymWriter_QueryInterface, + SymWriter_AddRef, + SymWriter_Release, + SymWriter_DefineDocument, + SymWriter_SetUserEntryPoint, + SymWriter_OpenMethod, + SymWriter_CloseMethod, + SymWriter_OpenScope, + SymWriter_CloseScope, + SymWriter_SetScopeRange, + SymWriter_DefineLocalVariable, + SymWriter_DefineParameter, + SymWriter_DefineField, + SymWriter_DefineGlobalVariable, + SymWriter_Close, + SymWriter_SetSymAttributes, + SymWriter_OpenNamespace, + SymWriter_CloseNamespace, + SymWriter_UsingNamespace, + SymWriter_SetMethodSourceRange, + SymWriter_Initialize, + SymWriter_GetDebugInfo, + SymWriter_DefineSequencePoints, + SymWriter_RemapToken, + SymWriter_Initialize2, + SymWriter_DefineConstant, + SymWriter_Abort +}; + +HRESULT SymWriter_CreateInstance(REFIID iid, void **ppv) +{ + SymWriter *This; + HRESULT hr; + + This = heap_alloc(sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->iface.lpVtbl = &SymWriter_Vtbl; + This->ref = 1; + + hr = IUnknown_QueryInterface(&This->iface, iid, ppv); + + ISymUnmanagedWriter_Release(&This->iface); + + return hr; +} +
Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/diasymreader/writer.c | 145 ++++++++++++++++++++++++++++--------- include/corsym.idl | 51 +++++++++++++ 2 files changed, 160 insertions(+), 36 deletions(-)
diff --git a/dlls/diasymreader/writer.c b/dlls/diasymreader/writer.c index dc4c3fb0d2b..dfc3cc47cbe 100644 --- a/dlls/diasymreader/writer.c +++ b/dlls/diasymreader/writer.c @@ -32,24 +32,28 @@ WINE_DEFAULT_DEBUG_CHANNEL(diasymreader);
typedef struct SymWriter { - ISymUnmanagedWriter iface; + ISymUnmanagedWriter5 iface; LONG ref; } SymWriter;
-static inline SymWriter *impl_from_ISymUnmanagedWriter(ISymUnmanagedWriter *iface) +static inline SymWriter *impl_from_ISymUnmanagedWriter5(ISymUnmanagedWriter5 *iface) { return CONTAINING_RECORD(iface, SymWriter, iface); }
-static HRESULT WINAPI SymWriter_QueryInterface(ISymUnmanagedWriter *iface, REFIID iid, +static HRESULT WINAPI SymWriter_QueryInterface(ISymUnmanagedWriter5 *iface, REFIID iid, void **ppv) { - SymWriter *This = impl_from_ISymUnmanagedWriter(iface); + SymWriter *This = impl_from_ISymUnmanagedWriter5(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (IsEqualIID(&IID_IUnknown, iid) || - IsEqualIID(&IID_ISymUnmanagedWriter, iid)) + IsEqualIID(&IID_ISymUnmanagedWriter, iid) || + IsEqualIID(&IID_ISymUnmanagedWriter2, iid) || + IsEqualIID(&IID_ISymUnmanagedWriter3, iid) || + IsEqualIID(&IID_ISymUnmanagedWriter4, iid) || + IsEqualIID(&IID_ISymUnmanagedWriter5, iid)) { *ppv = &This->iface; } @@ -64,9 +68,9 @@ static HRESULT WINAPI SymWriter_QueryInterface(ISymUnmanagedWriter *iface, REFII return S_OK; }
-static ULONG WINAPI SymWriter_AddRef(ISymUnmanagedWriter *iface) +static ULONG WINAPI SymWriter_AddRef(ISymUnmanagedWriter5 *iface) { - SymWriter *This = impl_from_ISymUnmanagedWriter(iface); + SymWriter *This = impl_from_ISymUnmanagedWriter5(iface); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref); @@ -74,9 +78,9 @@ static ULONG WINAPI SymWriter_AddRef(ISymUnmanagedWriter *iface) return ref; }
-static ULONG WINAPI SymWriter_Release(ISymUnmanagedWriter *iface) +static ULONG WINAPI SymWriter_Release(ISymUnmanagedWriter5 *iface) { - SymWriter *This = impl_from_ISymUnmanagedWriter(iface); + SymWriter *This = impl_from_ISymUnmanagedWriter5(iface); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref); @@ -89,7 +93,7 @@ static ULONG WINAPI SymWriter_Release(ISymUnmanagedWriter *iface) return ref; }
-static HRESULT WINAPI SymWriter_DefineDocument(ISymUnmanagedWriter *iface, const WCHAR *url, +static HRESULT WINAPI SymWriter_DefineDocument(ISymUnmanagedWriter5 *iface, const WCHAR *url, const GUID *language, const GUID *languageVendor, const GUID *documentType, ISymUnmanagedDocumentWriter** pRetVal) { @@ -98,45 +102,45 @@ static HRESULT WINAPI SymWriter_DefineDocument(ISymUnmanagedWriter *iface, const return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_SetUserEntryPoint(ISymUnmanagedWriter *iface, mdMethodDef entryMethod) +static HRESULT WINAPI SymWriter_SetUserEntryPoint(ISymUnmanagedWriter5 *iface, mdMethodDef entryMethod) { FIXME("(%p,0x%x)\n", iface, entryMethod); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_OpenMethod(ISymUnmanagedWriter *iface, mdMethodDef method) +static HRESULT WINAPI SymWriter_OpenMethod(ISymUnmanagedWriter5 *iface, mdMethodDef method) { FIXME("(%p,0x%x)\n", iface, method); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_CloseMethod(ISymUnmanagedWriter *iface) +static HRESULT WINAPI SymWriter_CloseMethod(ISymUnmanagedWriter5 *iface) { FIXME("(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_OpenScope(ISymUnmanagedWriter *iface, ULONG32 startOffset, +static HRESULT WINAPI SymWriter_OpenScope(ISymUnmanagedWriter5 *iface, ULONG32 startOffset, ULONG32 *pRetVal) { FIXME("(%p,%u,%p)\n", iface, startOffset, pRetVal); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_CloseScope(ISymUnmanagedWriter *iface, ULONG32 endOffset) +static HRESULT WINAPI SymWriter_CloseScope(ISymUnmanagedWriter5 *iface, ULONG32 endOffset) { FIXME("(%p,%u)\n", iface, endOffset); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_SetScopeRange(ISymUnmanagedWriter *iface, ULONG32 scopeID, ULONG32 startOffset, +static HRESULT WINAPI SymWriter_SetScopeRange(ISymUnmanagedWriter5 *iface, ULONG32 scopeID, ULONG32 startOffset, ULONG32 endOffset) { FIXME("(%p,%u,%u,%u)\n", iface, scopeID, startOffset, endOffset); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_DefineLocalVariable(ISymUnmanagedWriter *iface, const WCHAR *name, +static HRESULT WINAPI SymWriter_DefineLocalVariable(ISymUnmanagedWriter5 *iface, const WCHAR *name, ULONG32 attributes, ULONG32 cSig, unsigned char signature[], ULONG32 addrKind, ULONG32 addr1, ULONG32 addr2, ULONG32 addr3, ULONG32 startOffset, ULONG32 endOffset) { @@ -144,7 +148,7 @@ static HRESULT WINAPI SymWriter_DefineLocalVariable(ISymUnmanagedWriter *iface, return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_DefineParameter(ISymUnmanagedWriter *iface, const WCHAR *name, +static HRESULT WINAPI SymWriter_DefineParameter(ISymUnmanagedWriter5 *iface, const WCHAR *name, ULONG32 attributes, ULONG32 sequence, ULONG32 addrKind, ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) { @@ -152,7 +156,7 @@ static HRESULT WINAPI SymWriter_DefineParameter(ISymUnmanagedWriter *iface, cons return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_DefineField(ISymUnmanagedWriter *iface, mdTypeDef parent, +static HRESULT WINAPI SymWriter_DefineField(ISymUnmanagedWriter5 *iface, mdTypeDef parent, const WCHAR *name, ULONG32 attributes, ULONG32 cSig, unsigned char signature[], ULONG32 addrKind, ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) { @@ -160,7 +164,7 @@ static HRESULT WINAPI SymWriter_DefineField(ISymUnmanagedWriter *iface, mdTypeDe return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_DefineGlobalVariable(ISymUnmanagedWriter *iface, const WCHAR *name, +static HRESULT WINAPI SymWriter_DefineGlobalVariable(ISymUnmanagedWriter5 *iface, const WCHAR *name, ULONG32 attributes, ULONG32 cSig, unsigned char signature[], ULONG32 addrKind, ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) { @@ -168,92 +172,152 @@ static HRESULT WINAPI SymWriter_DefineGlobalVariable(ISymUnmanagedWriter *iface, return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_Close(ISymUnmanagedWriter *iface) +static HRESULT WINAPI SymWriter_Close(ISymUnmanagedWriter5 *iface) { FIXME("(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_SetSymAttributes(ISymUnmanagedWriter *iface, mdToken parent, +static HRESULT WINAPI SymWriter_SetSymAttributes(ISymUnmanagedWriter5 *iface, mdToken parent, const WCHAR *name, ULONG32 cData, unsigned char data[]) { FIXME("(%p,0x%x,%s,%u)\n", iface, parent, debugstr_w(name), cData); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_OpenNamespace(ISymUnmanagedWriter *iface, const WCHAR *name) +static HRESULT WINAPI SymWriter_OpenNamespace(ISymUnmanagedWriter5 *iface, const WCHAR *name) { FIXME("(%p,%s)\n", iface, debugstr_w(name)); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_CloseNamespace(ISymUnmanagedWriter *iface) +static HRESULT WINAPI SymWriter_CloseNamespace(ISymUnmanagedWriter5 *iface) { FIXME("(%p)\n", iface); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_UsingNamespace(ISymUnmanagedWriter *iface, const WCHAR *fullName) +static HRESULT WINAPI SymWriter_UsingNamespace(ISymUnmanagedWriter5 *iface, const WCHAR *fullName) { FIXME("(%p,%s)\n", iface, debugstr_w(fullName)); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_SetMethodSourceRange(ISymUnmanagedWriter *iface, ISymUnmanagedDocumentWriter *startDoc, +static HRESULT WINAPI SymWriter_SetMethodSourceRange(ISymUnmanagedWriter5 *iface, ISymUnmanagedDocumentWriter *startDoc, ULONG32 startLine, ULONG32 startColumn, ISymUnmanagedDocumentWriter *endDoc, ULONG32 endLine, ULONG32 endColumn) { FIXME("(%p,%p,%u,%u,%p,%u,%u)\n", iface, startDoc, startLine, startColumn, endDoc, endLine, endColumn); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_Initialize(ISymUnmanagedWriter *iface, IUnknown *emitter, const WCHAR *filename, +static HRESULT WINAPI SymWriter_Initialize(ISymUnmanagedWriter5 *iface, IUnknown *emitter, const WCHAR *filename, IStream *pIStream, BOOL fFullBuild) { FIXME("(%p,%p,%s,%p,%u)\n", iface, emitter, debugstr_w(filename), pIStream, fFullBuild); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_GetDebugInfo(ISymUnmanagedWriter *iface, IMAGE_DEBUG_DIRECTORY *pIDD, DWORD cData, +static HRESULT WINAPI SymWriter_GetDebugInfo(ISymUnmanagedWriter5 *iface, IMAGE_DEBUG_DIRECTORY *pIDD, DWORD cData, DWORD *pcData, BYTE data[]) { FIXME("(%p,%p,%u,%p,%p)\n", iface, pIDD, cData, pcData, data); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_DefineSequencePoints(ISymUnmanagedWriter *iface, ISymUnmanagedDocumentWriter *document, +static HRESULT WINAPI SymWriter_DefineSequencePoints(ISymUnmanagedWriter5 *iface, ISymUnmanagedDocumentWriter *document, ULONG32 spCount, ULONG32 offsets[], ULONG32 lines[], ULONG32 columns[], ULONG32 endLines[], ULONG32 endColumns[]) { FIXME("(%p,%p,%u)\n", iface, document, spCount); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_RemapToken(ISymUnmanagedWriter *iface, mdToken oldToken, mdToken newToken) +static HRESULT WINAPI SymWriter_RemapToken(ISymUnmanagedWriter5 *iface, mdToken oldToken, mdToken newToken) { FIXME("(%p,0x%x,0x%x)\n", iface, oldToken, newToken); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_Initialize2(ISymUnmanagedWriter *iface, IUnknown *emitter, const WCHAR *tempFilename, +static HRESULT WINAPI SymWriter_Initialize2(ISymUnmanagedWriter5 *iface, IUnknown *emitter, const WCHAR *tempFilename, IStream *pIStream, BOOL fFullBuild, const WCHAR *finalFilename) { FIXME("(%p,%p,%s,%p,%u,%s)\n", iface, emitter, debugstr_w(tempFilename), pIStream, fFullBuild, debugstr_w(finalFilename)); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_DefineConstant(ISymUnmanagedWriter *iface, const WCHAR *name, VARIANT value, ULONG32 cSig, +static HRESULT WINAPI SymWriter_DefineConstant(ISymUnmanagedWriter5 *iface, const WCHAR *name, VARIANT value, ULONG32 cSig, unsigned char signature[]) { FIXME("(%p,%s,%s,%u,%p)\n", iface, debugstr_w(name), debugstr_variant(&value), cSig, signature); return E_NOTIMPL; }
-static HRESULT WINAPI SymWriter_Abort(ISymUnmanagedWriter *iface) +static HRESULT WINAPI SymWriter_Abort(ISymUnmanagedWriter5 *iface) { FIXME("(%p)\n", iface); return E_NOTIMPL; }
-static const ISymUnmanagedWriterVtbl SymWriter_Vtbl = { +static HRESULT WINAPI SymWriter_DefineLocalVariable2(ISymUnmanagedWriter5 *iface, const WCHAR *name, ULONG32 attributes, + mdSignature sigToken, ULONG32 addrKind, ULONG32 addr1, ULONG32 addr2, ULONG32 addr3, + ULONG32 startOffset, ULONG32 endOffset) +{ + FIXME("(%p,%s,0x%x,0x%x,%u)\n", iface, debugstr_w(name), attributes, sigToken, addrKind); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineGlobalVariable2(ISymUnmanagedWriter5 *iface, const WCHAR *name, ULONG32 attributes, + mdSignature sigToken, ULONG32 addrKind, ULONG32 addr1, ULONG32 addr2, ULONG32 addr3) +{ + FIXME("(%p,%s,0x%x,0x%x,%u)\n", iface, debugstr_w(name), attributes, sigToken, addrKind); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_DefineConstant2(ISymUnmanagedWriter5 *iface, const WCHAR *name, VARIANT value, mdSignature sigToken) +{ + FIXME("(%p,%s,%s,0x%x)\n", iface, debugstr_w(name), debugstr_variant(&value), sigToken); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_OpenMethod2(ISymUnmanagedWriter5 *iface, mdMethodDef method, ULONG32 isect, ULONG32 offset) +{ + FIXME("(%p,0x%x,%u,%u)\n", iface, method, isect, offset); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_Commit(ISymUnmanagedWriter5 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_GetDebugInfoWithPadding(ISymUnmanagedWriter5 *iface, IMAGE_DEBUG_DIRECTORY *pIDD, DWORD cbData, + DWORD* pcData, BYTE data[]) +{ + FIXME("(%p,%p,%u,%p,%p)\n", iface, pIDD, cbData, pcData, data); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_OpenMapTokensToSourceSpans(ISymUnmanagedWriter5 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_CloseMapTokensToSourceSpans(ISymUnmanagedWriter5 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI SymWriter_MapTokenToSourceSpan(ISymUnmanagedWriter5 *iface, mdToken token, ISymUnmanagedDocumentWriter* document, + ULONG32 line, ULONG32 column, ULONG32 endLine, ULONG32 endColumn) +{ + FIXME("(%p,%x,%p,%u,%u,%u,%u)\n", iface, token, document, line, column, endLine, endColumn); + return E_NOTIMPL; +} + + +static const ISymUnmanagedWriter5Vtbl SymWriter_Vtbl = { SymWriter_QueryInterface, SymWriter_AddRef, SymWriter_Release, @@ -280,7 +344,16 @@ static const ISymUnmanagedWriterVtbl SymWriter_Vtbl = { SymWriter_RemapToken, SymWriter_Initialize2, SymWriter_DefineConstant, - SymWriter_Abort + SymWriter_Abort, + SymWriter_DefineLocalVariable2, + SymWriter_DefineGlobalVariable2, + SymWriter_DefineConstant2, + SymWriter_OpenMethod2, + SymWriter_Commit, + SymWriter_GetDebugInfoWithPadding, + SymWriter_OpenMapTokensToSourceSpans, + SymWriter_CloseMapTokensToSourceSpans, + SymWriter_MapTokenToSourceSpan };
HRESULT SymWriter_CreateInstance(REFIID iid, void **ppv) @@ -297,7 +370,7 @@ HRESULT SymWriter_CreateInstance(REFIID iid, void **ppv)
hr = IUnknown_QueryInterface(&This->iface, iid, ppv);
- ISymUnmanagedWriter_Release(&This->iface); + ISymUnmanagedWriter5_Release(&This->iface);
return hr; } diff --git a/include/corsym.idl b/include/corsym.idl index f46b1f5a78a..8edf92d5146 100644 --- a/include/corsym.idl +++ b/include/corsym.idl @@ -25,6 +25,7 @@ cpp_quote("#if 0") typedef UINT32 mdToken; typedef mdToken mdMethodDef; typedef mdToken mdTypeDef; +typedef mdToken mdSignature; /* defined in winnt.h */ typedef SIZE_T IMAGE_DEBUG_DIRECTORY; cpp_quote("#endif") @@ -93,4 +94,54 @@ interface ISymUnmanagedWriter : IUnknown HRESULT Abort(); }
+[ + object, + uuid(0b97726e-9e6d-4f05-9a26-424022093caa), + pointer_default(unique) +] +interface ISymUnmanagedWriter2 : ISymUnmanagedWriter +{ + HRESULT DefineLocalVariable2([in] const WCHAR *name, [in] ULONG32 attributes, [in] mdSignature sigToken, + [in] ULONG32 addrKind, [in] ULONG32 addr1, [in] ULONG32 addr2, [in] ULONG32 addr3, + [in] ULONG32 startOffset, [in] ULONG32 endOffset); + HRESULT DefineGlobalVariable2([in] const WCHAR *name, [in] ULONG32 attributes, [in] mdSignature sigToken, + [in] ULONG32 addrKind, [in] ULONG32 addr1, [in] ULONG32 addr2, [in] ULONG32 addr3); + HRESULT DefineConstant2([in] const WCHAR *name, [in] VARIANT value, [in] mdSignature sigToken); +} + +[ + object, + uuid(12f1e02c-1e05-4b0e-9468-ebc9d1bb040f), + pointer_default(unique) +] +interface ISymUnmanagedWriter3 : ISymUnmanagedWriter2 +{ + HRESULT OpenMethod2([in] mdMethodDef method, [in] ULONG32 isect, [in] ULONG32 offset); + HRESULT Commit(); +} + +[ + object, + uuid(bc7e3f53-f458-4c23-9dbd-a189e6e96594), + pointer_default(unique) +] +interface ISymUnmanagedWriter4 : ISymUnmanagedWriter3 +{ + HRESULT GetDebugInfoWithPadding([in, out] IMAGE_DEBUG_DIRECTORY *pIDD, [in] DWORD cbData, [out] DWORD* pcData, + [out, size_is(cbData), length_is(*pcData)] BYTE data[]); +} + +[ + object, + uuid(dcf7780d-bde9-45df-acfe-21731a32000c), + pointer_default(unique) +] +interface ISymUnmanagedWriter5 : ISymUnmanagedWriter4 +{ + HRESULT OpenMapTokensToSourceSpans(); + HRESULT CloseMapTokensToSourceSpans(); + HRESULT MapTokenToSourceSpan([in] mdToken token, [in] ISymUnmanagedDocumentWriter* document, + [in] ULONG32 line, [in] ULONG32 column, [in] ULONG32 endLine, [in] ULONG32 endColumn); +} + cpp_quote("DEFINE_GUID(CLSID_CorSymWriter_SxS, 0x0ae2deb0,0xf901,0x478b,0xbb,0x9f,0x88,0x1e,0xe8,0x06,0x67,0x88);")
Signed-off-by: Esme Povirk esme@codeweavers.com --- dlls/diasymreader/writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/diasymreader/writer.c b/dlls/diasymreader/writer.c index dfc3cc47cbe..71ea21c8f4d 100644 --- a/dlls/diasymreader/writer.c +++ b/dlls/diasymreader/writer.c @@ -214,7 +214,7 @@ static HRESULT WINAPI SymWriter_Initialize(ISymUnmanagedWriter5 *iface, IUnknown IStream *pIStream, BOOL fFullBuild) { FIXME("(%p,%p,%s,%p,%u)\n", iface, emitter, debugstr_w(filename), pIStream, fFullBuild); - return E_NOTIMPL; + return S_OK; }
static HRESULT WINAPI SymWriter_GetDebugInfo(ISymUnmanagedWriter5 *iface, IMAGE_DEBUG_DIRECTORY *pIDD, DWORD cData,