From: Nadav on
Another importent point to mention is that this problem is specific to
Win2003 ( where multiple WTS session can be opened simultaneously ), On WST &
WinXP the correct audio capture device list is being enumerated.
--
Nadav
http://www.sophin.com


"Nadav" wrote:

> Well, what I actually trying to do is to enumerate my audio capture devices,
> this is done using DirectShow and CoCreateInstance(CLSID_SystemDeviceEnum),
> the list of audio capture devices returned when executed in a WTS had some
> absent devices ( such as Osprey audio capture ).
>
> Using sysinternals process explorer I can clearly see that my application is
> created in a WST session ( \Sessions\1\Windows\WindowStations\WinSta0 ) while
> for an application running on a non WST session the window station is
> \Windows\WindowStations\WinSta0.
> --
> Nadav
> http://www.sophin.com
>
>
> "Ivan Brugiolo [MSFT]" wrote:
>
> > Are you absolutely sure that your process is created in the session
> > that is bound to the glass terminal ?
> > If you execute a simple code that enumerates the display devices,
> > do you ger RDPDD as your display driver, or something that
> > reflects the fact that you have an ATI, nVidia, etc video-card ?
> >
> > --
> > --
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > Use of any included script samples are subject to the terms specified at
> > http://www.microsoft.com/info/cpyright.htm
> >
> >
> > "Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
> > news:D9CFD8FF-90AB-4C20-A02F-8EB3CE19F527(a)microsoft.com...
> > > Problem resolved, when creating the process with Inherit handles set to
> > > false
> > > the process is created properly, HOWEVER, capture device information is
> > > still
> > > NOT AVAILABLE!!! this information is available ONLY when creating the
> > > process
> > > under a non WST session, hence, under \Windows\WindowStations & \Desktop
> > > all
> > > capture devices are available while under
> > > Sessions\%SessionId%\Windows\WindowStations& \Desktop capture devices are
> > > NOT
> > > available
> > >
> > > Why does this happen, how can it be resolved ?
> > >
> > > --
> > > Nadav
> > > http://www.sophin.com
> > >
> > >
> > > "Nadav" wrote:
> > >
> > >> Hi Ivan,
> > >>
> > >> - Thanks for your response, What U suggest works fine when dealing with
> > >> WinXP ( that enable a single remote desktop session ), however, this
> > >> doesn't
> > >> apply to Win2003 where multiple simultaneous sessions are available, on
> > >> Win2003 the application is getting created on a desktop/session otherthen
> > >> the
> > >> WST session I am connected through.
> > >> - To resolve that I was extracting the WST Session in use through the
> > >> launcher application in the followng way:
> > >> 1. I have used ProcessIdToSessionId(GetCurrentProcessId(), &dwSessionId),
> > >> It
> > >> gave an ID different then the one provided by
> > >> 'WTSGetActiveConsoleSessionId'
> > >> 2.
> > >> DuplicateTokenEx(hToken,MAXIMUM_ALLOWED,NULL,SecurityIdentification,TokenPrimary,
> > >> &hTokenDup)
> > >> 3. CreateEnvironmentBlock
> > >> 4. CreateProcessAsUser
> > >>
> > >> THE RESULT:
> > >> CreateProcessAsUser failes with GetLastError == 87 ( The parameter is
> > >> incorrect. )
> > >>
> > >> Why does this happen? how can I resolve that?
> > >>
> > >> Keep in mind that this happen only on Win2003 and NOT on WinXP.
> > >>
> > >> --
> > >> Nadav
> > >> http://www.sophin.com
> > >>
> > >>
> > >> "Ivan Brugiolo [MSFT]" wrote:
> > >>
> > >> > You don't connect *TO* a terminal.
> > >> > You connect a terminal to a session.
> > >> >
> > >> > You need to have an application running
> > >> > in the session attached to the glass terminal.
> > >> > First of all, you need to get the session bound to glass.
> > >> > In the following example it's session #1, while your remote session is
> > >> > #2
> > >> > G:\>qwinsta /server:ivanbrug-t1-b
> > >> > SESSIONNAME USERNAME ID STATE TYPE
> > >> > DEVICE
> > >> > services 0 Disc
> > >> > console USTLSUUser 1 Active
> > >> > rdp-tcp#0 2 ConnQ rdpwd
> > >> > rdp-tcp 65536 Listen
> > >> >
> > >> > Creating processes bound to a session is a matter of using
> > >> > WTSQueryUserToken / CreateProcessAsUser.
> > >> > Once you have a process in the session bound to the glass terminal,
> > >> > you can get all of your non-remote video stack with it's properties and
> > >> > capabilities.
> > >> >
> > >> > --
> > >> > --
> > >> > This posting is provided "AS IS" with no warranties, and confers no
> > >> > rights.
> > >> > Use of any included script samples are subject to the terms specified
> > >> > at
> > >> > http://www.microsoft.com/info/cpyright.htm
> > >> >
> > >> >
> > >> > "Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
> > >> > news:802D4C4B-BB23-4648-BADA-ECFDD4494CD4(a)microsoft.com...
> > >> > > Hi Ivan,
> > >> > >
> > >> > > Thanks for your immediate response, there are some points I wish to
> > >> > > clarify:
> > >> > > How can I connect to the 'glass termninal' ? My application is
> > >> > > launched
> > >> > > from
> > >> > > the remote desktop session, the station\desktop used are the ones
> > >> > > extracted
> > >> > > from that session, which, according to what you say doesn't really
> > >> > > represent
> > >> > > the remote session desktop, to be able to present GUI on the remote
> > >> > > desktop
> > >> > > session I have to use the 'glass termninal', BUT, how can I get the
> > >> > > station\desktop of the 'glass termninal' ????
> > >> > >
> > >> > > --
> > >> > > Nadav
> > >> > > http://www.sophin.com
> > >> > >
> > >> > >
> > >> > > "Ivan Brugiolo [MSFT]" wrote:
> > >> > >
> > >> > >> Let me clarify some concepts first:
> > >> > >> The entire video stack is sessionized.
> > >> > >> When you talk about windowstation\desktop,
> > >> > >> you are always speaking about 2 dimension of a 3 dimensional space.
> > >> > >>
> > >> > >> The system works this way:
> > >> > >> Session X is attached to a terminal.
> > >> > >> A terminal is the logical collction of input/HID devices and display
> > >> > >> drivers.
> > >> > >> When you TS into a ma
From: Ivan Brugiolo [MSFT] on
Untill you create a process in the session bound to the physical terminal,
nothing will work.
In WindowsXp, multiple session can exists.
You need Fast-User-Switching to be enabled.
In Vista, furthermore, the glass terminal will NOT be attached
to session-0 by default.
Let's discuss the win2003 case.
Assume you have Machine\User1 logged on in session #3 bound to the glass
terminal.
Assume you have Machine\User2 logged on in session #2 bound to the Tcp-Rdp
terminal.
Your task is to get a process running
in session #3 from session #2 (or from a service in session-0, if that is
convenient for you).
Once that is done, you can enumerate the capture devices.
The trick becomes more interesting if the glass terminal is bound to a
temporary session
where only winlogon.exe & csrss.exe lives. In that case, you need some help
from a custom GINA to switch to a desktop where you can run some
application.

