https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d506c2af65ee33ce0483f17ff7866dc400ec36b8

commit d506c2af65ee33ce0483f17ff7866dc400ec36b8
Author:     Amine Khaldi <[email protected]>
AuthorDate: Sun Mar 4 13:14:52 2018 +0100
Commit:     Amine Khaldi <[email protected]>
CommitDate: Sun Mar 4 13:14:52 2018 +0100

    [OLEAUT32] Sync with Wine Staging 3.3. CORE-14434
---
 dll/win32/oleaut32/connpt.c       |  17 ++-
 dll/win32/oleaut32/dispatch.c     |  18 ++-
 dll/win32/oleaut32/hash.c         |  10 +-
 dll/win32/oleaut32/oleaut.c       |  23 +++-
 dll/win32/oleaut32/olefont.c      |  24 +++-
 dll/win32/oleaut32/olepicture.c   |  28 +++-
 dll/win32/oleaut32/olepropframe.c |  21 ++-
 dll/win32/oleaut32/precomp.h      |   3 +-
 dll/win32/oleaut32/recinfo.c      |  15 ++-
 dll/win32/oleaut32/resource.h     |   3 +-
 dll/win32/oleaut32/safearray.c    |  14 +-
 dll/win32/oleaut32/tmarshal.c     |  29 +++-
 dll/win32/oleaut32/typelib.c      | 275 ++++++++++++++++++++++++++++++++++----
 dll/win32/oleaut32/typelib.h      |  26 +---
 dll/win32/oleaut32/usrmarshal.c   |  18 ++-
 dll/win32/oleaut32/varformat.c    |  14 +-
 dll/win32/oleaut32/variant.c      |  32 +++--
 dll/win32/oleaut32/variant.h      |   4 +
 dll/win32/oleaut32/vartype.c      |  14 +-
 media/doc/README.WINE             |   2 +-
 20 files changed, 499 insertions(+), 91 deletions(-)

diff --git a/dll/win32/oleaut32/connpt.c b/dll/win32/oleaut32/connpt.c
index d16dd16dba..0405d3857c 100644
--- a/dll/win32/oleaut32/connpt.c
+++ b/dll/win32/oleaut32/connpt.c
@@ -22,9 +22,22 @@
  * comments just above that function for information.
  */
 
-#include "precomp.h"
-
 #include <assert.h>
+#include <stdarg.h>
+#include <string.h>
+
+#define COBJMACROS
+
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "olectl.h"
+#include "connpt.h"
+
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
diff --git a/dll/win32/oleaut32/dispatch.c b/dll/win32/oleaut32/dispatch.c
index 1331d1c447..a666d3dba1 100644
--- a/dll/win32/oleaut32/dispatch.c
+++ b/dll/win32/oleaut32/dispatch.c
@@ -19,7 +19,23 @@
  *
  */
 
-#include "precomp.h"
+#include "config.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "oleauto.h"
+#include "winerror.h"
+
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
diff --git a/dll/win32/oleaut32/hash.c b/dll/win32/oleaut32/hash.c
index 9099948d80..43043980ad 100644
--- a/dll/win32/oleaut32/hash.c
+++ b/dll/win32/oleaut32/hash.c
@@ -18,8 +18,14 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
-
-#include "precomp.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+#include "objbase.h"
+#include "oaidl.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
diff --git a/dll/win32/oleaut32/oleaut.c b/dll/win32/oleaut32/oleaut.c
index 349a64da61..ee3ff27336 100644
--- a/dll/win32/oleaut32/oleaut.c
+++ b/dll/win32/oleaut32/oleaut.c
@@ -18,12 +18,29 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include "config.h"
 
-#include <initguid.h>
-#include <oleaut32_oaidl.h>
+#include <stdarg.h>
+#include <string.h>
+#include <limits.h>
 
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winerror.h"
+
+#include "ole2.h"
+#include "olectl.h"
+#include "oleauto.h"
+#include "initguid.h"
 #include "typelib.h"
