Rob Shearman : ole32: Only call IROTData::GetComparisonData once, like native does.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 28 07:40:33 CST 2006


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Thu Dec 28 02:41:56 2006 +0000

ole32: Only call IROTData::GetComparisonData once, like native does.

---

 dlls/ole32/moniker.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/moniker.c b/dlls/ole32/moniker.c
index 49de810..97f8914 100644
--- a/dlls/ole32/moniker.c
+++ b/dlls/ole32/moniker.c
@@ -45,6 +45,10 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
+/* see MSDN docs for IROTData::GetComparisonData, which states what this
+ * constant is (http://msdn2.microsoft.com/en-us/library/ms693773.aspx) */
+#define MAX_COMPARISON_DATA 2048
+
 /* define the structure of the running object table elements */
 struct rot_entry
 {
@@ -139,16 +143,14 @@ static HRESULT get_moniker_comparison_da
 {
     HRESULT hr;
     IROTData *pROTData = NULL;
-    ULONG size = 0;
+    ULONG size = MAX_COMPARISON_DATA;
     hr = IMoniker_QueryInterface(pMoniker, &IID_IROTData, (void *)&pROTData);
     if (hr != S_OK)
     {
         ERR("Failed to query moniker for IROTData interface, hr = 0x%08x\n", hr);
         return hr;
     }
-    IROTData_GetComparisonData(pROTData, NULL, 0, &size);
     *moniker_data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
-    (*moniker_data)->ulCntData = size;
     hr = IROTData_GetComparisonData(pROTData, (*moniker_data)->abData, size, &size);
     if (hr != S_OK)
     {
@@ -156,6 +158,7 @@ static HRESULT get_moniker_comparison_da
         HeapFree(GetProcessHeap(), 0, *moniker_data);
         return hr;
     }
+    (*moniker_data)->ulCntData = size;
     return S_OK;
 }
 




More information about the wine-cvs mailing list