- ReadFile() fails with error Incorrect Parameter
- Posted by davidmurray1@gmail.com on May 21st, 2008
I am trying to call ReadFile() on a handle for a USB storage device,
however, ReadFile() returns false everytime with the error code:
"Parameter is Incorrect."
The handle that I create via CreateFile is valid
Here's where I create the handle (returns a valid handle for my
device)
hDevice = CreateFile(
devDetailData->DevicePath,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
I then create an event and an OVERLAPPED structure:
HANDLE hEvent = CreateEvent(
NULL,
TRUE,
FALSE,
NULL);
OVERLAPPED gOverLapped;
gOverLapped.Offset = 0;
gOverLapped.OffsetHigh = 0;
gOverLapped.hEvent = hEvent;
I then init some variables for the ReadFile() function and call it:
CHAR pBuf[3];
pBuf[0] = 0;
DWORD nBytesRead;
BOOL bResult;
bResult = ReadFile(hDevice, pBuf, 3, &nBytesRead, &gOverLapped);
The result I receive via GetLastError() is "The parameter is
incorrect."
Any help would be GREATLY appreciated.
- Posted by chris.aseltine@gmail.com on May 21st, 2008
On May 21, 9:25 am, davidmurr...@gmail.com wrote:
What makes you think you should be able to do this? What are you
trying to do?
- Posted by davidmurray1@gmail.com on May 21st, 2008
On May 21, 12:15 pm, chris.aselt...@gmail.com wrote:
i'm trying to establish a connection with my usb driver so that i can
call ioctl's on it. all USB device interfacing examples state that
ReadFile() should be called upon successful creation of the handle.
- Posted by Doron Holan [MSFT] on May 21st, 2008
are you sure you are opening a handle to the storage device vs the file
system mounted on it? if this is the inbox driver, how will your custom
IOCTL work/
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
<davidmurray1@gmail.com> wrote in message
news:bda50d88-f31b-49d6-a109-caf392d66ede@e39g2000hsf.googlegroups.com...
- Posted by Alexander Grigoriev on May 22nd, 2008
If you want to send UICTL, why are you calling ReadFile?
<davidmurray1@gmail.com> wrote in message
news:bda50d88-f31b-49d6-a109-caf392d66ede@e39g2000hsf.googlegroups.com...