c++ - How to start an application as a child of a newly created explorer process? -


i'm working on application resembles kiosk. after application starts, creates new desktop limited capabilities. using key combo can move , forth between desktops. in order inform user desktop it's using, or other information i've created application, displaying balloon messages system tray area.

in newly created desktop, start explorer.exe using createprocess function, , providing new desktop thru startupinfo structure, , i'm returning handle process in process_information structure.

using same technique i'm trying start icon tray application in new desktop , providing new desktop in startupinfo structure. trouble that, according task manager, application running, tray icon not displayed.

my intuition says in new desktop, icon not shown because it's not child of new explorer.exe process, procexp application live.systernals showing these 2 processes, on same level in tree representation.

is there way provide argument createprocess, maybe explorer process handle, icon tray application starts child of process?

l.e.: here code use create start explorer.exe , icon tray processes:

startupinfo sinfont; /// startupinfo explorer.exe process_information pinfont; /// process infromation explorer.exe zeromemory(&sinfont, sizeof(sinfont)); sinfont.lpdesktop = l"threaddesktop"; /// setting desktop process pinfont = startprocess(sinfont, l"c:\\windows\\explorer.exe"); /// starting process  if (!pinfont.hprocess)     log(error) << "unable start new explorer process"; else     log(info) << "started new explorer process";  startupinfo sinfotitd; /// doing same thing tray icon application process_information pinfotitd; zeromemory(&sinfotitd, sizeof(sinfotitd)); sinfotitd.lpdesktop = l"threaddesktop"; pinfotitd = startprocess(sinfotitd, l"desktoptrayicon.exe"); if (!pinfotitd.hprocess)     log(error) << "unable start tray icon new desktop"; else     log(info) << "started tray icon new desktop"; 

, startprocess function:

process_information kiosklauncher::startprocess(startupinfo startupinfo, lpctstr lpapplicationname) {     process_information processinformation;     zeromemory(&processinformation, sizeof(processinformation));      if (!createprocess(lpapplicationname, null, null, null, false, create_new_console, null, null, &startupinfo, &processinformation))         messagebox(0, l"unable start process!\nthe path broken!", l"path error!", mb_iconerror);      return processinformation; } 

if want make new process child of other process, have use code injection. search createremotethread give plenty of reading material. biggest problem is, process has same bit-ness target. there 3 alternative ways of using it:

  • dll injection (standard)
  • inject actual shellcode: assembler code resolve dependencies itself. (will not work emet enabled)
  • copy block of code application , fix imports (tricky)

Comments