I started working on function doing this.
It's not finished, but it'll later so.
CreateProcess.c:
CreateProcess.bmx:
I've some problems with GetStartupInfo(...) function.
The program stops in debug mode by clicking any button.
It's not finished, but it'll later so.
CreateProcess.c:
#include <windows.h> int WinGetStartupInfo ( void * Info ) { GetStartupInfo ( Info ) ; return 0 ; }
CreateProcess.bmx:
Strict Import "CreateProcess.c" Local Stream:TStream = CreateProcess ( "calc.exe" ) Delay 10000 While Not Eof ( Stream ) Print ReadLine ( Stream ) Wend Function CreateProcess:TStream ( Cmd$ ) ?Win32 Local Stream:TProcessStream = New TProcessStream Stream.ProcInfo = New TProcInfo Stream.StartInfo = New TStartInfo ' Stream.StartInfo.Size = SizeOf Stream.StartInfo DebugStop Print WinGetStartupInfo ( Stream.StartInfo ) Print WinCreatePipe ( Varptr Stream.In , Varptr Stream.StartInfo.StdOutput , Null , 0 ) Print WinCreatePipe ( Varptr Stream.StartInfo.StdInput , Varptr Stream.Out , Null , 0 ) Stream.StartInfo.StdError = Stream.StartInfo.StdOutput Print WinCreateProcess ( "".ToCString ( ) , Cmd.ToCString ( ) , Null , Null , False , 0 , Null , Null , Stream.StartInfo , Stream.ProcInfo ) Return Stream Type TProcInfo Field Process Field Thread Field ProcessId Field ThreadId EndType Type TStartInfo Field Size Field Reserved1 Field Desktop Field Title Field X Field Y Field XSize Field YSize Field XCountChars Field YCountChars Field FillAttribute Field Flags Field ShowWindow:Short Field Reserved2:Short Field Reserved3:Byte Field StdInput Field StdOutput Field StdError Field Test:Long EndType Type TProcessStream Extends TStream Field In Field Out Field StartInfo:TStartInfo Field ProcInfo:TProcInfo Method Eof ( ) EndMethod EndType Extern "C" Function WinGetStartupInfo ( StartInfo:TStartInfo ) EndExtern Extern "Win32" Function WinCreatePipe ( ReadPipe Ptr , WritePipe Ptr , PipeAttributes:Byte Ptr , Size ) = "CreatePipe@16" Function WinCreateProcess ( App:Byte Ptr , Cmd:Byte Ptr , PrAt:Byte Ptr , ThAt:Byte Ptr , IH , Flags , Env:Byte Ptr , Dir:Byte Ptr , S:TStartInfo , P:TProcInfo ) = "CreateProcessA@40" Function WinReadFile ( File , Buffer:Byte Ptr , ReadLen , BytesRead Ptr , Overlapped:Byte Ptr ) = "ReadFile" Function WinWriteFile ( File , Buffer:Byte Ptr , WriteLen , BytesWritten Ptr , Overlapped:Byte Ptr ) = "WriteFile" Function WinCloseHandle ( Handle , abc ) = "CloseHandle" EndExtern ? system_ Cmd EndFunction
I've some problems with GetStartupInfo(...) function.
The program stops in debug mode by clicking any button.