msi: automation: Condense a few loops.
This commit is contained in:
parent
fef82e74b6
commit
187f856e46
|
@ -580,17 +580,14 @@ static HRESULT WINAPI RecordImpl_Invoke(
|
|||
if (FAILED(hr)) return hr;
|
||||
V_VT(pVarResult) = VT_BSTR;
|
||||
V_BSTR(pVarResult) = NULL;
|
||||
ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), NULL, &dwLen)) == ERROR_SUCCESS)
|
||||
{
|
||||
szString = msi_alloc((++dwLen)*sizeof(WCHAR));
|
||||
if (szString)
|
||||
{
|
||||
if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
|
||||
if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR))))
|
||||
ERR("Out of memory\n");
|
||||
else if ((ret = MsiRecordGetStringW(This->msiHandle, V_I4(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
|
||||
V_BSTR(pVarResult) = SysAllocString(szString);
|
||||
msi_free(szString);
|
||||
}
|
||||
}
|
||||
if (ret != ERROR_SUCCESS)
|
||||
ERR("MsiRecordGetString returned %d\n", ret);
|
||||
} else if (wFlags & DISPATCH_PROPERTYPUT) {
|
||||
|
@ -891,17 +888,14 @@ static HRESULT WINAPI SessionImpl_Invoke(
|
|||
if (FAILED(hr)) return hr;
|
||||
V_VT(pVarResult) = VT_BSTR;
|
||||
V_BSTR(pVarResult) = NULL;
|
||||
ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), NULL, &dwLen)) == ERROR_SUCCESS)
|
||||
{
|
||||
szString = msi_alloc((++dwLen)*sizeof(WCHAR));
|
||||
if (szString)
|
||||
{
|
||||
if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
|
||||
if (!(szString = msi_alloc((++dwLen)*sizeof(WCHAR))))
|
||||
ERR("Out of memory\n");
|
||||
else if ((ret = MsiGetPropertyW(This->msiHandle, V_BSTR(&varg0), szString, &dwLen)) == ERROR_SUCCESS)
|
||||
V_BSTR(pVarResult) = SysAllocString(szString);
|
||||
msi_free(szString);
|
||||
}
|
||||
}
|
||||
if (ret != ERROR_SUCCESS)
|
||||
ERR("MsiGetProperty returned %d\n", ret);
|
||||
} else if (wFlags & DISPATCH_PROPERTYPUT) {
|
||||
|
|
Loading…
Reference in New Issue