The service logs in on the system account. The spawned process is in
the same directory as the service (\winnt\system32) and SYSTEM has full
control on the EXE to be spawned.
The EXE to spawn is a 32 bit console application.
If I run the service as an application (I have a command line argument
to do this for debugging) _popen works fine.
--
------------------------------------------------------------------------
| A. Mackay EMail ed...@tag.co.uk |
| http://www.tag.co.uk/tag/ |
| Technology Applications Group |
| |
| Comments are my own and do not reflect the policies of the company I |
| work for. No responsiblitly accepted for incorrect advice given. |
------------------------------------------------------------------------
Source code for _popen is shipped with Visual C++ 4.x, so you can
debug it.
My guess is that _popen fails because your service doesn't have valid
stdin and stdout. Here is a piece of _popen code which may fail:
oldhnd = (HANDLE)_osfhnd( stdhdl ); //stdhdl = 1
if ( (oldhnd == INVALID_HANDLE_VALUE) ||
!DuplicateHandle( prochnd,
oldhnd,
prochnd,
&osfhndsv1,
0L,
FALSE, /*
non-inheritable */
DUPLICATE_SAME_ACCESS ))
{
goto error2;
The code above assumes that a process which does _popen has a valid
stdin,
which is probably not true about services.
Hope this helps.
Regards,
Max Starets
Alistair mackay (ed...@tag.co.uk) wrote:
: Is there any reason why _popen should fail when called from within a