I have been trying to call CreateProcess and am getting the error "The System cannot find the file specified". I am assuming that this refers to the lpApplicationName parameter. I have tried several methods of invoking CreateProcess, but continue to get the error. I am assembling on a desktop running Windows XP Pro.
If anyione out there has successfully invoked CreateProcess, I could really use your help.
Thanks.
well, my crystal ball is damgaged but this example on using CreateProcess (http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx) should also help you.include masm32rt.inc
.code
main proc
LOCAL sui:STARTUPINFO
LOCAL pi:PROCESS_INFORMATION
invoke memfill,ADDR sui,SIZEOF sui,0 ; fill STARTUPINFO
mov sui.cb,SIZEOF sui ;
fn CreateProcess,0,"C:\Windows\notepad.exe",0,0,0,0,0,0,ADDR sui,ADDR pi
ret
main endp
end main
Indeed, post the code you currently have if you want specific suggestions.
this one works for me - it also has command line parameters...
include \masm32\include\masm32rt.inc
.DATA
PrcName db '\minint\system32\cmd.exe',0
CmdLine db '/k "echo.&&'
db 'echo Recover - Recover C:&&'
db 'echo Wiz [?] - MBRWizard&&'
db 'echo Exit - Reboot"',0
.DATA?
SUInfo STARTUPINFO <>
PrcInfo PROCESS_INFORMATION <>
.CODE
_main proc
INVOKE CreateProcess,ADDR PrcName,ADDR CmdLine,
NULL, NULL,NULL,
CREATE_NEW_PROCESS_GROUP or NORMAL_PRIORITY_CLASS,
NULL,NULL,
ADDR SUInfo,ADDR PrcInfo
INVOKE ExitProcess,0
_main endp
end _main
Making sure the program name is terminate with a NUL (0) is important for C, ASCIIZ, or SZ type strings.
Quote from: dedndave on June 09, 2010, 04:06:19 PM
this one works for me - it also has command line parameters...
Cute, Dave. I had forgotten that you can concatenate DOS commands with &&.
Thanks for your responses. I think I may have over-simplified my problem.
I have been programming for over thirty years and have been a 'mainframe' assembler for the past 15 years.
I understand the parameter data dypes need to be in the api call. I do have Microsoft's SDK documentation. My problem is more with windows parameter values, etc.
After I posted this, I decided to revisit Iczelion's tutorials and did find one (Tut 14) that called Create Process. His Tutorial led me to the solution to my problem.
Again, thanks.