BIG window problem
Hi all, I have a problem with the Matlab editor: If I open Tools/Font..., I get a ChooseFontA(). This ChooseFontA dialog however doesn't get focused. Instead its parent stays "focused" (i.e.: yellow border), but as soon as you try to select any other window, *ANY* focus in the whole WM is *COMPLETELY* gone. Wasn't some recent patch supposed to fix *all* focus problems ?? Some "facts": Call user32.9: BeginDeferWindowPos(0008) ret=5f40c21c fs=0247 Ret user32.9: BeginDeferWindowPos() retval=09a8 ret=5f40c21c fs=0247 Main window that should lose its focus, but doesn't: Call user32.522: SetWindowTextA(09a8,41151250 "MATLAB Editor/Debugger") ret=5f403bcf fs=0247 Call user32.83: CreateWindowExA(0200,41153e8c "RICHEDIT",5f4cbe22 "",553081c4,,,0064,0064,0e88,e900,0040,40c1691c) ret=5f409db7 fs=0247 -- hwnd 0x0f4c Call comdlg32.3: ChooseFontA(40c167c0) ret=5f4195f9 fs=0247 -- hwnd 0x1244 trace:relay:WINPROC_CallWndProc (wndproc=0x5f40219d,hwnd=0f4c,msg=WM_KILLFOCUS,wp=13b8,lp=) (sorry, this isn't too informative...) This is with current CVS and icewm_1.0.1-1. Dunno about older Wine versions. Sorry, I don't have too much time now to debug this/gather more info. I just wanted to let you know that there is a major problem. If somebody is interested, just mail me. Andreas Mohr
Re: Automatic CDECL / STDCALL translation
Hmm. Could you send me a disassembly of the thunk as it is actually generated? Ok, here you are, directly from Wine's debugger : Wine-dbgbt bt Backtrace: =0 0x4967487e (wine_glGetString) (ebp=4eb610a0) Wine-dbgdisas 0x4967487e disas 0x4967487e 0x4967487e (wine_glGetString): movl 0x0(%esp),%eax 0x49674881 (wine_glGetString+0x3): leal 0x4(%esp),%edx 0x49674885 (.wine_glGetString [opengl_norm.c]): movl0x0(%edx),%ecx 0x49674887 (.wine_glGetString+0x2 [opengl_norm.c]): movl%eax,0x0(%edx) 0x49674889 (.wine_glGetString+0x4 [opengl_norm.c]): movl%ecx,%eax 0x4967488b (.wine_glGetString+0x6 [opengl_norm.c]): subl$4,%edx 0x4967488e (.wine_glGetString+0x9 [opengl_norm.c]): leal0x0(%esp),%ecx 0x49674891 (.wine_glGetString+0xc [opengl_norm.c]): cmpl%ecx,%edx 0x49674893 (.wine_glGetString+0xe [opengl_norm.c]): jnl 0x49674885 (.wine_glGetString [opengl_norm.c]) 0x49674895 (.wine_glGetString+0x10 [opengl_norm.c]): call 0x4967489a (.wine_glGetString.getgot.enter [opengl_norm.c]) 0x4967489a (.wine_glGetString.getgot.enter [opengl_norm.c]): popl %ebx 0x4967489b (.wine_glGetString.getgot.enter+0x1 [opengl_norm.c]): addl $0x14d32,%ebx 0x496748a1 (.wine_glGetString.getgot.enter+0x7 [opengl_norm.c]): pushl 0x6e4(%ebx) 0x496748a7 (.wine_glGetString.getgot.enter+0xd [opengl_norm.c]): call 0x4966fd98 (_init+0xa74) 0x496748ac (.wine_glGetString.getgot.enter+0x12 [opengl_norm.c]): call 0x496706f8 (_init+0x13d4) 0x496748b1 (.wine_glGetString.getgot.enter+0x17 [opengl_norm.c]): call 0x496748b6 (.wine_glGetString.getgot.leave [opengl_norm.c]) 0x496748b6 (.wine_glGetString.getgot.leave [opengl_norm.c]): popl %ebx 0x496748b7 (.wine_glGetString.getgot.leave+0x1 [opengl_norm.c]): addl $0x14d16,%ebx 0x496748bd (.wine_glGetString.getgot.leave+0x7 [opengl_norm.c]): pushl 0x6e4(%ebx) 0x496748c3 (.wine_glGetString.getgot.leave+0xd [opengl_norm.c]): call 0x49670738 (_init+0x1414) 0x496748c8 (.wine_glGetString.getgot.leave+0x12 [opengl_norm.c]): addl $4,%esp 0x496748cb (.wine_glGetString.getgot.leave+0x15 [opengl_norm.c]): ret Also helpful would be to get a stack dump at the point when the thunk is initially called, and another one at the point the called real glGetString routine has returned ... At the breakpoint, the stack looks like this (at least I hope it's where the stack should be :-) ) : Wine-dbgx /32x $esp 0x49646948 (_end+0x1798b8): 0041b6e2 1f03 4eb610a0 0x49646958 (_end+0x1798c8): 4ea44bc8 4017b388 0x49646968 (_end+0x1798d8): 081e0e80 49646980 407d8073 0001 0x49646978 (_end+0x1798e8): 081e0e80 496469ac 40180cd7 0021 0x49646988 (_end+0x1798f8): 407d8d3f 496895cc 40180c96 4024f658 0x49646998 (_end+0x179908): 0034 4024d330 0b78 0x496469a8 (_end+0x179918): 0001 496469dc 4017c249 0034 0x496469b8 (_end+0x179928): 0001 4017c1ba 496895cc 0x1F03 must be the argument to the glGetString function (it's the GL_EXTENSIONS enumerant). Now, the the stack before the call to the real glGetString is hard to get because of the entering of the X11 crit. section (VERY annoying, this). So, here I start again, but in setting '$critical_section' to '0' in Patrik's script : Wine-dbgbt Backtrace: =0 0x4967417c (wine_glGetString) (ebp=4eb610a0) Wine-dbgdisas disas 0x4967417c (wine_glGetString): movl 0x0(%esp),%eax 0x4967417f (wine_glGetString+0x3): leal 0x4(%esp),%edx 0x49674183 (.wine_glGetString [opengl_norm.c]): movl0x0(%edx),%ecx 0x49674185 (.wine_glGetString+0x2 [opengl_norm.c]): movl%eax,0x0(%edx) 0x49674187 (.wine_glGetString+0x4 [opengl_norm.c]): movl%ecx,%eax 0x49674189 (.wine_glGetString+0x6 [opengl_norm.c]): subl$4,%edx 0x4967418c (.wine_glGetString+0x9 [opengl_norm.c]): leal0x0(%esp),%ecx 0x4967418f (.wine_glGetString+0xc [opengl_norm.c]): cmpl%ecx,%edx 0x49674191 (.wine_glGetString+0xe [opengl_norm.c]): jnl 0x49674183 (.wine_glGetString [opengl_norm.c]) 0x49674193 (.wine_glGetString+0x10 [opengl_norm.c]): call 0x496706f8 (_init+0x13d4) 0x49674198 (.wine_glGetString+0x15 [opengl_norm.c]): addl $4,%esp 0x4967419b (.wine_glGetString+0x18 [opengl_norm.c]): ret Wine-dbgx /32x $esp x /32x $esp 0x49646948 (_end+0x1798b8): 0041b6e2 1f03 4eb610a0 0x49646958 (_end+0x1798c8): 4ea44bc8 407db616 0x49646968 (_end+0x1798d8): 081e17a8 49646980 407d8073 0001 0x49646978 (_end+0x1798e8): 081e17a8 080b3c58 496469cc 496469cc 0x49646988 (_end+0x1798f8): 407d8d3f 49684c6c 4040bb20 4024d330 0x49646998 (_end+0x179908): 080b42c4 496469ac 0d48 0x496469a8 (_end+0x179918): 8e42c4de 10f40001 0001 0x496469b8 (_end+0x179928): 0220042f 081d1d6c 4017c1ba 49684c6c (...) Wine-dbgni 0x49674193 (.wine_glGetString+0x10 [opengl_norm.c]): call 0x496706f8 (_init+0x13d4) Wine-dbgx /32x $esp x /32x $esp 0x49646948 (_end+0x1798b8): 1f03 0041b6e2
RE: Automatic CDECL / STDCALL translation
Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0257 GS: EIP:496706f8 ESP:49646944 EBP:4eb610a0 EFLAGS:00010297( R- 00 I S -A-P1C) EAX:0041b6e2 EBX: ECX:49646948 EDX:49646944 ESI:4eb610a0 EDI: [snip] Backtrace: =0 0x496706f8 (_init+0x13d4) (ebp=4eb610a0) 0x496706f8 (_init+0x13d4): jmp *0x4f0(%ebx) Hope this helps Hmm, EBX is 0. That shouldn't happend. This is perhaps because the GOT must be reloaded in EBX before the call. Perhaps it worked for me by pure luck. A previous function had set EBX to the GOT. Not very unlikely though. Anyway, this new version works for me as well. Index: wine/dlls/opengl32/make_opengl_norm === RCS file: /home/wine/wine/dlls/opengl32/make_opengl_norm,v retrieving revision 1.2 diff -u -u -r1.2 make_opengl_norm --- wine/dlls/opengl32/make_opengl_norm 2000/05/18 00:07:53 1.2 +++ wine/dlls/opengl32/make_opengl_norm 2000/05/20 10:30:06 @@ -1,5 +1,9 @@ #!/usr/bin/perl -w +my $i386 = 1; +my $critical_section = 1; +my $pic = 1; + print " /* Auto-generated file... Do not edit ! */ @@ -9,10 +13,64 @@ "; +print '#define THUNK_STDCALL_TO_CDECL(stdcall_name, cdecl_name, argsize)' . " \\\n"; +print ' asm("\t.globl\t" #stdcall_name "\n"' . " \\\n"; +print '"\t.type\t" #stdcall_name ", @function\n"' . " \\\n"; +print '#stdcall_name ":\n"' . " \\\n"; +print '"\tmovl (%esp), %eax\n"' . " \\\n"; +print '"\tleal " #argsize "(%esp), %edx\n"' . " \\\n"; +print '"." #stdcall_name ":\n"' . " \\\n"; +print '"\tmovl (%edx), %ecx\n"' . " \\\n"; +print '"\tmovl %eax, (%edx)\n"' . " \\\n"; +print '"\tmovl %ecx, %eax\n"' . " \\\n"; +print '"\tsubl $4, %edx\n"' . " \\\n"; +print '"\tleal (%esp), %ecx\n"' . " \\\n"; +print '"\tcmpl %ecx, %edx\n"' . " \\\n"; +print '"\tjge ." #stdcall_name "\n"' . " \\\n"; +if($critical_section) { +if($pic) { + print '"\tcall ." #stdcall_name ".getgot.enter\n"' . " \\\n"; + print '"." #stdcall_name ".getgot.enter:\n"' . " \\\n"; + print '"\tpopl %ebx\n"' . " \\\n"; + print '"\taddl $_GLOBAL_OFFSET_TABLE_+[.-." #stdcall_name ".getgot.enter], %ebx\n"' . " \\\n"; + print '"\tpushl X11DRV_CritSection@GOT(%ebx)\n"' . " \\\n"; + print '"\tcall EnterCriticalSection@PLT\n"' . " \\\n"; +} else { + print '"\tpushl $X11DRV_CritSection\n"' . " \\\n"; + print '"\tcall EnterCriticalSection\n"' . " \\\n"; +} +} +if($pic) { +print '"\tcall ." #stdcall_name ".getgot.call\n"' . " \\\n"; +print '"." #stdcall_name ".getgot.call:\n"' . " \\\n"; +print '"\tpopl %ebx\n"' . " \\\n"; +print '"\taddl $_GLOBAL_OFFSET_TABLE_+[.-." #stdcall_name ".getgot.call], %ebx\n"' . " \\\n"; +print '"\tcall " #cdecl_name "@PLT\n"' . " \\\n"; +} else { +print '"\tcall " #cdecl_name "\n"' . " \\\n"; +} +if($critical_section) { +if($pic) { + print '"\tcall ." #stdcall_name ".getgot.leave\n"' . " \\\n"; + print '"." #stdcall_name ".getgot.leave:\n"' . " \\\n"; + print '"\tpopl %ebx\n"' . " \\\n"; + print '"\taddl $_GLOBAL_OFFSET_TABLE_+[.-." #stdcall_name ".getgot.leave], %ebx\n"' . " \\\n"; + print '"\tpushl X11DRV_CritSection@GOT(%ebx)\n"' . " \\\n"; + print '"\tcall LeaveCriticalSection@PLT\n"' . " \\\n"; +} else { + print '"\tpushl $X11DRV_CritSection\n"' . " \\\n"; + print '"\tcall LeaveCriticalSection\n"' . " \\\n"; +} +} +print '"\taddl $" #argsize ", %esp\n"' . " \\\n"; +print '"\tret\n"' . " \\\n"; +print '"\t.size\t" #stdcall_name ", .-" #stdcall_name "\n"' . " \\\n"; +print ' );' . "\n"; + # # Now, the functions from the include file # -open(INC, "/usr/X11R6/include/GL/gl.h") || die "Could not open GL/gl.h"; +open(INC, "/usr/include/GL/gl.h") || die "Could not open GL/gl.h"; while ($line = INC) { if ($line =~ /GLAPI.*GLAPIENTRY/) { # Start of a function declaration @@ -22,9 +80,11 @@ if (($name !~ /(MESA|PGI|ARB|EXT)/) || ($name =~ /MultiTexCoord/) || ($name =~ /ActiveTextureARB/)) { + print "/***\n" ; print " *\t\t$name\n"; print " */\n"; + print "\n/* " if $i386; print "$ret WINAPI wine_$name("; @rargs = (); @names = (); @@ -61,32 +121,41 @@ foreach (@rargs) { print ", $_"; } - print ") {\n"; - if ($ret !~ /void/) { - print " $ret ret;\n"; - } - print " ENTER_GL();\n"; - if ($ret !~ /void/) { - print " ret = "; + if($i386) { + print ") */\n"; } else { - print " "; + print ") {\n"; } -
Re: Automatic CDECL / STDCALL translation
Patrik Stridvall wrote: Hmm, EBX is 0. That shouldn't happend. This is perhaps because the GOT must be reloaded in EBX before the call. Correct. You need to have the GOT in %ebx before calling any PLT stub ... (Hmpf. I missed that as well :-/) Perhaps it worked for me by pure luck. A previous function had set EBX to the GOT. Not very unlikely though. Probably because you loaded it just before, when calling EnterCriticalSection ;-) Anyway, this new version works for me as well. Hmmm. There's still one problem, though: both the Linux/ELF and the Win32 ABI assume that %ebx is preserved across function calls. This means on the one hand that you don't need to reload the GOT all the time, but much more importantly on the other hand that you really shouldn't corrupt the caller's %ebx :-/ This won't have any effect if you're just running trivial test cases, but when a non-trivial routine calls one of these stubs, it will matter ... Bye, Ulrich -- Dr. Ulrich Weigand [EMAIL PROTECTED]
Problem with running Builtin Ole32
Hallo, despite the teb problems reported earlier, the crashed run of the MS Excel viewer found somewhere at http://officeupdate.microsoft.com/downloadCatalog/dldExcel.asp#9798 leaves enough files in the temp directory to install it. Runnung xlview.exe succeeds in opening .xls-files with native ole32, but fails with builtin ole32. There are only a few calls to ole32-Apis until the program reports the failure and checking against the run with native ole32 shows no obvious errors in the return values. But as most things probably happen with function pointers passed, I am clueless. Bye Uwe Bonnes[EMAIL PROTECTED] Free Software: If you contribute nothing, expect nothing --