Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Security > Cannot access qwinsta.exe programmatically

Reply
Thread Tools Display Modes

Cannot access qwinsta.exe programmatically

 
 
Kristofer Skaug
Guest
Posts: n/a

 
      05-21-2009
Hi -

I have a piece of Delphi source code here that is calling the 'qwinsta'
utility and parses its output, in order to detect the presence of a Remote
Desktop login session.
This has always worked well on Windows XP (except on some XP-Embedded images
where 'qwinsta.exe' was not pre-installed).

Now I have a new Vista x64 Ultimate system. I have verified that 'qwinsta'
is installed, and it works properly from a command prompt.
However, the routine in my test program fails to access 'qwinsta' - here is
the commandline I use to invoke it:

'cmd.exe /c qwinsta.exe /server'

(this is invoked using CreateProcess) - which returns the following message:

-> "'qwinsta.exe' is not recognized as an internal or external command,
operable program or batch file."

PATH for the system has been set to include %systemroot%\System32, and just
to be sure, I've set the "start in" directory for this command to
c:\Windows\System32 - which is where qwinsta.exe is installed. Using the
same commandline invocation format on the same system, I am able to
succesfully invoke other utilities in the same directory, e.g. SYSTEMINFO.

My account is member of the "Administrators" group, and I've even tried
running the test program "As Administrator" (from the context menu) but no
difference.
I have completely turned off UAC. The last bit of 'relevant' information I
can think of is that all this testing is taking place using a Remote Desktop
connection. The 'qwinsta' output I get from the Command Prompt (i.e.
manually) is as follows:

SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console 1 Conn
>rdp-tcp#0 kgs 2 Active rdpwd

rdp-tcp 65536 Listen

Please, if someone has an idea what I'm doing wrong, let me know!
Also, if there's a better forum somewhere to ask this question - -

TIA, Kristofer







 
Reply With Quote
 
 
 
 
Kristofer Skaug
Guest
Posts: n/a

 
      05-21-2009
Additional information - by dumb experimentation I have found that also the
commands qprocess.exe and shadow.exe fail in the same way (i.e. they work
when typed manually into a command prompt, but fail to be launched via
cmd.exe /c). Yet other commands like tasklist, ping, netstat etc. do work in
both ways.

Kristofer

Kristofer Skaug wrote:
> Hi -
>
> I have a piece of Delphi source code here that is calling the
> 'qwinsta' utility and parses its output, in order to detect the
> presence of a Remote Desktop login session.
> This has always worked well on Windows XP (except on some XP-Embedded
> images where 'qwinsta.exe' was not pre-installed).
>
> Now I have a new Vista x64 Ultimate system. I have verified that
> 'qwinsta' is installed, and it works properly from a command prompt.
> However, the routine in my test program fails to access 'qwinsta' -
> here is the commandline I use to invoke it:
>
> 'cmd.exe /c qwinsta.exe /server'
>
> (this is invoked using CreateProcess) - which returns the following
> message:
> -> "'qwinsta.exe' is not recognized as an internal or external
> command, operable program or batch file."
>
> PATH for the system has been set to include %systemroot%\System32,
> and just to be sure, I've set the "start in" directory for this
> command to c:\Windows\System32 - which is where qwinsta.exe is
> installed. Using the same commandline invocation format on the same
> system, I am able to succesfully invoke other utilities in the same
> directory, e.g. SYSTEMINFO.
> My account is member of the "Administrators" group, and I've even
> tried running the test program "As Administrator" (from the context
> menu) but no difference.
> I have completely turned off UAC. The last bit of 'relevant'
> information I can think of is that all this testing is taking place
> using a Remote Desktop connection. The 'qwinsta' output I get from
> the Command Prompt (i.e. manually) is as follows:
>
> SESSIONNAME USERNAME ID STATE TYPE DEVICE
> services 0 Disc
> console 1 Conn
>> rdp-tcp#0 kgs 2 Active rdpwd

> rdp-tcp 65536 Listen
>
> Please, if someone has an idea what I'm doing wrong, let me know!
> Also, if there's a better forum somewhere to ask this question - -
>
> TIA, Kristofer



 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Programmatically Set -> 'DMA if available'? Stephan Wolf [MVP] Windows Vista Drivers 1 11-07-2006 07:37 PM
Programmatically Set -> 'DMA if available'? S. Heck Windows Vista Drivers 0 11-05-2006 07:13 PM
Cannot programmatically get a valid connection to a WPA enabled access point. Shane Schunker Windows Vista Drivers 5 10-17-2003 12:30 AM
Re: How can i access the device manager programmatically? Murthy Akella Windows Vista Drivers 0 07-02-2003 03:22 PM
Re: How can i access the device manager programmatically? tarun Windows Vista Drivers 0 07-02-2003 11:18 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59