Very short question here..what's the easiest way to simply execute a program by command line? As an example, if I just wanted to start cmd.exe or notepad.exe from a program (MASM32) how would I go about it?
bla db "notepad.exe",0 . . . invoke ShellExecute,NULL,NULL,addr bla,NULL,NULL,SW_NORMAL
Hmm..oddly enough that didn't seem to work :> I tried this as a bare-bones test: .386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc include \masm32\include\shell32.inc includelib \masm32\lib\shell32.lib includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib .data bla db "notepad.exe",0 .code start: invoke ShellExecute,NULL,NULL,addr bla,NULL,NULL,SW_NORMAL invoke ExitProcess,NULL end start Any idea what I'm doing wrong?
Aryss, i don't call exitprocess. This must work (is for Tasm). .486 locals jumps .model flat,stdcall extrn ShellExecuteA :Proc .data URL db "notepad.exe",0 .code entry: call ShellExecuteA, 0, 0, offset URL, 0, 0, 1 sub eax, eax ret end entry Ciao ! TheTramp32
invoke CreateProcess, addr prog, NULL, NULL, NULL, FALSE,\ NORMAL_PRIORITY_CLASS, NULL, NULL, NULL, NULL