Re: FMD_OEMIoControl - Passing parameters? by Marc
Marc
Thu Dec 04 04:06:03 CST 2003
UPDATE:
Obviously the problem is using IOCTL_DISK_USER_START directly as my IOCTL.
I increased the value (#define IOCTL_DISK_MYIOCTL
IOCTL_DISK_USER_START+1), and now it works, the parameters are passed to
FMD_OEMIoControl... :D
However, the bug mentioned by Danny on Oct 21 2003 ("Cannot send user
IOCTL's to FMD") prevents the use of the CTL_CODE macro to define
IOCTLs. If I define my IOCTK this way, it doesn't make it to
FMD_OEMIoControl. But it works OK using a simple #define (see above).
Cheers
Marc
Marc wrote:
> My intention is to read a physical sector from the flash.
> I set up the buffers and call DeviceIoControl as follows:
>
> SG_REQ lpInBuf;
> LPDWORD dwDummy = 0;
> LPBYTE lpOutBuf;
> lpOutBuf = (unsigned char *)malloc(512);
> lpInBuf.sr_start = SectNo; // physical sector to read
> lpInBuf.sr_num_sec = 1; // read 1 sector
> lpInBuf.sr_num_sg = 1;
> lpInBuf.sr_status = 0; //ERROR_SUCCESS;
> lpInBuf.sr_callback = NULL;
> lpInBuf.sr_sglist[0].sb_buf = ((LPBYTE) MapPtrToProcess(lpOutBuf,
> GetCurrentProcess()));
> lpInBuf.sr_sglist[0].sb_len = 512 * lpInBuf.sr_num_sec;
>
>
> if (!DeviceIoControl(hStore, // Handle to the device
> IOCTL_DISK_READSECTOR, // IOCTL for the operation
> &lpInBuf, // LP to a buffer (input data)
> sizeof(lpInBuf), // Size in Bytes of input data buffer
> lpInBuf.sr_sglist[0].sb_buf, // LP to a buffer for output data
> lpInBuf.sr_sglist[0].sb_len, // Size in Bytes of output buffer
> dwDummy, // LP to variable (size of data in out buffer)
> NULL)) { // Ignored, set to NULL
>
>
> This works great if I call IOCTL_DISK_READ (read logical sector) for
> example, so I figured I might use the same buffer setup for my own IOCTL.
>
>
> Steve Maillet (eMVP) wrote:
>
>> What does your call to DeviceIoControl() look like. What you pass in
>> there
>> should get assed on to the FMD driver.
>>
>