Hello :alright:

whats the best way to launch an executable ? ( for example "C:\Notepad.exe" ) :confused:

and how do i get a nice picture for my user lookup (but not a donkey please ;) )
Posted on 2003-08-19 05:12:41 by Ranma_at
CreateProcess ?
Posted on 2003-08-19 05:13:30 by BogdanOntanu
if you just want to open an associated 'viewer' then you can also use ShellExecute

Just look for a nice picture on the internet :)
Posted on 2003-08-19 05:51:56 by Hiroshimator
I agree with BogdanOntanu, it is CreateProcess.
Posted on 2003-08-19 06:22:59 by roticv
I know ShellExecute



{
ShellExecute(m_hWnd, "open", "http://www.microsoft.com/visualc", NULL, NULL, SW_SHOWNORMAL);
}


from C++ where i am coming from but i have no idea how to a createprocess in asm,
so i was just wondering :confused:
how to launch my Notepad.exe from asm.
Posted on 2003-08-19 06:30:14 by Ranma_at


.data?
process db "calc.exe",0
processinfo PROCESS_INFORMATION <?>
startinfo STARTUPINFO <?>
.code
..
invoke CreateProcess,offset process,0,0,0,0,CREATE_NEW_CONSOLE,0,0,offset startinfo, offset processinfo


Or you can use ShellExecute
Posted on 2003-08-19 07:16:35 by roticv
The WinExec function is also available.
Posted on 2003-08-19 12:44:27 by Vortex
Hi Roticv

when i put your


process db "calc.exe",0
processinfo PROCESS_INFORMATION <?>
startinfo STARTUPINFO <?>


under .data?

i get a compiler warning, not when i put it

under .data

should i listen to this warning or just forget it? :)
Posted on 2003-08-20 05:46:30 by Ranma_at
process db "calc.exe",0 --- that's not very _UN_initialized, is it?
Put the "process" string in ".data", and the two structures in ".data?"
Posted on 2003-08-20 07:40:40 by f0dder
hi all,

see Icezilion tutorials: Process tutorial, it loads notepad.exe as u want.

amr
Posted on 2003-08-20 07:46:17 by amr
Sorry typo :grin:
Posted on 2003-08-20 08:46:53 by roticv

hi all,

see Icezilion tutorials: Process tutorial, it loads notepad.exe as u want.

amr



he uses a dll for this tutorial. thats not what i wanted.
Posted on 2003-08-20 09:50:12 by Ranma_at
WinExec is not a good choice unless you plan on the process to either close or to be quick.. since it will force your other program to suspend until the other program exits before it lets the program that call the other program to continue..

also i have encountered problems with it locking up some apps.. if i remember correctly it messed up running a installer program..

with CreateProcess there are two way to call the exe one is to call it by path and exe like C:\windows\notepad.exe

then there is another way that allows you to call c:\windows\notepad.exe c:\txt.log
this will cause it to use parameters in this case it will open the file or create txt.log in the root of C drive.

.data?
process db "c:\windows\notepad.exe",0
process2 db "c:\windows\notepad.exe c:\txt.log ",0
processinfo PROCESS_INFORMATION <?>
startinfo STARTUPINFO <?>
.code
..
invoke CreateProcess,offset process,0,0,0,0,CREATE_NEW_CONSOLE,0,0,offset startinfo, offset processinfo

the above is the first example i was talking about this way can only call the exe


invoke CreateProcessA,0,offset process2,0,0,0,CREATE_NEW_CONSOLE,0,0,offset startinfo, offset processinfo

as you notice not much has changed but the first to vars are now swaped.. this way allows you to pass or call parameters to other programs.
Posted on 2003-08-20 14:03:23 by devilsclaw
If you want to include parameters, you could also use the following:



.data?
process db "c:\windows\notepad.exe",0
comnd_line db " c:\txt.log ",0
processinfo PROCESS_INFORMATION <?>
startinfo STARTUPINFO <?>
.code
..
invoke CreateProcess,offset process,offset comnd_line,0,0,0,CREATE_NEW_CONSOLE,0,0,offset startinfo, offset processinfo


Notice the space as the first character of the comnd_line string.

farrier
Posted on 2003-08-20 19:42:11 by farrier