From: shiva on
I am using CreateFile( ) to open a USB Device.
I have given first parameter lpFileName something like this,

\\?\USB#Vid_413c&Pid_4011#0e01312e-0507-1116-2800-0050bfe45ce5#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

which is i get from "dbcc_name" property of
DEV_BROADCAST_DEVICEINTERFACE structure.

its giving me VALID HANDLE also.

but with that handle, i am not able to perform any further operations.
is i need to modify my "lpFileName" parameter of CreateFile function.

Pls let me know...

Thanks u in advance.............

From: Ulrich Eckhardt on
shiva wrote:
> its giving me VALID HANDLE also.

Danger, some win32 functions return INVALID_HANDLE_VALUE, some return NULL
in case of failure. Check this and handle errors!

> but with that handle, i am not able to perform any further operations.

That's not an error description anyone could work with. I suggest you look
up Eric S. Raymonds' essay on asking questions the smart way on the web, it
will help you with this.

Uli

From: shiva on
function not returning either INVALID_HANDLE_VALUE or NULL.
Its returning some VALUE AS HANDLE, thats for sure.

BTW can u gimme link of Raymonds article


Shiva




Ulrich Eckhardt wrote:
> shiva wrote:
> > its giving me VALID HANDLE also.
>
> Danger, some win32 functions return INVALID_HANDLE_VALUE, some return NULL
> in case of failure. Check this and handle errors!
>
> > but with that handle, i am not able to perform any further operations.
>
> That's not an error description anyone could work with. I suggest you look
> up Eric S. Raymonds' essay on asking questions the smart way on the web, it
> will help you with this.
>
> Uli

From: Sten Westerback (MVP SDK) on

"shiva" <dudeofindia(a)gmail.com> wrote in message
news:1166097273.682744.105630(a)80g2000cwy.googlegroups.com...
>I am using CreateFile( ) to open a USB Device.
> I have given first parameter lpFileName something like this,
>
> \\?\USB#Vid_413c&Pid_4011#0e01312e-0507-1116-2800-0050bfe45ce5#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
>
> which is i get from "dbcc_name" property of
> DEV_BROADCAST_DEVICEINTERFACE structure.
>
> its giving me VALID HANDLE also.
>
> but with that handle, i am not able to perform any further operations.
> is i need to modify my "lpFileName" parameter of CreateFile function.
>

Modify only if you find a good reason. CreateFile succeeding seems like a
good reason not to to me.

Where did you leave the description of the other parameters you used to
CreateFile?

Which API did you pass the handle to? WaitForSingleObject(), ReadFile(),
WriteFile(), printf() or something else? ;)
Which error code did you get and what does it mean?
What type of USB device is it and are you 100% sure the sent data is as
expected or that you should receive data without asking for it etc?

- Sten


From: shiva on
hi Sten,
I am sure about the data i am asking for :)...

I am using DeviceIoControl() function after createfile().\
i am querying for USB_DEVICE_DESCRPTOR but always deviceIoControl
giving me "Invalid function" as error.

Sten Westerback (MVP SDK) wrote:
> "shiva" <dudeofindia(a)gmail.com> wrote in message
> news:1166097273.682744.105630(a)80g2000cwy.googlegroups.com...
> >I am using CreateFile( ) to open a USB Device.
> > I have given first parameter lpFileName something like this,
> >
> > \\?\USB#Vid_413c&Pid_4011#0e01312e-0507-1116-2800-0050bfe45ce5#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
> >
> > which is i get from "dbcc_name" property of
> > DEV_BROADCAST_DEVICEINTERFACE structure.
> >
> > its giving me VALID HANDLE also.
> >
> > but with that handle, i am not able to perform any further operations.
> > is i need to modify my "lpFileName" parameter of CreateFile function.
> >
>
> Modify only if you find a good reason. CreateFile succeeding seems like a
> good reason not to to me.
>
> Where did you leave the description of the other parameters you used to
> CreateFile?
>
> Which API did you pass the handle to? WaitForSingleObject(), ReadFile(),
> WriteFile(), printf() or something else? ;)
> Which error code did you get and what does it mean?
> What type of USB device is it and are you 100% sure the sent data is as
> expected or that you should receive data without asking for it etc?
>
> - Sten