How can I launch a C++ native application from a Windows Service main function (the application interacts with the console)? -
i'm using _spawnl() function launching c++ native application main service function (svcmain), application never gets run.
is there trick launch applications interacts user?
it runs, cannot see it. have use createprocessasuser() instead of _spawnl() new process runs in specific user's session, not in service's own session. in vista , later, services run in own isolated sessions (session 0 isolation), users cannot see or interact with. common solution use wtsgetactiveconsolesessionid() and/or wtsenumeratesessions() find desired user session, use wtsqueryusertoken() token hanlde can used createenvironmentblock() , createprocessasuser(). also, when providing startupinfo createprocessasuser(), set lpdesktop field "winsta0\\default" (the user's default desktop can interact after logging in).
Comments
Post a Comment