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

This commit is contained in:
Misha Koshelev 2007-06-04 09:26:45 -05:00 committed by Alexandre Julliard
parent aaa7fd9e11
commit dcbd8e93d5
3 changed files with 61 additions and 18 deletions

View File

@ -742,10 +742,13 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
UINT* puArgErr) UINT* puArgErr)
{ {
UINT ret; UINT ret;
VARIANTARG varg0; VARIANTARG varg0, varg1;
FILETIME ft, ftlocal;
SYSTEMTIME st;
HRESULT hr; HRESULT hr;
VariantInit(&varg0); VariantInit(&varg0);
VariantInit(&varg1);
switch (dispIdMember) switch (dispIdMember)
{ {
@ -755,8 +758,6 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
UINT type; UINT type;
INT value; INT value;
DWORD size = 0; DWORD size = 0;
FILETIME ft, ftlocal;
SYSTEMTIME st;
DATE date; DATE date;
LPWSTR str; LPWSTR str;
@ -779,10 +780,6 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
break; break;
case VT_I2: case VT_I2:
V_VT(pVarResult) = VT_I2;
V_I2(pVarResult) = value;
break;
case VT_I4: case VT_I4:
V_VT(pVarResult) = VT_I4; V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) = value; V_I4(pVarResult) = value;
@ -815,6 +812,49 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
ERR("Unhandled variant type %d\n", type); 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; else return DISP_E_MEMBERNOTFOUND;
break; break;
@ -822,7 +862,9 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
return DISP_E_MEMBERNOTFOUND; return DISP_E_MEMBERNOTFOUND;
} }
VariantClear(&varg1);
VariantClear(&varg0); VariantClear(&varg0);
return S_OK; return S_OK;
} }

View File

@ -157,6 +157,10 @@ library WindowsInstaller
methods: methods:
[id(DISPID_SUMMARYINFO_PROPERTY), propget] [id(DISPID_SUMMARYINFO_PROPERTY), propget]
VARIANT Property([in] long Pid); VARIANT Property([in] long Pid);
[id(DISPID_SUMMARYINFO_PROPERTY), propput]
void Property(
[in] long Pid,
[in] VARIANT rhs);
} }
typedef enum { typedef enum {

View File

@ -1379,18 +1379,16 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
{ {
/* SummaryInfo::Property, put; one for each type */ /* SummaryInfo::Property, put; one for each type */
_invoke_todo_vtResult = 1;
/* VT_I2 */ /* VT_I2 */
VariantInit(&var); VariantInit(&var);
V_VT(&var) = VT_I2; V_VT(&var) = VT_I2;
V_I2(&var) = 1; V_I2(&var) = 1;
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_CODEPAGE, &var); 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 */); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CODEPAGE, &varresult, VT_I4 /* NOT VT_I2 */);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); 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(&varresult);
VariantClear(&var); VariantClear(&var);
@ -1398,11 +1396,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
V_VT(&var) = VT_BSTR; V_VT(&var) = VT_BSTR;
V_BSTR(&var) = SysAllocString(szTitle); V_BSTR(&var) = SysAllocString(szTitle);
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_TITLE, &var); 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)); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_TITLE, &varresult, V_VT(&var));
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); 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(&varresult);
VariantClear(&var); VariantClear(&var);
@ -1411,10 +1409,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
FileTimeToSystemTime(&systemtime, &st); FileTimeToSystemTime(&systemtime, &st);
SystemTimeToVariantTime(&st, &V_DATE(&var)); SystemTimeToVariantTime(&st, &V_DATE(&var));
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_LASTSAVE_DTM, &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)); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_LASTSAVE_DTM, &varresult, V_VT(&var));
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); 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)); 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(&varresult);
VariantClear(&var); VariantClear(&var);
@ -1423,15 +1422,13 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
V_VT(&var) = VT_I4; V_VT(&var) = VT_I4;
V_I4(&var) = 1000; V_I4(&var) = 1000;
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_CHARCOUNT, &var); 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)); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CHARCOUNT, &varresult, V_VT(&var));
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); 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(&varresult);
VariantClear(&var); VariantClear(&var);
_invoke_todo_vtResult = 0;
} }
} }