+#include "oleaut32_oaidl.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 WINE_DECLARE_DEBUG_CHANNEL(heap);
diff --git a/dll/win32/oleaut32/olefont.c b/dll/win32/oleaut32/olefont.c
index abb48d93a3..c20093c702 100644
--- a/dll/win32/oleaut32/olefont.c
+++ b/dll/win32/oleaut32/olefont.c
@@ -21,8 +21,28 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
-
-#include "precomp.h"
+#include <assert.h>
+#include <stdarg.h>
+#include <string.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "wine/list.h"
+#include "wine/unicode.h"
+#include "objbase.h"
+#include "oleauto.h"    /* for SysAllocString(....) */
+#include "ole2.h"
+#include "olectl.h"
+#include "wine/debug.h"
+#include "connpt.h" /* for CreateConnectionPoint */
+#include "oaidl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
diff --git a/dll/win32/oleaut32/olepicture.c b/dll/win32/oleaut32/olepicture.c
index 878fd18292..96304e0644 100644
--- a/dll/win32/oleaut32/olepicture.c
+++ b/dll/win32/oleaut32/olepicture.c
@@ -36,14 +36,34 @@
  *
  */
 
-#include "precomp.h"
+#include "config.h"
+#include "wine/port.h"
 
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
-
-#include <initguid.h>
-#include <wincodec.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "olectl.h"
+#include "oleauto.h"
+#include "connpt.h"
+#include "urlmon.h"
+#include "initguid.h"
+#include "wincodec.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+#include "wine/library.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(olepicture);
 
diff --git a/dll/win32/oleaut32/olepropframe.c 
b/dll/win32/oleaut32/olepropframe.c
index 5cb83e40ec..ecffdc9218 100644
--- a/dll/win32/oleaut32/olepropframe.c
+++ b/dll/win32/oleaut32/olepropframe.c
@@ -19,9 +19,18 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
 
-#include <oledlg.h>
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "ole2.h"
+#include "olectl.h"
+#include "oledlg.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
@@ -177,7 +186,7 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS 
lpParams)
             lpParams->lplpUnk, lpParams->cPages, lpParams->lpPages,
             lpParams->lcid, lpParams->dispidInitialProperty);
 