--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
news:EC74ECE3-5144-4AE8-B017-FC48B1F742DE(a)microsoft.com...
> Another importent point to mention is that this problem is specific to
> Win2003 ( where multiple WTS session can be opened simultaneously ), On
> WST &
> WinXP the correct audio capture device list is being enumerated.
> --
> Nadav
> http://www.sophin.com
>
>
> "Nadav" wrote:
>
>> Well, what I actually trying to do is to enumerate my audio capture
>> devices,
>> this is done using DirectShow and
>> CoCreateInstance(CLSID_SystemDeviceEnum),
>> the list of audio capture devices returned when executed in a WTS had
>> some
>> absent devices ( such as Osprey audio capture ).
>>
>> Using sysinternals process explorer I can clearly see that my application
>> is
>> created in a WST session ( \Sessions\1\Windows\WindowStations\WinSta0 )
>> while
>> for an application running on a non WST session the window station is
>> \Windows\WindowStations\WinSta0.
>> --
>> Nadav
>> http://www.sophin.com
>>
>>
>> "Ivan Brugiolo [MSFT]" wrote:
>>
>> > Are you absolutely sure that your process is created in the session
>> > that is bound to the glass terminal ?
>> > If you execute a simple code that enumerates the display devices,
>> > do you ger RDPDD as your display driver, or something that
>> > reflects the fact that you have an ATI, nVidia, etc video-card ?
>> >
>> > --
>> > --
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
>> > Use of any included script samples are subject to the terms specified
>> > at
>> > http://www.microsoft.com/info/cpyright.htm
>> >
>> >
>> > "Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
>> > news:D9CFD8FF-90AB-4C20-A02F-8EB3CE19F527(a)microsoft.com...
>> > > Problem resolved, when creating the process with Inherit handles set
>> > > to
>> > > false
>> > > the process is created properly, HOWEVER, capture device information
>> > > is
>> > > still
>> > > NOT AVAILABLE!!! this information is available ONLY when creating the
>> > > process
>> > > under a non WST session, hence, under \Windows\WindowStations &
>> > > \Desktop
>> > > all
>> > > capture devices are available while under
>> > > Sessions\%SessionId%\Windows\WindowStations& \Desktop capture devices
>> > > are
>> > > NOT
>> > > available
>> > >
>> > > Why does this happen, how can it be resolved ?
>> > >
>> > > --
>> > > Nadav
>> > > http://www.sophin.com
>> > >
>> > >
>> > > "Nadav" wrote:
>> > >
>> > >> Hi Ivan,
>> > >>
>> > >> - Thanks for your response, What U suggest works fine when dealing
>> > >> with
>> > >> WinXP ( that enable a single remote desktop session ), however, this
>> > >> doesn't
>> > >> apply to Win2003 where multiple simultaneous sessions are available,
>> > >> on
>> > >> Win2003 the application is getting created on a desktop/session
>> > >> otherthen
>> > >> the
>> > >> WST session I am connected through.
>> > >> - To resolve that I was extracting the WST Session in use through
>> > >> the
>> > >> launcher application in the followng way:
>> > >> 1. I have used ProcessIdToSessionId(GetCurrentProcessId(),
>> > >> &dwSessionId),
>> > >> It
>> > >> gave an ID different then the one provided by
>> > >> 'WTSGetActiveConsoleSessionId'
>> > >> 2.
>> > >> DuplicateTokenEx(hToken,MAXIMUM_ALLOWED,NULL,SecurityIdentification,TokenPrimary,
>> > >> &hTokenDup)
>> > >> 3. CreateEnvironmentBlock
>> > >> 4. CreateProcessAsUser
>> > >>
>> > >> THE RESULT:
>> > >> CreateProcessAsUser failes with GetLastError == 87 ( The parameter
>> > >> is
>> > >> incorrect. )
>> > >>
>> > >> Why does this happen? how can I resolve that?
>> > >>
>> > >> Keep in mind that this happen only on Win2003 and NOT on WinXP.
>> > >>
>> > >> --
>> > >> Nadav
>> > >> http://www.sophin.com
>> > >>
>> > >>
>> > >> "Ivan Brugiolo [MSFT]" wrote:
>> > >>
>> > >> > You don't connect *TO* a terminal.
>> > >> > You connect a terminal to a session.
>> > >> >
>> > >> > You need to have an application running
>> > >> > in the session attached to the glass terminal.
>> > >> > First of all, you need to get the session bound to glass.
>> > >> > In the following example it's session #1, while your remote
>> > >> > session is
>> > >> > #2
>> > >> > G:\>qwinsta /server:ivanbrug-t1-b
>> > >> > SESSIONNAME USERNAME ID STATE TYPE
>> > >> > DEVICE
>> > >> > services 0 Disc
>> > >> > console USTLSUUser 1 Active
>> > >> > rdp-tcp#0 2 ConnQ rdpwd
>> > >> > rdp-tcp 65536 Listen
>> > >> >
>> > >> > Creating processes bound to a session is a matter of using
>> > >> > WTSQueryUserToken / CreateProcessAsUser.
>> > >> > Once you have a process in the session bound to the glass
>> > >> > terminal,
>> > >> > you can get all of your non-remote video stack with it's
>> > >> > properties and
>> > >> > capabilities.
>> > >> >
>> > >> > --
>> > >> > --
>> > >> > This posting is provided "AS IS" with no warranties, and confers
>> > >> > no
>> > >> > rights.
>> > >> > Use of any included script samples are subject to the terms
>> > >> > s
From: Nadav on
I successfly created a service that create a process on my WTS session ( I
can see it's GUI ) the problem is that at the moment the process being
created has a windoestation associated with the glass terminal ( e.g.
\Sessions\1\Windows\WindowStations\WinSta0 ) the audio capture device list
doesn't contain all my audio capture devices.
When the process is NOT bound to the glass terminal, hence, it's
windowstation is \Windows\WindowStations\WinSta0 I can get the full audio
capture list.
--
Nadav
http://www.sophin.com


"Ivan Brugiolo [MSFT]" wrote:

> Untill you create a process in the session bound to the physical terminal,
> nothing will work.
> In WindowsXp, multiple session can exists.
> You need Fast-User-Switching to be enabled.
> In Vista, furthermore, the glass terminal will NOT be attached
> to session-0 by default.
> Let's discuss the win2003 case.
> Assume you have Machine\User1 logged on in session #3 bound to the glass
> terminal.
> Assume you have Machine\User2 logged on in session #2 bound to the Tcp-Rdp
> terminal.
> Your task is to get a process running
> in session #3 from session #2 (or from a service in session-0, if that is
> convenient for you).
> Once that is done, you can enumerate the capture devices.
> The trick becomes more interesting if the glass terminal is bound to a
> temporary session
> where only winlogon.exe & csrss.exe lives. In that case, you need some help
> from a custom GINA to switch to a desktop where you can run some
> application.
>
> --
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of any included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
>
> "Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
> news:EC74ECE3-5144-4AE8-B017-FC48B1F742DE(a)microsoft.com...
> > Another importent point to mention is that this problem is specific to
> > Win2003 ( where multiple WTS session can be opened simultaneously ), On
> > WST &
> > WinXP the correct audio capture device list is being enumerated.
> > --
> > Nadav
> > http://www.sophin.com
> >
> >
> > "Nadav" wrote:
> >
> >> Well, what I actually trying to do is to enumerate my audio capture
> >> devices,
> >> this is done using DirectShow and
> >> CoCreateInstance(CLSID_SystemDeviceEnum),
> >> the list of audio capture devices returned when executed in a WTS had
> >> some
> >> absent devices ( such as Osprey audio capture ).
> >>
> >> Using sysinternals process explorer I can clearly see that my application
> >> is
> >> created in a WST session ( \Sessions\1\Windows\WindowStations\WinSta0 )
> >> while
> >> for an application running on a non WST session the window station is
> >> \Windows\WindowStations\WinSta0.
> >> --
> >> Nadav
> >> http://www.sophin.com
> >>
> >>
> >> "Ivan Brugiolo [MSFT]" wrote:
> >>
> >> > Are you absolutely sure that your process is created in the session
> >> > that is bound to the glass terminal ?
> >> > If you execute a simple code that enumerates the display devices,
> >> > do you ger RDPDD as your display driver, or something that
> >> > reflects the fact that you have an ATI, nVidia, etc video-card ?
> >> >
> >> > --
> >> > --
> >> > This posting is provided "AS IS" with no warranties, and confers no
> >> > rights.
> >> > Use of any included script samples are subject to the terms specified
> >> > at
> >> > http://www.microsoft.com/info/cpyright.htm
> >> >
> >> >
> >> > "Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
> >> > news:D9CFD8FF-90AB-4C20-A02F-8EB3CE19F527(a)microsoft.com...
> >> > > Problem resolved, when creating the process with Inherit handles set
> >> > > to
> >> > > false
> >> > > the process is created properly, HOWEVER, capture device information
> >> > > is
> >> > > still
> >> > > NOT AVAILABLE!!! this information is available ONLY when creating the
> >> > > process
> >> > > under a non WST session, hence, under \Windows\WindowStations &
> >> > > \Desktop
> >> > > all
> >> > > capture devices are available while under
> >> > > Sessions\%SessionId%\Windows\WindowStations& \Desktop capture devices
> >> > > are
> >> > > NOT
> >> > > available
> >> > >
> >> > > Why does this happen, how can it be resolved ?
> >> > >
> >> > > --
> >> > > Nadav
> >> > > http://www.sophin.com
> >> > >
> >> > >
> >> > > "Nadav" wrote:
> >> > >
> >> > >> Hi Ivan,
> >> > >>
> >> > >> - Thanks for your response, What U suggest works fine when dealing
> >> > >> with
> >> > >> WinXP ( that enable a single remote desktop session ), however, this
> >> > >> doesn't
> >> > >> apply to Win2003 where multiple simultaneous sessions are available,
> >> > >> on
> >> > >> Win2003 the application is getting created on a desktop/session
> >> > >> otherthen
> >> > >> the
> >> > >> WST session I am connected through.
> >> > >> - To resolve that I was extracting the WST Session in use through
> >> > >> the
> >> > >> launcher application in the followng way:
> >> > >> 1. I have used ProcessIdToSessionId(GetCurrentProcessId(),
> >> > >> &dwSessionId),
> >> > >> It
> >> > >> gave an ID different then the one provided by
> >> > >> 'WTSGetActiveConsoleSessionId'
> >> > >> 2.
> >> > >> DuplicateTokenEx(hToken,MAXIMUM_ALLOWED,NULL,SecurityIdentification,TokenPrimary,
> >> > >> &hTokenDup)
> >> > >> 3. CreateEnvironmentBlock
> >> > >> 4. CreateProcessAsUser
> >> > >>
> >> > >> THE RESULT:
> >> > >> CreateProcessAsUser failes with GetLastError == 87 ( The parameter
> >> > >> is
> >> > >> incorrect. )
> >> > >>
> >> > >> Why does this happen? how can I resolve that?
> >> > >>
> >> > >> Keep in mind that this happen only on Win2003 and NOT on WinXP.
> >> > >>
> >> > >> --
> >> > >> Nadav
> >> > >> http://www.sophin.com
> >> > >>
> >> > >>
> >> > >> "Ivan Brugiolo [MSFT]" wrote:
> >> > >>
> >> > >> > You don't connect *TO* a terminal.
> >> > >> > You connect a terminal to a session.
> >> > >> >
> >> > >> > You need to have an application running
> >> > >> > in the session attached to the glass terminal.
> >> > >> > First of all, you need to get the session bound to glass.
> >> > >> > In the following example it's session #1, while your remote
> >> > >> > session is
> >> > >> > #2
> >> > >> > G:\>qwinsta /server:ivanbrug-t1-b
> >> > >> > SESSIONNAME USERNAME
From: Anatoly Greenblatt on
Here's an alternative. Why won't you change the way you enumerate devices ?

