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

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jun 4 08:14:34 CDT 2007


Module: wine
Branch: master
Commit: 0c503defcff6fa6e7c4a1d630eefa44f6d924126
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c503defcff6fa6e7c4a1d630eefa44f6d924126

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Fri Jun  1 20:06:55 2007 -0500

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

---

 dlls/msi/automation.c       |   65 ++++++++++++++++++++----------------------
 dlls/msi/tests/automation.c |   12 ++-----
 2 files changed, 35 insertions(+), 42 deletions(-)

diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index 95fb8c4..52474d4 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -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;
-
-                    FileTimeToSystemTime(&ft, &st);
-                    SystemTimeToVariantTime(&st, &date);
+                    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);
 
-                    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;
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index 69cb9c6..5f6f667 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -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)




More information about the wine-cvs mailing list