SIGSEGV in IDirectDrawImpl_EnumDisplayModes (test program)

Matthew Bloch matthew at pcgamesonline.net
Fri Nov 1 08:39:35 CST 2002


On Friday 01 November 2002 12:19, Lionel Ulmer wrote:
> > Yes, to my eye it looks like a linking problem but I'm not sure how to
> > tell. Maybe if I whittle it down to a single .c file which I can post to
> > the list it'll make it easier to diagnose.
>
> Well, the easier would be that, yes. Basically, just create the DDraw
> interface (as done in createDirectDrawObject) and call 'CreateSurface' on
> it. That should be enough to reproduce the problem (now that I think of it,
> I could do it myself, but well, I have no experience about creating Winelib
> apps :-) ).

Okay, calling this function as the first statement in my WinMain causes 
exactly the same crash:

-------------------------------------------------------------------------
void dummy(void)
{
	IDirectDraw* dd;
	IDirectDrawSurface *surface;
	DDSURFACEDESC ddsd;
	HRESULT hr;
	
	memset(&ddsd, 0, sizeof(DDSURFACEDESC));
	ddsd.dwSize = sizeof(DDSURFACEDESC);
	ddsd.dwFlags = DDSD_CAPS;
	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
	
	if (DirectDrawCreate(0, &dd, NULL))
	{
		exit(1);
	}
	
	if (dd->CreateSurface(&ddsd, &surface, NULL))
	{
		exit(2);
	}
	
	printf("created surface okay!\n");
    
}
-------------------------------------------------------------------------

though I'm not sure why it ends up in the environ() function...?

-------------------------------------------------------------------------
(gdb) bt
#0  0x400114a9 in environ () from /lib/ld-linux.so.2
#1  0x40f49323 in User_DirectDraw_EnumDisplayModes (iface=0x403a7620, 
dwFlags=1086926012, pDDSD=0x40c92d34, context=0x40c92cf8, 
    callback=0x40f481c0 <EnumDisplayModesCallbackThunk>) at ddraw/user.c:373
#2  0x40f48245 in IDirectDrawImpl_EnumDisplayModes (This=0x40c92cf8, 
dwFlags=1086926140, pDDSD=0x40c92d34, context=0x40c92ba4, cb=0x40c92ba4)
    at ddraw/thunks.c:348
#3  0x4082d85e in dummy () at Source/Main.cpp:325
#4  0x4082d891 in WinMain (hInst=0x40620000, hPrevInst=0x0, 
lpCmdLine=0x403710c5 "", nCmdShow=1) at Source/Main.cpp:340
#5  0x4062509c in __wine_exe_main () from 
/home/mattbee/Work/Nemesis/LSNClient.exe
#6  0x400b37ed in start_process () at ../../scheduler/process.c:564
#7  0x400b771d in call_on_thread_stack (func=0x400b35ac) at 
../../scheduler/sysdeps.c:112
-------------------------------------------------------------------------

disassembly looks like this:

-------------------------------------------------------------------------
00000768 <dummy__Fv>:
     768:       55                      push   %ebp
     769:       89 e5                   mov    %esp,%ebp
     76b:       81 ec 88 00 00 00       sub    $0x88,%esp
     771:       83 c4 fc                add    $0xfffffffc,%esp
     774:       6a 6c                   push   $0x6c
     776:       6a 00                   push   $0x0
     778:       8d 45 94                lea    0xffffff94(%ebp),%eax
     77b:       50                      push   %eax
     77c:       e8 fc ff ff ff          call   77d <dummy__Fv+0x15>
     781:       c7 45 94 6c 00 00 00    movl   $0x6c,0xffffff94(%ebp)
     788:       c7 45 98 01 00 00 00    movl   $0x1,0xffffff98(%ebp)
     78f:       c7 45 fc 00 02 00 00    movl   $0x200,0xfffffffc(%ebp)
     796:       83 c4 fc                add    $0xfffffffc,%esp
     799:       6a 00                   push   $0x0
     79b:       8d 45 90                lea    0xffffff90(%ebp),%eax
     79e:       50                      push   %eax
     79f:       6a 00                   push   $0x0
     7a1:       e8 fc ff ff ff          call   7a2 <dummy__Fv+0x3a>
     7a6:       83 c4 14                add    $0x14,%esp
     7a9:       85 c0                   test   %eax,%eax
     7ab:       74 0a                   je     7b7 <dummy__Fv+0x4f>
     7ad:       83 c4 f4                add    $0xfffffff4,%esp
     7b0:       6a 01                   push   $0x1
     7b2:       e8 fc ff ff ff          call   7b3 <dummy__Fv+0x4b>
     7b7:       8b 45 90                mov    0xffffff90(%ebp),%eax
     7ba:       8b 10                   mov    (%eax),%edx
     7bc:       6a 00                   push   $0x0
     7be:       8d 45 8c                lea    0xffffff8c(%ebp),%eax
     7c1:       50                      push   %eax
     7c2:       8d 45 94                lea    0xffffff94(%ebp),%eax
     7c5:       50                      push   %eax
     7c6:       ff 75 90                pushl  0xffffff90(%ebp)
     7c9:       8b 42 20                mov    0x20(%edx),%eax
     7cc:       ff d0                   call   *%eax
     7ce:       85 c0                   test   %eax,%eax
     7d0:       74 0e                   je     7e0 <dummy__Fv+0x78>
     7d2:       83 c4 f4                add    $0xfffffff4,%esp
     7d5:       6a 02                   push   $0x2
     7d7:       e8 fc ff ff ff          call   7d8 <dummy__Fv+0x70>
     7dc:       8d 74 26 00             lea    0x0(%esi,1),%esi
     7e0:       83 c4 f4                add    $0xfffffff4,%esp
     7e3:       68 50 00 00 00          push   $0x50
     7e8:       e8 fc ff ff ff          call   7e9 <dummy__Fv+0x81>
     7ed:       c9                      leave  
     7ee:       c3                      ret    
     7ef:       90                      nop    
-------------------------------------------------------------------------

and the ddraw trace looks like this:

-------------------------------------------------------------------------
trace:ddraw:initialize enabling DirectDraw HAL
trace:ddraw:DDRAW_Create ((null),0x40c92d38,(nil))
trace:ddraw:DDRAW_FindDriver ((null))
trace:ddraw:HAL_DirectDraw_Create 
trace:ddraw:HAL_DirectDraw_Construct (0x403a7390)
trace:ddraw:User_DirectDraw_Construct (0x403a7390,0)
trace:ddraw:Main_DirectDraw_QueryInterface 
(0x403a7390)->({6c14db80-a733-11ce-a521-0020af0be560},0x40c92d38)
trace:ddraw:Main_DirectDraw_AddRef (0x403a7390)->() incrementing from 1.
trace:ddraw:Main_DirectDraw_Release (0x403a7390)->() decrementing from 2.
trace:ddraw:User_DirectDraw_EnumDisplayModes 
(0x403a7390)->(0x40c92d3c,0x40c92d34,0x40c92cf8,0x40f481c0)
trace:ddraw:User_DirectDraw_EnumDisplayModes - mode: 512x384
trace:ddraw:User_DirectDraw_EnumDisplayModes  -  8 bpp, R=00000000 G=00000000 
B=00000000
-------------------------------------------------------------------------

Any comments would be appreciated.

-- 
Matthew Bloch




More information about the wine-devel mailing list