-    if(!lpParams->lplpUnk || !lpParams->lpPages)
+    if(!lpParams->lpPages)
         return E_POINTER;
 
     if(lpParams->cbStructSize != sizeof(OCPFIPARAMS)) {
@@ -279,7 +288,7 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect(LPOCPFIPARAMS 
lpParams)
         res = IPropertyPage_SetObjects(property_page[i],
                 lpParams->cObjects, lpParams->lplpUnk);
         if(FAILED(res))
-            continue;
+            WARN("SetObjects() failed, hr %#x.\n", res);
 
         res = IPropertyPage_GetPageInfo(property_page[i], &page_info);
         if(FAILED(res))
@@ -299,10 +308,8 @@ HRESULT WINAPI 
OleCreatePropertyFrameIndirect(LPOCPFIPARAMS lpParams)
     PropertySheetW(&property_sheet);
 
     for(i=0; i<lpParams->cPages; i++) {
-        if(property_page[i]) {
-            IPropertyPage_SetPageSite(property_page[i], NULL);
+        if(property_page[i])
             IPropertyPage_Release(property_page[i]);
-        }
     }
 
     HeapFree(GetProcessHeap(), 0, dialogs);
diff --git a/dll/win32/oleaut32/precomp.h b/dll/win32/oleaut32/precomp.h
index cc22ae2745..c5d3cb15e1 100644
--- a/dll/win32/oleaut32/precomp.h
+++ b/dll/win32/oleaut32/precomp.h
@@ -1,3 +1,4 @@
+
 #ifndef _OLEAUT32_PCH_
 #define _OLEAUT32_PCH_
 
@@ -28,4 +29,4 @@
 #include "variant.h"
 #include "resource.h"
 
-#endif /* _OLEAUT32_PCH_ */
+#endif /* !_OLEAUT32_PCH_ */
diff --git a/dll/win32/oleaut32/recinfo.c b/dll/win32/oleaut32/recinfo.c
index 46fa3d1e38..ec65a523e3 100644
--- a/dll/win32/oleaut32/recinfo.c
+++ b/dll/win32/oleaut32/recinfo.c
@@ -16,7 +16,20 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "oaidl.h"
+#include "oleauto.h"
+#include "variant.h"
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
diff --git a/dll/win32/oleaut32/resource.h b/dll/win32/oleaut32/resource.h
index daf3a4b3a4..550170afc6 100644
--- a/dll/win32/oleaut32/resource.h
+++ b/dll/win32/oleaut32/resource.h
@@ -17,10 +17,11 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
-
 #ifndef WINE_OLEAUT32_RESOURCE_H
 #define WINE_OLEAUT32_RESOURCE_H
 
+#include <windef.h>
+
 /* Localised boolean text */
 #define IDS_TRUE  100
 #define IDS_FALSE 101
diff --git a/dll/win32/oleaut32/safearray.c b/dll/win32/oleaut32/safearray.c
index 1a9109170a..01dbfc3417 100644
--- a/dll/win32/oleaut32/safearray.c
+++ b/dll/win32/oleaut32/safearray.c
@@ -31,7 +31,19 @@
  *  0x10: SAFEARRAYBOUNDS[0...]
  */
 
-#include "precomp.h"
+#include "config.h"
+
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winerror.h"
+#include "winbase.h"
+#include "variant.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(variant);
 
diff --git a/dll/win32/oleaut32/tmarshal.c b/dll/win32/oleaut32/tmarshal.c
index 7a085f1fa2..7530f66c9b 100644
--- a/dll/win32/oleaut32/tmarshal.c
+++ b/dll/win32/oleaut32/tmarshal.c
@@ -21,11 +21,32 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
-
+#include "config.h"
+#include "wine/port.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+#include "winreg.h"
+#include "winuser.h"
+
+#include "ole2.h"
+#include "propidl.h" /* for LPSAFEARRAY_User* functions */
 #include "typelib.h"
-
-#include <wine/exception.h>
+#include "variant.h"
+#include "wine/debug.h"
+#include "wine/exception.h"
 
 static const WCHAR IDispatchW[] = { 'I','D','i','s','p','a','t','c','h',0};
 
diff --git a/dll/win32/oleaut32/typelib.c b/dll/win32/oleaut32/typelib.c
index 4f2fa47924..4a609d7050 100644
--- a/dll/win32/oleaut32/typelib.c
+++ b/dll/win32/oleaut32/typelib.c
@@ -47,12 +47,34 @@
  *
  */
 
-#include "precomp.h"
-
-#include <winternl.h>
-#include <lzexpand.h>
-
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <ctype.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+#include "winreg.h"
+#include "winuser.h"
+#include "winternl.h"
+#include "lzexpand.h"
+
+#include "wine/unicode.h"
+#include "objbase.h"
 #include "typelib.h"
+#include "wine/debug.h"
+#include "variant.h"
+#include "wine/heap.h"
+#include "wine/list.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 WINE_DECLARE_DEBUG_CHANNEL(typelib);
@@ -2415,7 +2437,7 @@ MSFT_DoFuncs(TLBContext*     pcx,
         ptfd->funcdesc.callconv   =  (pFuncRec->FKCCIC) >> 8 & 0xF;
         ptfd->funcdesc.cParams    =   pFuncRec->nrargs  ;
         ptfd->funcdesc.cParamsOpt =   pFuncRec->nroargs ;
-        ptfd->funcdesc.oVft       =   pFuncRec->VtableOffset & ~1;
+        ptfd->funcdesc.oVft       =   (pFuncRec->VtableOffset & ~1) * 
sizeof(void *) / pTI->pTypeLib->ptr_size;
         ptfd->funcdesc.wFuncFlags =   LOWORD(pFuncRec->Flags) ;
 
         /* nameoffset is sometimes -1 on the second half of a propget/propput
@@ -3501,10 +3523,6 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID 
pLib, DWORD dwTLBLength)
     /* name, eventually add to a hash table */
     pTypeLibImpl->Name = MSFT_ReadName(&cx, tlbHeader.NameOffset);
 
-    TRACE("%s, syskind %d, version %d.%d, flags %04x\n",
-        debugstr_w(pTypeLibImpl->Name->str), pTypeLibImpl->syskind,
-        pTypeLibImpl->ver_major, pTypeLibImpl->ver_minor, 
pTypeLibImpl->libflags);
-
     /* help info */
     pTypeLibImpl->DocString = MSFT_ReadString(&cx, tlbHeader.helpstring);
     pTypeLibImpl->HelpFile = MSFT_ReadString(&cx, tlbHeader.helpfile);
@@ -4241,7 +4259,7 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, 
ITypeInfoImpl *pTI,
        pFuncDesc->funcdesc.callconv = pFunc->nacc & 0x7;
        pFuncDesc->funcdesc.cParams = pFunc->nacc >> 3;
        pFuncDesc->funcdesc.cParamsOpt = (pFunc->retnextopt & 0x7e) >> 1;
-       pFuncDesc->funcdesc.oVft = pFunc->vtblpos & ~1;
+       pFuncDesc->funcdesc.oVft = (pFunc->vtblpos & ~1) * sizeof(void *) / 
pTI->pTypeLib->ptr_size;
         if (pFunc->helpstring != 0xffff)
             pFuncDesc->HelpString = decode_string(hlp_strings, pBlk + 
pFunc->helpstring, pNameTable - pBlk, pTI->pTypeLib);
 
@@ -6531,6 +6549,44 @@ DWORD _invoke(FARPROC func, CALLCONV callconv, int 
nrargs, DWORD_PTR *args)
     return res;
 }
 
+#elif defined(__arm__)
+
+extern LONGLONG CDECL call_method( void *func, int nb_stk_args, const DWORD 
*stk_args, const DWORD *reg_args );
+__ASM_GLOBAL_FUNC( call_method,
+                    /* r0 = *func
+                     * r1 = nb_stk_args
+                     * r2 = *stk_args (pointer to 'nb_stk_args' DWORD values 
to push on stack)
+                     * r3 = *reg_args (pointer to 8, 64-bit d0-d7 (double) 
values OR as 16, 32-bit s0-s15 (float) values, followed by 4, 32-bit (DWORD) 
r0-r3 values)
+                     */
+
+                    "push {fp, lr}\n\t"             /* Save frame pointer and 
return address (stack still aligned to 8 bytes) */
+                    "mov fp, sp\n\t"                /* Save stack pointer as 
our frame for cleaning the stack on return */
+
+                    "lsls r1, r1, #2\n\t"           /* r1 = nb_stk_args * 
sizeof(DWORD) */
+                    "beq 1f\n\t"                    /* Skip allocation if no 
stack args */
+                    "add r2, r2, r1\n"              /* Calculate ending 
address of incoming stack data */
+                    "2:\tldr ip, [r2, #-4]!\n\t"    /* Get next value */
+                    "str ip, [sp, #-4]!\n\t"        /* Push it on the stack */
+                    "subs r1, r1, #4\n\t"           /* Decrement count */
+                    "bgt 2b\n\t"                    /* Loop till done */
+
+                    "1:\n\t"
+#ifndef __SOFTFP__
+                    "vldm r3!, {s0-s15}\n\t"        /* Load the s0-s15/d0-d7 
arguments */
+#endif
+                    "mov ip, r0\n\t"                /* Save the function call 
address to ip before we nuke r0 with arguments to pass */
+                    "ldm r3, {r0-r3}\n\t"           /* Load the r0-r3 
arguments */
+
+                    "blx ip\n\t"                    /* Call the target 
function */
+
+                    "mov sp, fp\n\t"                /* Clean the stack using 
fp */
+                    "pop {fp, pc}\n\t"              /* Restore fp and return */
+                )
+
+/* same function but returning single/double floating point */
+static float (CDECL * const call_float_method)(void *, int, const DWORD *, 
const DWORD *) = (void *)call_method;
+static double (CDECL * const call_double_method)(void *, int, const DWORD *, 
const DWORD *) = (void *)call_method;
+
 #endif  /* __x86_64__ */
 
 static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, const TYPEDESC 
*tdesc, VARTYPE *vt)
@@ -6562,7 +6618,6 @@ static HRESULT userdefined_to_variantvt(ITypeInfo *tinfo, 
const TYPEDESC *tdesc,
         break;
 
     case TKIND_ALIAS:
-        tdesc = &tattr->tdescAlias;
         hr = typedescvt_to_variantvt(tinfo2, &tattr->tdescAlias, vt);
         break;
 
@@ -6956,6 +7011,182 @@ DispCallFunc(
     TRACE("retval: %s\n", debugstr_variant(pvargResult));
     return S_OK;
 
+#elif defined(__arm__)
+    int argspos;
+    void *func;
+    UINT i;
+    DWORD *args;
+    struct {
+#ifndef __SOFTFP__
+        union {
+            float s[16];
+            double d[8];
+        } sd;
+#endif
+        DWORD r[4];
+    } regs;
+    int rcount;     /* 32-bit register index count */
+#ifndef __SOFTFP__
+    int scount = 0; /* single-precision float register index count */
+    int dcount = 0; /* double-precision float register index count */
+#endif
+
+    TRACE("(%p, %ld, %d, %d, %d, %p, %p, %p (vt=%d))\n",
+        pvInstance, oVft, cc, vtReturn, cActuals, prgvt, prgpvarg, 
pvargResult, V_VT(pvargResult));
+
+    if (cc != CC_STDCALL && cc != CC_CDECL)
+    {
+        FIXME("unsupported calling convention %d\n",cc);
+        return E_INVALIDARG;
+    }
+
+    argspos = 0;
+    rcount = 0;
+
+    /* Determine if we need to pass a pointer for the return value as arg 0.  
If so, do that */
+    /*  first as it will need to be in the 'r' registers:                      
              */
+    switch (vtReturn)
+    {
+    case VT_DECIMAL:
+    case VT_VARIANT:
+        regs.r[rcount++] = (DWORD)pvargResult;  /* arg 0 is a pointer to the 
result */
+        break;
+    case VT_HRESULT:
+        WARN("invalid return type %u\n", vtReturn);
+        return E_INVALIDARG;
+    default:                    /* And all others are in 'r', 's', or 'd' 
registers or have no return value */
+        break;
+    }
+
+    if (pvInstance)
+    {
+        const FARPROC *vtable = *(FARPROC **)pvInstance;
+        func = vtable[oVft/sizeof(void *)];
+        regs.r[rcount++] = (DWORD)pvInstance; /* the This pointer is always 
the first parameter */
+    }
+    else func = (void *)oVft;
+
+    /* maximum size for an argument is sizeof(VARIANT).  Also allow for return 
pointer and stack alignment. */
+    args = heap_alloc( sizeof(VARIANT) * cActuals + sizeof(DWORD) * 4 );
+
+    for (i = 0; i < cActuals; i++)
+    {
+        VARIANT *arg = prgpvarg[i];
+        DWORD *pdwarg = (DWORD *)(arg);     /* a reinterpret_cast of the 
variant, used for copying structures when they are split between registers and 
stack */
+        int ntemp;              /* Used for counting words split between 
registers and stack */
+
+        switch (prgvt[i])
+        {
+        case VT_EMPTY:
+            break;
+        case VT_R8:             /* these must be 8-byte aligned, and put in 
'd' regs or stack, as they are double-floats */
+        case VT_DATE:
+#ifndef __SOFTFP__
+            dcount = max( (scount + 1) / 2, dcount );
+            if (dcount < 8)
+            {
+                regs.sd.d[dcount++] = V_R8(arg);
+            }
+            else
+            {
+                argspos += (argspos % 2);   /* align argspos to 8-bytes */
+                memcpy( &args[argspos], &V_R8(arg), sizeof(V_R8(arg)) );
+                argspos += sizeof(V_R8(arg)) / sizeof(DWORD);
+            }
+            break;
+#endif
+        case VT_I8:             /* these must be 8-byte aligned, and put in 
'r' regs or stack, as they are long-longs */
+        case VT_UI8:
+        case VT_CY:
+            if (rcount < 3)
+            {
+                rcount += (rcount % 2);     /* align rcount to 8-byte register 
pair */
+                memcpy( &regs.r[rcount], &V_UI8(arg), sizeof(V_UI8(arg)) );
+                rcount += sizeof(V_UI8(arg)) / sizeof(DWORD);
+            }
+            else
+            {
+                rcount = 4;                 /* Make sure we flag that all 'r' 
regs are full */
+                argspos += (argspos % 2);   /* align argspos to 8-bytes */
+                memcpy( &args[argspos], &V_UI8(arg), sizeof(V_UI8(arg)) );
+                argspos += sizeof(V_UI8(arg)) / sizeof(DWORD);
+            }
+            break;
+        case VT_DECIMAL:        /* these structures are 8-byte aligned, and 
put in 'r' regs or stack, can be split between the two */
+        case VT_VARIANT:
+            /* 8-byte align 'r' and/or stack: */
+            if (rcount < 3)
+                rcount += (rcount % 2);
+            else
+            {
+                rcount = 4;
+                argspos += (argspos % 2);
+            }
+            ntemp = sizeof(*arg) / sizeof(DWORD);
+            while (ntemp > 0)
+            {
+                if (rcount < 4)
+                    regs.r[rcount++] = *pdwarg++;
+                else
+                    args[argspos++] = *pdwarg++;
+                --ntemp;
+            }
+            break;
+        case VT_BOOL:  /* VT_BOOL is 16-bit but BOOL is 32-bit, needs to be 
extended */
+            if (rcount < 4)
+                regs.r[rcount++] = V_BOOL(arg);
+            else
+                args[argspos++] = V_BOOL(arg);
+            break;
+        case VT_R4:             /* these must be 4-byte aligned, and put in 
's' regs or stack, as they are single-floats */
+#ifndef __SOFTFP__
+            if (!(scount % 2)) scount = max( scount, dcount * 2 );
+            if (scount < 16)
+                regs.sd.s[scount++] = V_R4(arg);
+            else
+                args[argspos++] = V_UI4(arg);
+            break;
+#endif
+        default:
+            if (rcount < 4)
+                regs.r[rcount++] = V_UI4(arg);
+            else
+                args[argspos++] = V_UI4(arg);
+            break;
+        }
+        TRACE("arg %u: type %s %s\n", i, debugstr_vt(prgvt[i]), 
debugstr_variant(arg));
+    }
+
+    argspos += (argspos % 2);   /* Make sure stack function alignment is 
8-byte */
+
+    switch (vtReturn)
+    {
+    case VT_EMPTY:      /* EMPTY = no return value */
+    case VT_DECIMAL:    /* DECIMAL and VARIANT already have a pointer argument 
passed (see above) */
+    case VT_VARIANT:
+        call_method( func, argspos, args, (DWORD*)&regs );
+        break;
+    case VT_R4:
+        V_R4(pvargResult) = call_float_method( func, argspos, args, 
(DWORD*)&regs );
+        break;
+    case VT_R8:
+    case VT_DATE:
+        V_R8(pvargResult) = call_double_method( func, argspos, args, 
(DWORD*)&regs );
+        break;
+    case VT_I8:
+    case VT_UI8:
+    case VT_CY:
+        V_UI8(pvargResult) = call_method( func, argspos, args, (DWORD*)&regs );
+        break;
+    default:
+        V_UI4(pvargResult) = call_method( func, argspos, args, (DWORD*)&regs );
+        break;
+    }
+    heap_free( args );
+    if (vtReturn != VT_VARIANT) V_VT(pvargResult) = vtReturn;
+    TRACE("retval: %s\n", debugstr_variant(pvargResult));
+    return S_OK;
+
 #else
     FIXME( "(%p, %ld, %d, %d, %d, %p, %p, %p (vt=%d)): not implemented for 
this CPU\n",
            pvInstance, oVft, cc, vtReturn, cActuals, prgvt, prgpvarg, 
pvargResult, V_VT(pvargResult));
@@ -7049,7 +7280,6 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
             UINT cNamedArgs = pDispParams->cNamedArgs;
             DISPID *rgdispidNamedArgs = pDispParams->rgdispidNamedArgs;
             UINT vargs_converted=0;
-            ULONG_PTR offset;
 
             hres = S_OK;
 
@@ -7298,11 +7528,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
                     break;
                 }
             }
