[Bug 27106] IMSSA EuroDEEM (VB6 app) fails on startup, reporting "Type MisMatch" error (VARIANT_Coerce: treat VT_NULL like VT_EMPTY when converting to VT_BSTR)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Jan 12 08:53:32 CST 2014


https://bugs.winehq.org/show_bug.cgi?id=27106

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|-unknown                    |oleaut32
            Summary|EuroDEEM: Fails to start    |IMSSA EuroDEEM (VB6 app)
                   |                            |fails on startup, reporting
                   |                            |"Type MisMatch" error
                   |                            |(VARIANT_Coerce: treat
                   |                            |VT_NULL like VT_EMPTY when
                   |                            |converting to VT_BSTR)

--- Comment #4 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming.

Prerequisites: 'winetricks -q mfc42 mdac28 jet40'

Additionally: 'wine odbcconf /f "c:\windows\system32\jetodbc.rsp"' (see my
comment #2)

Relevant part of trace log:

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/EuroDEEM International

$ WINEDEBUG=+tid,+seh,+relay,+snoop,+ole,+variant wine ./IMSSA.exe >>log.txt
2>&1
...
0028:CALL MSVBVM60.__vbaVarCat(0033f5cc,0033f5bc,0033f678) ret=007da24d
0028:Call oleaut32.VarCat(0033f678,0033f5bc,0033f5cc) ret=7350a374
0028:trace:variant:VarCat
(0x33f678->(VT_DISPATCH),0x33f5bc->(VT_BSTR),0x33f5cc)
0028:trace:variant:VariantInit (0x33f4b8)
0028:trace:variant:VariantInit (0x33f4a8)
0028:trace:variant:VariantChangeTypeEx
(0x33f4b8->(VT_EMPTY),0x33f678->(VT_DISPATCH),0x00000000,0x0000,VT_BSTR)
0028:trace:variant:VariantClear (0x33f418->(VT_EMPTY))
0028:trace:variant:VariantClear (0x33f408->(VT_EMPTY))
0028:trace:variant:VariantCopyInd
(0x33f408->(VT_EMPTY),0x33f678->(VT_DISPATCH))
0028:trace:variant:VariantCopy (0x33f408->(VT_EMPTY),0x33f678->(VT_DISPATCH))
0028:trace:variant:VariantClear (0x33f408->(VT_EMPTY))
0028:Call KERNEL32.InterlockedIncrement(012aded8) ret=1f444484
0028:Ret  KERNEL32.InterlockedIncrement() retval=00000002 ret=1f444484
0028:trace:variant:VARIANT_Coerce
(0x33f418->(VT_EMPTY),0x00000000,0x0000,0x33f408->(VT_DISPATCH),VT_BSTR)
0028:Call oleaut32.VariantInit(0033f0a4) ret=1f44d693
0028:trace:variant:VariantInit (0x33f0a4)
0028:Ret  oleaut32.VariantInit() retval=0033f0a4 ret=1f44d693
0028:Call ole32.SetErrorInfo(00000000,00000000) ret=1f6b8a03
0028:trace:ole:SetErrorInfo (0, (nil))
0028:Ret  ole32.SetErrorInfo() retval=00000000 ret=1f6b8a03
0028:CALL MSDATL3.?IsZombie at CBaseObjZombie@@QAEHXZ() ret=1f6b8a0f
0028:RET  MSDATL3.?IsZombie at CBaseObjZombie@@QAEHXZ() retval=00000000
ret=1f6b8a0f
0028:CALL
MSDATL3.?GetItemOfExtBuffer at CExtBuffer@@QAGXKPAX at Z(012b112c,00000006,0033f044)
ret=1f6b8a2e
0028:RET  MSDATL3.?GetItemOfExtBuffer at CExtBuffer@@QAGXKPAX at Z() retval=00000004
ret=1f6b8a2e
0028:CALL MSDATL3.?GetRowBuff at CSlotListShort@@UAIPAUtagRowBuff@@K at Z()
ret=1f6b8a3f
0028:RET  MSDATL3.?GetRowBuff at CSlotListShort@@UAIPAUtagRowBuff@@K at Z()
retval=08f800f8 ret=1f6b8a3f
0028:CALL MSDATL3.?IsValidSlot at CSlotListShort@@UAGJK at Z(012acba8,00000002)
ret=1f6b8a56
0028:RET  MSDATL3.?IsValidSlot at CSlotListShort@@UAGJK at Z() retval=00000000
ret=1f6b8a56
0028:Call oleaut32.VariantClear(0033f0a4) ret=1f53184f
0028:trace:variant:VariantClear (0x33f0a4->(VT_EMPTY))
0028:Ret  oleaut32.VariantClear() retval=00000000 ret=1f53184f
0028:trace:variant:VariantChangeTypeEx
(0x33f298->(VT_EMPTY),0x33f2a8->(VT_NULL),0x00000000,0x0000,VT_BSTR)
0028:trace:variant:VariantClear (0x33f208->(VT_EMPTY))
0028:trace:variant:VariantClear (0x33f1f8->(VT_EMPTY))
0028:trace:variant:VariantCopyInd (0x33f1f8->(VT_EMPTY),0x33f2a8->(VT_NULL))
0028:trace:variant:VariantCopy (0x33f1f8->(VT_EMPTY),0x33f2a8->(VT_NULL))
0028:trace:variant:VariantClear (0x33f1f8->(VT_EMPTY))
0028:trace:variant:VARIANT_Coerce
(0x33f208->(VT_EMPTY),0x00000000,0x0000,0x33f1f8->(VT_NULL),VT_BSTR)
0028:trace:variant:VariantClear (0x33f208->(VT_EMPTY))
0028:trace:variant:VariantClear (0x33f1f8->(VT_NULL))
0028:trace:variant:VariantChangeTypeEx returning 0x80020005,
0x33f298->(VT_EMPTY)
0028:trace:variant:VariantClear (0x33f2a8->(VT_NULL))
0028:trace:variant:VariantClear (0x33f418->(VT_EMPTY))
0028:trace:variant:VariantClear (0x33f408->(VT_DISPATCH))
0028:Call KERNEL32.InterlockedDecrement(012aded8) ret=1f4444b0
0028:Ret  KERNEL32.InterlockedDecrement() retval=00000001 ret=1f4444b0
0028:trace:variant:VariantChangeTypeEx returning 0x80020005,
0x33f4b8->(VT_EMPTY)
0028:trace:variant:VariantClear (0x33f4b8->(VT_EMPTY))
0028:trace:variant:VariantClear (0x33f4a8->(VT_EMPTY))
0028:Ret  oleaut32.VarCat() retval=80020005 ret=7350a374
...
0028:Call KERNEL32.MultiByteToWideChar(00000000,00000000,00487df8
"IMSSA_Canada",ffffffff,00000000,00000000) ret=73445432
0028:Ret  KERNEL32.MultiByteToWideChar() retval=0000000d ret=73445432
0028:Call oleaut32.SysAllocStringLen(00000000,0000000c) ret=7344543d
0028:trace:ole:SysAllocStringLen (null)
0028:Ret  oleaut32.SysAllocStringLen() retval=010ac034 ret=7344543d
0028:Call KERNEL32.MultiByteToWideChar(00000000,00000000,00487df8
"IMSSA_Canada",ffffffff,010ac034,0000000d) ret=73445455
0028:Ret  KERNEL32.MultiByteToWideChar() retval=0000000d ret=73445455
0028:Call KERNEL32.RaiseException(c000008f,00000001,00000002,0033f4e4)
ret=73444b1a
0028:trace:seh:raise_exception code=c000008f flags=1 addr=0x7b83a913
ip=7b83a913 tid=0028
0028:trace:seh:raise_exception  info[0]=deadcafe
0028:trace:seh:raise_exception  info[1]=deadcafe
0028:trace:seh:raise_exception  eax=7b826989 ebx=7b8ba000 ecx=deadcafe
edx=0033f44c esi=0033f4e4 edi=0033f4b0
0028:trace:seh:raise_exception  ebp=0033f488 esp=0033f424 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00200287
0028:trace:seh:call_stack_handlers calling handler at 0x40eaf6 code=c000008f
flags=1
...
0028:Call winex11.drv.SetWindowText(0001008c,010ac6e0 L"Error initializing
program: Type mismatch") ret=7ec9f739 
--- snip ---

Debugger session:

--- snip ---
Wine-dbg>b *0x0076303B

(3rd time hit)

Wine-dbg>bt
Backtrace:
=>0 0x7e7ec285 VARIANT_Coerce+0x231(pd=0x33f248, lcid=0, wFlags=0, ps=0x33f238,
vt=0x8) [/home/focht/projects/wine/wine-git/dlls/oleaut32/variant.c:98] in
oleaut32 (0x0033f1d8)
  1 0x7e7f03fc VariantChangeTypeEx+0x347(pvargDest=<couldn't compute location>,
pvargSrc=<couldn't compute location>, lcid=<couldn't compute location>,
wFlags=0, vt=0x8)
[/home/focht/projects/wine/wine-git/dlls/oleaut32/variant.c:1047] in oleaut32
(0x0033f288)
  2 0x7e7fe3dd VARIANT_FromDisp+0xea(pdispIn=0x108ded0, lcid=0, pOut=0x33f460,
vt=0x8, dwFlags=0)
[/home/focht/projects/wine/wine-git/dlls/oleaut32/vartype.c:132] in oleaut32
(0x0033f328)
  3 0x7e808955 VarBstrFromDisp+0x30(pdispIn=0x108ded0, lcid=0, dwFlags=0,
pbstrOut=0x33f460)
[/home/focht/projects/wine/wine-git/dlls/oleaut32/vartype.c:7061] in oleaut32
(0x0033f358)
  4 0x7e7ee76f VARIANT_Coerce+0x271a(pd=0x33f458, lcid=0, wFlags=0,
ps=0x33f448, vt=0x8)
[/home/focht/projects/wine/wine-git/dlls/oleaut32/variant.c:436] in oleaut32
(0x0033f3e8)
  5 0x7e7f03fc VariantChangeTypeEx+0x347(pvargDest=<couldn't compute location>,
pvargSrc=<couldn't compute location>, lcid=<couldn't compute location>,
wFlags=0, vt=0x8)
[/home/focht/projects/wine/wine-git/dlls/oleaut32/variant.c:1047] in oleaut32
(0x0033f498)
  6 0x7e7f4de5 VarCat+0x585(left=<couldn't compute location>, right=<couldn't
compute location>, out=<couldn't compute location>)
[/home/focht/projects/wine/wine-git/dlls/oleaut32/variant.c:2647] in oleaut32
(0x0033f538)
  7 0x7350a374 in msvbvm60 (+0xea373) (0x0033f584)
  8 0x007da24d in imssa (+0x3da24c) (0x0033f600)
  9 0x00763040 in imssa (+0x36303f) (0x0033f6ac)
  10 0x00762aa6 in imssa (+0x362aa5) (0x0033f744)
  11 0x00766966 in imssa (+0x366965) (0x0033f79c)
--- snip ---

__vbaVarCat: left=VT_DISPATCH, right=VT_BSTR

IDispatch_Invoke() succeeds and returns VT_NULL type for default 'value'
property (see MSDATL3 calls which happen during IDispatch invoke).

The problem is the conversion to VT_BSTR.

VARIANT_FromDisp() -> VariantChangeTypeEx() -> VARIANT_Coerce()

Wine doesn't handle the case VT_NULL -> VT_BSTR properly, leading to conversion
failure (DISP_E_TYPEMISMATCH).

Source:
http://source.winehq.org/git/wine.git/blob/8306518424a24a19c9c88d87f98fd3ac0024415a:/dlls/oleaut32/variant.c#l82

--- snip ---
82 static inline HRESULT VARIANT_Coerce(VARIANTARG* pd, LCID lcid, USHORT
wFlags,
83                                      VARIANTARG* ps, VARTYPE vt)
84 {
85   HRESULT res = DISP_E_TYPEMISMATCH;
86   VARTYPE vtFrom = V_TYPE(ps);
87   DWORD dwFlags = 0;
...
134  switch (vt)
135  {
...
413  case VT_BSTR:
414    switch (vtFrom)
415    {
416    case VT_EMPTY:
417      V_BSTR(pd) = SysAllocStringLen(NULL, 0);
418      return V_BSTR(pd) ? S_OK : E_OUTOFMEMORY;
...
437    }
438    break;
...
--- snip ---

I changed the code to treat VT_NULL like VT_EMPTY, creating empty bstr and it
helped the application to run.
Database selection works and forms can be filled (includes database queries).

$ sha1sum IMSSA_EuroDEEM.exe 
75d3cc6aac0c2673d537c026789ba012f61ca8a3  IMSSA_EuroDEEM.exe

$ du -sh IMSSA_EuroDEEM.exe 
25M    IMSSA_EuroDEEM.exe

$ wine --version
wine-1.7.10-343-g770d09d

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list