mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 09:29:07 +02:00
* ExecuteProcess fixes, ProcessID and ThreadID added
This commit is contained in:
parent
1779c5dd8c
commit
e0f9297e01
@ -1812,6 +1812,9 @@ begin
|
|||||||
Initial:=FALSE;
|
Initial:=FALSE;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
{ Startup }
|
{ Startup }
|
||||||
{ Only AmigaOS v2.04 or greater is supported }
|
{ Only AmigaOS v2.04 or greater is supported }
|
||||||
If KickVersion < 36 then
|
If KickVersion < 36 then
|
||||||
@ -1830,7 +1833,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2003-10-25 23:42:35 hajny
|
Revision 1.10 2004-01-20 23:05:31 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.9 2003/10/25 23:42:35 hajny
|
||||||
* THandle in sysutils common using System.THandle
|
* THandle in sysutils common using System.THandle
|
||||||
|
|
||||||
Revision 1.8 2003/09/29 18:52:36 hajny
|
Revision 1.8 2003/09/29 18:52:36 hajny
|
||||||
|
@ -752,6 +752,9 @@ begin
|
|||||||
OpenStdIO(StdErr,fmOutput,StdErrorHandle);
|
OpenStdIO(StdErr,fmOutput,StdErrorHandle);
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
errno := 0;
|
errno := 0;
|
||||||
{ Setup command line arguments }
|
{ Setup command line arguments }
|
||||||
argc:=GetParamCount(args);
|
argc:=GetParamCount(args);
|
||||||
@ -762,7 +765,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2003-10-25 23:42:35 hajny
|
Revision 1.10 2004-01-20 23:05:31 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.9 2003/10/25 23:42:35 hajny
|
||||||
* THandle in sysutils common using System.THandle
|
* THandle in sysutils common using System.THandle
|
||||||
|
|
||||||
Revision 1.8 2003/09/29 18:52:36 hajny
|
Revision 1.8 2003/09/29 18:52:36 hajny
|
||||||
|
@ -532,13 +532,19 @@ begin
|
|||||||
|
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
{$ifdef HASVARIANT}
|
{$ifdef HASVARIANT}
|
||||||
initvariantmanager;
|
initvariantmanager;
|
||||||
{$endif HASVARIANT}
|
{$endif HASVARIANT}
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.10 2003-10-25 23:42:35 hajny
|
Revision 1.11 2004-01-20 23:09:14 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.10 2003/10/25 23:42:35 hajny
|
||||||
* THandle in sysutils common using System.THandle
|
* THandle in sysutils common using System.THandle
|
||||||
|
|
||||||
Revision 1.9 2003/09/27 11:52:35 peter
|
Revision 1.9 2003/09/27 11:52:35 peter
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Copyright (c) 1999-2000 by Florian Klaempfl
|
Copyright (c) 1999-2000 by Florian Klaempfl
|
||||||
member of the Free Pascal development team
|
member of the Free Pascal development team
|
||||||
|
|
||||||
Sysutils unit for linux
|
Sysutils unit for BeOS
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
@ -255,6 +255,25 @@ begin
|
|||||||
Result:=StrPas(beos.Getenv(PChar(EnvVar)));
|
Result:=StrPas(beos.Getenv(PChar(EnvVar)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString):
|
||||||
|
integer;
|
||||||
|
|
||||||
|
var
|
||||||
|
CommandLine: AnsiString;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{ always surround the name of the application by quotes
|
||||||
|
so that long filenames will always be accepted. But don't
|
||||||
|
do it if there are already double quotes!
|
||||||
|
}
|
||||||
|
if pos('"',path)=0 then
|
||||||
|
CommandLine:='"'+path+'"'
|
||||||
|
else
|
||||||
|
CommandLine:=path;
|
||||||
|
if ComLine <> '' then
|
||||||
|
CommandLine := Commandline + ' ' + ComLine;
|
||||||
|
ExecuteProcess := beos.shell (CommandLine);
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Initialization code
|
Initialization code
|
||||||
@ -268,7 +287,10 @@ Finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2003-11-26 20:00:19 florian
|
Revision 1.8 2004-01-20 23:09:14 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.7 2003/11/26 20:00:19 florian
|
||||||
* error handling for Variants improved
|
* error handling for Variants improved
|
||||||
|
|
||||||
Revision 1.5 2003/03/29 15:16:26 hajny
|
Revision 1.5 2003/03/29 15:16:26 hajny
|
||||||
|
@ -163,6 +163,9 @@ Begin
|
|||||||
SysInitStdIO;
|
SysInitStdIO;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
{$ifdef HASVARIANT}
|
{$ifdef HASVARIANT}
|
||||||
initvariantmanager;
|
initvariantmanager;
|
||||||
{$endif HASVARIANT}
|
{$endif HASVARIANT}
|
||||||
@ -170,7 +173,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.12 2004-01-04 20:32:05 jonas
|
Revision 1.13 2004-01-20 23:09:14 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.12 2004/01/04 20:32:05 jonas
|
||||||
+ geterrnolocation for Darwin
|
+ geterrnolocation for Darwin
|
||||||
+ C-style main for Darwin (generic, can be used for anything)
|
+ C-style main for Darwin (generic, can be used for anything)
|
||||||
|
|
||||||
|
@ -466,10 +466,10 @@ asm
|
|||||||
pushl %ebx
|
pushl %ebx
|
||||||
{$IFDEF REGCALL}
|
{$IFDEF REGCALL}
|
||||||
movl %eax,%ebx
|
movl %eax,%ebx
|
||||||
{$IFDEF REGCALL}
|
{$ELSE REGCALL}
|
||||||
movl handle,%ebx
|
movl handle,%ebx
|
||||||
movl pos,%edx
|
movl pos,%edx
|
||||||
{$IFDEF REGCALL}
|
{$ENDIF REGCALL}
|
||||||
movw $0x4200,%ax
|
movw $0x4200,%ax
|
||||||
call syscall
|
call syscall
|
||||||
jnc .LDOSSEEK1
|
jnc .LDOSSEEK1
|
||||||
@ -1184,6 +1184,9 @@ end;
|
|||||||
var TIB: PThreadInfoBlock;
|
var TIB: PThreadInfoBlock;
|
||||||
PIB: PProcessInfoBlock;
|
PIB: PProcessInfoBlock;
|
||||||
|
|
||||||
|
const
|
||||||
|
FatalHeap: array [0..33] of char = 'FATAL: Cannot initialize heap!!'#13#10'$';
|
||||||
|
|
||||||
begin
|
begin
|
||||||
IsLibrary := FALSE;
|
IsLibrary := FALSE;
|
||||||
{Determine the operating system we are running on.}
|
{Determine the operating system we are running on.}
|
||||||
@ -1200,13 +1203,15 @@ begin
|
|||||||
mov os_mode, 2
|
mov os_mode, 2
|
||||||
@noRSX:
|
@noRSX:
|
||||||
{Enable the brk area by initializing it with the initial heap size.}
|
{Enable the brk area by initializing it with the initial heap size.}
|
||||||
|
|
||||||
mov eax, 7F01h
|
mov eax, 7F01h
|
||||||
mov edx, heap_brk
|
mov edx, heap_brk
|
||||||
add edx, heap_base
|
add edx, heap_base
|
||||||
call syscall
|
call syscall
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
jnz @heapok
|
jnz @heapok
|
||||||
|
lea edx, FatalHeap
|
||||||
|
mov eax, 900h
|
||||||
|
call syscall
|
||||||
pop ebx
|
pop ebx
|
||||||
push dword 204
|
push dword 204
|
||||||
call HandleError
|
call HandleError
|
||||||
@ -1229,7 +1234,6 @@ begin
|
|||||||
{$ENDIF CONTHEAP}
|
{$ENDIF CONTHEAP}
|
||||||
pop ebx
|
pop ebx
|
||||||
end ['eax', 'ecx', 'edx'];
|
end ['eax', 'ecx', 'edx'];
|
||||||
|
|
||||||
{ in OS/2 this will always be nil, but in DOS mode }
|
{ in OS/2 this will always be nil, but in DOS mode }
|
||||||
{ this can be changed. }
|
{ this can be changed. }
|
||||||
first_meg := nil;
|
first_meg := nil;
|
||||||
@ -1261,7 +1265,8 @@ begin
|
|||||||
also the stack bottom.}
|
also the stack bottom.}
|
||||||
ApplicationType := 1; (* Running under DOS. *)
|
ApplicationType := 1; (* Running under DOS. *)
|
||||||
IsConsole := true;
|
IsConsole := true;
|
||||||
DosEnvInit;
|
ProcessID := 1;
|
||||||
|
ThreadID := 1;
|
||||||
end;
|
end;
|
||||||
osOS2:
|
osOS2:
|
||||||
begin
|
begin
|
||||||
@ -1269,6 +1274,8 @@ begin
|
|||||||
StackBottom := pointer (TIB^.Stack);
|
StackBottom := pointer (TIB^.Stack);
|
||||||
Environment := pointer (PIB^.Env);
|
Environment := pointer (PIB^.Env);
|
||||||
ApplicationType := PIB^.ProcType;
|
ApplicationType := PIB^.ProcType;
|
||||||
|
ProcessID := PIB^.PID;
|
||||||
|
ThreadID := TIB^.TIB2^.TID;
|
||||||
IsConsole := ApplicationType <> 3;
|
IsConsole := ApplicationType <> 3;
|
||||||
end;
|
end;
|
||||||
osDPMI:
|
osDPMI:
|
||||||
@ -1277,7 +1284,8 @@ begin
|
|||||||
always zero.}
|
always zero.}
|
||||||
ApplicationType := 1; (* Running under DOS. *)
|
ApplicationType := 1; (* Running under DOS. *)
|
||||||
IsConsole := true;
|
IsConsole := true;
|
||||||
DosEnvInit;
|
ProcessID := 1;
|
||||||
|
ThreadID := 1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
exitproc:=nil;
|
exitproc:=nil;
|
||||||
@ -1298,6 +1306,9 @@ begin
|
|||||||
initvariantmanager;
|
initvariantmanager;
|
||||||
{$endif HASVARIANT}
|
{$endif HASVARIANT}
|
||||||
|
|
||||||
|
if os_Mode in [osDOS,osDPMI] then
|
||||||
|
DosEnvInit;
|
||||||
|
|
||||||
{$IFDEF DUMPGROW}
|
{$IFDEF DUMPGROW}
|
||||||
{$IFDEF CONTHEAP}
|
{$IFDEF CONTHEAP}
|
||||||
WriteLn ('Initial brk size is ', GetHeapSize);
|
WriteLn ('Initial brk size is ', GetHeapSize);
|
||||||
@ -1307,7 +1318,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.22 2003-12-26 22:20:44 hajny
|
Revision 1.23 2004-01-20 23:05:31 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.22 2003/12/26 22:20:44 hajny
|
||||||
* regcall fixes
|
* regcall fixes
|
||||||
|
|
||||||
Revision 1.21 2003/12/17 22:52:39 hajny
|
Revision 1.21 2003/12/17 22:52:39 hajny
|
||||||
|
@ -223,6 +223,7 @@ end;
|
|||||||
{ Open all stdio fds again }
|
{ Open all stdio fds again }
|
||||||
SysInitStdio;
|
SysInitStdio;
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
ThreadID := ...;
|
||||||
// ErrNo:=0;
|
// ErrNo:=0;
|
||||||
{ Stack checking }
|
{ Stack checking }
|
||||||
StackLength:=stklen;
|
StackLength:=stklen;
|
||||||
@ -379,7 +380,10 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 2003-10-19 09:35:28 hajny
|
Revision 1.5 2004-01-20 23:05:31 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.4 2003/10/19 09:35:28 hajny
|
||||||
* fixes from OS/2 merged to EMX
|
* fixes from OS/2 merged to EMX
|
||||||
|
|
||||||
Revision 1.3 2003/03/23 23:11:17 hajny
|
Revision 1.3 2003/03/23 23:11:17 hajny
|
||||||
|
@ -25,6 +25,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Dos;
|
Dos;
|
||||||
|
|
||||||
|
{$DEFINE HAS_SLEEP}
|
||||||
{ Include platform independent interface part }
|
{ Include platform independent interface part }
|
||||||
{$i sysutilh.inc}
|
{$i sysutilh.inc}
|
||||||
|
|
||||||
@ -46,44 +47,65 @@ implementation
|
|||||||
(* conflicts, so needed parts had to be redefined here). *)
|
(* conflicts, so needed parts had to be redefined here). *)
|
||||||
|
|
||||||
type
|
type
|
||||||
TFileStatus = object
|
TFileStatus = object
|
||||||
end;
|
end;
|
||||||
PFileStatus = ^TFileStatus;
|
PFileStatus = ^TFileStatus;
|
||||||
|
|
||||||
TFileStatus0 = object (TFileStatus)
|
TFileStatus3 = object (TFileStatus)
|
||||||
DateCreation, {Date of file creation.}
|
DateCreation, {Date of file creation.}
|
||||||
TimeCreation, {Time of file creation.}
|
TimeCreation, {Time of file creation.}
|
||||||
DateLastAccess, {Date of last access to file.}
|
DateLastAccess, {Date of last access to file.}
|
||||||
TimeLastAccess, {Time of last access to file.}
|
TimeLastAccess, {Time of last access to file.}
|
||||||
DateLastWrite, {Date of last modification of file.}
|
DateLastWrite, {Date of last modification of file.}
|
||||||
TimeLastWrite: word; {Time of last modification of file.}
|
TimeLastWrite:word; {Time of last modification of file.}
|
||||||
FileSize, {Size of file.}
|
FileSize, {Size of file.}
|
||||||
FileAlloc: cardinal; {Amount of space the file really
|
FileAlloc:cardinal; {Amount of space the file really
|
||||||
occupies on disk.}
|
occupies on disk.}
|
||||||
end;
|
AttrFile:cardinal; {Attributes of file.}
|
||||||
PFileStatus0 = ^TFileStatus0;
|
end;
|
||||||
|
PFileStatus3=^TFileStatus3;
|
||||||
|
|
||||||
TFileStatus3 = object (TFileStatus)
|
TFileStatus4=object(TFileStatus3)
|
||||||
NextEntryOffset: cardinal; {Offset of next entry}
|
cbList:cardinal; {Length of entire EA set.}
|
||||||
DateCreation, {Date of file creation.}
|
end;
|
||||||
TimeCreation, {Time of file creation.}
|
PFileStatus4=^TFileStatus4;
|
||||||
DateLastAccess, {Date of last access to file.}
|
|
||||||
TimeLastAccess, {Time of last access to file.}
|
|
||||||
DateLastWrite, {Date of last modification of file.}
|
|
||||||
TimeLastWrite: word; {Time of last modification of file.}
|
|
||||||
FileSize, {Size of file.}
|
|
||||||
FileAlloc: cardinal; {Amount of space the file really
|
|
||||||
occupies on disk.}
|
|
||||||
AttrFile: cardinal; {Attributes of file.}
|
|
||||||
end;
|
|
||||||
PFileStatus3 = ^TFileStatus3;
|
|
||||||
|
|
||||||
TFileFindBuf3 = object (TFileStatus3)
|
TFileFindBuf3=object(TFileStatus)
|
||||||
Name: ShortString; {Also possible to use as ASCIIZ.
|
NextEntryOffset: cardinal; {Offset of next entry}
|
||||||
The byte following the last string
|
DateCreation, {Date of file creation.}
|
||||||
character is always zero.}
|
TimeCreation, {Time of file creation.}
|
||||||
end;
|
DateLastAccess, {Date of last access to file.}
|
||||||
PFileFindBuf3 = ^TFileFindBuf3;
|
TimeLastAccess, {Time of last access to file.}
|
||||||
|
DateLastWrite, {Date of last modification of file.}
|
||||||
|
TimeLastWrite:word; {Time of last modification of file.}
|
||||||
|
FileSize, {Size of file.}
|
||||||
|
FileAlloc:cardinal; {Amount of space the file really
|
||||||
|
occupies on disk.}
|
||||||
|
AttrFile:cardinal; {Attributes of file.}
|
||||||
|
Name:string; {Also possible to use as ASCIIZ.
|
||||||
|
The byte following the last string
|
||||||
|
character is always zero.}
|
||||||
|
end;
|
||||||
|
PFileFindBuf3=^TFileFindBuf3;
|
||||||
|
|
||||||
|
TFileFindBuf4=object(TFileStatus)
|
||||||
|
NextEntryOffset: cardinal; {Offset of next entry}
|
||||||
|
DateCreation, {Date of file creation.}
|
||||||
|
TimeCreation, {Time of file creation.}
|
||||||
|
DateLastAccess, {Date of last access to file.}
|
||||||
|
TimeLastAccess, {Time of last access to file.}
|
||||||
|
DateLastWrite, {Date of last modification of file.}
|
||||||
|
TimeLastWrite:word; {Time of last modification of file.}
|
||||||
|
FileSize, {Size of file.}
|
||||||
|
FileAlloc:cardinal; {Amount of space the file really
|
||||||
|
occupies on disk.}
|
||||||
|
AttrFile:cardinal; {Attributes of file.}
|
||||||
|
cbList:longint; {Size of the file's extended attributes.}
|
||||||
|
Name:string; {Also possible to use as ASCIIZ.
|
||||||
|
The byte following the last string
|
||||||
|
character is always zero.}
|
||||||
|
end;
|
||||||
|
PFileFindBuf4=^TFileFindBuf4;
|
||||||
|
|
||||||
TFSInfo = record
|
TFSInfo = record
|
||||||
case word of
|
case word of
|
||||||
@ -172,38 +194,154 @@ type
|
|||||||
end;
|
end;
|
||||||
PCountryInfo=^TCountryInfo;
|
PCountryInfo=^TCountryInfo;
|
||||||
|
|
||||||
|
TRequestData=record
|
||||||
|
PID, {ID of process that wrote element.}
|
||||||
|
Data: cardinal; {Information from process writing the data.}
|
||||||
|
end;
|
||||||
|
PRequestData=^TRequestData;
|
||||||
|
|
||||||
|
{Queue data structure for synchronously started sessions.}
|
||||||
|
TChildInfo = record
|
||||||
|
case boolean of
|
||||||
|
false:
|
||||||
|
(SessionID,
|
||||||
|
Return: word); {Return code from the child process.}
|
||||||
|
true:
|
||||||
|
(usSessionID,
|
||||||
|
usReturn: word); {Return code from the child process.}
|
||||||
|
end;
|
||||||
|
PChildInfo = ^TChildInfo;
|
||||||
|
|
||||||
|
TStartData=record
|
||||||
|
{Note: to omit some fields, use a length smaller than SizeOf(TStartData).}
|
||||||
|
Length:word; {Length, in bytes, of datastructure
|
||||||
|
(24/30/32/50/60).}
|
||||||
|
Related:word; {Independent/child session (0/1).}
|
||||||
|
FgBg:word; {Foreground/background (0/1).}
|
||||||
|
TraceOpt:word; {No trace/trace this/trace all (0/1/2).}
|
||||||
|
PgmTitle:PChar; {Program title.}
|
||||||
|
PgmName:PChar; {Filename to program.}
|
||||||
|
PgmInputs:PChar; {Command parameters (nil allowed).}
|
||||||
|
TermQ:PChar; {System queue. (nil allowed).}
|
||||||
|
Environment:PChar; {Environment to pass (nil allowed).}
|
||||||
|
InheritOpt:word; {Inherit enviroment from shell/
|
||||||
|
inherit environment from parent (0/1).}
|
||||||
|
SessionType:word; {Auto/full screen/window/presentation
|
||||||
|
manager/full screen Dos/windowed Dos
|
||||||
|
(0/1/2/3/4/5/6/7).}
|
||||||
|
Iconfile:PChar; {Icon file to use (nil allowed).}
|
||||||
|
PgmHandle:cardinal; {0 or the program handle.}
|
||||||
|
PgmControl:word; {Bitfield describing initial state
|
||||||
|
of windowed sessions.}
|
||||||
|
InitXPos,InitYPos:word; {Initial top coordinates.}
|
||||||
|
InitXSize,InitYSize:word; {Initial size.}
|
||||||
|
Reserved:word;
|
||||||
|
ObjectBuffer:PChar; {If a module cannot be loaded, its
|
||||||
|
name will be returned here.}
|
||||||
|
ObjectBuffLen:cardinal; {Size of your buffer.}
|
||||||
|
end;
|
||||||
|
PStartData=^TStartData;
|
||||||
|
|
||||||
const
|
const
|
||||||
ilStandard = 1;
|
ilStandard = 1;
|
||||||
ilQueryEAsize = 2;
|
ilQueryEAsize = 2;
|
||||||
ilQueryEAs = 3;
|
ilQueryEAs = 3;
|
||||||
ilQueryFullName = 5;
|
ilQueryFullName = 5;
|
||||||
|
|
||||||
|
quFIFO = 0;
|
||||||
|
quLIFO = 1;
|
||||||
|
quPriority = 2;
|
||||||
|
|
||||||
|
quNoConvert_Address = 0;
|
||||||
|
quConvert_Address = 4;
|
||||||
|
|
||||||
|
{Start the new session independent or as a child.}
|
||||||
|
ssf_Related_Independent = 0; {Start new session independent
|
||||||
|
of the calling session.}
|
||||||
|
ssf_Related_Child = 1; {Start new session as a child
|
||||||
|
session to the calling session.}
|
||||||
|
|
||||||
|
{Start the new session in the foreground or in the background.}
|
||||||
|
ssf_FgBg_Fore = 0; {Start new session in foreground.}
|
||||||
|
ssf_FgBg_Back = 1; {Start new session in background.}
|
||||||
|
|
||||||
|
{Should the program started in the new session
|
||||||
|
be executed under conditions for tracing?}
|
||||||
|
ssf_TraceOpt_None = 0; {No trace.}
|
||||||
|
ssf_TraceOpt_Trace = 1; {Trace with no notification
|
||||||
|
of descendants.}
|
||||||
|
ssf_TraceOpt_TraceAll = 2; {Trace all descendant sessions.
|
||||||
|
A termination queue must be
|
||||||
|
supplied and Related must be
|
||||||
|
ssf_Related_Child (=1).}
|
||||||
|
|
||||||
|
{Will the new session inherit open file handles
|
||||||
|
and environment from the calling process.}
|
||||||
|
ssf_InhertOpt_Shell = 0; {Inherit from the shell.}
|
||||||
|
ssf_InhertOpt_Parent = 1; {Inherit from the calling process.}
|
||||||
|
|
||||||
|
{Specifies the type of session to start.}
|
||||||
|
ssf_Type_Default = 0; {Use program's type.}
|
||||||
|
ssf_Type_FullScreen = 1; {OS/2 full screen.}
|
||||||
|
ssf_Type_WindowableVIO = 2; {OS/2 window.}
|
||||||
|
ssf_Type_PM = 3; {Presentation Manager.}
|
||||||
|
ssf_Type_VDM = 4; {DOS full screen.}
|
||||||
|
ssf_Type_WindowedVDM = 7; {DOS window.}
|
||||||
|
{Additional values for Windows programs}
|
||||||
|
Prog_31_StdSeamlessVDM = 15; {Windows 3.1 program in its
|
||||||
|
own windowed session.}
|
||||||
|
Prog_31_StdSeamlessCommon = 16; {Windows 3.1 program in a
|
||||||
|
common windowed session.}
|
||||||
|
Prog_31_EnhSeamlessVDM = 17; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in its own
|
||||||
|
windowed session.}
|
||||||
|
Prog_31_EnhSeamlessCommon = 18; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in a common
|
||||||
|
windowed session.}
|
||||||
|
Prog_31_Enh = 19; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in a full
|
||||||
|
screen session.}
|
||||||
|
Prog_31_Std = 20; {Windows 3.1 program in a full
|
||||||
|
screen session.}
|
||||||
|
|
||||||
|
{Specifies the initial attributes for a OS/2 window or DOS window session.}
|
||||||
|
ssf_Control_Visible = 0; {Window is visible.}
|
||||||
|
ssf_Control_Invisible = 1; {Window is invisible.}
|
||||||
|
ssf_Control_Maximize = 2; {Window is maximized.}
|
||||||
|
ssf_Control_Minimize = 4; {Window is minimized.}
|
||||||
|
ssf_Control_NoAutoClose = 8; {Window will not close after
|
||||||
|
the program has ended.}
|
||||||
|
ssf_Control_SetPos = 32768; {Use InitXPos, InitYPos,
|
||||||
|
InitXSize, and InitYSize for
|
||||||
|
the size and placement.}
|
||||||
|
|
||||||
|
|
||||||
{This is the correct way to call external assembler procedures.}
|
{This is the correct way to call external assembler procedures.}
|
||||||
procedure syscall;external name '___SYSCALL';
|
procedure syscall;external name '___SYSCALL';
|
||||||
|
|
||||||
function DosSetFileInfo (Handle: longint; InfoLevel: cardinal; AFileStatus: PFileStatus;
|
function DosSetFileInfo (Handle: THandle; InfoLevel: cardinal; AFileStatus: PFileStatus;
|
||||||
FileStatusLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 218;
|
FileStatusLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 218;
|
||||||
|
|
||||||
function DosQueryFSInfo (DiskNum, InfoLevel: cardinal; var Buffer: TFSInfo;
|
function DosQueryFSInfo (DiskNum, InfoLevel: cardinal; var Buffer: TFSInfo;
|
||||||
BufLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 278;
|
BufLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 278;
|
||||||
|
|
||||||
function DosQueryFileInfo (Handle: longint; InfoLevel: cardinal;
|
function DosQueryFileInfo (Handle: THandle; InfoLevel: cardinal;
|
||||||
AFileStatus: PFileStatus; FileStatusLen: cardinal): cardinal; cdecl;
|
AFileStatus: PFileStatus; FileStatusLen: cardinal): cardinal; cdecl;
|
||||||
external 'DOSCALLS' index 279;
|
external 'DOSCALLS' index 279;
|
||||||
|
|
||||||
function DosScanEnv (Name: PChar; var Value: PChar): cardinal; cdecl;
|
function DosScanEnv (Name: PChar; var Value: PChar): cardinal; cdecl;
|
||||||
external 'DOSCALLS' index 227;
|
external 'DOSCALLS' index 227;
|
||||||
|
|
||||||
function DosFindFirst (FileMask: PChar; var Handle: longint; Attrib: cardinal;
|
function DosFindFirst (FileMask: PChar; var Handle: THandle; Attrib: cardinal;
|
||||||
AFileStatus: PFileStatus; FileStatusLen: cardinal;
|
AFileStatus: PFileStatus; FileStatusLen: cardinal;
|
||||||
var Count: cardinal; InfoLevel: cardinal): cardinal; cdecl;
|
var Count: cardinal; InfoLevel: cardinal): cardinal; cdecl;
|
||||||
external 'DOSCALLS' index 264;
|
external 'DOSCALLS' index 264;
|
||||||
|
|
||||||
function DosFindNext (Handle: longint; AFileStatus: PFileStatus;
|
function DosFindNext (Handle: THandle; AFileStatus: PFileStatus;
|
||||||
FileStatusLen: cardinal; var Count: cardinal): cardinal; cdecl;
|
FileStatusLen: cardinal; var Count: cardinal): cardinal; cdecl;
|
||||||
external 'DOSCALLS' index 265;
|
external 'DOSCALLS' index 265;
|
||||||
|
|
||||||
function DosFindClose (Handle: longint): cardinal; cdecl;
|
function DosFindClose (Handle: THandle): cardinal; cdecl;
|
||||||
external 'DOSCALLS' index 263;
|
external 'DOSCALLS' index 263;
|
||||||
|
|
||||||
function DosQueryCtryInfo (Size: cardinal; var Country: TCountryCode;
|
function DosQueryCtryInfo (Size: cardinal; var Country: TCountryCode;
|
||||||
@ -213,6 +351,27 @@ function DosQueryCtryInfo (Size: cardinal; var Country: TCountryCode;
|
|||||||
function DosMapCase (Size: cardinal; var Country: TCountryCode;
|
function DosMapCase (Size: cardinal; var Country: TCountryCode;
|
||||||
AString: PChar): cardinal; cdecl; external 'NLS' index 7;
|
AString: PChar): cardinal; cdecl; external 'NLS' index 7;
|
||||||
|
|
||||||
|
procedure DosSleep (MSec: cardinal); cdecl; external 'DOSCALLS' index 229;
|
||||||
|
|
||||||
|
function DosCreateQueue (var Handle: THandle; Priority:longint;
|
||||||
|
Name: PChar): cardinal; cdecl;
|
||||||
|
external 'QUECALLS' index 16;
|
||||||
|
|
||||||
|
function DosReadQueue (Handle: THandle; var ReqBuffer: TRequestData;
|
||||||
|
var DataLen: cardinal; var DataPtr: pointer;
|
||||||
|
Element, Wait: cardinal; var Priority: byte;
|
||||||
|
ASem: THandle): cardinal; cdecl;
|
||||||
|
external 'QUECALLS' index 9;
|
||||||
|
|
||||||
|
function DosCloseQueue (Handle: THandle): cardinal; cdecl;
|
||||||
|
external 'QUECALLS' index 11;
|
||||||
|
|
||||||
|
function DosStartSession (var AStartData: TStartData;
|
||||||
|
var SesID, PID: cardinal): cardinal; cdecl;
|
||||||
|
external 'SESMGR' index 37;
|
||||||
|
|
||||||
|
function DosFreeMem(P:pointer):cardinal; cdecl; external 'DOSCALLS' index 304;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
File Functions
|
File Functions
|
||||||
@ -259,7 +418,7 @@ asm
|
|||||||
end {['eax', 'ebx', 'ecx', 'edx']};
|
end {['eax', 'ebx', 'ecx', 'edx']};
|
||||||
|
|
||||||
|
|
||||||
function FileCreate (const FileName: string; Mode: longint): longint;
|
function FileCreate (const FileName: string; Mode: integer): longint;
|
||||||
begin
|
begin
|
||||||
FileCreate:=FileCreate(FileName);
|
FileCreate:=FileCreate(FileName);
|
||||||
end;
|
end;
|
||||||
@ -514,7 +673,7 @@ end {['eax', 'ebx', 'ecx', 'edx']};
|
|||||||
|
|
||||||
|
|
||||||
function FileSetDate (Handle, Age: longint): longint;
|
function FileSetDate (Handle, Age: longint): longint;
|
||||||
var FStat: PFileStatus0;
|
var FStat: PFileStatus3;
|
||||||
RC: cardinal;
|
RC: cardinal;
|
||||||
begin
|
begin
|
||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
@ -871,6 +1030,87 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{$ASMMODE INTEL}
|
||||||
|
procedure Sleep (Milliseconds: cardinal);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if os_mode = osOS2 then DosSleep (Milliseconds) else
|
||||||
|
asm
|
||||||
|
mov edx, Milliseconds
|
||||||
|
mov eax, 7F30h
|
||||||
|
call syscall
|
||||||
|
end ['eax', 'edx'];
|
||||||
|
end;
|
||||||
|
{$ASMMODE DEFAULT}
|
||||||
|
|
||||||
|
|
||||||
|
function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString):
|
||||||
|
integer;
|
||||||
|
var
|
||||||
|
HQ: THandle;
|
||||||
|
SPID, STID, QName: shortstring;
|
||||||
|
SD: TStartData;
|
||||||
|
SID, PID: cardinal;
|
||||||
|
RD: TRequestData;
|
||||||
|
PCI: PChildInfo;
|
||||||
|
CISize: cardinal;
|
||||||
|
Prio: byte;
|
||||||
|
E: EOSError;
|
||||||
|
CommandLine: ansistring;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if os_Mode = osOS2 then
|
||||||
|
begin
|
||||||
|
FillChar (SD, SizeOf (SD), 0);
|
||||||
|
SD.Length := 24;
|
||||||
|
SD.Related := ssf_Related_Child;
|
||||||
|
SD.PgmName := PChar (Path);
|
||||||
|
SD.PgmInputs := PChar (ComLine);
|
||||||
|
Str (ProcessID, SPID);
|
||||||
|
Str (ThreadID, STID);
|
||||||
|
QName := '\QUEUES\FPC_ExecuteProcess_p' + SPID + 't' + STID + '.QUE'#0;
|
||||||
|
SD.TermQ := @QName [1];
|
||||||
|
Result := DosCreateQueue (HQ, quFIFO or quConvert_Address, @QName [1]);
|
||||||
|
if Result = 0 then
|
||||||
|
begin
|
||||||
|
Result := DosStartSession (SD, SID, PID);
|
||||||
|
if (Result = 0) or (Result = 457) then
|
||||||
|
begin
|
||||||
|
Result := DosReadQueue (HQ, RD, CISize, PCI, 0, 0, Prio, 0);
|
||||||
|
if Result = 0 then
|
||||||
|
begin
|
||||||
|
Result := PCI^.Return;
|
||||||
|
DosCloseQueue (HQ);
|
||||||
|
DosFreeMem (PCI);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
DosCloseQueue (HQ);
|
||||||
|
end;
|
||||||
|
if ComLine = '' then
|
||||||
|
CommandLine := Path
|
||||||
|
else
|
||||||
|
CommandLine := Path + ' ' + ComLine;
|
||||||
|
E := EOSError.CreateFmt (SExecuteProcessFailed, [CommandLine, Result]);
|
||||||
|
E.ErrorCode := Result;
|
||||||
|
raise E;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Dos.Exec (Path, ComLine);
|
||||||
|
if DosError <> 0 then
|
||||||
|
begin
|
||||||
|
if ComLine = '' then
|
||||||
|
CommandLine := Path
|
||||||
|
else
|
||||||
|
CommandLine := Path + ' ' + ComLine;
|
||||||
|
E := EOSError.CreateFmt (SExecuteProcessFailed, [CommandLine, DosError]);
|
||||||
|
E.ErrorCode := DosError;
|
||||||
|
raise E;
|
||||||
|
end;
|
||||||
|
ExecuteProcess := DosExitCode;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Initialization code
|
Initialization code
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -884,7 +1124,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 2003-11-26 20:00:19 florian
|
Revision 1.14 2004-01-20 23:05:31 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.13 2003/11/26 20:00:19 florian
|
||||||
* error handling for Variants improved
|
* error handling for Variants improved
|
||||||
|
|
||||||
Revision 1.12 2003/10/19 09:35:28 hajny
|
Revision 1.12 2003/10/19 09:35:28 hajny
|
||||||
|
@ -1597,6 +1597,7 @@ Begin
|
|||||||
FileNameCaseSensitive:=true;
|
FileNameCaseSensitive:=true;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
ThreadID := 1;
|
||||||
{$ifdef EXCEPTIONS_IN_SYSTEM}
|
{$ifdef EXCEPTIONS_IN_SYSTEM}
|
||||||
InitDPMIExcp;
|
InitDPMIExcp;
|
||||||
InstallDefaultHandlers;
|
InstallDefaultHandlers;
|
||||||
@ -1607,7 +1608,10 @@ Begin
|
|||||||
End.
|
End.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.31 2004-01-10 10:49:24 jonas
|
Revision 1.32 2004-01-20 23:09:14 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.31 2004/01/10 10:49:24 jonas
|
||||||
* fixed compilation
|
* fixed compilation
|
||||||
|
|
||||||
Revision 1.30 2003/12/17 20:40:38 hajny
|
Revision 1.30 2003/12/17 20:40:38 hajny
|
||||||
|
@ -764,19 +764,22 @@ end;
|
|||||||
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
||||||
var
|
var
|
||||||
e : EOSError;
|
e : EOSError;
|
||||||
|
CommandLine: AnsiString;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
dos.exec(path,comline);
|
dos.exec(path,comline);
|
||||||
|
|
||||||
result := dos.doserror;
|
if (Dos.DosError <> 0) then
|
||||||
{ (dos)exit code is irrelevant, at least the unix implementation }
|
|
||||||
{ does not }
|
|
||||||
{ take it into account }
|
|
||||||
if (result <> 0) then
|
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt('Failed to execute %s : %d',[ComLine,result]);
|
if ComLine <> '' then
|
||||||
e.ErrorCode:=result;
|
CommandLine := Path + ' ' + ComLine
|
||||||
|
else
|
||||||
|
CommandLine := Path;
|
||||||
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,Dos.DosError]);
|
||||||
|
e.ErrorCode:=Dos.DosError;
|
||||||
raise e;
|
raise e;
|
||||||
end;
|
end;
|
||||||
|
Result := DosExitCode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{*************************************************************************
|
{*************************************************************************
|
||||||
@ -851,12 +854,16 @@ end;
|
|||||||
Initialization
|
Initialization
|
||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
|
InitDelay;
|
||||||
Finalization
|
Finalization
|
||||||
DoneExceptions;
|
DoneExceptions;
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2004-01-10 20:25:14 michael
|
Revision 1.22 2004-01-20 23:09:14 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.21 2004/01/10 20:25:14 michael
|
||||||
+ Added rtlconst dependency to classes.ppu and implemented sysutils.sleep
|
+ Added rtlconst dependency to classes.ppu and implemented sysutils.sleep
|
||||||
|
|
||||||
Revision 1.20 2004/01/10 10:49:24 jonas
|
Revision 1.20 2004/01/10 10:49:24 jonas
|
||||||
|
@ -326,6 +326,8 @@ const
|
|||||||
fmAppend = $D7B4;
|
fmAppend = $D7B4;
|
||||||
Filemode : byte = 2;
|
Filemode : byte = 2;
|
||||||
CmdLine : PChar = nil;
|
CmdLine : PChar = nil;
|
||||||
|
ProcessID: SizeUInt = 1;
|
||||||
|
(* Value should be changed during system initialization as appropriate. *)
|
||||||
|
|
||||||
{ assume that this program will not spawn other threads, when the
|
{ assume that this program will not spawn other threads, when the
|
||||||
first thread is started the following constants need to be filled }
|
first thread is started the following constants need to be filled }
|
||||||
@ -347,6 +349,7 @@ ThreadVar
|
|||||||
{$else SUPPORT_THREADVAR}
|
{$else SUPPORT_THREADVAR}
|
||||||
Var
|
Var
|
||||||
{$endif SUPPORT_THREADVAR}
|
{$endif SUPPORT_THREADVAR}
|
||||||
|
ThreadID : SizeUInt;
|
||||||
{ Standard In- and Output }
|
{ Standard In- and Output }
|
||||||
Output,
|
Output,
|
||||||
Input,
|
Input,
|
||||||
@ -717,7 +720,10 @@ const
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.81 2003-12-29 19:24:12 florian
|
Revision 1.82 2004-01-20 23:13:53 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.81 2003/12/29 19:24:12 florian
|
||||||
+ introduced PtrInt and PtrUInt
|
+ introduced PtrInt and PtrUInt
|
||||||
* made strscan 64 bit safe
|
* made strscan 64 bit safe
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
{ Stack checking }
|
{ Stack checking }
|
||||||
StackLength:=stklen;
|
StackLength:=stklen;
|
||||||
StackBottom:=Sptr - StackLength;
|
StackBottom:=Sptr - StackLength;
|
||||||
|
ThreadID := SysGetCurrentThreadID;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -320,7 +321,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2003-11-29 17:33:09 michael
|
Revision 1.7 2004-01-20 23:13:53 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.6 2003/11/29 17:33:09 michael
|
||||||
+ Removed dummy variable from SetNothreadManager
|
+ Removed dummy variable from SetNothreadManager
|
||||||
|
|
||||||
Revision 1.5 2003/11/29 17:29:32 michael
|
Revision 1.5 2003/11/29 17:29:32 michael
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Copyright (c) 2000 by Marco van de Voort
|
Copyright (c) 2000 by Marco van de Voort
|
||||||
member of the Free Pascal development team.
|
member of the Free Pascal development team.
|
||||||
|
|
||||||
System unit for the *BSD's.
|
System unit for Linux.
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
@ -164,6 +164,9 @@ Begin
|
|||||||
SysInitStdIO;
|
SysInitStdIO;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
{$ifdef HASVARIANT}
|
{$ifdef HASVARIANT}
|
||||||
initvariantmanager;
|
initvariantmanager;
|
||||||
{$endif HASVARIANT}
|
{$endif HASVARIANT}
|
||||||
@ -171,7 +174,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 2004-01-01 14:16:55 marco
|
Revision 1.14 2004-01-20 23:09:14 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.13 2004/01/01 14:16:55 marco
|
||||||
* getcwd missed cdecl
|
* getcwd missed cdecl
|
||||||
|
|
||||||
Revision 1.12 2003/12/31 20:20:57 marco
|
Revision 1.12 2003/12/31 20:20:57 marco
|
||||||
|
@ -1130,6 +1130,9 @@ begin
|
|||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
errno:=0;
|
errno:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
{$ifdef HASVARIANT}
|
{$ifdef HASVARIANT}
|
||||||
initvariantmanager;
|
initvariantmanager;
|
||||||
{$endif HASVARIANT}
|
{$endif HASVARIANT}
|
||||||
@ -1138,7 +1141,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2004-01-04 21:06:43 jonas
|
Revision 1.12 2004-01-20 23:11:20 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.11 2004/01/04 21:06:43 jonas
|
||||||
* make the C-main public
|
* make the C-main public
|
||||||
|
|
||||||
Revision 1.10 2003/10/29 22:34:52 olle
|
Revision 1.10 2003/10/29 22:34:52 olle
|
||||||
|
@ -802,6 +802,10 @@ Begin
|
|||||||
|
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
|
|
||||||
SysInitStdIO;
|
SysInitStdIO;
|
||||||
|
|
||||||
@ -815,7 +819,10 @@ Begin
|
|||||||
End.
|
End.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.20 2003-10-25 23:43:59 hajny
|
Revision 1.21 2004-01-20 23:11:20 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.20 2003/10/25 23:43:59 hajny
|
||||||
* THandle in sysutils common using System.THandle
|
* THandle in sysutils common using System.THandle
|
||||||
|
|
||||||
Revision 1.19 2003/10/17 22:12:02 olle
|
Revision 1.19 2003/10/17 22:12:02 olle
|
||||||
|
@ -487,6 +487,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
||||||
|
|
||||||
|
var
|
||||||
|
e : EOSError;
|
||||||
|
CommandLine: AnsiString;
|
||||||
|
|
||||||
|
begin
|
||||||
|
dos.exec(path,comline);
|
||||||
|
|
||||||
|
if (Dos.DosError <> 0) then
|
||||||
|
begin
|
||||||
|
if ComLine <> '' then
|
||||||
|
CommandLine := Path + ' ' + ComLine
|
||||||
|
else
|
||||||
|
CommandLine := Path;
|
||||||
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,Dos.DosError]);
|
||||||
|
e.ErrorCode:=Dos.DosError;
|
||||||
|
raise e;
|
||||||
|
end;
|
||||||
|
Result := DosExitCode;
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Initialization code
|
Initialization code
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -500,7 +522,10 @@ end.
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 2003-11-26 20:00:19 florian
|
Revision 1.14 2004-01-20 23:11:20 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.13 2003/11/26 20:00:19 florian
|
||||||
* error handling for Variants improved
|
* error handling for Variants improved
|
||||||
|
|
||||||
Revision 1.12 2003/10/25 23:42:35 hajny
|
Revision 1.12 2003/10/25 23:42:35 hajny
|
||||||
|
@ -42,6 +42,7 @@ resourcestring
|
|||||||
SErrInvalidTimeStamp = 'Invalid date/timestamp : "%s"';
|
SErrInvalidTimeStamp = 'Invalid date/timestamp : "%s"';
|
||||||
SExceptionErrorMessage = 'exception at %p';
|
SExceptionErrorMessage = 'exception at %p';
|
||||||
SExceptionStack = 'Exception stack error';
|
SExceptionStack = 'Exception stack error';
|
||||||
|
SExecuteProcessFailed = 'Failed to execute %s : %d';
|
||||||
SExternalException = 'External exception %x';
|
SExternalException = 'External exception %x';
|
||||||
SFileNotAssigned = 'File not assigned';
|
SFileNotAssigned = 'File not assigned';
|
||||||
SFileNotFound = 'File not found';
|
SFileNotFound = 'File not found';
|
||||||
@ -205,7 +206,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2004-01-10 19:35:17 michael
|
Revision 1.8 2004-01-20 23:05:31 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.7 2004/01/10 19:35:17 michael
|
||||||
+ Moved all resource strings to rtlconst/sysconst
|
+ Moved all resource strings to rtlconst/sysconst
|
||||||
|
|
||||||
Revision 1.6 2004/01/10 17:55:45 michael
|
Revision 1.6 2004/01/10 17:55:45 michael
|
||||||
|
@ -2475,6 +2475,67 @@ function DosQueryMessageCP(var Buf;BufSize:longint;const FileName:string;
|
|||||||
|
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
|
const
|
||||||
|
{Start the new session independent or as a child.}
|
||||||
|
ssf_Related_Independent = 0; {Start new session independent
|
||||||
|
of the calling session.}
|
||||||
|
ssf_Related_Child = 1; {Start new session as a child
|
||||||
|
session to the calling session.}
|
||||||
|
|
||||||
|
{Start the new session in the foreground or in the background.}
|
||||||
|
ssf_FgBg_Fore = 0; {Start new session in foreground.}
|
||||||
|
ssf_FgBg_Back = 1; {Start new session in background.}
|
||||||
|
|
||||||
|
{Should the program started in the new session
|
||||||
|
be executed under conditions for tracing?}
|
||||||
|
ssf_TraceOpt_None = 0; {No trace.}
|
||||||
|
ssf_TraceOpt_Trace = 1; {Trace with no notification
|
||||||
|
of descendants.}
|
||||||
|
ssf_TraceOpt_TraceAll = 2; {Trace all descendant sessions.
|
||||||
|
A termination queue must be
|
||||||
|
supplied and Related must be
|
||||||
|
ssf_Related_Child (=1).}
|
||||||
|
|
||||||
|
{Will the new session inherit open file handles
|
||||||
|
and environment from the calling process.}
|
||||||
|
ssf_InhertOpt_Shell = 0; {Inherit from the shell.}
|
||||||
|
ssf_InhertOpt_Parent = 1; {Inherit from the calling process.}
|
||||||
|
|
||||||
|
{Specifies the type of session to start.}
|
||||||
|
ssf_Type_Default = 0; {Use program's type.}
|
||||||
|
ssf_Type_FullScreen = 1; {OS/2 full screen.}
|
||||||
|
ssf_Type_WindowableVIO = 2; {OS/2 window.}
|
||||||
|
ssf_Type_PM = 3; {Presentation Manager.}
|
||||||
|
ssf_Type_VDM = 4; {DOS full screen.}
|
||||||
|
ssf_Type_WindowedVDM = 7; {DOS window.}
|
||||||
|
{Additional values for Windows programs}
|
||||||
|
Prog_31_StdSeamlessVDM = 15; {Windows 3.1 program in its
|
||||||
|
own windowed session.}
|
||||||
|
Prog_31_StdSeamlessCommon = 16; {Windows 3.1 program in a
|
||||||
|
common windowed session.}
|
||||||
|
Prog_31_EnhSeamlessVDM = 17; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in its own
|
||||||
|
windowed session.}
|
||||||
|
Prog_31_EnhSeamlessCommon = 18; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in a common
|
||||||
|
windowed session.}
|
||||||
|
Prog_31_Enh = 19; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in a full
|
||||||
|
screen session.}
|
||||||
|
Prog_31_Std = 20; {Windows 3.1 program in a full
|
||||||
|
screen session.}
|
||||||
|
|
||||||
|
{Specifies the initial attributes for a OS/2 window or DOS window session.}
|
||||||
|
ssf_Control_Visible = 0; {Window is visible.}
|
||||||
|
ssf_Control_Invisible = 1; {Window is invisible.}
|
||||||
|
ssf_Control_Maximize = 2; {Window is maximized.}
|
||||||
|
ssf_Control_Minimize = 4; {Window is minimized.}
|
||||||
|
ssf_Control_NoAutoClose = 8; {Window will not close after
|
||||||
|
the program has ended.}
|
||||||
|
ssf_Control_SetPos = 32768; {Use InitXPos, InitYPos,
|
||||||
|
InitXSize, and InitYSize for
|
||||||
|
the size and placement.}
|
||||||
|
|
||||||
type TStatusData=record
|
type TStatusData=record
|
||||||
Length:word; {Length, in bytes, of datastructure.}
|
Length:word; {Length, in bytes, of datastructure.}
|
||||||
SelectIND:word; {Determines if the session can be
|
SelectIND:word; {Determines if the session can be
|
||||||
@ -2526,13 +2587,13 @@ type TStartData=record
|
|||||||
AStartData = A startdata record.
|
AStartData = A startdata record.
|
||||||
SesID = Receives session ID of session created.
|
SesID = Receives session ID of session created.
|
||||||
PID = Receives process ID of process created.}
|
PID = Receives process ID of process created.}
|
||||||
function DosStartSession(const AStartData:TStartData;
|
function DosStartSession (var AStartData:TStartData;
|
||||||
var SesID,PID:longint):longint; cdecl;
|
var SesID,PID:longint):longint; cdecl;
|
||||||
|
|
||||||
{Set the status of a child session.
|
{Set the status of a child session.
|
||||||
SesID = ID of session.
|
SesID = ID of session.
|
||||||
AStatus = Status to set.}
|
AStatus = Status to set.}
|
||||||
function DosSetSession(SesID:longint;const AStatus:TStatusData):longint; cdecl;
|
function DosSetSession(SesID:longint;var AStatus:TStatusData):longint; cdecl;
|
||||||
|
|
||||||
{Bring a child session to the foreground.
|
{Bring a child session to the foreground.
|
||||||
SesID = ID of session.}
|
SesID = ID of session.}
|
||||||
@ -4471,12 +4532,12 @@ begin
|
|||||||
DosPutMessage:=DosPutMessage(Handle,Length(Buf),@Buf[1]);
|
DosPutMessage:=DosPutMessage(Handle,Length(Buf),@Buf[1]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function DosStartSession(const AStartData:TStartData;
|
function DosStartSession (var AStartData:TStartData;
|
||||||
var SesID,PID:longint):longint; cdecl;
|
var SesID,PID:longint):longint; cdecl;
|
||||||
|
|
||||||
external 'SESMGR' index 37;
|
external 'SESMGR' index 37;
|
||||||
|
|
||||||
function DosSetSession(SesID:longint;const AStatus:TStatusData):longint; cdecl;
|
function DosSetSession(SesID:longint;var AStatus:TStatusData):longint; cdecl;
|
||||||
|
|
||||||
external 'SESMGR' index 39;
|
external 'SESMGR' index 39;
|
||||||
|
|
||||||
@ -4713,7 +4774,10 @@ external 'DOSCALLS' index 582;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.24 2003-12-04 21:22:38 peter
|
Revision 1.25 2004-01-20 23:11:20 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.24 2003/12/04 21:22:38 peter
|
||||||
* regcall updates (untested)
|
* regcall updates (untested)
|
||||||
|
|
||||||
Revision 1.23 2003/11/02 00:25:09 hajny
|
Revision 1.23 2003/11/02 00:25:09 hajny
|
||||||
|
@ -210,6 +210,7 @@ function DosClose(Handle:longint): longint; cdecl;
|
|||||||
function DosRead(Handle:longint; Buffer: Pointer;Count:longint;
|
function DosRead(Handle:longint; Buffer: Pointer;Count:longint;
|
||||||
var ActCount:longint):longint; cdecl;
|
var ActCount:longint):longint; cdecl;
|
||||||
external 'DOSCALLS' index 281;
|
external 'DOSCALLS' index 281;
|
||||||
|
|
||||||
function DosWrite(Handle:longint; Buffer: Pointer;Count:longint;
|
function DosWrite(Handle:longint; Buffer: Pointer;Count:longint;
|
||||||
var ActCount:longint):longint; cdecl;
|
var ActCount:longint):longint; cdecl;
|
||||||
external 'DOSCALLS' index 282;
|
external 'DOSCALLS' index 282;
|
||||||
@ -1391,6 +1392,8 @@ begin
|
|||||||
|
|
||||||
{Set type of application}
|
{Set type of application}
|
||||||
ApplicationType := PIB^.ProcType;
|
ApplicationType := PIB^.ProcType;
|
||||||
|
ProcessID := PIB^.PID;
|
||||||
|
ThreadID := TIB^.TIB2^.TID;
|
||||||
IsConsole := ApplicationType <> 3;
|
IsConsole := ApplicationType <> 3;
|
||||||
|
|
||||||
exitproc:=nil;
|
exitproc:=nil;
|
||||||
@ -1438,7 +1441,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.61 2003-12-04 21:22:38 peter
|
Revision 1.62 2004-01-20 23:11:20 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.61 2003/12/04 21:22:38 peter
|
||||||
* regcall updates (untested)
|
* regcall updates (untested)
|
||||||
|
|
||||||
Revision 1.60 2003/11/23 07:21:16 yuri
|
Revision 1.60 2003/11/23 07:21:16 yuri
|
||||||
|
@ -25,6 +25,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Dos;
|
Dos;
|
||||||
|
|
||||||
|
{$DEFINE HAS_SLEEP}
|
||||||
{ Include platform independent interface part }
|
{ Include platform independent interface part }
|
||||||
{$i sysutilh.inc}
|
{$i sysutilh.inc}
|
||||||
|
|
||||||
@ -46,44 +47,65 @@ implementation
|
|||||||
(* conflicts, so needed parts had to be redefined here). *)
|
(* conflicts, so needed parts had to be redefined here). *)
|
||||||
|
|
||||||
type
|
type
|
||||||
TFileStatus = object
|
TFileStatus = object
|
||||||
end;
|
end;
|
||||||
PFileStatus = ^TFileStatus;
|
PFileStatus = ^TFileStatus;
|
||||||
|
|
||||||
TFileStatus0 = object (TFileStatus)
|
TFileStatus3 = object (TFileStatus)
|
||||||
DateCreation, {Date of file creation.}
|
DateCreation, {Date of file creation.}
|
||||||
TimeCreation, {Time of file creation.}
|
TimeCreation, {Time of file creation.}
|
||||||
DateLastAccess, {Date of last access to file.}
|
DateLastAccess, {Date of last access to file.}
|
||||||
TimeLastAccess, {Time of last access to file.}
|
TimeLastAccess, {Time of last access to file.}
|
||||||
DateLastWrite, {Date of last modification of file.}
|
DateLastWrite, {Date of last modification of file.}
|
||||||
TimeLastWrite: word; {Time of last modification of file.}
|
TimeLastWrite:word; {Time of last modification of file.}
|
||||||
FileSize, {Size of file.}
|
FileSize, {Size of file.}
|
||||||
FileAlloc: cardinal; {Amount of space the file really
|
FileAlloc:cardinal; {Amount of space the file really
|
||||||
occupies on disk.}
|
occupies on disk.}
|
||||||
end;
|
AttrFile:cardinal; {Attributes of file.}
|
||||||
PFileStatus0 = ^TFileStatus0;
|
end;
|
||||||
|
PFileStatus3=^TFileStatus3;
|
||||||
|
|
||||||
TFileStatus3 = object (TFileStatus)
|
TFileStatus4=object(TFileStatus3)
|
||||||
NextEntryOffset: cardinal; {Offset of next entry}
|
cbList:cardinal; {Length of entire EA set.}
|
||||||
DateCreation, {Date of file creation.}
|
end;
|
||||||
TimeCreation, {Time of file creation.}
|
PFileStatus4=^TFileStatus4;
|
||||||
DateLastAccess, {Date of last access to file.}
|
|
||||||
TimeLastAccess, {Time of last access to file.}
|
|
||||||
DateLastWrite, {Date of last modification of file.}
|
|
||||||
TimeLastWrite: word; {Time of last modification of file.}
|
|
||||||
FileSize, {Size of file.}
|
|
||||||
FileAlloc: cardinal; {Amount of space the file really
|
|
||||||
occupies on disk.}
|
|
||||||
AttrFile: cardinal; {Attributes of file.}
|
|
||||||
end;
|
|
||||||
PFileStatus3 = ^TFileStatus3;
|
|
||||||
|
|
||||||
TFileFindBuf3 = object (TFileStatus3)
|
TFileFindBuf3=object(TFileStatus)
|
||||||
Name: ShortString; {Also possible to use as ASCIIZ.
|
NextEntryOffset: cardinal; {Offset of next entry}
|
||||||
The byte following the last string
|
DateCreation, {Date of file creation.}
|
||||||
character is always zero.}
|
TimeCreation, {Time of file creation.}
|
||||||
end;
|
DateLastAccess, {Date of last access to file.}
|
||||||
PFileFindBuf3 = ^TFileFindBuf3;
|
TimeLastAccess, {Time of last access to file.}
|
||||||
|
DateLastWrite, {Date of last modification of file.}
|
||||||
|
TimeLastWrite:word; {Time of last modification of file.}
|
||||||
|
FileSize, {Size of file.}
|
||||||
|
FileAlloc:cardinal; {Amount of space the file really
|
||||||
|
occupies on disk.}
|
||||||
|
AttrFile:cardinal; {Attributes of file.}
|
||||||
|
Name:string; {Also possible to use as ASCIIZ.
|
||||||
|
The byte following the last string
|
||||||
|
character is always zero.}
|
||||||
|
end;
|
||||||
|
PFileFindBuf3=^TFileFindBuf3;
|
||||||
|
|
||||||
|
TFileFindBuf4=object(TFileStatus)
|
||||||
|
NextEntryOffset: cardinal; {Offset of next entry}
|
||||||
|
DateCreation, {Date of file creation.}
|
||||||
|
TimeCreation, {Time of file creation.}
|
||||||
|
DateLastAccess, {Date of last access to file.}
|
||||||
|
TimeLastAccess, {Time of last access to file.}
|
||||||
|
DateLastWrite, {Date of last modification of file.}
|
||||||
|
TimeLastWrite:word; {Time of last modification of file.}
|
||||||
|
FileSize, {Size of file.}
|
||||||
|
FileAlloc:cardinal; {Amount of space the file really
|
||||||
|
occupies on disk.}
|
||||||
|
AttrFile:cardinal; {Attributes of file.}
|
||||||
|
cbList:longint; {Size of the file's extended attributes.}
|
||||||
|
Name:string; {Also possible to use as ASCIIZ.
|
||||||
|
The byte following the last string
|
||||||
|
character is always zero.}
|
||||||
|
end;
|
||||||
|
PFileFindBuf4=^TFileFindBuf4;
|
||||||
|
|
||||||
TFSInfo = record
|
TFSInfo = record
|
||||||
case word of
|
case word of
|
||||||
@ -172,12 +194,128 @@ type
|
|||||||
end;
|
end;
|
||||||
PCountryInfo=^TCountryInfo;
|
PCountryInfo=^TCountryInfo;
|
||||||
|
|
||||||
|
TRequestData=record
|
||||||
|
PID, {ID of process that wrote element.}
|
||||||
|
Data: cardinal; {Information from process writing the data.}
|
||||||
|
end;
|
||||||
|
PRequestData=^TRequestData;
|
||||||
|
|
||||||
|
{Queue data structure for synchronously started sessions.}
|
||||||
|
TChildInfo = record
|
||||||
|
case boolean of
|
||||||
|
false:
|
||||||
|
(SessionID,
|
||||||
|
Return: word); {Return code from the child process.}
|
||||||
|
true:
|
||||||
|
(usSessionID,
|
||||||
|
usReturn: word); {Return code from the child process.}
|
||||||
|
end;
|
||||||
|
PChildInfo = ^TChildInfo;
|
||||||
|
|
||||||
|
TStartData=record
|
||||||
|
{Note: to omit some fields, use a length smaller than SizeOf(TStartData).}
|
||||||
|
Length:word; {Length, in bytes, of datastructure
|
||||||
|
(24/30/32/50/60).}
|
||||||
|
Related:word; {Independent/child session (0/1).}
|
||||||
|
FgBg:word; {Foreground/background (0/1).}
|
||||||
|
TraceOpt:word; {No trace/trace this/trace all (0/1/2).}
|
||||||
|
PgmTitle:PChar; {Program title.}
|
||||||
|
PgmName:PChar; {Filename to program.}
|
||||||
|
PgmInputs:PChar; {Command parameters (nil allowed).}
|
||||||
|
TermQ:PChar; {System queue. (nil allowed).}
|
||||||
|
Environment:PChar; {Environment to pass (nil allowed).}
|
||||||
|
InheritOpt:word; {Inherit enviroment from shell/
|
||||||
|
inherit environment from parent (0/1).}
|
||||||
|
SessionType:word; {Auto/full screen/window/presentation
|
||||||
|
manager/full screen Dos/windowed Dos
|
||||||
|
(0/1/2/3/4/5/6/7).}
|
||||||
|
Iconfile:PChar; {Icon file to use (nil allowed).}
|
||||||
|
PgmHandle:cardinal; {0 or the program handle.}
|
||||||
|
PgmControl:word; {Bitfield describing initial state
|
||||||
|
of windowed sessions.}
|
||||||
|
InitXPos,InitYPos:word; {Initial top coordinates.}
|
||||||
|
InitXSize,InitYSize:word; {Initial size.}
|
||||||
|
Reserved:word;
|
||||||
|
ObjectBuffer:PChar; {If a module cannot be loaded, its
|
||||||
|
name will be returned here.}
|
||||||
|
ObjectBuffLen:cardinal; {Size of your buffer.}
|
||||||
|
end;
|
||||||
|
PStartData=^TStartData;
|
||||||
|
|
||||||
const
|
const
|
||||||
ilStandard = 1;
|
ilStandard = 1;
|
||||||
ilQueryEAsize = 2;
|
ilQueryEAsize = 2;
|
||||||
ilQueryEAs = 3;
|
ilQueryEAs = 3;
|
||||||
ilQueryFullName = 5;
|
ilQueryFullName = 5;
|
||||||
|
|
||||||
|
quFIFO = 0;
|
||||||
|
quLIFO = 1;
|
||||||
|
quPriority = 2;
|
||||||
|
|
||||||
|
quNoConvert_Address = 0;
|
||||||
|
quConvert_Address = 4;
|
||||||
|
|
||||||
|
{Start the new session independent or as a child.}
|
||||||
|
ssf_Related_Independent = 0; {Start new session independent
|
||||||
|
of the calling session.}
|
||||||
|
ssf_Related_Child = 1; {Start new session as a child
|
||||||
|
session to the calling session.}
|
||||||
|
|
||||||
|
{Start the new session in the foreground or in the background.}
|
||||||
|
ssf_FgBg_Fore = 0; {Start new session in foreground.}
|
||||||
|
ssf_FgBg_Back = 1; {Start new session in background.}
|
||||||
|
|
||||||
|
{Should the program started in the new session
|
||||||
|
be executed under conditions for tracing?}
|
||||||
|
ssf_TraceOpt_None = 0; {No trace.}
|
||||||
|
ssf_TraceOpt_Trace = 1; {Trace with no notification
|
||||||
|
of descendants.}
|
||||||
|
ssf_TraceOpt_TraceAll = 2; {Trace all descendant sessions.
|
||||||
|
A termination queue must be
|
||||||
|
supplied and Related must be
|
||||||
|
ssf_Related_Child (=1).}
|
||||||
|
|
||||||
|
{Will the new session inherit open file handles
|
||||||
|
and environment from the calling process.}
|
||||||
|
ssf_InhertOpt_Shell = 0; {Inherit from the shell.}
|
||||||
|
ssf_InhertOpt_Parent = 1; {Inherit from the calling process.}
|
||||||
|
|
||||||
|
{Specifies the type of session to start.}
|
||||||
|
ssf_Type_Default = 0; {Use program's type.}
|
||||||
|
ssf_Type_FullScreen = 1; {OS/2 full screen.}
|
||||||
|
ssf_Type_WindowableVIO = 2; {OS/2 window.}
|
||||||
|
ssf_Type_PM = 3; {Presentation Manager.}
|
||||||
|
ssf_Type_VDM = 4; {DOS full screen.}
|
||||||
|
ssf_Type_WindowedVDM = 7; {DOS window.}
|
||||||
|
{Additional values for Windows programs}
|
||||||
|
Prog_31_StdSeamlessVDM = 15; {Windows 3.1 program in its
|
||||||
|
own windowed session.}
|
||||||
|
Prog_31_StdSeamlessCommon = 16; {Windows 3.1 program in a
|
||||||
|
common windowed session.}
|
||||||
|
Prog_31_EnhSeamlessVDM = 17; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in its own
|
||||||
|
windowed session.}
|
||||||
|
Prog_31_EnhSeamlessCommon = 18; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in a common
|
||||||
|
windowed session.}
|
||||||
|
Prog_31_Enh = 19; {Windows 3.1 program in enhanced
|
||||||
|
compatibility mode in a full
|
||||||
|
screen session.}
|
||||||
|
Prog_31_Std = 20; {Windows 3.1 program in a full
|
||||||
|
screen session.}
|
||||||
|
|
||||||
|
{Specifies the initial attributes for a OS/2 window or DOS window session.}
|
||||||
|
ssf_Control_Visible = 0; {Window is visible.}
|
||||||
|
ssf_Control_Invisible = 1; {Window is invisible.}
|
||||||
|
ssf_Control_Maximize = 2; {Window is maximized.}
|
||||||
|
ssf_Control_Minimize = 4; {Window is minimized.}
|
||||||
|
ssf_Control_NoAutoClose = 8; {Window will not close after
|
||||||
|
the program has ended.}
|
||||||
|
ssf_Control_SetPos = 32768; {Use InitXPos, InitYPos,
|
||||||
|
InitXSize, and InitYSize for
|
||||||
|
the size and placement.}
|
||||||
|
|
||||||
|
|
||||||
function DosSetFileInfo (Handle: longint; InfoLevel: cardinal; AFileStatus: PFileStatus;
|
function DosSetFileInfo (Handle: longint; InfoLevel: cardinal; AFileStatus: PFileStatus;
|
||||||
FileStatusLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 218;
|
FileStatusLen: cardinal): cardinal; cdecl; external 'DOSCALLS' index 218;
|
||||||
|
|
||||||
@ -236,7 +374,8 @@ function DosClose(Handle:longint): longint; cdecl;
|
|||||||
function DosRead(Handle:longint; var Buffer; Count:longint;
|
function DosRead(Handle:longint; var Buffer; Count:longint;
|
||||||
var ActCount:longint):longint; cdecl;
|
var ActCount:longint):longint; cdecl;
|
||||||
external 'DOSCALLS' index 281;
|
external 'DOSCALLS' index 281;
|
||||||
function DosWrite(Handle:longint; const Buffer; Count:longint;
|
|
||||||
|
function DosWrite(Handle:longint; Buffer: pointer; Count:longint;
|
||||||
var ActCount:longint):longint; cdecl;
|
var ActCount:longint):longint; cdecl;
|
||||||
external 'DOSCALLS' index 282;
|
external 'DOSCALLS' index 282;
|
||||||
|
|
||||||
@ -247,6 +386,28 @@ function DosSetFilePtr(Handle:longint;Pos:longint;Method:cardinal;
|
|||||||
function DosSetFileSize(Handle:longint;Size:cardinal):longint; cdecl;
|
function DosSetFileSize(Handle:longint;Size:cardinal):longint; cdecl;
|
||||||
external 'DOSCALLS' index 272;
|
external 'DOSCALLS' index 272;
|
||||||
|
|
||||||
|
procedure DosSleep (MSec: cardinal); cdecl; external 'DOSCALLS' index 229;
|
||||||
|
|
||||||
|
function DosCreateQueue (var Handle: THandle; Priority:longint;
|
||||||
|
Name: PChar): cardinal; cdecl;
|
||||||
|
external 'QUECALLS' index 16;
|
||||||
|
|
||||||
|
function DosReadQueue (Handle: THandle; var ReqBuffer: TRequestData;
|
||||||
|
var DataLen: cardinal; var DataPtr: pointer;
|
||||||
|
Element, Wait: cardinal; var Priority: byte;
|
||||||
|
ASem: THandle): cardinal; cdecl;
|
||||||
|
external 'QUECALLS' index 9;
|
||||||
|
|
||||||
|
function DosCloseQueue (Handle: THandle): cardinal; cdecl;
|
||||||
|
external 'QUECALLS' index 11;
|
||||||
|
|
||||||
|
function DosStartSession (var AStartData: TStartData;
|
||||||
|
var SesID, PID: cardinal): cardinal; cdecl;
|
||||||
|
external 'SESMGR' index 37;
|
||||||
|
|
||||||
|
function DosFreeMem(P:pointer):cardinal; cdecl; external 'DOSCALLS' index 304;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TDT=packed record
|
TDT=packed record
|
||||||
Hour,
|
Hour,
|
||||||
@ -314,7 +475,7 @@ Begin
|
|||||||
FileCreate:=-RC;
|
FileCreate:=-RC;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
function FileCreate (const FileName: string; Mode: longint): longint;
|
function FileCreate (const FileName: string; Mode: integer): longint;
|
||||||
begin
|
begin
|
||||||
FileCreate := FileCreate(FileName);
|
FileCreate := FileCreate(FileName);
|
||||||
end;
|
end;
|
||||||
@ -332,7 +493,7 @@ function FileWrite (Handle: longint; const Buffer; Count: longint): longint;
|
|||||||
Var
|
Var
|
||||||
T: Longint;
|
T: Longint;
|
||||||
begin
|
begin
|
||||||
DosWrite(Handle, Buffer, Count, T);
|
DosWrite (Handle, @Buffer, Count, T);
|
||||||
FileWrite:=T;
|
FileWrite:=T;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -472,7 +633,7 @@ end;
|
|||||||
|
|
||||||
function FileSetDate (Handle, Age: longint): longint;
|
function FileSetDate (Handle, Age: longint): longint;
|
||||||
var
|
var
|
||||||
FStat: PFileStatus0;
|
FStat: PFileStatus3;
|
||||||
RC: cardinal;
|
RC: cardinal;
|
||||||
begin
|
begin
|
||||||
New (FStat);
|
New (FStat);
|
||||||
@ -726,6 +887,63 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Sleep (Milliseconds: cardinal);
|
||||||
|
|
||||||
|
begin
|
||||||
|
DosSleep (Milliseconds);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString):
|
||||||
|
integer;
|
||||||
|
var
|
||||||
|
HQ: THandle;
|
||||||
|
SPID, STID, QName: shortstring;
|
||||||
|
SD: TStartData;
|
||||||
|
SID, PID: cardinal;
|
||||||
|
RD: TRequestData;
|
||||||
|
PCI: PChildInfo;
|
||||||
|
CISize: cardinal;
|
||||||
|
Prio: byte;
|
||||||
|
E: EOSError;
|
||||||
|
CommandLine: ansistring;
|
||||||
|
|
||||||
|
begin
|
||||||
|
FillChar (SD, SizeOf (SD), 0);
|
||||||
|
SD.Length := 24;
|
||||||
|
SD.Related := ssf_Related_Child;
|
||||||
|
SD.PgmName := PChar (Path);
|
||||||
|
SD.PgmInputs := PChar (ComLine);
|
||||||
|
Str (ProcessID, SPID);
|
||||||
|
Str (ThreadID, STID);
|
||||||
|
QName := '\QUEUES\FPC_ExecuteProcess_p' + SPID + 't' + STID + '.QUE'#0;
|
||||||
|
SD.TermQ := @QName [1];
|
||||||
|
Result := DosCreateQueue (HQ, quFIFO or quConvert_Address, @QName [1]);
|
||||||
|
if Result = 0 then
|
||||||
|
begin
|
||||||
|
Result := DosStartSession (SD, SID, PID);
|
||||||
|
if (Result = 0) or (Result = 457) then
|
||||||
|
begin
|
||||||
|
Result := DosReadQueue (HQ, RD, CISize, PCI, 0, 0, Prio, 0);
|
||||||
|
if Result = 0 then
|
||||||
|
begin
|
||||||
|
Result := PCI^.Return;
|
||||||
|
DosCloseQueue (HQ);
|
||||||
|
DosFreeMem (PCI);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
DosCloseQueue (HQ);
|
||||||
|
end;
|
||||||
|
if ComLine = '' then
|
||||||
|
CommandLine := Path
|
||||||
|
else
|
||||||
|
CommandLine := Path + ' ' + ComLine;
|
||||||
|
E := EOSError.CreateFmt (SExecuteProcessFailed, [CommandLine, Result]);
|
||||||
|
E.ErrorCode := Result;
|
||||||
|
raise E;
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Initialization code
|
Initialization code
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -739,7 +957,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.39 2003-11-26 20:00:19 florian
|
Revision 1.40 2004-01-20 23:11:20 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.39 2003/11/26 20:00:19 florian
|
||||||
* error handling for Variants improved
|
* error handling for Variants improved
|
||||||
|
|
||||||
Revision 1.38 2003/11/23 15:50:07 yuri
|
Revision 1.38 2003/11/23 15:50:07 yuri
|
||||||
|
@ -25,6 +25,10 @@ interface
|
|||||||
|
|
||||||
{$I systemh.inc}
|
{$I systemh.inc}
|
||||||
|
|
||||||
|
type
|
||||||
|
THandle = longint;
|
||||||
|
|
||||||
|
|
||||||
{ include heap support headers }
|
{ include heap support headers }
|
||||||
|
|
||||||
{$I heaph.inc}
|
{$I heaph.inc}
|
||||||
@ -288,10 +292,16 @@ Begin
|
|||||||
Setup_Arguments;
|
Setup_Arguments;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
(* This should be changed to a real value during *)
|
||||||
|
(* thread driver initialization if appropriate. *)
|
||||||
|
ThreadID := 1;
|
||||||
End.
|
End.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.9 2003-09-27 11:52:36 peter
|
Revision 1.10 2004-01-20 23:12:49 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.9 2003/09/27 11:52:36 peter
|
||||||
* sbrk returns pointer
|
* sbrk returns pointer
|
||||||
|
|
||||||
Revision 1.8 2002/09/07 16:01:27 peter
|
Revision 1.8 2002/09/07 16:01:27 peter
|
||||||
|
@ -249,6 +249,27 @@ begin
|
|||||||
Result:=StrPas(beos.Getenv(PChar(EnvVar)));
|
Result:=StrPas(beos.Getenv(PChar(EnvVar)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
||||||
|
|
||||||
|
var
|
||||||
|
e : EOSError;
|
||||||
|
CommandLine: AnsiString;
|
||||||
|
|
||||||
|
begin
|
||||||
|
dos.exec(path,comline);
|
||||||
|
|
||||||
|
if (Dos.DosError <> 0) then
|
||||||
|
begin
|
||||||
|
if ComLine <> '' then
|
||||||
|
CommandLine := Path + ' ' + ComLine
|
||||||
|
else
|
||||||
|
CommandLine := Path;
|
||||||
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,Dos.DosError]);
|
||||||
|
e.ErrorCode:=Dos.DosError;
|
||||||
|
raise e;
|
||||||
|
end;
|
||||||
|
Result := DosExitCode;
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Initialization code
|
Initialization code
|
||||||
@ -263,7 +284,10 @@ Finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2003-03-29 15:16:26 hajny
|
Revision 1.4 2004-01-20 23:12:49 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.3 2003/03/29 15:16:26 hajny
|
||||||
* dummy DirectoryExists added
|
* dummy DirectoryExists added
|
||||||
|
|
||||||
Revision 1.2 2002/09/07 16:01:27 peter
|
Revision 1.2 2002/09/07 16:01:27 peter
|
||||||
|
@ -365,7 +365,8 @@ begin
|
|||||||
Result:=True;
|
Result:=True;
|
||||||
{$else}
|
{$else}
|
||||||
Result:=LoadPthreads;
|
Result:=LoadPthreads;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
ThreadID := SizeUInt (pthread_self);
|
||||||
Writeln('InitThreads : ',Result);
|
Writeln('InitThreads : ',Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -420,7 +421,10 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 2004-01-07 17:40:56 jonas
|
Revision 1.7 2004-01-20 23:13:53 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.6 2004/01/07 17:40:56 jonas
|
||||||
* Darwin does not have a lib_r, libc itself is already reentrant
|
* Darwin does not have a lib_r, libc itself is already reentrant
|
||||||
|
|
||||||
Revision 1.5 2003/12/16 09:43:04 daniel
|
Revision 1.5 2003/12/16 09:43:04 daniel
|
||||||
|
@ -483,23 +483,31 @@ var
|
|||||||
pid : longint;
|
pid : longint;
|
||||||
err : longint;
|
err : longint;
|
||||||
e : EOSError;
|
e : EOSError;
|
||||||
|
CommandLine: AnsiString;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
|
{ always surround the name of the application by quotes
|
||||||
|
so that long filenames will always be accepted. But don't
|
||||||
|
do it if there are already double quotes!
|
||||||
|
}
|
||||||
|
if Pos ('"', Path) = 0 then
|
||||||
|
CommandLine := '"' + Path + '"'
|
||||||
|
else
|
||||||
|
CommandLine := Path;
|
||||||
|
if ComLine <> '' then
|
||||||
|
CommandLine := Commandline + ' ' + ComLine;
|
||||||
pid:=fpFork;
|
pid:=fpFork;
|
||||||
if pid=0 then
|
if pid=0 then
|
||||||
begin
|
begin
|
||||||
{The child does the actual exec, and then exits}
|
{The child does the actual exec, and then exits}
|
||||||
if ComLine='' then
|
Execl(CommandLine);
|
||||||
Execl(Path)
|
|
||||||
else
|
|
||||||
Execl(Path+' '+ComLine);
|
|
||||||
{ If the execve fails, we return an exitvalue of 127, to let it be known}
|
{ If the execve fails, we return an exitvalue of 127, to let it be known}
|
||||||
fpExit(127);
|
fpExit(127);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if pid=-1 then {Fork failed}
|
if pid=-1 then {Fork failed}
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt('Failed to execute %s : %d',[ComLine,-1]);
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,-1]);
|
||||||
e.ErrorCode:=-1;
|
e.ErrorCode:=-1;
|
||||||
raise e;
|
raise e;
|
||||||
end;
|
end;
|
||||||
@ -511,7 +519,7 @@ Begin
|
|||||||
result:=0
|
result:=0
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt('Failed to execute %s : %d',[ComLine,result]);
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,result]);
|
||||||
e.ErrorCode:=result;
|
e.ErrorCode:=result;
|
||||||
raise e;
|
raise e;
|
||||||
end;
|
end;
|
||||||
@ -549,7 +557,10 @@ end.
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.30 2004-01-10 17:34:36 michael
|
Revision 1.31 2004-01-20 23:13:53 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.30 2004/01/10 17:34:36 michael
|
||||||
+ Implemented sleep() on Unix.
|
+ Implemented sleep() on Unix.
|
||||||
|
|
||||||
Revision 1.29 2004/01/05 22:42:35 florian
|
Revision 1.29 2004/01/05 22:42:35 florian
|
||||||
|
@ -1525,6 +1525,7 @@ Begin
|
|||||||
FileNameCaseSensitive:=true;
|
FileNameCaseSensitive:=true;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
ThreadID := 1;
|
||||||
{$ifdef EXCEPTIONS_IN_SYSTEM}
|
{$ifdef EXCEPTIONS_IN_SYSTEM}
|
||||||
InitDPMIExcp;
|
InitDPMIExcp;
|
||||||
InstallDefaultHandlers;
|
InstallDefaultHandlers;
|
||||||
@ -1534,11 +1535,12 @@ Begin
|
|||||||
{$endif HASVARIANT}
|
{$endif HASVARIANT}
|
||||||
End.
|
End.
|
||||||
|
|
||||||
END.
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2004-01-11 23:08:39 hajny
|
Revision 1.12 2004-01-20 23:12:49 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.11 2004/01/11 23:08:39 hajny
|
||||||
* merged Jonas fix from GO32v2
|
* merged Jonas fix from GO32v2
|
||||||
|
|
||||||
Revision 1.10 2004/01/11 22:54:44 hajny
|
Revision 1.10 2004/01/11 22:54:44 hajny
|
||||||
|
@ -24,6 +24,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
watcom,dos;
|
watcom,dos;
|
||||||
|
|
||||||
|
{$DEFINE HAS_SLEEP}
|
||||||
{ Include platform independent interface part }
|
{ Include platform independent interface part }
|
||||||
{$i sysutilh.inc}
|
{$i sysutilh.inc}
|
||||||
|
|
||||||
@ -759,6 +760,93 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
||||||
|
|
||||||
|
var
|
||||||
|
e : EOSError;
|
||||||
|
CommandLine: AnsiString;
|
||||||
|
|
||||||
|
begin
|
||||||
|
dos.exec(path,comline);
|
||||||
|
|
||||||
|
if (Dos.DosError <> 0) then
|
||||||
|
begin
|
||||||
|
if ComLine <> '' then
|
||||||
|
CommandLine := Path + ' ' + ComLine
|
||||||
|
else
|
||||||
|
CommandLine := Path;
|
||||||
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,Dos.DosError]);
|
||||||
|
e.ErrorCode:=Dos.DosError;
|
||||||
|
raise e;
|
||||||
|
end;
|
||||||
|
Result := DosExitCode;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{*************************************************************************
|
||||||
|
Sleep (copied from crt.Delay)
|
||||||
|
*************************************************************************}
|
||||||
|
|
||||||
|
var
|
||||||
|
DelayCnt : Longint;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Delayloop;assembler;
|
||||||
|
asm
|
||||||
|
.LDelayLoop1:
|
||||||
|
subl $1,%eax
|
||||||
|
jc .LDelayLoop2
|
||||||
|
cmpl %fs:(%edi),%ebx
|
||||||
|
je .LDelayLoop1
|
||||||
|
.LDelayLoop2:
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure initdelay;assembler;
|
||||||
|
asm
|
||||||
|
pushl %ebx
|
||||||
|
pushl %edi
|
||||||
|
{ for some reason, using int $31/ax=$901 doesn't work here }
|
||||||
|
{ and interrupts are always disabled at this point when }
|
||||||
|
{ running a program inside gdb(pas). Web bug 1345 (JM) }
|
||||||
|
sti
|
||||||
|
movl $0x46c,%edi
|
||||||
|
movl $-28,%edx
|
||||||
|
movl %fs:(%edi),%ebx
|
||||||
|
.LInitDel1:
|
||||||
|
cmpl %fs:(%edi),%ebx
|
||||||
|
je .LInitDel1
|
||||||
|
movl %fs:(%edi),%ebx
|
||||||
|
movl %edx,%eax
|
||||||
|
call DelayLoop
|
||||||
|
|
||||||
|
notl %eax
|
||||||
|
xorl %edx,%edx
|
||||||
|
movl $55,%ecx
|
||||||
|
divl %ecx
|
||||||
|
movl %eax,DelayCnt
|
||||||
|
popl %edi
|
||||||
|
popl %ebx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure Sleep(MilliSeconds: Cardinal);assembler;
|
||||||
|
asm
|
||||||
|
pushl %ebx
|
||||||
|
pushl %edi
|
||||||
|
movl MilliSeconds,%ecx
|
||||||
|
jecxz .LDelay2
|
||||||
|
movl $0x400,%edi
|
||||||
|
movl DelayCnt,%edx
|
||||||
|
movl %fs:(%edi),%ebx
|
||||||
|
.LDelay1:
|
||||||
|
movl %edx,%eax
|
||||||
|
call DelayLoop
|
||||||
|
loop .LDelay1
|
||||||
|
.LDelay2:
|
||||||
|
popl %edi
|
||||||
|
popl %ebx
|
||||||
|
end;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Initialization code
|
Initialization code
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -766,13 +854,17 @@ end;
|
|||||||
Initialization
|
Initialization
|
||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
|
InitDelay;
|
||||||
Finalization
|
Finalization
|
||||||
DoneExceptions;
|
DoneExceptions;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2003-12-15 15:57:49 peter
|
Revision 1.4 2004-01-20 23:12:49 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.3 2003/12/15 15:57:49 peter
|
||||||
* patches from wiktor
|
* patches from wiktor
|
||||||
|
|
||||||
Revision 1.2 2003/11/26 20:00:19 florian
|
Revision 1.2 2003/11/26 20:00:19 florian
|
||||||
|
@ -694,6 +694,9 @@ end;
|
|||||||
function GetCommandLine : pchar;
|
function GetCommandLine : pchar;
|
||||||
stdcall;external 'kernel32' name 'GetCommandLineA';
|
stdcall;external 'kernel32' name 'GetCommandLineA';
|
||||||
|
|
||||||
|
function GetCurrentThread : dword;
|
||||||
|
stdcall; external 'kernel32' name 'GetCurrentThread';
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
ModuleName : array[0..255] of char;
|
ModuleName : array[0..255] of char;
|
||||||
@ -1539,6 +1542,7 @@ begin
|
|||||||
setup_arguments;
|
setup_arguments;
|
||||||
{ Reset IO Error }
|
{ Reset IO Error }
|
||||||
InOutRes:=0;
|
InOutRes:=0;
|
||||||
|
ThreadID := GetCurrentThread;
|
||||||
{ Reset internal error variable }
|
{ Reset internal error variable }
|
||||||
errno:=0;
|
errno:=0;
|
||||||
{$ifdef HASVARIANT}
|
{$ifdef HASVARIANT}
|
||||||
@ -1548,7 +1552,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.51 2003-12-17 21:56:33 peter
|
Revision 1.52 2004-01-20 23:12:49 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.51 2003/12/17 21:56:33 peter
|
||||||
* win32 regcall patches
|
* win32 regcall patches
|
||||||
|
|
||||||
Revision 1.50 2003/12/04 20:52:41 peter
|
Revision 1.50 2003/12/04 20:52:41 peter
|
||||||
|
@ -688,7 +688,7 @@ begin
|
|||||||
FillChar(SI, SizeOf(SI), 0);
|
FillChar(SI, SizeOf(SI), 0);
|
||||||
SI.cb:=SizeOf(SI);
|
SI.cb:=SizeOf(SI);
|
||||||
SI.wShowWindow:=1;
|
SI.wShowWindow:=1;
|
||||||
{ always surroound the name of the application by quotes
|
{ always surround the name of the application by quotes
|
||||||
so that long filenames will always be accepted. But don't
|
so that long filenames will always be accepted. But don't
|
||||||
do it if there are already double quotes, since Win32 does not
|
do it if there are already double quotes, since Win32 does not
|
||||||
like double quotes which are duplicated!
|
like double quotes which are duplicated!
|
||||||
@ -697,12 +697,15 @@ begin
|
|||||||
CommandLine:='"'+path+'"'
|
CommandLine:='"'+path+'"'
|
||||||
else
|
else
|
||||||
CommandLine:=path;
|
CommandLine:=path;
|
||||||
CommandLine:=Commandline+' '+ComLine+#0;
|
if ComLine <> '' then
|
||||||
|
CommandLine:=Commandline+' '+ComLine+#0
|
||||||
|
else
|
||||||
|
CommandLine := CommandLine + #0;
|
||||||
|
|
||||||
if not CreateProcess(nil, pchar(CommandLine),
|
if not CreateProcess(nil, pchar(CommandLine),
|
||||||
Nil, Nil, ExecInheritsHandles,$20, Nil, Nil, SI, PI) then
|
Nil, Nil, ExecInheritsHandles,$20, Nil, Nil, SI, PI) then
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt('Failed to execute %s : %d',[CommandLine,GetLastError]);
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,GetLastError]);
|
||||||
e.ErrorCode:=GetLastError;
|
e.ErrorCode:=GetLastError;
|
||||||
raise e;
|
raise e;
|
||||||
end;
|
end;
|
||||||
@ -716,7 +719,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
e:=EOSError.CreateFmt('Failed to execute %s : %d',[CommandLine,GetLastError]);
|
e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,GetLastError]);
|
||||||
e.ErrorCode:=GetLastError;
|
e.ErrorCode:=GetLastError;
|
||||||
CloseHandle(Proc);
|
CloseHandle(Proc);
|
||||||
raise e;
|
raise e;
|
||||||
@ -790,7 +793,10 @@ Finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.30 2004-01-16 20:53:33 michael
|
Revision 1.31 2004-01-20 23:12:49 hajny
|
||||||
|
* ExecuteProcess fixes, ProcessID and ThreadID added
|
||||||
|
|
||||||
|
Revision 1.30 2004/01/16 20:53:33 michael
|
||||||
+ DirectoryExists now closes findfirst handle
|
+ DirectoryExists now closes findfirst handle
|
||||||
|
|
||||||
Revision 1.29 2004/01/10 17:40:25 michael
|
Revision 1.29 2004/01/10 17:40:25 michael
|
||||||
|
Loading…
Reference in New Issue
Block a user