SIGSEGV in IDirectDrawImpl_EnumDisplayModes

Matthew Bloch matthew at bytemark.co.uk
Thu Oct 31 10:33:02 CST 2002


On Thursday 31 October 2002 14:32, Lionel Ulmer wrote:
> > Apologies for needing some more hand-holding: from Alexander's advice I
> > now have the game linking and beginning to execute.  It now gets stuck
> > while executing this piece of C++:
>
> Hmm, according to the backtrace, it is rather crashing when executing
> 'User_DirectDraw_EnumDisplayModes' (ie something like
> mp_directDraw->EnumDisplayModes(...)) in the
> tDirectDrawScreen::setUpWindowedSurfaces method.

Sorry, that was the method I posted, I happened to paste the wrong function 
name; this is the entire function with line 852 marked:

------------------------------------------------------------------------------
void tDirectDrawScreen::setUpWindowedSurfaces()
{
  DDSURFACEDESC ddsd;
  memset(&ddsd,0,sizeof(DDSURFACEDESC));
  ddsd.dwSize = sizeof(DDSURFACEDESC);

  //Set up the caps for the primary
  ddsd.dwFlags = DDSD_CAPS;
  ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;

  //Finally create the primary surface (line 852)
  HRESULT hr = mp_directDraw->CreateSurface(&ddsd,&mp_primarySurface,NULL); 
  handleErrors(hr,"Failed to create windowed primary surface.");  

  //Calculate and preserve current screen size
  setScreenSize();

  //Calculate and store current screen position
  setScreenPosition();

  //Create a "backbuffer" surface exactly the same size as primary
  createBackBuffer();
}
------------------------------------------------------------------------------

the ddraw trace looks like this:

------------------------------------------------------------------------------
trace:ddraw:initialize enabling DirectDraw HAL
trace:ddraw:DDRAW_Create ((null),0x808c718,(nil))
trace:ddraw:DDRAW_FindDriver ((null))
trace:ddraw:HAL_DirectDraw_Create 
trace:ddraw:HAL_DirectDraw_Construct (0x403a9be0)
trace:ddraw:User_DirectDraw_Construct (0x403a9be0,0)
trace:ddraw:Main_DirectDraw_QueryInterface 
(0x403a9be0)->({6c14db80-a733-11ce-a521-0020af0be560},0x808c718)
trace:ddraw:Main_DirectDraw_AddRef (0x403a9be0)->() incrementing from 1.
trace:ddraw:Main_DirectDraw_Release (0x403a9be0)->() decrementing from 2.
fixme:ddraw:Main_DirectDraw_WaitForVerticalBlank 
(0x403a9be0)->(flags=0x00010021,handle=0x8)
trace:ddraw:User_DirectDraw_EnumDisplayModes 
(0x403a9be0)->(0x40c92c4c,0x808c720,0x40c92be8,0x40f55dfc)
trace:ddraw:User_DirectDraw_EnumDisplayModes - mode: 512x384
trace:ddraw:User_DirectDraw_EnumDisplayModes  -  8 bpp, R=00000000 G=00000000 
B=00000000
(bang!)
------------------------------------------------------------------------------

and the backtrace from the exception looks like this:

------------------------------------------------------------------------------
#0  0x40c92c4c in ?? ()
#1  0x40f56f5f in User_DirectDraw_EnumDisplayModes (iface=0x403a9be0, 
dwFlags=1086925740, pDDSD=0x808c720, context=0x40c92be8, callback=0x40f55dfc 
<EnumDisplayModesCallbackThunk>) at ddraw/user.c:373
#2  0x40f55e81 in IDirectDrawImpl_EnumDisplayModes (This=0x40c92be8, 
dwFlags=1086925900, pDDSD=0x808c720, context=0x40c92a94, cb=0x40c92a94) at 
ddraw/thunks.c:348
#3  0x4080f9b2 in tDirectDrawScreen::setUpWindowedSurfaces (this=0x808c710) at 
Source/tDirectDrawScreen.cpp:852
#4  0x4080cf1f in tDirectDrawScreen::initialise (this=0x808c710, 
fullScreen=false, screenWidth=640, screenHeight=480) at 
Source/tDirectDrawScreen.cpp:88
#5  0x4080caac in tDirectDrawScreen::tDirectDrawScreen (this=0x808c710, 
fullScreen=false, screenWidth=640, screenHeight=480) at 
Source/tDirectDrawScreen.cpp:55
#6  0x4082d76f in InitApp (hInst=0x40620000, nCmdShow=1) at 
Source/Main.cpp:289
#7  0x4082d8fc in WinMain (hInst=0x40620000, hPrevInst=0x0, 
lpCmdLine=0x403710dd "", nCmdShow=1) at Source/Main.cpp:322
#8  0x4062509c in __wine_exe_main () from 
/home/mattbee/Work/Nemesis/LSNClient.exe
#9  0x400b3799 in start_process () at ../../scheduler/process.c:564
#10 0x400b76c9 in call_on_thread_stack (func=0x400b3558) at 
../../scheduler/sysdeps.c:112
------------------------------------------------------------------------------


> From what I see, I wonder if the enum procedure you give to DDraw has the
> right protoype (ie is it a STDCALL or a CDECL function) ?

I'm not supplying any procedure to DDraw; could it be that some linking 
problem has caused EnumDisplayModes to be called instead of CreateSurface?  
That's what the backtrace implies.  I've tried a rebuild of the relevant 
source files just in case but the same thing happens.

If it helps, this is the function that creates the  mp_directDraw variable, 
called before setUpWindowedSurfaces:

------------------------------------------------------------------------------
void tDirectDrawScreen::createDirectDrawObject()
{
  HRESULT hr = DirectDrawCreate(0,&mp_directDraw,NULL);
  handleErrors(hr,"Failed to create Direct Draw Object."); 
}
------------------------------------------------------------------------------

cheers,

-- 
Matthew Bloch         Bytemark Computer Consulting Limited
                                http://www.bytemark.co.uk/
                                  tel. +44 (0) 8707 455026




More information about the wine-devel mailing list