Anatoly.

"Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
news:60B8EE3D-83CC-4918-9CE0-8DE35C0C35E7(a)microsoft.com...
> Hi Guntar,
>
> Indeed what you are suggesting is possible, however, I have an already
> enxisting application and doing the chage you are suggesting will
> practically
> require me to re-write that application, I wish to be sure there are no
> other
> alternatives before doing that.
> --
> Nadav
> http://www.sophin.com
>
>
> "G?nter Prossliner" wrote:
>
>> Hi!
>>
>> > 1. I am writing a DirectShow/DirectX oriented application.
>> > 2. This application has no real interaction with DirectShow/DirectX
>> > object other then enumerating available video & audio capture sources
>> > and presenting the capture properties.
>>
>> ....
>>
>> > 7. Capture device enumeration DOESN'T fail when executed by a services
>> > started through a remote desktop session.
>>
>> Why do you want to display a GUI from a service?
>>
>> Why dont you just develop a service (you did it already), but instead
>> showing the GUI from the serivce, you just enumerate the available video
>> &
>> audio capture sources and return them as a data-structure with some kind
>> of
>> IPC.
>>
>> Your GUI (normal windows exe started by RDC) recieves this information
>> and
>> can display it or do whatever is needed (you do not need any drawing,
>> it's
>> just a kind of "system information", right?). The service is not needed
>> anymore and can be stopped by the application.
>>
>>
>>
>>
>> GP
>>
>>
>>


