Per Session USB redirection from RDP

Hi all,

I have developed an USB Redirection over RDP using an virtual WDM bus
driver. I am able to mount the USB devices remotely, but the problem is when
is switch to Remote desktop and redirect the USB to the Server all the USB
devices are listing irrespective of session.

Is their an clean way to mount USB devices per Terminal session?

Targeted OS are win server 200, XP,VISTA.

Dennis.scott

Sorry guys

typo:
Targeted OS are win server 2003, XP,VISTA.

On Thu, Mar 4, 2010 at 12:30 PM, Dennis Scott
wrote:

> Hi all,
>
> I have developed an USB Redirection over RDP using an virtual WDM bus
> driver. I am able to mount the USB devices remotely, but the problem is when
> is switch to Remote desktop and redirect the USB to the Server all the USB
> devices are listing irrespective of session.
>
> Is their an clean way to mount USB devices per Terminal session?
>
> Targeted OS are win server 200, XP,VISTA.
>
>
> Dennis.scott
>
>

>Is their an clean way to mount USB devices per Terminal session?

How?

USB subsystem knows nothing on sessions.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

yes Maxim, I know that but i wonder how USB keyboard and USB mouse connected
to client is loaded per session.

On Thu, Mar 4, 2010 at 1:26 PM, Maxim S. Shatskih wrote:

> >Is their an clean way to mount USB devices per Terminal session?
>
> How?
>
> USB subsystem knows nothing on sessions.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

>yes Maxim, I know that but i wonder how USB keyboard and USB mouse connected to client is

loaded per session.

They are loaded globally, but the RDP-based sessions cannot use them - they are only allowed to use the RDP-redirected fake keyboard/mouse.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

So if it is not possible to mount USB per session.

can the below scenario be possible.

  1. since the usb will be connected to client and it will be exported over
    network, i ll be knowing which session id the usb belongs to.

  2. if i can get the session id in the driver such that session id will be
    from which session the device is accessed, can i reject or allow the
    operation to be completed?

On Thu, Mar 4, 2010 at 4:13 PM, Maxim S. Shatskih wrote:

> >yes Maxim, I know that but i wonder how USB keyboard and USB mouse
> connected to client is
> >loaded per session.
>
> They are loaded globally, but the RDP-based sessions cannot use them - they
> are only allowed to use the RDP-redirected fake keyboard/mouse.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

>2. if i can get the session id in the driver such that session id will be from which session the device is

accessed, can i reject or allow the operation to be completed?

In simplest cases - yes, in more complex cases (imagine the USB NIC) - no.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks Maxim

I hope this will be normal usb devices only.

Is their any documented way of doing this?

can i use *IoGetRequestorSessionId()*

On Thu, Mar 4, 2010 at 4:26 PM, Maxim S. Shatskih wrote:

> >2. if i can get the session id in the driver such that session id will be
> from which session the device is
> >accessed, can i reject or allow the operation to be completed?
>
> In simplest cases - yes, in more complex cases (imagine the USB NIC) - no.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

>I hope this will be normal usb devices only.

Sorry, what is “normal USB device”?

Is USB NIC normal? USB hard disk? USB printer?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

USB Memory stick (pen drive) and Hard disk

On Fri, Mar 5, 2010 at 1:08 AM, Maxim S. Shatskih wrote:

> >I hope this will be normal usb devices only.
>
> Sorry, what is “normal USB device”?
>
> Is USB NIC normal? USB hard disk? USB printer?
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Remote file system access (per-session) is already provided by RDP. The
terminal-side USB storage device can be accessed via the redirector.

How is your proposed solution different than the existing one? Maybe that
will help explain how it can (or why it cannot) be achieved.

Regards,

Dave Cattley

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dennis Scott
Sent: Thursday, March 04, 2010 11:17 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Per Session USB redirection from RDP

USB Memory stick (pen drive) and Hard disk

On Fri, Mar 5, 2010 at 1:08 AM, Maxim S. Shatskih
wrote:

>I hope this will be normal usb devices only.

Sorry, what is “normal USB device”?

Is USB NIC normal? USB hard disk? USB printer?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

>USB Memory stick (pen drive) and Hard disk

In the RDP client applet, say “allow the remote to access my drives”.

On the remote, use \tsclient\d\path\name pathnames.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks Maxim and David,

Will this also works if i use Rdesktop from an linux machine?

On Fri, Mar 5, 2010 at 7:52 PM, Maxim S. Shatskih wrote:

> >USB Memory stick (pen drive) and Hard disk
>
> In the RDP client applet, say “allow the remote to access my drives”.
>
> On the remote, use \tsclient\d\path\name pathnames.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

>Will this also works if i use Rdesktop from an linux machine?

Depends on quality of their implementation, probably yes.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks maxim,

