Author: akhaldi
Date: Sun Sep 17 22:56:37 2017
New Revision: 75892
URL:
http://svn.reactos.org/svn/reactos?rev=75892&view=rev
Log:
[OLEAUT32] Sync with Wine Staging 2.16. CORE-13762
8da116d oleaut32: Don't copy uninitialized data.
0dde882 oleaut32: Use variable with the correct type in LIST_FOR_EACH_ENTRY_SAFE macro.
840ab7c oleaut32: Simplify VarCat implementation.
538e46a oleaut32: Improve support for IDispatch in VarCat.
cf45f3b oleaut32: Add an arguments check to LoadTypeLibEx.
4be8d83 oleaut32: Make VARIANT_GetLocalisedText() static.
Modified:
trunk/reactos/dll/win32/oleaut32/tmarshal.c
trunk/reactos/dll/win32/oleaut32/typelib.c
trunk/reactos/dll/win32/oleaut32/variant.c
trunk/reactos/dll/win32/oleaut32/variant.h
trunk/reactos/dll/win32/oleaut32/vartype.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/oleaut32/tmarshal.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/tmarsha…
==============================================================================
--- trunk/reactos/dll/win32/oleaut32/tmarshal.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/oleaut32/tmarshal.c [iso-8859-1] Sun Sep 17 22:56:37 2017
@@ -1127,7 +1127,7 @@
DWORD x;
hres = xbuf_get(buf,(LPBYTE)&x,sizeof(DWORD));
if (hres) ERR("Failed to read integer 4 byte\n");
- memcpy(arg,&x,2);
+ else memcpy(arg,&x,2);
}
if (debugout) TRACE_(olerelay)("%04x", *(WORD *)arg);
return hres;
@@ -1137,7 +1137,7 @@
DWORD x;
hres = xbuf_get(buf,(LPBYTE)&x,sizeof(DWORD));
if (hres) ERR("Failed to read integer 4 byte\n");
- memcpy(arg,&x,1);
+ else memcpy(arg,&x,1);
}
if (debugout) TRACE_(olerelay)("%02x", *(BYTE *)arg);
return hres;
Modified: trunk/reactos/dll/win32/oleaut32/typelib.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
==============================================================================
--- trunk/reactos/dll/win32/oleaut32/typelib.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/oleaut32/typelib.c [iso-8859-1] Sun Sep 17 22:56:37 2017
@@ -4809,10 +4809,9 @@
if (!ref)
{
TLBImpLib *pImpLib, *pImpLibNext;
- TLBRefType *ref_type;
+ TLBRefType *ref_type, *ref_type_next;
TLBString *tlbstr, *tlbstr_next;
TLBGuid *tlbguid, *tlbguid_next;
- void *cursor2;
int i;
/* remove cache entry */
@@ -4862,7 +4861,7 @@
heap_free(pImpLib);
}
- LIST_FOR_EACH_ENTRY_SAFE(ref_type, cursor2, &This->ref_list, TLBRefType,
entry)
+ LIST_FOR_EACH_ENTRY_SAFE(ref_type, ref_type_next, &This->ref_list,
TLBRefType, entry)
{
list_remove(&ref_type->entry);
heap_free(ref_type);
Modified: trunk/reactos/dll/win32/oleaut32/variant.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/variant…
==============================================================================
--- trunk/reactos/dll/win32/oleaut32/variant.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/oleaut32/variant.c [iso-8859-1] Sun Sep 17 22:56:37 2017
@@ -497,6 +497,22 @@
return SafeArrayCopy(V_ARRAY(ps), &V_ARRAY(pd));
return DISP_E_TYPEMISMATCH;
+}
+
+static HRESULT VARIANT_FetchDispatchValue(LPVARIANT pvDispatch, LPVARIANT pValue)
+{
+ HRESULT hres;
+ static DISPPARAMS emptyParams = { NULL, NULL, 0, 0 };
+
+ if ((V_VT(pvDispatch) & VT_TYPEMASK) == VT_DISPATCH) {
+ if (NULL == V_DISPATCH(pvDispatch)) return DISP_E_TYPEMISMATCH;
+ hres = IDispatch_Invoke(V_DISPATCH(pvDispatch), DISPID_VALUE, &IID_NULL,
+ LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, &emptyParams, pValue,
+ NULL, NULL);
+ } else {
+ hres = DISP_E_TYPEMISMATCH;
+ }
+ return hres;
}
/******************************************************************************
@@ -2485,23 +2501,21 @@
*/
HRESULT WINAPI VarCat(LPVARIANT left, LPVARIANT right, LPVARIANT out)
{
- VARTYPE leftvt,rightvt,resultvt;
+ BSTR left_str = NULL, right_str = NULL;
+ VARTYPE leftvt, rightvt;
HRESULT hres;
- static const WCHAR sz_empty[] = {'\0'};
+
+ TRACE("%s,%s,%p)\n", debugstr_variant(left), debugstr_variant(right),
out);
+
leftvt = V_VT(left);
rightvt = V_VT(right);
- TRACE("%s,%s,%p)\n", debugstr_variant(left), debugstr_variant(right),
out);
-
/* when both left and right are NULL the result is NULL */
if (leftvt == VT_NULL && rightvt == VT_NULL)
{
V_VT(out) = VT_NULL;
return S_OK;
}
-
- hres = S_OK;
- resultvt = VT_EMPTY;
/* There are many special case for errors and return types */
if (leftvt == VT_VARIANT && (rightvt == VT_ERROR ||
@@ -2528,7 +2542,7 @@
rightvt == VT_UINT || rightvt == VT_EMPTY ||
rightvt == VT_NULL || rightvt == VT_DATE ||
rightvt == VT_DECIMAL || rightvt == VT_DISPATCH))
- resultvt = VT_BSTR;
+ hres = S_OK;
else if (rightvt == VT_ERROR && leftvt < VT_VOID)
hres = DISP_E_TYPEMISMATCH;
else if (leftvt == VT_ERROR && (rightvt == VT_DATE ||
@@ -2558,72 +2572,72 @@
/* if result type is not S_OK, then no need to go further */
if (hres != S_OK)
{
- V_VT(out) = resultvt;
+ V_VT(out) = VT_EMPTY;
return hres;
}
- /* Else proceed with formatting inputs to strings */
+
+ if (leftvt == VT_BSTR)
+ left_str = V_BSTR(left);
else
{
- VARIANT bstrvar_left, bstrvar_right;
- V_VT(out) = VT_BSTR;
-
- VariantInit(&bstrvar_left);
- VariantInit(&bstrvar_right);
-
- /* Convert left side variant to string */
- if (leftvt != VT_BSTR)
+ VARIANT converted, *tmp = left;
+
+ VariantInit(&converted);
+ if(leftvt == VT_DISPATCH)
{
- /* Fill with empty string for later concat with right side */
- if (leftvt == VT_NULL)
- {
- V_VT(&bstrvar_left) = VT_BSTR;
- V_BSTR(&bstrvar_left) = SysAllocString(sz_empty);
- }
- else
- {
- hres =
VariantChangeTypeEx(&bstrvar_left,left,0,VARIANT_ALPHABOOL|VARIANT_LOCALBOOL,VT_BSTR);
- if (hres != S_OK) {
- VariantClear(&bstrvar_left);
- VariantClear(&bstrvar_right);
- return hres;
- }
- }
+ hres = VARIANT_FetchDispatchValue(left, &converted);
+ if(FAILED(hres))
+ goto failed;
+
+ tmp = &converted;
}
- /* convert right side variant to string */
- if (rightvt != VT_BSTR)
+ hres = VariantChangeTypeEx(&converted, tmp, 0,
VARIANT_ALPHABOOL|VARIANT_LOCALBOOL, VT_BSTR);
+ if (SUCCEEDED(hres))
+ left_str = V_BSTR(&converted);
+ else if (hres != DISP_E_TYPEMISMATCH)
{
- /* Fill with empty string for later concat with right side */
- if (rightvt == VT_NULL)
- {
- V_VT(&bstrvar_right) = VT_BSTR;
- V_BSTR(&bstrvar_right) = SysAllocString(sz_empty);
- }
- else
- {
- hres =
VariantChangeTypeEx(&bstrvar_right,right,0,VARIANT_ALPHABOOL|VARIANT_LOCALBOOL,VT_BSTR);
- if (hres != S_OK) {
- VariantClear(&bstrvar_left);
- VariantClear(&bstrvar_right);
- return hres;
- }
- }
+ VariantClear(&converted);
+ goto failed;
}
-
- /* Concat the resulting strings together */
- if (leftvt == VT_BSTR && rightvt == VT_BSTR)
- VarBstrCat (V_BSTR(left), V_BSTR(right), &V_BSTR(out));
- else if (leftvt != VT_BSTR && rightvt != VT_BSTR)
- VarBstrCat (V_BSTR(&bstrvar_left), V_BSTR(&bstrvar_right),
&V_BSTR(out));
- else if (leftvt != VT_BSTR && rightvt == VT_BSTR)
- VarBstrCat (V_BSTR(&bstrvar_left), V_BSTR(right), &V_BSTR(out));
- else if (leftvt == VT_BSTR && rightvt != VT_BSTR)
- VarBstrCat (V_BSTR(left), V_BSTR(&bstrvar_right), &V_BSTR(out));
-
- VariantClear(&bstrvar_left);
- VariantClear(&bstrvar_right);
- return S_OK;
- }
+ }
+
+ if (rightvt == VT_BSTR)
+ right_str = V_BSTR(right);
+ else
+ {
+ VARIANT converted, *tmp = right;
+
+ VariantInit(&converted);
+ if(rightvt == VT_DISPATCH)
+ {
+ hres = VARIANT_FetchDispatchValue(right, &converted);
+ if(FAILED(hres))
+ goto failed;
+
+ tmp = &converted;
+ }
+
+ hres = VariantChangeTypeEx(&converted, tmp, 0,
VARIANT_ALPHABOOL|VARIANT_LOCALBOOL, VT_BSTR);
+ if (SUCCEEDED(hres))
+ right_str = V_BSTR(&converted);
+ else if (hres != DISP_E_TYPEMISMATCH)
+ {
+ VariantClear(&converted);
+ goto failed;
+ }
+ }
+
+
+ V_VT(out) = VT_BSTR;
+ hres = VarBstrCat(left_str, right_str, &V_BSTR(out));
+
+failed:
+ if(V_VT(left) != VT_BSTR)
+ SysFreeString(left_str);
+ if(V_VT(right) != VT_BSTR)
+ SysFreeString(right_str);
+ return hres;
}
@@ -2847,22 +2861,6 @@
return E_FAIL;
}
#undef _VARCMP
-}
-
-static HRESULT VARIANT_FetchDispatchValue(LPVARIANT pvDispatch, LPVARIANT pValue)
-{
- HRESULT hres;
- static DISPPARAMS emptyParams = { NULL, NULL, 0, 0 };
-
- if ((V_VT(pvDispatch) & VT_TYPEMASK) == VT_DISPATCH) {
- if (NULL == V_DISPATCH(pvDispatch)) return DISP_E_TYPEMISMATCH;
- hres = IDispatch_Invoke(V_DISPATCH(pvDispatch), DISPID_VALUE, &IID_NULL,
- LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, &emptyParams, pValue,
- NULL, NULL);
- } else {
- hres = DISP_E_TYPEMISMATCH;
- }
- return hres;
}
/**********************************************************************
Modified: trunk/reactos/dll/win32/oleaut32/variant.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/variant…
==============================================================================
--- trunk/reactos/dll/win32/oleaut32/variant.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/oleaut32/variant.h [iso-8859-1] Sun Sep 17 22:56:37 2017
@@ -113,7 +113,6 @@
} VARIANT_NUMBER_CHARS;
unsigned int get_type_size(ULONG*, VARTYPE) DECLSPEC_HIDDEN;
-BOOL VARIANT_GetLocalisedText(LANGID, DWORD, WCHAR *) DECLSPEC_HIDDEN;
HRESULT VARIANT_ClearInd(VARIANTARG *) DECLSPEC_HIDDEN;
BOOL get_date_format(LCID, DWORD, const SYSTEMTIME *,
const WCHAR *, WCHAR *, int) DECLSPEC_HIDDEN;
Modified: trunk/reactos/dll/win32/oleaut32/vartype.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/vartype…
==============================================================================
--- trunk/reactos/dll/win32/oleaut32/vartype.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/oleaut32/vartype.c [iso-8859-1] Sun Sep 17 22:56:37 2017
@@ -6051,7 +6051,7 @@
* Get a localized string from the resources
*
*/
-BOOL VARIANT_GetLocalisedText(LANGID langId, DWORD dwId, WCHAR *lpszDest)
+static BOOL VARIANT_GetLocalisedText(LANGID langId, DWORD dwId, WCHAR *lpszDest)
{
HRSRC hrsrc;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Sep 17 22:56:37 2017
@@ -141,7 +141,7 @@
reactos/dll/win32/odbccp32 # Synced to WineStaging-2.9
reactos/dll/win32/ole32 # Synced to WineStaging-2.16
reactos/dll/win32/oleacc # Synced to WineStaging-2.9
-reactos/dll/win32/oleaut32 # Synced to WineStaging-2.9
+reactos/dll/win32/oleaut32 # Synced to WineStaging-2.16
reactos/dll/win32/olecli32 # Synced to WineStaging-2.9
reactos/dll/win32/oledlg # Synced to WineStaging-2.9
reactos/dll/win32/olepro32 # Synced to WineStaging-2.9