hi all,
During the USB device design, a problem confused me.
I want to get the handle of the USB device, and the symbolicname
of this USB device in register, like following:
\??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
somebody told me, this symbolicname can be used in
CreateFile to create the handle.
After some tests (by change the symbolicname into the right
form), I can use the "new" symbolicname in createfile, and
the return handle is VALID_HANDLE.
I want to know, is this symbolicname the right parameter
in CreateFile?
And the handle is which handle? Can this handle be used
to communicate with the USB device? If it can, how?

Re: can symbolicname be used to get handle by Owen

Owen
Fri Oct 12 07:28:04 PDT 2007

Yes, if you call CreateFile with the symboliclink, you can call ReadFile,
WriteFile and DeviceIoControl to communicate with the driver. Some devices
wont let you create them (Mice and Keyboards).

Look at the SetupDi... functions to enumerate devices for your symbolic
link, because it will change with different ports and on different systems

On Sat, 13 Oct 2007 01:15:17 +0100, zonhai.won <zonhai.won@gmail.com>
wrote:

> hi all,
> During the USB device design, a problem confused me.
> I want to get the handle of the USB device, and the symbolicname
> of this USB device in register, like following:
> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
> somebody told me, this symbolicname can be used in
> CreateFile to create the handle.
> After some tests (by change the symbolicname into the right
> form), I can use the "new" symbolicname in createfile, and
> the return handle is VALID_HANDLE.
> I want to know, is this symbolicname the right parameter
> in CreateFile?
> And the handle is which handle? Can this handle be used
> to communicate with the USB device? If it can, how?
>
>
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Re: can symbolicname be used to get handle by zonhai

zonhai
Sat Oct 13 00:10:05 PDT 2007

Hi,
Sorry, I forget one thing about the symbolicname, the
symbolicname like
\??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
then,
I declare a new device path like this:
\??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}#pipe0
or like this:
\??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}#startsdfklasdfjjs
after the declaring the new "devicename path", I use it
as the parameter in CreateFile, I always get the
VALID_HANDLE, I don't know why, does it mean that
no matter what I declare, if the symbolicname is used,
the CreateFile will always return VALID_HANDLE?





"Owen Smith" <nospam.osmith@saitek.com.nospam> wrote in message
news:op.tz2842cu39p9aw@oas-core2...
> Yes, if you call CreateFile with the symboliclink, you can call ReadFile,
> WriteFile and DeviceIoControl to communicate with the driver. Some devices
> wont let you create them (Mice and Keyboards).
>
> Look at the SetupDi... functions to enumerate devices for your symbolic
> link, because it will change with different ports and on different systems
>
> On Sat, 13 Oct 2007 01:15:17 +0100, zonhai.won <zonhai.won@gmail.com>
> wrote:
>
>> hi all,
>> During the USB device design, a problem confused me.
>> I want to get the handle of the USB device, and the symbolicname
>> of this USB device in register, like following:
>> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
>> somebody told me, this symbolicname can be used in
>> CreateFile to create the handle.
>> After some tests (by change the symbolicname into the right
>> form), I can use the "new" symbolicname in createfile, and
>> the return handle is VALID_HANDLE.
>> I want to know, is this symbolicname the right parameter
>> in CreateFile?
>> And the handle is which handle? Can this handle be used
>> to communicate with the USB device? If it can, how?
>>
>>
>>
>
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



Re: can symbolicname be used to get handle by zonhai

zonhai
Sat Oct 13 00:23:36 PDT 2007

I also want to know, if I can communicate with the
USB device by using the symbolicname, if I can,
which steps should I take?
I read an article which said, communicating with
a USB device should get the device interface handle,
if this is true, can I get the interface handle by
using the symbolicname?

