Nikolay Sivov : scrobj: Implement get_GUID().
Alexandre Julliard
julliard at winehq.org
Fri Jan 27 14:12:22 CST 2017
Module: wine
Branch: master
Commit: 0fa152791f324d992c4f3716b9b0165576ceba45
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0fa152791f324d992c4f3716b9b0165576ceba45
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Jan 27 00:36:12 2017 +0300
scrobj: Implement get_GUID().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/scrobj/Makefile.in | 2 +-
dlls/scrobj/scrobj.c | 33 ++++++++++++++++++++++++++++++---
2 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/dlls/scrobj/Makefile.in b/dlls/scrobj/Makefile.in
index 75dd7ec..179409a 100644
--- a/dlls/scrobj/Makefile.in
+++ b/dlls/scrobj/Makefile.in
@@ -1,5 +1,5 @@
MODULE = scrobj.dll
-IMPORTS = uuid oleaut32
+IMPORTS = uuid ole32 oleaut32
C_SRCS = \
scrobj.c
diff --git a/dlls/scrobj/scrobj.c b/dlls/scrobj/scrobj.c
index 44cb778..38f1c65 100644
--- a/dlls/scrobj/scrobj.c
+++ b/dlls/scrobj/scrobj.c
@@ -113,6 +113,8 @@ struct scriptlet_typelib
{
IGenScriptletTLib IGenScriptletTLib_iface;
LONG ref;
+
+ BSTR guid;
};
static inline struct scriptlet_typelib *impl_from_IGenScriptletTLib(IGenScriptletTLib *iface)
@@ -155,7 +157,10 @@ static ULONG WINAPI scriptlet_typelib_Release(IGenScriptletTLib *iface)
TRACE("(%p)->(%u)\n", This, ref);
if (!ref)
+ {
+ SysFreeString(This->guid);
HeapFree(GetProcessHeap(), 0, This);
+ }
return ref;
}
@@ -346,13 +351,34 @@ static HRESULT WINAPI scriptlet_typelib_put_GUID(IGenScriptletTLib *iface, BSTR
return E_NOTIMPL;
}
-static HRESULT WINAPI scriptlet_typelib_get_GUID(IGenScriptletTLib *iface, BSTR *guid)
+static HRESULT WINAPI scriptlet_typelib_get_GUID(IGenScriptletTLib *iface, BSTR *ret)
{
struct scriptlet_typelib *This = impl_from_IGenScriptletTLib(iface);
- FIXME("(%p, %p): stub\n", This, guid);
+ TRACE("(%p, %p)\n", This, ret);
- return E_NOTIMPL;
+ *ret = NULL;
+
+ if (!This->guid)
+ {
+ WCHAR guidW[39];
+ GUID guid;
+ HRESULT hr;
+
+ hr = CoCreateGuid(&guid);
+ if (FAILED(hr))
+ return hr;
+
+ hr = StringFromGUID2(&guid, guidW, sizeof(guidW)/sizeof(guidW[0]));
+ if (FAILED(hr))
+ return hr;
+
+ if (!(This->guid = SysAllocString(guidW)))
+ return E_OUTOFMEMORY;
+ }
+
+ *ret = SysAllocString(This->guid);
+ return *ret ? S_OK : E_OUTOFMEMORY;
}
static const IGenScriptletTLibVtbl scriptlet_typelib_vtbl =
@@ -434,6 +460,7 @@ HRESULT WINAPI scriptlet_typelib_CreateInstance(IClassFactory *factory, IUnknown
This->IGenScriptletTLib_iface.lpVtbl = &scriptlet_typelib_vtbl;
This->ref = 1;
+ This->guid = NULL;
hr = IGenScriptletTLib_QueryInterface(&This->IGenScriptletTLib_iface, riid, obj);
IGenScriptletTLib_Release(&This->IGenScriptletTLib_iface);
More information about the wine-cvs
mailing list