From: Nadav on
Yeah, Unfortunetly this is what I did to resolve this problem
--
Nadav
http://www.sophin.com


"Anatoly Greenblatt" wrote:

> Here's an alternative. Why won't you change the way you enumerate devices ?
>
> Anatoly.
>
> "Nadav" <Nadav(a)discussions.microsoft.com> wrote in message
> news:60B8EE3D-83CC-4918-9CE0-8DE35C0C35E7(a)microsoft.com...
> > Hi Guntar,
> >
> > Indeed what you are suggesting is possible, however, I have an already
> > enxisting application and doing the chage you are suggesting will
> > practically
> > require me to re-write that application, I wish to be sure there are no
> > other
> > alternatives before doing that.
> > --
> > Nadav
> > http://www.sophin.com
> >
> >
> > "Günter Prossliner" wrote:
> >
> >> Hi!
> >>
> >> > 1. I am writing a DirectShow/DirectX oriented application.
> >> > 2. This application has no real interaction with DirectShow/DirectX
> >> > object other then enumerating available video & audio capture sources
> >> > and presenting the capture properties.
> >>
> >> ....
> >>
> >> > 7. Capture device enumeration DOESN'T fail when executed by a services
> >> > started through a remote desktop session.
> >>
> >> Why do you want to display a GUI from a service?
> >>
> >> Why dont you just develop a service (you did it already), but instead
> >> showing the GUI from the serivce, you just enumerate the available video
> >> &
> >> audio capture sources and return them as a data-structure with some kind
> >> of
> >> IPC.
> >>
> >> Your GUI (normal windows exe started by RDC) recieves this information
> >> and
> >> can display it or do whatever is needed (you do not need any drawing,
> >> it's
> >> just a kind of "system information", right?). The service is not needed
> >> anymore and can be stopped by the application.
> >>
> >>
> >>
> >>
> >> GP
> >>
> >>
> >>
>
>
>