From: davidmurray1 on
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.
From: chris.aseltine on
On May 21, 9:25 am, davidmurr...(a)gmail.com wrote:

> 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."

What makes you think you should be able to do this? What are you
trying to do?
From: davidmurray1 on
On May 21, 12:15 pm, chris.aselt...(a)gmail.com wrote:
> On May 21, 9:25 am, davidmurr...(a)gmail.com wrote:
>
> > 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."
>
> What makes you think you should be able to do this? What are you
> trying to do?

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.
From: Doron Holan [MSFT] on
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(a)gmail.com> wrote in message
news:bda50d88-f31b-49d6-a109-caf392d66ede(a)e39g2000hsf.googlegroups.com...
> On May 21, 12:15 pm, chris.aselt...(a)gmail.com wrote:
>> On May 21, 9:25 am, davidmurr...(a)gmail.com wrote:
>>
>> > 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."
>>
>> What makes you think you should be able to do this? What are you
>> trying to do?
>
> 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.

From: Alexander Grigoriev on
If you want to send UICTL, why are you calling ReadFile?

<davidmurray1(a)gmail.com> wrote in message
news:bda50d88-f31b-49d6-a109-caf392d66ede(a)e39g2000hsf.googlegroups.com...
> On May 21, 12:15 pm, chris.aselt...(a)gmail.com wrote:
>> On May 21, 9:25 am, davidmurr...(a)gmail.com wrote:
>>
>> > 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."
>>
>> What makes you think you should be able to do this? What are you
>> trying to do?
>
> 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.