msi: automation: Fix SummaryInfo::Property get to conform to native.

oldstable
Misha Koshelev 2007-06-01 20:06:55 -05:00 committed by Alexandre Julliard
parent f2c10a530c
commit 0c503defcf
2 changed files with 35 additions and 42 deletions

View File

@ -764,17 +764,15 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
if (pid == PID_CODEPAGE || (pid >= PID_PAGECOUNT && pid <= PID_CHARCOUNT) || pid == PID_SECURITY)
{
ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, &value,
NULL, NULL, NULL);
if (ret != ERROR_SUCCESS)
return DISP_E_EXCEPTION;
if (pid == PID_CODEPAGE)
if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, &value,
NULL, NULL, NULL)) != ERROR_SUCCESS)
ERR("MsiSummaryInfoGetProperty returned %d\n", ret);
else if (type == VT_I2)
{
V_VT(pVarResult) = VT_I2;
V_I2(pVarResult) = value;
}
else
else if (type == VT_I4)
{
V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) = value;
@ -785,44 +783,43 @@ static HRESULT WINAPI SummaryInfoImpl_Invoke(
LPWSTR str;
DWORD size = 0;
ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, NULL,
NULL, szEmpty, &size);
if (ret != ERROR_MORE_DATA)
return DISP_E_EXCEPTION;
str = msi_alloc(++size * sizeof(WCHAR));
if (!str)
return DISP_E_EXCEPTION;
ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, NULL,
NULL, str, &size);
if (ret != ERROR_SUCCESS)
if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, NULL,
NULL, szEmpty, &size)) == ERROR_MORE_DATA)
{
if (!(str = msi_alloc(++size * sizeof(WCHAR))))
ERR("Out of memory\n");
else if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, NULL,
NULL, str, &size)) == ERROR_SUCCESS)
{
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocString(str);
}
msi_free(str);
return DISP_E_EXCEPTION;
}
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocString(str);
msi_free(str);
if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA)
ERR("MsiSummaryInfoGetProperty returned %d\n", ret);
}
else if (pid >= PID_EDITTIME && pid <= PID_LASTSAVE_DTM)
{
FILETIME ft;
FILETIME ft, ftlocal;
SYSTEMTIME st;
DATE date;
ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, &value,
&ft, NULL, NULL);
if (ret != ERROR_SUCCESS)
return DISP_E_EXCEPTION;
if ((ret = MsiSummaryInfoGetPropertyW(This->msiHandle, pid, &type, &value,
&ft, NULL, NULL)) != ERROR_SUCCESS)
ERR("MsiSummaryInfoGetProperty returned %d\n", ret);
else if (type == VT_FILETIME)
{
FileTimeToLocalFileTime(&ft, &ftlocal);
FileTimeToSystemTime(&ftlocal, &st);
SystemTimeToVariantTime(&st, &date);
FileTimeToSystemTime(&ft, &st);
SystemTimeToVariantTime(&st, &date);
V_VT(pVarResult) = VT_DATE;
V_DATE(pVarResult) = date;
V_VT(pVarResult) = VT_DATE;
V_DATE(pVarResult) = date;
}
}
else if (pid != PID_DICTIONARY && pid != PID_THUMBNAIL)
return DISP_E_EXCEPTION;
}
else return DISP_E_MEMBERNOTFOUND;
break;

View File

@ -1289,7 +1289,7 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
else if (vt == VT_I4)
ok(V_I4(&varresult) == entry->iValue, "SummaryInfo_Property (pid %d) I4 result expected to be %d, but was %d\n",
entry->property, entry->iValue, V_I4(&varresult));
else if (vt == VT_DATE) todo_wine
else if (vt == VT_DATE)
{
SYSTEMTIME st;
FILETIME ft;
@ -1312,11 +1312,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
/* Invalid pids */
hr = SummaryInfo_PropertyGet(pSummaryInfo, -1, &varresult, VT_EMPTY);
todo_wine ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
ok_exception(hr, szPropertyException);
hr = SummaryInfo_PropertyGet(pSummaryInfo, 1000, &varresult, VT_EMPTY);
todo_wine ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
ok_exception(hr, szPropertyException);
/* Unsupported pids */
@ -1327,21 +1327,17 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
/* Pids we have not set, one for each type */
_invoke_todo_vtResult = 1;
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CODEPAGE, &varresult, VT_EMPTY);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_TITLE, &varresult, VT_EMPTY);
todo_wine ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_EDITTIME, &varresult, VT_EMPTY);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CHARCOUNT, &varresult, VT_EMPTY);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
_invoke_todo_vtResult = 0;
}
static void test_Database(IDispatch *pDatabase)