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?
Thx in Advance :)
Greez DaEagle99
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,
NULL,NULL,NULL,NULL,
ADDR st_info,
ADDR pr_info
invoke CloseHandle,pr_info.hThread
invoke ExitProcess, 0
Thx in Advance :)
Greez DaEagle99
Eagle,
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.
Regards,
hutch@movsd.com
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.
Regards,
hutch@movsd.com
Hutch,
thanks for this fast reply :)
I've now added the following line after the CreateProcess call:
Do you mean I should try the same with a GUI App so I got a class, a handle, etc.?
Greez DaEagle99
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
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.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win9x/95func_3t0z.asp
Regards,
Vortex
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.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win9x/95func_3t0z.asp
Regards,
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.
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.
[color=red]
mov st_info.dwFlags,STARTF_USESHOWWINDOW [/color]
[color=sienna]mov st_info.wShowWindow, SW_HIDE
[/color]
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
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
The param 'SW_HIDE' should work with console/windows applications. :alright: