Re: Problem With DeviceIoControl IOCTL_STORAGE_MCN_CONTROL

Tech-Archive recommends: Fix windows errors by optimizing your registry



S. Heck wrote:

Same error.

There is some mention of access rights for at IOCTL_STORAGE_MCN_CONTROL at the following link.

http://msdn2.microsoft.com/en-us/library/aa363415.aspx

hDevice [in] Handle to the device. This device must be enabled for AutoPlay. To obtain a device handle, call the CreateFile function. Files must be opened with the FILE_READ_ATTRIBUTES access right. They must not be opened with read or write access. For more information, see File Security and Access Rights.

You have probably misunderstood the CreateFile() parameter list as you don't pass FILE_READ_ATTRIBUTES correctly. FILE_READ_ATTRIBUTES is an access right, not a file attribute.

e.g.
fd = CreateFile(device_name,FILE_READ_ATTRIBUTES,
0,NULL,OPEN_EXISTING,
0,NULL);

--
Olof Lagerkvist
ICQ: 724451
Web: http://here.is/olof

.