propsys: Added InitVariantFromGUIDAsString implementation.
authorPiotr Caban <piotr@codeweavers.com>
Fri, 16 Sep 2011 09:20:07 +0000 (11:20 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 16 Sep 2011 15:23:12 +0000 (17:23 +0200)
dlls/propsys/Makefile.in
dlls/propsys/propsys.spec
dlls/propsys/propvar.c

index ae2d91fca082ed0130d912bb7d63df312e0d593b..1cbbe7c0a8f3b59f5fe3c586f185eaa7f1c2793f 100644 (file)
@@ -1,5 +1,6 @@
 MODULE    = propsys.dll
 IMPORTLIB = propsys
+IMPORTS   = ole32 oleaut32
 
 C_SRCS = \
        propsys_main.c \
index 3726facc089f407751f112c5b0c20e38f51f485b..e7389856d73cdbc2fc8b290b2d94fb0bf91cdbd8 100644 (file)
@@ -33,7 +33,7 @@
 @ stub InitPropVariantFromDoubleVector
 @ stub InitPropVariantFromFileTime
 @ stub InitPropVariantFromFileTimeVector
-@ stub InitPropVariantFromGUIDAsString
+@ stdcall InitPropVariantFromGUIDAsString(ptr ptr)
 @ stub InitPropVariantFromInt16Vector
 @ stub InitPropVariantFromInt32Vector
 @ stub InitPropVariantFromInt64Vector
@@ -51,7 +51,7 @@
 @ stub InitVariantFromDoubleArray
 @ stub InitVariantFromFileTime
 @ stub InitVariantFromFileTimeArray
-@ stub InitVariantFromGUIDAsString
+@ stdcall InitVariantFromGUIDAsString(ptr ptr)
 @ stub InitVariantFromInt16Array
 @ stub InitVariantFromInt32Array
 @ stub InitVariantFromInt64Array
index cdfb89fa76897112f2bc8741eeca46e650341f0e..d59173c2adb32763f590bb09b004d348705907c8 100644 (file)
@@ -32,6 +32,7 @@
 #include "propvarutil.h"
 
 #include "wine/debug.h"
+#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(propsys);
 
@@ -86,3 +87,48 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
 
     return E_FAIL;
 }
+
+static void PROPVAR_GUIDToWSTR(REFGUID guid, WCHAR *str)
+{
+    static const WCHAR format[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
+        '-','%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X',
+        '%','0','2','X','%','0','2','X','%','0','2','X','}',0};
+
+    sprintfW(str, format, guid->Data1, guid->Data2, guid->Data3,
+            guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
+            guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+}
+
+HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar)
+{
+    TRACE("(%p %p)\n", guid, ppropvar);
+
+    if(!guid)
+        return E_FAIL;
+
+    ppropvar->vt = VT_LPWSTR;
+    ppropvar->u.pwszVal = CoTaskMemAlloc(39*sizeof(WCHAR));
+    if(!ppropvar->u.pwszVal)
+        return E_OUTOFMEMORY;
+
+    PROPVAR_GUIDToWSTR(guid, ppropvar->u.pwszVal);
+    return S_OK;
+}
+
+HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar)
+{
+    TRACE("(%p %p)\n", guid, pvar);
+
+    if(!guid) {
+        FIXME("guid == NULL\n");
+        return E_FAIL;
+    }
+
+    V_VT(pvar) = VT_BSTR;
+    V_BSTR(pvar) = SysAllocStringLen(NULL, 38);
+    if(!V_BSTR(pvar))
+        return E_OUTOFMEMORY;
+
+    PROPVAR_GUIDToWSTR(guid, V_BSTR(pvar));
+    return S_OK;
+}