Commit df5f835e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

devenum: Use V_* macros to access variant data.

parent b5cd4775
......@@ -761,7 +761,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
VARIANT var;
V_VT(&var) = VT_I4;
V_UNION(&var, ulVal) = i;
V_I4(&var) = i;
res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszWaveOutID, &var);
......@@ -769,7 +769,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
pPropBag = NULL;
V_VT(&var) = VT_LPWSTR;
V_UNION(&var, bstrVal) = wocaps.szPname;
V_BSTR(&var) = wocaps.szPname;
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
if (pPropBag)
......@@ -842,7 +842,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
VARIANT var;
V_VT(&var) = VT_I4;
V_UNION(&var, ulVal) = i;
V_I4(&var) = i;
res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszWaveInID, &var);
......@@ -850,7 +850,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
pPropBag = NULL;
V_VT(&var) = VT_LPWSTR;
V_UNION(&var, bstrVal) = wicaps.szPname;
V_BSTR(&var) = wicaps.szPname;
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
......@@ -952,7 +952,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
OLECHAR wszVfwIndex[] = { 'V','F','W','I','n','d','e','x',0 };
VARIANT var;
V_VT(&var) = VT_I4;
V_UNION(&var, ulVal) = i;
V_I4(&var) = i;
res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
if (SUCCEEDED(res)) {
res = IPropertyBag_Write(pPropBag, wszVfwIndex, &var);
......
......@@ -149,15 +149,15 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
switch (V_VT(pVar))
{
case VT_LPWSTR:
V_UNION(pVar, bstrVal) = CoTaskMemAlloc(received);
memcpy(V_UNION(pVar, bstrVal), pData, received);
V_BSTR(pVar) = CoTaskMemAlloc(received);
memcpy(V_BSTR(pVar), pData, received);
res = S_OK;
break;
case VT_EMPTY:
V_VT(pVar) = VT_BSTR;
/* fall through */
case VT_BSTR:
V_UNION(pVar, bstrVal) = SysAllocStringLen(pData, received/sizeof(WCHAR) - 1);
V_BSTR(pVar) = SysAllocStringLen(pData, received/sizeof(WCHAR) - 1);
res = S_OK;
break;
}
......@@ -171,7 +171,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
/* fall through */
case VT_I4:
case VT_UI4:
V_UNION(pVar, ulVal) = *(DWORD *)pData;
V_I4(pVar) = *(DWORD *)pData;
res = S_OK;
break;
}
......@@ -189,7 +189,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
V_VT(pVar) = VT_ARRAY | VT_UI1;
/* fall through */
case VT_ARRAY | VT_UI1:
if (!(V_UNION(pVar, parray) = SafeArrayCreate(VT_UI1, 1, &bound)))
if (!(V_ARRAY(pVar) = SafeArrayCreate(VT_UI1, 1, &bound)))
res = E_OUTOFMEMORY;
else
res = S_OK;
......@@ -199,12 +199,12 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
if (res == E_INVALIDARG)
break;
res = SafeArrayAccessData(V_UNION(pVar, parray), &pArrayElements);
res = SafeArrayAccessData(V_ARRAY(pVar), &pArrayElements);
if (FAILED(res))
break;
CopyMemory(pArrayElements, pData, received);
res = SafeArrayUnaccessData(V_UNION(pVar, parray));
res = SafeArrayUnaccessData(V_ARRAY(pVar));
break;
}
}
......@@ -235,15 +235,15 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
{
case VT_BSTR:
case VT_LPWSTR:
TRACE("writing %s\n", debugstr_w(V_UNION(pVar, bstrVal)));
lpData = V_UNION(pVar, bstrVal);
TRACE("writing %s\n", debugstr_w(V_BSTR(pVar)));
lpData = V_BSTR(pVar);
dwType = REG_SZ;
cbData = (lstrlenW(V_UNION(pVar, bstrVal)) + 1) * sizeof(WCHAR);
cbData = (lstrlenW(V_BSTR(pVar)) + 1) * sizeof(WCHAR);
break;
case VT_I4:
case VT_UI4:
TRACE("writing %u\n", V_UNION(pVar, ulVal));
lpData = &V_UNION(pVar, ulVal);
TRACE("writing %u\n", V_UI4(pVar));
lpData = &V_UI4(pVar);
dwType = REG_DWORD;
cbData = sizeof(DWORD);
break;
......@@ -252,11 +252,11 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
LONG lUbound = 0;
LONG lLbound = 0;
dwType = REG_BINARY;
res = SafeArrayGetLBound(V_UNION(pVar, parray), 1, &lLbound);
res = SafeArrayGetUBound(V_UNION(pVar, parray), 1, &lUbound);
res = SafeArrayGetLBound(V_ARRAY(pVar), 1, &lLbound);
res = SafeArrayGetUBound(V_ARRAY(pVar), 1, &lUbound);
cbData = (lUbound - lLbound + 1) /* * sizeof(BYTE)*/;
TRACE("cbData: %d\n", cbData);
res = SafeArrayAccessData(V_UNION(pVar, parray), &lpData);
res = SafeArrayAccessData(V_ARRAY(pVar), &lpData);
break;
}
default:
......@@ -270,7 +270,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
res = E_FAIL;
if (V_VT(pVar) & VT_ARRAY)
res = SafeArrayUnaccessData(V_UNION(pVar, parray));
res = SafeArrayUnaccessData(V_ARRAY(pVar));
return res;
}
......@@ -421,8 +421,8 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(IMoniker *iface, IBi
}
if (SUCCEEDED(res))
{
res = CLSIDFromString(V_UNION(&var,bstrVal), &clsID);
CoTaskMemFree(V_UNION(&var, bstrVal));
res = CLSIDFromString(V_BSTR(&var), &clsID);
CoTaskMemFree(V_BSTR(&var));
}
if (SUCCEEDED(res))
{
......
......@@ -92,7 +92,7 @@ static void test_devenum(IBindCtx *bind_ctx)
if (SUCCEEDED(hr))
{
if (winetest_debug > 1)
trace(" %s\n", wine_dbgstr_w(V_UNION(&var, bstrVal)));
trace(" %s\n", wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
}
else
......
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