-            if (FAILED(hres))
-            {
-                ERR("failed: %08x\n", hres);
-                goto func_fail; /* FIXME: we don't free changed types here */
-            }
+            if (FAILED(hres)) goto func_fail; /* FIXME: we don't free changed 
types here */
 
             /* VT_VOID is a special case for return types, so it is not
              * handled in the general function */
@@ -7315,16 +7541,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
                 if (FAILED(hres)) goto func_fail; /* FIXME: we don't free 
changed types here */
             }
 
-            offset = func_desc->oVft & 0xFFFC;
-#ifdef _WIN64
-            if (This->pTypeLib->syskind == SYS_WIN32)
-            {
-                offset *= 2;
-                TRACE("extended offset to %#lx for SYS_WIN32\n", offset);
-            }
-#endif
-            TRACE("func_desc->oVft %#x, offset %#lx\n", func_desc->oVft, 
offset);
-            hres = DispCallFunc(pIUnk, offset, func_desc->callconv,
+            hres = DispCallFunc(pIUnk, func_desc->oVft & 0xFFFC, 
func_desc->callconv,
                                 V_VT(&varresult), func_desc->cParams, rgvt,
                                 prgpvarg, &varresult);
 
@@ -7451,7 +7668,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
                      * pointer to be valid */
                     VariantInit(pVarResult);
                     hres = IDispatch_Invoke(pDispatch, DISPID_VALUE, &IID_NULL,
-                        GetSystemDefaultLCID(), INVOKE_PROPERTYGET,
+                        GetSystemDefaultLCID(), wFlags,
                         pDispParams, pVarResult, pExcepInfo, pArgErr);
                     IDispatch_Release(pDispatch);
                 }
