Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

Mr Cucumber

Weird problem

This topic is 6664 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I try to enumerate DirectDraw drivers I encounter a problem when trying to run the program. I get an Illegal operation. Here is the my callback function:
    BOOL WINAPI DDEnumCallbackEx(GUID FAR *lpGUID, LPSTR lpDriverDescription, LPSTR lpDriverName, LPVOID lpContext, HMONITOR hm)
	//Covert the context

	LPDRIVER driver = (LPDRIVER)lpContext;

	//Copy the driver''s properties

	driver->tdrivers[driver->numfound].driver = *lpGUID;
	driver->tdrivers[driver->numfound].description = lpDriverDescription;
	driver->tdrivers[driver->numfound].name = lpDriverName;

	//Tell the system that a driver was found


	//Continue enumeration

	return FALSE;
The MSVC debugger points to the line: driver->tdrivers[driver->numfound].driver = *lpGUID; I cannot see any problems with it. I have checked that the driver pointer is valid and if I remove that line and keep all others then everything works fine. Could anyone guess whats wrong?

Share this post

Link to post
Share on other sites

Because MSVCC points to the Line
driver->tdrivers[driver->numfound].driver = *lpGUID;

But the Access to the Array can''t be the Problem cause u use it later without Problem.
So i would think the lpGUID Pointer isn''t valid, and when you try to Access the Memory where that Pointer points to the Illegal Opertion Error occurs (Don''t ask why just check it before using it, DirectX Functions are sometimes... ).
But maybe it is an Type Problem, but i don''t know what your driver-Variable is.


Share this post

Link to post
Share on other sites
Here is a bit of the structure where the guid is supposed to be saved to:

        typedef struct _TEMPDRIVER
//Driver stuff

GUID driver;
char *description;
char *name;
//Some more stuff


And the compiler would give an error if the types were incorrectt but I'll check what you said.

Edited by - Mr Cucumber on June 20, 2000 10:32:22 AM

Share this post

Link to post
Share on other sites
When you are enumerating Direct Draw devices and you only have one video card in your system, the primary display drivers GUID pointer is going to be NULL. I haven''t tried enumerating on a system with more than one display device, but it may be the the first (primary) display device GUID pointer is always NULL, I am not sure. In anycase just have an if statement that sets the GUID pointer in your driver database (infomation about the display) to NULL if the lpGUID given to you by the Emumeration callback function is NULL.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!