yes rdesktop has this implementation but the device will be shown as network
shared devices,
I wanted to show the devices as local devices which are mounted on the
system.

virtual bus driver on the windows side will do the need full, but i am not
able to isolate per session devices.

On Mon, Mar 8, 2010 at 4:19 PM, Maxim S. Shatskih wrote:

> >Will this also works if i use Rdesktop from an linux machine?
>
> Depends on quality of their implementation, probably yes.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

I suspect that Windows cannot implement per-session isolation of “local devices which are mounted on the system”.

Only the network share connections are per-session.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Dennis Scott” wrote in message news:xxxxx@ntdev…
Thanks maxim,

yes rdesktop has this implementation but the device will be shown as network shared devices,
I wanted to show the devices as local devices which are mounted on the system.

virtual bus driver on the windows side will do the need full, but i am not able to isolate per session devices.

On Mon, Mar 8, 2010 at 4:19 PM, Maxim S. Shatskih wrote:

>Will this also works if i use Rdesktop from an linux machine?

Depends on quality of their implementation, probably yes.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Yet per-session namespace support does exist (which is how the redirector
creates drive letter aliases to network shares that are per-session).

You might try asking in NTFSD about making a volume mount visible to a
single session and/or how to lock down the device object such that only that
session can open it. The device might still be visible in devmgr and the
system might know all about it globally but you might still be able to
achieve the result of making it appear as a drive letter only in one
session. But this has just turned into a FSD issue …

As for other types of thingies that might get plugged in, each ‘class’ of
device will be its own challenge.

Why do you want it to look like a local disk instead of remote file system -
I ask to understand what behavior / feature of being local you wish to make
available. Clearly ‘file access’ is achievable remotely and I just don’t
know what else one might want to do from within an RDP session - you want to
format the USB thumb-drive?

Good Luck,
Dave Cattley

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Tuesday, March 09, 2010 10:27 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Per Session USB redirection from RDP

I suspect that Windows cannot implement per-session isolation of “local
devices which are mounted on the system”.

Only the network share connections are per-session.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Dennis Scott” wrote in message
news:xxxxx@ntdev…
Thanks maxim,

yes rdesktop has this implementation but the device will be shown as network
shared devices,
I wanted to show the devices as local devices which are mounted on the
system.

virtual bus driver on the windows side will do the need full, but i am not
able to isolate per session devices.

On Mon, Mar 8, 2010 at 4:19 PM, Maxim S. Shatskih
wrote:

>Will this also works if i use Rdesktop from an linux machine?

Depends on quality of their implementation, probably yes.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks David for the informative mail, i ll knock the door of NTFSD.

David:
Why do you want it to look like a local disk instead of remote file system -
I ask to understand what behavior / feature of being local you wish to make
available. Clearly ‘file access’ is achievable remotely and I just don’t
know what else one might want to do from within an RDP session - you want to
format the USB thumb-drive?

To say as simple as it is, its a client requirement.
As you said the Remote device Or network shared device can be accessed
with out problem, making that device local will be an add-on for the
product.

On Thu, Mar 11, 2010 at 5:57 AM, David R. Cattley wrote:

> Yet per-session namespace support does exist (which is how the redirector
> creates drive letter aliases to network shares that are per-session).
>
> You might try asking in NTFSD about making a volume mount visible to a
> single session and/or how to lock down the device object such that only
> that
> session can open it. The device might still be visible in devmgr and the
> system might know all about it globally but you might still be able to
> achieve the result of making it appear as a drive letter only in one
> session. But this has just turned into a FSD issue …
>
> As for other types of thingies that might get plugged in, each ‘class’ of
> device will be its own challenge.
>
> Why do you want it to look like a local disk instead of remote file system
> -
> I ask to understand what behavior / feature of being local you wish to make
> available. Clearly ‘file access’ is achievable remotely and I just don’t
> know what else one might want to do from within an RDP session - you want
> to
> format the USB thumb-drive?
>
> Good Luck,
> Dave Cattley
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
> Sent: Tuesday, March 09, 2010 10:27 AM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Per Session USB redirection from RDP
>
> I suspect that Windows cannot implement per-session isolation of “local
> devices which are mounted on the system”.
>
> Only the network share connections are per-session.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> “Dennis Scott” wrote in message
> news:xxxxx@ntdev…
> Thanks maxim,
>
> yes rdesktop has this implementation but the device will be shown as
> network
> shared devices,
> I wanted to show the devices as local devices which are mounted on the
> system.
>
> virtual bus driver on the windows side will do the need full, but i am not
> able to isolate per session devices.
>
>
> On Mon, Mar 8, 2010 at 4:19 PM, Maxim S. Shatskih
> wrote:
>
> >Will this also works if i use Rdesktop from an linux machine?
>
>
> Depends on quality of their implementation, probably yes.
>
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>