Skip to main content
GameDev.net gamedev.net
🔒 Locked

EnumObjects generates unahled exception

Started by jfalstaff May 1, 2012 at 1:39 AM 0 replies 1.1k views
Original Post
jfalstaff
jfalstaff
I'm doing some discovery on my stick (X-52) and I'm getting an unhandled exception when I attempt to enumerate the objects on it. The drivers are the MS installed ones (as soon as I plug in my stick it installs them). I can't at this time install the Saitek drivers over it, so I'm stuck here now.

The callback prototype:

BOOL CALLBACK ObjectCallback( LPCDIDEVICEOBJECTINSTANCE, VOID*);

The call:

if( FAILED(hr = joystick->EnumObjects( ObjectCallback, NULL, DIDFT_ALL )))
return hr;


The callback function:

BOOL CALLBACK ObjectCallback( LPCDIDEVICEOBJECTINSTANCE ObjectInstance, VOID *context)
{

JSControlData *jscinstance = new JSControlData;

memcpy( jscinstance, ObjectInstance, sizeof( JSControlData ));

jsdata.jscdata.push_back(jscinstance);

// keep going until we get them all.
return DIENUM_CONTINUE;
}


The error:
Unhandled exception at 0x01342e73 in jsfind.exe: 0xC0000005: Access violation reading location 0xccccccd0.

It's happening in xutility, in the _Adopt function of the _Iterator_base12 structure. The parent is going in NULL, but I can't determine why.

If I build in release, it will get one object, then stop responding. And, yes, DI and the stick get created with no errors and I can get the capabilities as well, but I can't get info on each object.

Does anyone have any insight on this problem?

PS: Make that "unhandled" exception. I can't go back and edit the title.
jfalstaff
jfalstaff
Solved. For some reason, STL is choking it. I'll look into this more, but I'll have to use straight C for this quick implementation.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.