diff --git a/dll/win32/oleaut32/typelib.h b/dll/win32/oleaut32/typelib.h
index 100e15a145..bfea174bc0 100644
--- a/dll/win32/oleaut32/typelib.h
+++ b/dll/win32/oleaut32/typelib.h
@@ -21,6 +21,12 @@
 #ifndef _WINE_TYPELIB_H
 #define _WINE_TYPELIB_H
 
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "oleauto.h"
+
 #define HELPDLLFLAG (0x0100)
 #define DO_NOT_SEEK (-1)
 
@@ -590,26 +596,6 @@ WORD typeofarray
 
 #include "poppack.h"
 
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc( SIZE_T size )
-{
-    return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero( SIZE_T size )
-{
-    return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
-}
-
-static inline void* __WINE_ALLOC_SIZE(2) heap_realloc( LPVOID mem, SIZE_T size 
)
-{
-    return HeapReAlloc( GetProcessHeap(), 0, mem, size );
-}
-
-static inline BOOL heap_free( LPVOID mem )
-{
-    return HeapFree( GetProcessHeap(), 0, mem );
-}
-
 HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const 
FUNCDESC **ppFuncDesc ) DECLSPEC_HIDDEN;
 
 extern DWORD _invoke(FARPROC func, CALLCONV callconv, int nrargs, DWORD_PTR 
*args) DECLSPEC_HIDDEN;
diff --git a/dll/win32/oleaut32/usrmarshal.c b/dll/win32/oleaut32/usrmarshal.c
index e42518a0dc..da524c85eb 100644
--- a/dll/win32/oleaut32/usrmarshal.c
+++ b/dll/win32/oleaut32/usrmarshal.c
@@ -19,7 +19,23 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include <stdarg.h>
+#include <string.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winerror.h"
+
+#include "ole2.h"
+#include "oleauto.h"
+#include "typelib.h"
+#include "ocidl.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
diff --git a/dll/win32/oleaut32/varformat.c b/dll/win32/oleaut32/varformat.c
index f701bfbf7d..696763e7ed 100644
--- a/dll/win32/oleaut32/varformat.c
+++ b/dll/win32/oleaut32/varformat.c
@@ -25,7 +25,19 @@
  *  Please submit a test case if you find a difference.
  */
 
