I'm trying to do direct disk access on Win CE (5.0), and I n开发者_如何学编程eed to p/invoke a DeviceIoControl call with IOCTL_DISK_READ.
But I can't find which header file that's defined in (I'm using VS2008 rather than a CE SDK), so I can't find the value of the IOCTL.
If anyone knows the value (or where I can get it) I'd be very grateful.
from diskio.h
#define IOCTL_DISK_BASE FILE_DEVICE_DISK
...
#define IOCTL_DISK_READ \
CTL_CODE(IOCTL_DISK_BASE, 0x702, METHOD_BUFFERED, FILE_READ_ACCESS)
EDIT
For completeness sake so you don't have to backtrack the other values
from winioctl.h
#define CTL_CODE ( DeviceType, Function, Method, Access ) ( \
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
)
...
#define METHOD_BUFFERED 0
...
#define FILE_READ_ACCESS (0x0001)
...
#define FILE_DEVICE_DISK 0x00000007
EDIT 2 And for those who are lazy (like me) it unfolds like this:
(7 << 16) | (1 << 14) | (0x702 << 2) | (0)
which is
(0x70000) | (0x4000) | (0x1C08) | (0)
Which would be (in C#)
public const int IOCTL_DISK_READ = 0x75C08;
精彩评论