MSVCRT calling convention issue

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon May 5 08:58:18 CDT 2003


>>>>> "us" == us  <us at the-edmeades.demon.co.uk> writes:

    >>> The problem revolves around the function
    >>> MSVCRT_type_info_raw_name. This is defined as stdcall, but
    >>> disassembling the windows version, it clearly shows use of a calling
    >>> convention I had never heard of, 'thiscall'. According to the MSDN,
    >>> thiscall is stdcall BUT the 'this' pointer on x86 machines is stored
    >>> in the ECX register.

    >> We have the -register adder in the spec file. Look at e.g. how
    >> __CxxFrameHandler is defined in msvcrt.spec and implemented in
    >> dlls/msvcrt/cppexcept.c.

    us> Thanks Uwe - I took a look, but cannot see what this actually does
    us> (nor how to use it). It appears the spec entry means we end up with
    us> an extra layer of indirection, but I really cant see how else it
    us> works!

Have a look at winebuild.man.

All the occurances of type_info should be replaces like in the patch for
MSVCRT_type_info_raw_name below. I am not sure if we need to add the -i386
flag. 

Will you do the cleanup and submit the more complete patch?

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.71
diff -u -r1.71 msvcrt.spec
--- wine/dlls/msvcrt/msvcrt.spec	20 Mar 2003 23:47:25 -0000	1.71
+++ wine/dlls/msvcrt/msvcrt.spec	5 May 2003 13:51:31 -0000
@@ -44,7 +44,7 @@
 @ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0 at Z@Z(ptr) MSVCRT__set_se_translator
 @ stub ?before at type_info@@QBEHABV1@@Z #(ptr ptr) stdcall
 @ stdcall ?name at type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_name
-@ stdcall ?raw_name at type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_raw_name
+@ stdcall -register ?raw_name at type_info@@QBEPBDXZ ()MSVCRT_type_info_raw_name
 @ cdecl ?set_new_handler@@YAP6AXXZP6AXXZ at Z(ptr) MSVCRT__set_new_handler
 @ cdecl ?set_terminate@@YAP6AXXZP6AXXZ at Z(ptr) MSVCRT_set_terminate
 @ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ at Z(ptr) MSVCRT_set_unexpected
Index: wine/dlls/msvcrt/cpp.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/cpp.c,v
retrieving revision 1.12
diff -u -r1.12 cpp.c
--- wine/dlls/msvcrt/cpp.c	19 Jul 2002 03:24:50 -0000	1.12
+++ wine/dlls/msvcrt/cpp.c	5 May 2003 13:51:32 -0000
@@ -412,10 +412,11 @@
 /******************************************************************
  *		?raw_name at type_info@@QBEPBDXZ (MSVCRT.@)
  */
-const char * __stdcall MSVCRT_type_info_raw_name(type_info * _this)
+void __stdcall MSVCRT_type_info_raw_name(CONTEXT86* context)
 {
+  type_info * _this = (type_info *) context->Ecx;
   TRACE("(%p) returning %s\n",_this,_this->name);
-  return _this->name;
+  context->Eax= (DWORD)_this->name;
 }
 
 



More information about the wine-devel mailing list