Commit dcbd8e93 authored by Misha Koshelev's avatar Misha Koshelev Committed by Alexandre Julliard

msi: automation: Implement SummaryInfo::Property, put.

parent aaa7fd9e
......@@ -742,10 +742,13 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
UINT* puArgErr)
{
UINT ret;
VARIANTARG varg0;
VARIANTARG varg0, varg1;
FILETIME ft, ftlocal;
SYSTEMTIME st;
HRESULT hr;
VariantInit(&varg0);
VariantInit(&varg1);
switch (dispIdMember)
{
......@@ -755,8 +758,6 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
UINT type;
INT value;
DWORD size = 0;
FILETIME ft, ftlocal;
SYSTEMTIME st;
DATE date;
LPWSTR str;
......@@ -779,10 +780,6 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
break;
case VT_I2:
V_VT(pVarResult) = VT_I2;
V_I2(pVarResult) = value;
break;
case VT_I4:
V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) = value;
......@@ -815,6 +812,49 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
ERR("Unhandled variant type %d\n", type);
}
}
else if (wFlags & DISPATCH_PROPERTYPUT)
{
UINT posValue = DISPID_PROPERTYPUT;
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
hr = DispGetParam_CopyOnly(pDispParams, &posValue, &varg1);
if (FAILED(hr))
{
*puArgErr = posValue;
return hr;
}
switch (V_VT(&varg1))
{
case VT_I2:
case VT_I4:
ret = MsiSummaryInfoSetPropertyW(This->msiHandle, V_I4(&varg0), V_VT(&varg1), V_I4(&varg1), NULL, NULL);
break;
case VT_DATE:
VariantTimeToSystemTime(V_DATE(&varg1), &st);
SystemTimeToFileTime(&st, &ftlocal);
LocalFileTimeToFileTime(&ftlocal, &ft);
ret = MsiSummaryInfoSetPropertyW(This->msiHandle, V_I4(&varg0), VT_FILETIME, 0, &ft, NULL);
break;
case VT_BSTR:
ret = MsiSummaryInfoSetPropertyW(This->msiHandle, V_I4(&varg0), VT_LPSTR, 0, NULL, V_BSTR(&varg1));
break;
default:
FIXME("Unhandled variant type %d\n", V_VT(&varg1));
VariantClear(&varg1);
return DISP_E_EXCEPTION;
}
if (ret != ERROR_SUCCESS)
{
ERR("MsiSummaryInfoSetPropertyW returned %d\n", ret);
return DISP_E_EXCEPTION;
}
}
else return DISP_E_MEMBERNOTFOUND;
break;
......@@ -822,7 +862,9 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
return DISP_E_MEMBERNOTFOUND;
}
VariantClear(&varg1);
VariantClear(&varg0);
return S_OK;
}
......
......@@ -157,6 +157,10 @@ library WindowsInstaller
methods:
[id(DISPID_SUMMARYINFO_PROPERTY), propget]
VARIANT Property([in] long Pid);
[id(DISPID_SUMMARYINFO_PROPERTY), propput]
void Property(
[in] long Pid,
[in] VARIANT rhs);
}
typedef enum {
......
......@@ -1379,18 +1379,16 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
{
/* SummaryInfo::Property, put; one for each type */
_invoke_todo_vtResult = 1;
/* VT_I2 */
VariantInit(&var);
V_VT(&var) = VT_I2;
V_I2(&var) = 1;
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_CODEPAGE, &var);
todo_wine ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CODEPAGE, &varresult, VT_I4 /* NOT VT_I2 */);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
todo_wine ok(V_I2(&var) == V_I2(&varresult), "SummaryInfo_PropertyGet expected %d, but returned %d\n", V_I2(&var), V_I2(&varresult));
ok(V_I2(&var) == V_I2(&varresult), "SummaryInfo_PropertyGet expected %d, but returned %d\n", V_I2(&var), V_I2(&varresult));
VariantClear(&varresult);
VariantClear(&var);
......@@ -1398,11 +1396,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(szTitle);
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_TITLE, &var);
todo_wine ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_TITLE, &varresult, V_VT(&var));
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
todo_wine ok_w2("SummaryInfo_PropertyGet expected %s, but returned %s\n", V_BSTR(&var), V_BSTR(&varresult));
ok_w2("SummaryInfo_PropertyGet expected %s, but returned %s\n", V_BSTR(&var), V_BSTR(&varresult));
VariantClear(&varresult);
VariantClear(&var);
......@@ -1411,10 +1409,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
FileTimeToSystemTime(&systemtime, &st);
SystemTimeToVariantTime(&st, &V_DATE(&var));
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_LASTSAVE_DTM, &var);
todo_wine ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_LASTSAVE_DTM, &varresult, V_VT(&var));
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
/* FIXME: Off by one second */
todo_wine ok(V_DATE(&var) == V_DATE(&varresult), "SummaryInfo_PropertyGet expected %lf, but returned %lf\n", V_DATE(&var), V_DATE(&varresult));
VariantClear(&varresult);
VariantClear(&var);
......@@ -1423,15 +1422,13 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
V_VT(&var) = VT_I4;
V_I4(&var) = 1000;
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_CHARCOUNT, &var);
todo_wine ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CHARCOUNT, &varresult, V_VT(&var));
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
todo_wine ok(V_I4(&var) == V_I4(&varresult), "SummaryInfo_PropertyGet expected %d, but returned %d\n", V_I4(&var), V_I4(&varresult));
ok(V_I4(&var) == V_I4(&varresult), "SummaryInfo_PropertyGet expected %d, but returned %d\n", V_I4(&var), V_I4(&varresult));
VariantClear(&varresult);
VariantClear(&var);
_invoke_todo_vtResult = 0;
}
}
......
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