Commit 6fbf6c33 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

propsys: Add InitPropVariantFromCLSID().

parent ec09119f
......@@ -29,7 +29,7 @@
@ stdcall -private DllUnregisterServer()
@ stub InitPropVariantFromBooleanVector
@ stdcall InitPropVariantFromBuffer(ptr long ptr)
@ stub InitPropVariantFromCLSID
@ stdcall InitPropVariantFromCLSID(ptr ptr)
@ stub InitPropVariantFromDoubleVector
@ stub InitPropVariantFromFileTime
@ stub InitPropVariantFromFileTimeVector
......
......@@ -570,6 +570,19 @@ HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *p
return S_OK;
}
HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar)
{
TRACE("(%s %p)\n", debugstr_guid(clsid), ppropvar);
ppropvar->u.puuid = CoTaskMemAlloc(sizeof(*ppropvar->u.puuid));
if(!ppropvar->u.puuid)
return E_OUTOFMEMORY;
ppropvar->vt = VT_CLSID;
memcpy(ppropvar->u.puuid, clsid, sizeof(*ppropvar->u.puuid));
return S_OK;
}
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar)
{
SAFEARRAY *arr;
......
......@@ -1230,6 +1230,24 @@ static void test_PropVariantChangeType_LPWSTR(void)
PropVariantClear(&src);
}
static void test_InitPropVariantFromCLSID(void)
{
PROPVARIANT propvar;
GUID clsid;
HRESULT hr;
memset(&propvar, 0, sizeof(propvar));
propvar.vt = VT_I4;
propvar.u.lVal = 15;
memset(&clsid, 0xcc, sizeof(clsid));
hr = InitPropVariantFromCLSID(&clsid, &propvar);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(propvar.vt == VT_CLSID, "Unexpected type %d.\n", propvar.vt);
ok(IsEqualGUID(propvar.u.puuid, &clsid), "Unexpected puuid value.\n");
PropVariantClear(&propvar);
}
START_TEST(propsys)
{
test_PSStringFromPropertyKey();
......@@ -1244,4 +1262,5 @@ START_TEST(propsys)
test_PropVariantChangeType_LPWSTR();
test_PropVariantToBoolean();
test_PropVariantToStringWithDefault();
test_InitPropVariantFromCLSID();
}
......@@ -64,6 +64,7 @@ HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT p
HRESULT WINAPI InitPropVariantFromGUIDAsString(REFGUID guid, PROPVARIANT *ppropvar);
HRESULT WINAPI InitVariantFromGUIDAsString(REFGUID guid, VARIANT *pvar);
HRESULT WINAPI InitPropVariantFromBuffer(const VOID *pv, UINT cb, PROPVARIANT *ppropvar);
HRESULT WINAPI InitPropVariantFromCLSID(REFCLSID clsid, PROPVARIANT *ppropvar);
HRESULT WINAPI InitVariantFromBuffer(const VOID *pv, UINT cb, VARIANT *pvar);
HRESULT WINAPI PropVariantToGUID(const PROPVARIANT *ppropvar, GUID *guid);
HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment