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

View File

@ -1289,7 +1289,7 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
else if (vt == VT_I4) 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", 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)); entry->property, entry->iValue, V_I4(&varresult));
else if (vt == VT_DATE) todo_wine else if (vt == VT_DATE)
{ {
SYSTEMTIME st; SYSTEMTIME st;
FILETIME ft; FILETIME ft;
@ -1312,11 +1312,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
/* Invalid pids */ /* Invalid pids */
hr = SummaryInfo_PropertyGet(pSummaryInfo, -1, &varresult, VT_EMPTY); 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); ok_exception(hr, szPropertyException);
hr = SummaryInfo_PropertyGet(pSummaryInfo, 1000, &varresult, VT_EMPTY); 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); ok_exception(hr, szPropertyException);
/* Unsupported pids */ /* 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); ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
/* Pids we have not set, one for each type */ /* Pids we have not set, one for each type */
_invoke_todo_vtResult = 1;
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CODEPAGE, &varresult, VT_EMPTY); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CODEPAGE, &varresult, VT_EMPTY);
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_TITLE, &varresult, VT_EMPTY); 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); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_EDITTIME, &varresult, VT_EMPTY);
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_CHARCOUNT, &varresult, VT_EMPTY); hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_CHARCOUNT, &varresult, VT_EMPTY);
ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr); ok(hr == S_OK, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
_invoke_todo_vtResult = 0;
} }
static void test_Database(IDispatch *pDatabase) static void test_Database(IDispatch *pDatabase)