Okay, if it'll help you although my knowledge of x86 calling conventions and post-286 instructions etc. (last x86 I wrote was in a BIOS five years ago) is pretty hopeless :-)
Well, I am not very good at X86 ASM either, but well, the problem lies here :
2fe0: 8b 57 08 mov 0x8(%edi),%edx
%edx is the address of the COM object (IDirectDraw)
2fe3: 8b 0a mov (%edx),%ecx
%ecx is the address of the VTable
2fe5: 6a 00 push $0x0 2fe7: 8d 47 10 lea 0x10(%edi),%eax 2fea: 50 push %eax 2feb: 53 push %ebx 2fec: 52 push %edx
All arguments are pushed on the stack (with the last being the pointer to the COM object itself).
2fed: 8b 41 20 mov 0x20(%ecx),%eax
%eax is the address of the method
2ff0: ff d0 call *%eax
Which is called here.
The problem being that the method at the offset '0x20' in the VTable is NOT CreateSurface (as you want to use in the code) but 'EnumDisplayModes' and thus the crash.
I will now look at how the VTable is built for COM objects in the case of C++ (you are building with g++, no ?) and try to understand why this particular code is generated.
Lionel