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
|