comctl32.dll: Running siap and modules under wine, first steps

Alex Villací­s Lasso a_villacis at
Mon Sep 26 13:00:46 CDT 2005

Maximiliano Curia wrote:

>I'm trying to use a program called "siap"[1] under wine. It's the required 
>program to pay taxes that the Argentinian government uses.
>So, it's quite important for the free software community in Argentina to be 
>able to use it in a free software environment. However, I haven't heard 
>of any real success on it, so far.
>I've been trying to make it run using winetools[2], and differents versions of 
>wine. The furthest I've gone, has been with version 20050310 and all the 
>"plugins" that winetools provides, installed.
I found some free time to investigate the SIAP program issue. As I can 
the SIAP package is a software program to prepare and submit taxes for the
government of Argentina. This software is written in MS Visual Basic 5.

When an attempt is made to run the program without any overrides with the
current CVS (2005/09/23), the following messages appear (with 

trace:ole:ITypeLib2_fnRelease (0x7cb9f198)->(1)
trace:ole:LoadTypeLib (L"C:\\ARCHIVOS DE 
trace:ole:LoadTypeLibEx (L"C:\\ARCHIVOS DE 
trace:ole:LoadTypeLibEx File L"C:\\ARCHIVOS DE 
trace:ole:TLB_ReadTypeLib cache hit
trace:ole:ITypeLib2_fnAddRef (0x7cb9f198)->ref was 1
trace:ole:LoadTypeLibEx  returns 00000000
trace:ole:LoadRegTypeLib (IID: {00028c01-0000-0000-0000-000000000046}) 
load SUCCESS (0x7cb9f198)
trace:ole:ITypeLib2_fnGetTypeInfoOfGuid (0x7cb9f198)
    guid:    {00028c02-0000-0000-0000-000000000046})
trace:ole:ITypeLib2_fnGetTypeInfoOfGuid -- found (0x7cbb3bd8, 
trace:ole:ITypeLib2_fnAddRef (0x7cb9f198)->ref was 2
trace:ole:ITypeInfo_fnAddRef (0x7cbb3bd8)->ref is 3
trace:ole:ITypeLib2_fnRelease (0x7cb9f198)->(2)
trace:ole:ITypeInfo_fnGetTypeAttr (0x7cbb3bd8)
trace:ole:ITypeInfo_fnReleaseTypeAttr (0x7cbb3bd8)->(0x7fdb8e58)
trace:ole:ITypeInfo_fnGetFuncDesc (0x7cbb3bd8) index 0
trace:ole:ITypeInfo_fnReleaseFuncDesc (0x7cbb3bd8)->(0x7cbb3d48)
trace:ole:ITypeInfo_fnGetFuncDesc (0x7cbb3bd8) index 1
trace:ole:ITypeInfo_fnReleaseFuncDesc (0x7cbb3bd8)->(0x7cbb4eb8)
trace:ole:ITypeInfo_fnGetFuncDesc (0x7cbb3bd8) index 12
fixme:ole:ITypeInfo_fnGetRefTypeInfo Can't find pRefType for ref 19
trace:ole:ITypeInfo_fnGetRefTypeInfo (0x7cbb3bd8) hreftype 0x0019 loaded 
FAILURE (0x7ca52dc8)
wine: Unhandled exception (thread 0009), starting debugger...
WineDbg starting on pid 0x8
Unhandled exception: page fault on read access to 0x00000010 in 32-bit 
code (0x230f4f61).
In 32 bit mode.
Register dump:
 CS:0073 SS:007b DS:007b ES:007b FS:1007 GS:0033
 EIP:230f4f61 ESP:7fa5f5bc EBP:7fa5f624 EFLAGS:00010202(   - 00      - -RI1)
 EAX:00000004 EBX:00000020 ECX:7fa5f5d0 EDX:7ca52dc8
 ESI:7ca52ddc EDI:7ca52b70
Stack dump:
0x7fa5f5bc:  7ca52dc8 7fa5f5d0 7ca52df8 7cbb3bd8
0x7fa5f5cc:  7ca52dc8 7fa5f624 230f4ae8 7cbb3bd8
0x7fa5f5dc:  7ca52ddc 7cbb5048 7ca52b70 7ca505a0
0x7fa5f5ec:  7f6bb480 7f6857a0 7f686444 00000000
0x7fa5f5fc:  7fdb8e58 0000000c 00000032 00000011
0x7fa5f60c:  7ca52b88 7ca52b70 7cbb5028 7fa5f660
0200: sel=1007 base=7fe9a000 limit=00001fff 32-bit rw-
=>1 0x230f4f61 in dbgrid32.ocx (+0x34f61) (0x7fa5f624)
  2 0x230e9c2f in dbgrid32.ocx (+0x29c2f) (0x7fa5f66c)
  3 0x230e7573 in dbgrid32.ocx (+0x27573) (0x7fa5f6b4)
  4 0x230c3bee in dbgrid32.ocx (+0x3bee) (0x7fa5f6e8)
  5 0x230cd0a9 in dbgrid32.ocx (+0xd0a9) (0x7fa5f754)
err:dbghelp:pe_load_dbg_file -Unable to peruse .DBG file MSVBVM50.dbg 
  6 0x0f045840 in msvbvm50 (+0x45840) (0x7fa5f7a4)
  7 0x0f046096 in msvbvm50 (+0x46096) (0x7fa5f7b4)
  8 0x0f0293dd in msvbvm50 (+0x293dd) (0x7fa5f7f4)
  9 0x0f028f7b in msvbvm50 (+0x28f7b) (0x7fa5f824)
  10 0x0f028e6e in msvbvm50 (+0x28e6e) (0x7fa5f858)
  11 0x0f028ed5 in msvbvm50 (+0x28ed5) (0x7fa5f890)
  12 0x0f029feb in msvbvm50 (+0x29feb) (0x7fa5f8c8)
  13 0x0f029b4e in msvbvm50 (+0x29b4e) (0x7fa5f928)
  14 0x0f029a57 in msvbvm50 (+0x29a57) (0x7fa5f94c)
  15 0x0f0299e9 in msvbvm50 (+0x299e9) (0x7fa5f96c)
  16 0x0f023e77 in msvbvm50 (+0x23e77) (0x7fa5f9a4)
  17 0x0f027329 in msvbvm50 (+0x27329) (0x7f1e5420)
  18 0x00000000 (0x0f10e1f0)
0x230f4f61: call    *0xc(%eax)
fixme:winedbg:be_i386_is_func_call Unsupported yet call insn (0x10) at 

This result suggests that builtin oleaut32 is unable to cope with the 
embedded in DBGRID32.OCX. When *both* native oleaut32 and ole32 are 
used, the
program starts up normally.

The following test was made: with MS Visual Basic 6 SP6, I made a sample 
that includes a Data control, a DBGrid control from DBGRID32.OCX, and a 
MDB file to query into the DBGrid. This sample program crashes in the 
exact same
way as the SIAP package when no overrides are used, and also runs 
correctly when
native ole32 and oleaut32 are used. After some trial and error, I came 
up with
the following patch:

--- wine-20050830-cvs/dlls/oleaut32/typelib.c   2005-09-21 
10:39:22.000000000 -0500
+++ wine-20050830-cvs-patch/dlls/oleaut32/typelib.c     2005-09-24 
20:34:32.000000000 -0500
@@ -5207,9 +5207,11 @@
     ITypeInfoImpl *This = (ITypeInfoImpl *)iface;
     HRESULT result = E_FAIL;

-    if (hRefType == -1 &&
+    if ((hRefType == -1 &&
        (((ITypeInfoImpl*) This)->TypeAttr.typekind   == TKIND_DISPATCH) &&
-       (((ITypeInfoImpl*) This)->TypeAttr.wTypeFlags &  TYPEFLAG_FDUAL))
+       (((ITypeInfoImpl*) This)->TypeAttr.wTypeFlags &  TYPEFLAG_FDUAL)) ||
+       ((((ITypeInfoImpl*) This)->TypeAttr.typekind   == TKIND_DISPATCH) &&
+             (((ITypeInfoImpl*) This)->TypeAttr.wTypeFlags &  
          /* when we meet a DUAL dispinterface, we must create the interface
          * version of it.

This patch executes the "create interface" code when typekind == 
and wTypeFlags has TYPEFLAG_FDISPATCHABLE, regardless of the value of 
in addition to the previous condition. With this patch, the native oleaut32
requirement is removed. The typelib test still passes - not that it 
tests the change in code (more on this later). One more VB6 application 
I wrote
also works correctly before as well as after the change. However, I 
don't know
enough about typelibs to evaluate whether the previous code was wrong or 
the change is the "right" thing to do. I must note that the test program 
requires native ole32 - when an attempt to run it is made otherwise, the
CLASS_E_NOAGGREGATION error is triggered from OleCreateDefaultHandler() in
defaulthandler.c (what is the purpose of this error anyway?).

BTW, is there a way to extract an IDL definition from a binary OCX file? 
could be a basis to build a more complete test for typelib - there is a
difference between native and wine that DBGRID32.OCX depends upon
(please ignore, I found out about oleview.exe in Visual Studio, but I am 
still curious
about whether the bug "corrected" above is in fact exposed by the IDL of 
problematic control).

UPDATE: The OleCreateDefaultHandler routine seems to be in error in 
the CLASS_E_NOAGGREGATION error in the DBGRID32.OCX case. If I read the 
correctly (and *please* tell me so if I am not), the aggregation case
(pUnkOuter != NULL) is forbidden when riid is other than IID_IUnknown, and
therefore the test is reversed from what it should be:

--- wine-20050830-cvs/dlls/ole32/defaulthandler.c    2005-09-23 
10:51:36.000000000 -0500
+++ wine-20050830-cvs-patch/dlls/ole32/defaulthandler.c    2005-09-25 
19:19:31.000000000 -0500
@@ -1422,7 +1422,7 @@
    * This is necessary because it's the only time the non-delegating
    * IUnknown pointer can be returned to the outside.
-  if (pUnkOuter && IsEqualIID(&IID_IUnknown, riid))
+  if (pUnkOuter && !IsEqualIID(&IID_IUnknown, riid))

This patch allows the DBGrid test to move to the next error: the
DataCache_GetAdvise function crashes after the above patch is applied, 
this->sinkInterface is NULL at the time of call, but it does not make 
any check
for it:

--- wine-20050830-cvs/dlls/ole32/datacache.c    2005-07-27 
10:49:38.000000000 -0500
+++ wine-20050830-cvs-patch/dlls/ole32/datacache.c    2005-09-25 
19:45:48.000000000 -0500
@@ -1390,9 +1390,11 @@
   if (ppAdvSink!=NULL)
-    IAdviseSink_QueryInterface(this->sinkInterface,
+    if (this->sinkInterface != NULL)
+        IAdviseSink_QueryInterface(this->sinkInterface,
+    else *ppAdvSink = NULL;
   return S_OK;

With the above two patches, the DBGrid test sheds all dependencies on native
oleaut32 *and* ole32. In addition, the SIAP package is freed from the 
on native ole32. I will try to investigate later the remaining dependency on
native oleaut32.

Mr. Maximiliano Curia, could you please indicate where to get sample 
modules for SIAP? The default installer
doesn't seem to come with any modules inside. Of course, this might be 
yet another Wine bug, so please confirm.

Alex Villacís Lasso

More information about the wine-devel mailing list