-#include "precomp.h"
+#include "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wine/unicode.h"
+#include "winerror.h"
+#include "variant.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(variant);
 
diff --git a/dll/win32/oleaut32/variant.c b/dll/win32/oleaut32/variant.c
index 05818bcfd6..b9cf4b0a00 100644
--- a/dll/win32/oleaut32/variant.c
+++ b/dll/win32/oleaut32/variant.c
@@ -25,7 +25,23 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#include "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "windef.h"
+#include "winbase.h"
+#include "wine/unicode.h"
+#include "winerror.h"
+#include "variant.h"
+#include "resource.h"
+#include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(variant);
 
@@ -2145,7 +2161,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE 
*rgbDig,
         multiplier10, divisor10);
 
   if (dwVtBits & (INTEGER_VTBITS|VTBIT_DECIMAL) &&
-      (!fractionalDigits || !(dwVtBits & 
(REAL_VTBITS|VTBIT_CY|VTBIT_DECIMAL))))
+      (!fractionalDigits || !(dwVtBits & (REAL_VTBITS|VTBIT_DECIMAL))))
   {
     /* We have one or more integer output choices, and either:
      *  1) An integer input value, or
@@ -2259,7 +2275,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE 
*rgbDig,
           V_I8(pVarDst) = -ul64;
           return S_OK;
         }
-        else if ((dwVtBits & REAL_VTBITS) == VTBIT_DECIMAL)
+        else if ((dwVtBits & (REAL_VTBITS|VTBIT_DECIMAL)) == VTBIT_DECIMAL)
         {
           /* Decimal is only output choice left - fast path */
           V_VT(pVarDst) = VT_DECIMAL;
@@ -2321,7 +2337,7 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE 
*rgbDig,
         V_UI8(pVarDst) = ul64;
         return S_OK;
       }
