DeviceIoControl Problem

wfunction

Well-known member
Joined
Oct 31, 2006
Messages
46
Programming Experience
1-3
Hi. PLEASE help: I Googled 10,000,000 things and did not get any HELPFUL result! (So please don't guess the answer )
I am trying to create a device manager, so to speak. That's not what I'm doing, but I need all the functions used in it.
My main problem is the EnumDeviceDrivers api... For one thing, are negative handles real? Also, when I pass those handles to the GetDeviceDriverBaseName, I have problems with the nSize parameter - I put 0, it returns nothing. Put 1, and it puts weird characters. Put 10, and it returns a protected memory exception. The string is empty - why the heck does it need an nSize?!
My main point is to use IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS in the DeviceIOControl, and do some other things (disable/enable devices). The problem is getting the handle - I tried the ServiceProcessBase.GetDevices(), but it gets the services associated with the devices - and I can't stop, for example, my DVD-RW device.

I also know C#, so if you can help me in that context, it's still helpful.
I am using VS 2005, and can also use 2003.
 
Back
Top