News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

CreateProcess: MOD_NOT_FOUND Error

Started by EarlCrapstone, November 18, 2005, 03:49:14 AM

Previous topic - Next topic

EarlCrapstone

Here's mine:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\

Looks fine.

PBrennick

Yes it does.

Make this change to the program...


;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CommandLine db "c:\windows\system32\cmd.exe",0


If this does not work then go to the system32 directory and make very sure that cmd.exe resides there.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

PBrennick

Earl,
Ijust noticed you got it to work.  About not seeing it in the TaskManager, when it runs correctly; you will see Pipe.exe running as an Application and also as a Process.  The Application is Pipe.exe, but the Process is really CMD.EXE, okay.

Also, the console thing, I thought that might be a part of your problem and is why I modified my attachment.  Tale a close look at the batch file it is my version of Mark's excellent batch file and should serve all your needs.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

EarlCrapstone

I got the pipe.exe program to work, but mine still stops on a line that starts with "rep" and I have to hold SHIFT+F8 in OllyDbg to get it to continue on with the program. It does this whether I compile it as a console app or not.

PBrennick

EarlCrapstone,
With one addition and one change, I was able to get your program to work.


.486
.model flat, stdcall
option casemap :none
StartCmd proto

; includes

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.data

cmdexe db "cmd.exe",0

.code

start:

invoke StartCmd
invoke ExitProcess,eax

StartCmd Proc

LOCAL stin:STARTUPINFO
LOCAL prin:PROCESS_INFORMATION

invoke  GetStartupInfo, addr stin       ; You forgot this
mov stin.cb,sizeof stin
mov stin.wShowWindow,SW_HIDE
mov stin.dwFlags,STARTF_USESHOWWINDOW   ; The other flag that was here refuses to work

invoke CreateProcess,NULL,addr cmdexe,NULL,NULL,TRUE,0,NULL,NULL,addr stin,addr prin

invoke CloseHandle,prin.hProcess
invoke CloseHandle,prin.hThread

ret

StartCmd endp

end start


I also removed the Message Box as eax would need to be converted before display and cmd.exe is working, anyway.

Paul


[attachment deleted by admin]
The GeneSys Project is available from:
The Repository or My crappy website

EarlCrapstone

Thank you so much! It works perfectly now.

PBrennick

Earl,
No problem.  Right now, the program has no error checking.  I am sure you will add it now that you have gotten it to work.

Happy coding!  :U
Paul
The GeneSys Project is available from:
The Repository or My crappy website

EarlCrapstone

Do you know why STARTF_USESTDHANDLES doesn't work in the line:

mov stin.dwFlags,STARTF_USESHOWWINDOW+ STARTF_USESTDHANDLES

It works in the Pipe example.

PBrennick

Earl,
It is because of the fundamental difference between the two programs.  Yours creates a process but does not create a pipe.

With a pipe you need to use standard handles so STDInput and STDOutput will work properly.  For your purposes, it is not important.  Also, in the Pipe example, I am using CreatePipe.

hth,
Paul
The GeneSys Project is available from:
The Repository or My crappy website

EarlCrapstone

So it wont work unless I create a pipe?

PBrennick

Earl,
Yes, also, take a look at Iczelion's Tutorial 21.

hth,
Paul
The GeneSys Project is available from:
The Repository or My crappy website