-      else if ((dwVtBits & REAL_VTBITS) == VTBIT_DECIMAL)
+      else if ((dwVtBits & (REAL_VTBITS|VTBIT_DECIMAL)) == VTBIT_DECIMAL)
       {
         /* Decimal is only output choice left - fast path */
         V_VT(pVarDst) = VT_DECIMAL;
@@ -2376,8 +2392,8 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE 
*rgbDig,
     {
       if (whole < dblMinimums[10] && whole != 0)
       {
-        dwVtBits &= ~(VTBIT_R4|VTBIT_R8|VTBIT_CY); /* Underflow */
-        bOverflow = TRUE;
+        whole = 0; /* ignore underflow */
+        divisor10 = 0;
         break;
       }
       whole = whole / dblMultipliers[10];
@@ -2387,8 +2403,8 @@ HRESULT WINAPI VarNumFromParseNum(NUMPARSE *pNumprs, BYTE 
*rgbDig,
     {
       if (whole < dblMinimums[divisor10] && whole != 0)
       {
-        dwVtBits &= ~(VTBIT_R4|VTBIT_R8|VTBIT_CY); /* Underflow */
-        bOverflow = TRUE;
+        whole = 0; /* ignore underflow */
+        divisor10 = 0;
       }
       else
         whole = whole / dblMultipliers[divisor10];
diff --git a/dll/win32/oleaut32/variant.h b/dll/win32/oleaut32/variant.h
index d895a46012..df69c60ca6 100644
--- a/dll/win32/oleaut32/variant.h
+++ b/dll/win32/oleaut32/variant.h
@@ -20,6 +20,10 @@
 
 #pragma once
 
+#include "windef.h"
+#include "winerror.h"
+#include "objbase.h"
+#include "oleauto.h"
 #include <math.h>
 
 /* Get just the type from a variant pointer */
diff --git a/dll/win32/oleaut32/vartype.c b/dll/win32/oleaut32/vartype.c
index 3d07a277a4..eeef9922f2 100644
--- a/dll/win32/oleaut32/vartype.c
+++ b/dll/win32/oleaut32/vartype.c
@@ -18,7 +18,17 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include "precomp.h"
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winnt.h"
+#include "variant.h"
+#include "resource.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(variant);
 
@@ -5362,7 +5372,7 @@ static HRESULT VARIANT_DI_normalize(VARIANT_DI * val, int 
exponent2, BOOL isDoub
        end of the bit representation, down to the precision guaranteed by the
        floating point number. */
     if (isDouble) {
-        while (exponent10 < 0 && (val->bitsnum[2] != 0 || (val->bitsnum[2] == 
0 && (val->bitsnum[1] & 0xFFE00000) != 0))) {
+        while (exponent10 < 0 && (val->bitsnum[2] != 0 || (val->bitsnum[1] & 
0xFFE00000) != 0)) {
             int rem10;
 
             rem10 = VARIANT_int_divbychar(val->bitsnum, 3, 10);
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 7f2e9e6af6..d31a67f70f 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -141,7 +141,7 @@ reactos/dll/win32/odbc32              # Synced to 
WineStaging-2.9. Depends on po
 reactos/dll/win32/odbccp32            # Synced to WineStaging-2.9
 reactos/dll/win32/ole32               # Synced to Wine-3.0
 reactos/dll/win32/oleacc              # Synced to WineStaging-2.9
-reactos/dll/win32/oleaut32            # Synced to WineStaging-2.16
+reactos/dll/win32/oleaut32            # Synced to WineStaging-3.3
 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

Reply via email to