"zonhai.won" <zonhai.won@gmail.com> wrote in message
news:OfFiDCLDIHA.3332@TK2MSFTNGP04.phx.gbl...
> hi all,
> During the USB device design, a problem confused me.
> I want to get the handle of the USB device, and the symbolicname
> of this USB device in register, like following:
> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
> somebody told me, this symbolicname can be used in
> CreateFile to create the handle.
> After some tests (by change the symbolicname into the right
> form), I can use the "new" symbolicname in createfile, and
> the return handle is VALID_HANDLE.
> I want to know, is this symbolicname the right parameter
> in CreateFile?
> And the handle is which handle? Can this handle be used
> to communicate with the USB device? If it can, how?
>
>
>



Re: can symbolicname be used to get handle by Doron

Doron
Fri Oct 12 09:57:42 PDT 2007

you appending to the link name and accessing a device's private namespace.
most drivers ignore namespace strings when processing the creation of
handles which is why this works (for instnace you could open "\\.\com1\FOO"
and it would still open COM1

d

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


"zonhai.won" <zonhai.won@gmail.com> wrote in message
news:u$rwjpODIHA.4296@TK2MSFTNGP04.phx.gbl...
> Hi,
> Sorry, I forget one thing about the symbolicname, the
> symbolicname like
> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
> then,
> I declare a new device path like this:
> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}#pipe0
> or like this:
> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}#startsdfklasdfjjs
> after the declaring the new "devicename path", I use it
> as the parameter in CreateFile, I always get the
> VALID_HANDLE, I don't know why, does it mean that
> no matter what I declare, if the symbolicname is used,
> the CreateFile will always return VALID_HANDLE?
>
>
>
>
>
> "Owen Smith" <nospam.osmith@saitek.com.nospam> wrote in message
> news:op.tz2842cu39p9aw@oas-core2...
>> Yes, if you call CreateFile with the symboliclink, you can call ReadFile,
>> WriteFile and DeviceIoControl to communicate with the driver. Some
>> devices wont let you create them (Mice and Keyboards).
>>
>> Look at the SetupDi... functions to enumerate devices for your symbolic
>> link, because it will change with different ports and on different
>> systems
>>
>> On Sat, 13 Oct 2007 01:15:17 +0100, zonhai.won <zonhai.won@gmail.com>
>> wrote:
>>
>>> hi all,
>>> During the USB device design, a problem confused me.
>>> I want to get the handle of the USB device, and the symbolicname
>>> of this USB device in register, like following:
>>> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
>>> somebody told me, this symbolicname can be used in
>>> CreateFile to create the handle.
>>> After some tests (by change the symbolicname into the right
>>> form), I can use the "new" symbolicname in createfile, and
>>> the return handle is VALID_HANDLE.
>>> I want to know, is this symbolicname the right parameter
>>> in CreateFile?
>>> And the handle is which handle? Can this handle be used
>>> to communicate with the USB device? If it can, how?
>>>
>>>
>>>
>>
>>
>>
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
>


Re: can symbolicname be used to get handle by Maxim

Maxim
Sun Oct 14 07:24:31 PDT 2007

Do not hardcode such names in your code.

Use SetupDiGetClassDevs to find all of your devices on the machine, then
SetupDiGetDeviceInterfaceDetail to extract this-styled name.

Then pass the name to CreateFile.

Then send ReadFile/WriteFile/DeviceIoControl to the handle created by
CreateFile.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"zonhai.won" <zonhai.won@gmail.com> wrote in message
news:OfFiDCLDIHA.3332@TK2MSFTNGP04.phx.gbl...
> hi all,
> During the USB device design, a problem confused me.
> I want to get the handle of the USB device, and the symbolicname
> of this USB device in register, like following:
> \??\USB#Vid_xx&Pid_xx#x&xx&x&x#{xxx..}
> somebody told me, this symbolicname can be used in
> CreateFile to create the handle.
> After some tests (by change the symbolicname into the right
> form), I can use the "new" symbolicname in createfile, and
> the return handle is VALID_HANDLE.
> I want to know, is this symbolicname the right parameter
> in CreateFile?
> And the handle is which handle? Can this handle be used
> to communicate with the USB device? If it can, how?
>
>
>