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