Hi Folks,
i'm currently writing a console-app that runs an application hidden with the parameters specified @ the command line. I think everything's working correctly, but it doesn't run hidden. Where's the fault?

invoke ClearScreen
invoke GetCL,1,ADDR Executable

invoke GetCL,cnt,ADDR cmdBuffer
cmp eax, 1
jne @F

invoke szCatStr,ADDR Parameters,ADDR cmdBuffer
invoke szCatStr,ADDR Parameters,ADDR space

inc cnt
jmp @B

invoke rtrim, addr Parameters, addr Parameters

invoke szCatStr, addr Executable, addr space
invoke szCatStr, addr Executable, addr Parameters

invoke GetStartupInfo,ADDR st_info
mov st_info.wShowWindow, SW_HIDE

invoke CreateProcess,0,ADDR Executable,NULL,NULL,
ADDR st_info,
ADDR pr_info

invoke CloseHandle,pr_info.hThread

invoke ExitProcess, 0

Thx in Advance :)

Greez DaEagle99
Posted on 2002-12-14 04:00:45 by DaEagle99

You have little chance of hiding a console window so if you are trying to make a hidden service (and not doing anything illegal) you would be better off running a GUI app as the ShowWindow() API is designed for windows, not consoles.

If you just want to hide the app you can start it off the screen, make the X - Y coordinates negative numbers, -1000 for example so that the windsow works perfectly but cannot be seen. It will still be seen on the task bar though.


Posted on 2002-12-14 04:08:45 by hutch--

thanks for this fast reply :)
I've now added the following line after the CreateProcess call:
invoke ShowWindow, pr_info.hProcess, SW_HIDE
but it doesn't work.
Do you mean I should try the same with a GUI App so I got a class, a handle, etc.?

Greez DaEagle99
Posted on 2002-12-14 04:17:59 by DaEagle99
I think you must use the FindWindow function to get the handle of your window.
You can use Iczelion's tutorial 24 (hooks) to retrieve immediatly the window class.
If your operating system is Win9x,try the RegisterServiceProcess function,still Hutch's solution is the best.



Posted on 2002-12-14 05:35:50 by Vortex
Hutch, I dont think he is trying to hide a console window. He sayd that
he executed programs from a console window. Anyways, in order
to correctly use the the param. 'SW_HIDE' with the STARTUPINFO struct.
You need to setup the flags first, so that the createprocess knows wich
members of the startupinfo structure is used.

mov st_info.dwFlags,STARTF_USESHOWWINDOW [/color]
[color=sienna]mov st_info.wShowWindow, SW_HIDE
Posted on 2002-12-14 06:21:37 by natas
Hi Natas,
you've found the fault. Now it works :)
I have no special target that I want to execute. Actually it should execute GUIs and Console Applications. May there be an error with executing Console Apps (like mine is) hidden?

Greez DaEagle99
Posted on 2002-12-14 06:45:48 by DaEagle99
The param 'SW_HIDE' should work with console/windows applications. :alright:
Posted on 2002-12-14 06:54:17 by natas