propsys: Add InitPropVariantFromCLSID().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45347
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-09-16 16:48:41 +03:00 committed by Alexandre Julliard
parent ec09119f2e
commit 6fbf6c330b
4 changed files with 34 additions and 1 deletions

View File

@ -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

View File

@ -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;

View File

@ -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();
}

View File

@ -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);