|
@@ -27,6 +27,8 @@ interface
|
|
|
{.$define DEBUGARGUMENTS}
|
|
|
{$endif SYSTEMDEBUG}
|
|
|
|
|
|
+{$DEFINE EOF_CTRLZ}
|
|
|
+
|
|
|
{ $DEFINE OS2EXCEPTIONS}
|
|
|
|
|
|
{$I systemh.inc}
|
|
@@ -42,12 +44,6 @@ type
|
|
|
|
|
|
{$ENDIF OS2EXCEPTIONS}
|
|
|
|
|
|
-{$I heaph.inc}
|
|
|
-
|
|
|
-{Platform specific information}
|
|
|
-type
|
|
|
- THandle = Longint;
|
|
|
-
|
|
|
const
|
|
|
LineEnding = #13#10;
|
|
|
{ LFNSupport is defined separately below!!! }
|
|
@@ -151,292 +147,6 @@ implementation
|
|
|
|
|
|
{$I system.inc}
|
|
|
|
|
|
-var
|
|
|
- ProcessID: SizeUInt;
|
|
|
-
|
|
|
-function GetProcessID:SizeUInt;
|
|
|
-begin
|
|
|
- GetProcessID := ProcessID;
|
|
|
-end;
|
|
|
-
|
|
|
-procedure DosGetInfoBlocks (PATIB: PPThreadInfoBlock;
|
|
|
- PAPIB: PPProcessInfoBlock); cdecl;
|
|
|
- external 'DOSCALLS' index 312;
|
|
|
-
|
|
|
-function DosLoadModule (ObjName: PChar; ObjLen: cardinal; DLLName: PChar;
|
|
|
- var Handle: cardinal): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 318;
|
|
|
-
|
|
|
-function DosQueryProcAddr (Handle, Ordinal: cardinal; ProcName: PChar;
|
|
|
- var Address: pointer): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 321;
|
|
|
-
|
|
|
-function DosSetRelMaxFH (var ReqCount: longint; var CurMaxFH: cardinal):
|
|
|
- cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 382;
|
|
|
-
|
|
|
-function DosSetCurrentDir (Name:PChar): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 255;
|
|
|
-
|
|
|
-procedure DosQueryCurrentDisk(var DiskNum:cardinal;var Logical:cardinal); cdecl;
|
|
|
-external 'DOSCALLS' index 275;
|
|
|
-
|
|
|
-function DosSetDefaultDisk (DiskNum:cardinal): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 220;
|
|
|
-
|
|
|
-{ This is not real prototype, but is close enough }
|
|
|
-{ for us (the 2nd parameter is actually a pointer }
|
|
|
-{ to a structure). }
|
|
|
-function DosCreateDir (Name: PChar; P: pointer): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 270;
|
|
|
-
|
|
|
-function DosDeleteDir (Name: PChar): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 226;
|
|
|
-
|
|
|
-function DosQueryCurrentDir(DiskNum:cardinal;var Buffer;
|
|
|
- var BufLen:cardinal): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 274;
|
|
|
-
|
|
|
-function DosMove(OldFile,NewFile:PChar):cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 271;
|
|
|
-
|
|
|
-function DosDelete(FileName:PChar):cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 259;
|
|
|
-
|
|
|
-procedure DosExit(Action, Result: cardinal); cdecl;
|
|
|
- external 'DOSCALLS' index 234;
|
|
|
-
|
|
|
-// EAs not used in System unit
|
|
|
-function DosOpen(FileName:PChar;var Handle: THandle;var Action:cardinal;
|
|
|
- InitSize,Attrib,OpenFlags,FileMode:cardinal;
|
|
|
- EA:Pointer): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 273;
|
|
|
-
|
|
|
-function DosClose(Handle: THandle): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 257;
|
|
|
-
|
|
|
-function DosRead(Handle: THandle; Buffer: Pointer; Count: cardinal;
|
|
|
- var ActCount: cardinal): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 281;
|
|
|
-
|
|
|
-function DosWrite(Handle: THandle; Buffer: Pointer;Count: cardinal;
|
|
|
- var ActCount: cardinal): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 282;
|
|
|
-
|
|
|
-function DosSetFilePtr(Handle: THandle; Pos:longint; Method:cardinal;
|
|
|
- var PosActual: cardinal): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 256;
|
|
|
-
|
|
|
-function DosSetFileSize(Handle: THandle; Size: cardinal): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 272;
|
|
|
-
|
|
|
-function DosQueryHType(Handle: THandle; var HandType: cardinal;
|
|
|
- var Attr: cardinal): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 224;
|
|
|
-
|
|
|
-type
|
|
|
- TSysDateTime=packed record
|
|
|
- Hour,
|
|
|
- Minute,
|
|
|
- Second,
|
|
|
- Sec100,
|
|
|
- Day,
|
|
|
- Month: byte;
|
|
|
- Year: word;
|
|
|
- TimeZone: smallint;
|
|
|
- WeekDay: byte;
|
|
|
- end;
|
|
|
-
|
|
|
-function DosGetDateTime(var Buf:TSysDateTime): cardinal; cdecl;
|
|
|
- external 'DOSCALLS' index 230;
|
|
|
-
|
|
|
- { converts an OS/2 error code to a TP compatible error }
|
|
|
- { code. Same thing exists under most other supported }
|
|
|
- { systems. }
|
|
|
- { Only call for OS/2 DLL imported routines }
|
|
|
- Procedure Errno2InOutRes;
|
|
|
- Begin
|
|
|
- { errors 1..18 are the same as in DOS }
|
|
|
- case InOutRes of
|
|
|
- { simple offset to convert these error codes }
|
|
|
- { exactly like the error codes in Win32 }
|
|
|
- 19..31 : InOutRes := InOutRes + 131;
|
|
|
- { gets a bit more complicated ... }
|
|
|
- 32..33 : InOutRes := 5;
|
|
|
- 38 : InOutRes := 100;
|
|
|
- 39 : InOutRes := 101;
|
|
|
- 112 : InOutRes := 101;
|
|
|
- 110 : InOutRes := 5;
|
|
|
- 114 : InOutRes := 6;
|
|
|
- 290 : InOutRes := 290;
|
|
|
- end;
|
|
|
- { all other cases ... we keep the same error code }
|
|
|
- end;
|
|
|
-
|
|
|
-
|
|
|
-{$IFDEF OS2EXCEPTIONS}
|
|
|
-(*
|
|
|
-The operating system defines a class of error conditions called exceptions, and specifies the default actions that are taken when these exceptions occur. The system default action in most cases is to terminate the thread that caused the exception.
|
|
|
-
|
|
|
-Exception values have the following 32-bit format:
|
|
|
-
|
|
|
- 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
|
|
|
- 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
|
|
|
-ÚÄÄÄÂÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Sev³C³ Facility ³ Code ³
|
|
|
-ÀÄÄÄÁÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-
|
|
|
-
|
|
|
-Sev Severity code. Possible values are described in the following list:
|
|
|
-
|
|
|
-00 Success
|
|
|
-01 Informational
|
|
|
-10 Warning
|
|
|
-11 Error
|
|
|
-
|
|
|
-C Customer code flag.
|
|
|
-
|
|
|
-Facility Facility code.
|
|
|
-
|
|
|
-Code Facility's status code.
|
|
|
-
|
|
|
-Exceptions that are specific to OS/2 Version 2.X (for example, XCPT_SIGNAL)
|
|
|
-have a facility code of 1.
|
|
|
-
|
|
|
-System exceptions include both synchronous and asynchronous exceptions.
|
|
|
-Synchronous exceptions are caused by events that are internal to a thread's
|
|
|
-execution. For example, synchronous exceptions could be caused by invalid
|
|
|
-parameters, or by a thread's request to end its own execution.
|
|
|
-
|
|
|
-Asynchronous exceptions are caused by events that are external to a thread's
|
|
|
-execution. For example, an asynchronous exception can be caused by a user's
|
|
|
-entering a Ctrl+C or Ctrl+Break key sequence, or by a process' issuing
|
|
|
-DosKillProcess to end the execution of another process.
|
|
|
-
|
|
|
-The Ctrl+Break and Ctrl+C exceptions are also known as signals, or as signal
|
|
|
-exceptions.
|
|
|
-
|
|
|
-The following tables show the symbolic names of system exceptions, their
|
|
|
-numerical values, and related information fields.
|
|
|
-
|
|
|
-Portable, Non-Fatal, Software-Generated Exceptions
|
|
|
-
|
|
|
-ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Exception Name ³Value ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_GUARD_PAGE_VIOLATION ³0x80000001³
|
|
|
-³ ExceptionInfo[0] - R/W flag ³ ³
|
|
|
-³ ExceptionInfo[1] - FaultAddr ³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_UNABLE_TO_GROW_STACK ³0x80010001³
|
|
|
-ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-
|
|
|
-
|
|
|
-Portable, Fatal, Hardware-Generated Exceptions
|
|
|
-
|
|
|
-ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Exception Name ³Value ³Related Trap ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_ACCESS_VIOLATION ³0xC0000005³0x09, 0x0B, ³
|
|
|
-³ ExceptionInfo[0] - Flags ³ ³0x0C, 0x0D, ³
|
|
|
-³ XCPT_UNKNOWN_ACCESS 0x0 ³ ³0x0E ³
|
|
|
-³ XCPT_READ_ACCESS 0x1 ³ ³ ³
|
|
|
-³ XCPT_WRITE_ACCESS 0x2 ³ ³ ³
|
|
|
-³ XCPT_EXECUTE_ACCESS 0x4 ³ ³ ³
|
|
|
-³ XCPT_SPACE_ACCESS 0x8 ³ ³ ³
|
|
|
-³ XCPT_LIMIT_ACCESS 0x10 ³ ³ ³
|
|
|
-³ ExceptionInfo[1] - FaultAddr ³ ³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_INTEGER_DIVIDE_BY_ZERO ³0xC000009B³0 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_DIVIDE_BY_ZERO ³0xC0000095³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_INVALID_OPERATION ³0xC0000097³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_ILLEGAL_INSTRUCTION ³0xC000001C³0x06 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_PRIVILEGED_INSTRUCTION ³0xC000009D³0x0D ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_INTEGER_OVERFLOW ³0xC000009C³0x04 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_OVERFLOW ³0xC0000098³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_UNDERFLOW ³0xC000009A³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_DENORMAL_OPERAND ³0xC0000094³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_INEXACT_RESULT ³0xC0000096³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_FLOAT_STACK_CHECK ³0xC0000099³0x10 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_DATATYPE_MISALIGNMENT ³0xC000009E³0x11 ³
|
|
|
-³ ExceptionInfo[0] - R/W flag ³ ³ ³
|
|
|
-³ ExceptionInfo[1] - Alignment ³ ³ ³
|
|
|
-³ ExceptionInfo[2] - FaultAddr ³ ³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_BREAKPOINT ³0xC000009F³0x03 ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_SINGLE_STEP ³0xC00000A0³0x01 ³
|
|
|
-ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-
|
|
|
-
|
|
|
-Portable, Fatal, Software-Generated Exceptions
|
|
|
-
|
|
|
-ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Exception Name ³Value ³Related Trap ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_IN_PAGE_ERROR ³0xC0000006³0x0E ³
|
|
|
-³ ExceptionInfo[0] - FaultAddr ³ ³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_PROCESS_TERMINATE ³0xC0010001³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_ASYNC_PROCESS_TERMINATE ³0xC0010002³ ³
|
|
|
-³ ExceptionInfo[0] - TID of ³ ³ ³
|
|
|
-³ terminating thread ³ ³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_NONCONTINUABLE_EXCEPTION ³0xC0000024³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_INVALID_DISPOSITION ³0xC0000025³ ³
|
|
|
-ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-
|
|
|
-
|
|
|
-Non-Portable, Fatal Exceptions
|
|
|
-
|
|
|
-ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Exception Name ³Value ³Related Trap ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_INVALID_LOCK_SEQUENCE ³0xC000001D³ ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_ARRAY_BOUNDS_EXCEEDED ³0xC0000093³0x05 ³
|
|
|
-ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-
|
|
|
-
|
|
|
-Unwind Operation Exceptions
|
|
|
-
|
|
|
-ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Exception Name ³Value ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_UNWIND ³0xC0000026³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_BAD_STACK ³0xC0000027³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_INVALID_UNWIND_TARGET ³0xC0000028³
|
|
|
-ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-
|
|
|
-
|
|
|
-Fatal Signal Exceptions
|
|
|
-
|
|
|
-ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿
|
|
|
-³Exception Name ³Value ³
|
|
|
-ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´
|
|
|
-³XCPT_SIGNAL ³0xC0010003³
|
|
|
-³ ExceptionInfo[ 0 ] - Signal ³ ³
|
|
|
-³ Number ³ ³
|
|
|
-ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÙ
|
|
|
-*)
|
|
|
-{$ENDIF OS2EXCEPTIONS}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
{****************************************************************************
|
|
|
|
|
@@ -446,6 +156,7 @@ Fatal Signal Exceptions
|
|
|
|
|
|
procedure system_exit;
|
|
|
begin
|
|
|
+ DosFreeThreadLocalMemory (DataIndex);
|
|
|
DosExit(1{process}, exitcode);
|
|
|
end;
|
|
|
|
|
@@ -487,551 +198,6 @@ end;
|
|
|
|
|
|
{$ASMMODE ATT}
|
|
|
|
|
|
-{****************************************************************************
|
|
|
-
|
|
|
- Heap management releated routines.
|
|
|
-
|
|
|
-****************************************************************************}
|
|
|
-
|
|
|
-{Get some memory.
|
|
|
- P = Pointer to memory will be returned here.
|
|
|
- Size = Number of bytes to get. The size is rounded up to a multiple
|
|
|
- of 4096. This is probably not the case on non-intel 386
|
|
|
- versions of OS/2.
|
|
|
- Flags = One or more of the mfXXXX constants.}
|
|
|
-
|
|
|
-function DosAllocMem(var P:pointer;Size,Flag:cardinal): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 299;
|
|
|
-
|
|
|
-function DosSetMem(P:pointer;Size,Flag:cardinal): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 305;
|
|
|
-
|
|
|
-function DosFreeMem (P: pointer): cardinal; cdecl;
|
|
|
-external 'DOSCALLS' index 304;
|
|
|
-
|
|
|
-{$IFDEF DUMPGROW}
|
|
|
- {$DEFINE EXTDUMPGROW}
|
|
|
-{$ENDIF DUMPGROW}
|
|
|
-
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
-var
|
|
|
- Int_HeapSize: cardinal;
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
-
|
|
|
-{function GetHeapSize: longint; assembler;
|
|
|
-asm
|
|
|
- movl Int_HeapSize, %eax
|
|
|
-end ['EAX'];
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function SysOSAlloc (Size: PtrInt): pointer;
|
|
|
-var
|
|
|
- P: pointer;
|
|
|
- RC: cardinal;
|
|
|
-begin
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if Int_HeapSize <> high (cardinal) then
|
|
|
-{
|
|
|
- if Int_HeapSize = high (cardinal) then
|
|
|
- WriteLn ('Trying to allocate first heap of size ', Size)
|
|
|
- else
|
|
|
-}
|
|
|
- WriteLn ('Trying to grow heap by ', Size, ' to ', Int_HeapSize);
|
|
|
-{$ENDIF}
|
|
|
-
|
|
|
- if UseHighMem then
|
|
|
- RC := DosAllocMem (P, Size, $403)
|
|
|
- else
|
|
|
- RC := DosAllocMem (P, Size, 3);
|
|
|
- if RC = 0 then
|
|
|
- begin
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if Int_HeapSize <> high (cardinal) then
|
|
|
- WriteLn ('DosAllocMem returned memory at ', cardinal (P));
|
|
|
-{$ENDIF}
|
|
|
- RC := DosSetMem (P, Size, $410);
|
|
|
- if RC = 0 then
|
|
|
- begin
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if Int_HeapSize <> high (cardinal) then
|
|
|
- WriteLn ('New heap at ', cardinal (P));
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
- SysOSAlloc := P;
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if Int_HeapSize = high (cardinal) then
|
|
|
- Int_HeapSize := Size
|
|
|
- else
|
|
|
- Inc (Int_HeapSize, Size);
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if Int_HeapSize <> high (cardinal) then
|
|
|
- begin
|
|
|
- WriteLn ('Error ', RC, ' in DosSetMem while trying to commit memory!');
|
|
|
-{ if Int_HeapSize = high (cardinal) then
|
|
|
- WriteLn ('No allocated memory comitted yet!')
|
|
|
- else
|
|
|
-}
|
|
|
- WriteLn ('Total allocated memory is ', Int_HeapSize);
|
|
|
- end;
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
- RC := DosFreeMem (P);
|
|
|
- SysOSAlloc := nil;
|
|
|
- end;
|
|
|
- end
|
|
|
- else
|
|
|
- begin
|
|
|
- SysOSAlloc := nil;
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if Int_HeapSize <> high (cardinal) then
|
|
|
- begin
|
|
|
- WriteLn ('Error ', RC, ' during additional memory allocation (DosAllocMem)!');
|
|
|
-{ if Int_HeapSize = high (cardinal) then
|
|
|
- WriteLn ('No memory allocated yet!')
|
|
|
- else
|
|
|
-}
|
|
|
- WriteLn ('Total allocated memory is ', Int_HeapSize);
|
|
|
- end;
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
- end;
|
|
|
-end;
|
|
|
-
|
|
|
-{$define HAS_SYSOSFREE}
|
|
|
-
|
|
|
-procedure SysOSFree (P: pointer; Size: PtrInt);
|
|
|
-var
|
|
|
- RC: cardinal;
|
|
|
-begin
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- WriteLn ('Trying to free memory!');
|
|
|
- WriteLn ('Total allocated memory is ', Int_HeapSize);
|
|
|
- Dec (Int_HeapSize, Size);
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
- RC := DosSetMem (P, Size, $20);
|
|
|
- if RC = 0 then
|
|
|
- begin
|
|
|
- RC := DosFreeMem (P);
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- if RC <> 0 then
|
|
|
- begin
|
|
|
- WriteLn ('Error ', RC, ' during memory deallocation (DosFreeMem)!');
|
|
|
- WriteLn ('Total allocated memory is ', Int_HeapSize);
|
|
|
- end;
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
- end
|
|
|
-{$IFDEF EXTDUMPGROW}
|
|
|
- else
|
|
|
- begin
|
|
|
- WriteLn ('Error ', RC, ' in DosSetMem while trying to decommit memory!');
|
|
|
- WriteLn ('Total allocated memory is ', Int_HeapSize);
|
|
|
- end;
|
|
|
-{$ENDIF EXTDUMPGROW}
|
|
|
-end;
|
|
|
-
|
|
|
-{$i heap.inc}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-{****************************************************************************
|
|
|
-
|
|
|
- Low Level File Routines
|
|
|
-
|
|
|
-****************************************************************************}
|
|
|
-
|
|
|
-procedure allowslash(p:Pchar);
|
|
|
-{Allow slash as backslash.}
|
|
|
-var i:longint;
|
|
|
-begin
|
|
|
- for i:=0 to strlen(p) do
|
|
|
- if p[i]='/' then p[i]:='\';
|
|
|
-end;
|
|
|
-
|
|
|
-procedure do_close(h:thandle);
|
|
|
-begin
|
|
|
-{ Only three standard handles under real OS/2 }
|
|
|
- if h>2 then
|
|
|
- begin
|
|
|
- InOutRes:=DosClose(h);
|
|
|
- end;
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln('do_close: handle=', H, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-procedure do_erase(p:Pchar);
|
|
|
-begin
|
|
|
- allowslash(p);
|
|
|
- inoutres:=DosDelete(p);
|
|
|
-end;
|
|
|
-
|
|
|
-procedure do_rename(p1,p2:Pchar);
|
|
|
-begin
|
|
|
- allowslash(p1);
|
|
|
- allowslash(p2);
|
|
|
- inoutres:=DosMove(p1, p2);
|
|
|
-end;
|
|
|
-
|
|
|
-function do_read(h:thandle;addr:pointer;len:longint):longint;
|
|
|
-Var
|
|
|
- T: cardinal;
|
|
|
-begin
|
|
|
-{$ifdef IODEBUG}
|
|
|
- write('do_read: handle=', h, ', addr=', ptrint(addr), ', length=', len);
|
|
|
-{$endif}
|
|
|
- InOutRes:=DosRead(H, Addr, Len, T);
|
|
|
- do_read:= longint (T);
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln(', actual_len=', t, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-function do_write(h:thandle;addr:pointer;len:longint) : longint;
|
|
|
-Var
|
|
|
- T: cardinal;
|
|
|
-begin
|
|
|
-{$ifdef IODEBUG}
|
|
|
- write('do_write: handle=', h, ', addr=', ptrint(addr), ', length=', len);
|
|
|
-{$endif}
|
|
|
- InOutRes:=DosWrite(H, Addr, Len, T);
|
|
|
- do_write:= longint (T);
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln(', actual_len=', t, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-function do_filepos(handle:thandle): longint;
|
|
|
-var
|
|
|
- PosActual: cardinal;
|
|
|
-begin
|
|
|
- InOutRes:=DosSetFilePtr(Handle, 0, 1, PosActual);
|
|
|
- do_filepos:=longint (PosActual);
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln('do_filepos: handle=', Handle, ', actual_pos=', PosActual, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-procedure do_seek(handle:thandle;pos:longint);
|
|
|
-var
|
|
|
- PosActual: cardinal;
|
|
|
-begin
|
|
|
- InOutRes:=DosSetFilePtr(Handle, Pos, 0 {ZeroBased}, PosActual);
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln('do_seek: handle=', Handle, ', pos=', pos, ', actual_pos=', PosActual, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-function do_seekend(handle:thandle):longint;
|
|
|
-var
|
|
|
- PosActual: cardinal;
|
|
|
-begin
|
|
|
- InOutRes:=DosSetFilePtr(Handle, 0, 2 {EndBased}, PosActual);
|
|
|
- do_seekend:=longint (PosActual);
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln('do_seekend: handle=', Handle, ', actual_pos=', PosActual, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-function do_filesize(handle:thandle):longint;
|
|
|
-var aktfilepos: cardinal;
|
|
|
-begin
|
|
|
- aktfilepos:=do_filepos(handle);
|
|
|
- do_filesize:=do_seekend(handle);
|
|
|
- do_seek(handle,aktfilepos);
|
|
|
-end;
|
|
|
-
|
|
|
-procedure do_truncate(handle:thandle;pos:longint);
|
|
|
-begin
|
|
|
- InOutRes:=DosSetFileSize(Handle, Pos);
|
|
|
- do_seekend(handle);
|
|
|
-end;
|
|
|
-
|
|
|
-const
|
|
|
- FileHandleCount: cardinal = 20;
|
|
|
-
|
|
|
-function Increase_File_Handle_Count: boolean;
|
|
|
-var Err: word;
|
|
|
- L1: longint;
|
|
|
- L2: cardinal;
|
|
|
-begin
|
|
|
- L1 := 10;
|
|
|
- if DosSetRelMaxFH (L1, L2) <> 0 then
|
|
|
- Increase_File_Handle_Count := false
|
|
|
- else
|
|
|
- if L2 > FileHandleCount then
|
|
|
- begin
|
|
|
- FileHandleCount := L2;
|
|
|
- Increase_File_Handle_Count := true;
|
|
|
- end
|
|
|
- else
|
|
|
- Increase_File_Handle_Count := false;
|
|
|
-end;
|
|
|
-
|
|
|
-procedure do_open(var f;p:pchar;flags:longint);
|
|
|
-{
|
|
|
- filerec and textrec have both handle and mode as the first items so
|
|
|
- they could use the same routine for opening/creating.
|
|
|
-
|
|
|
- when (flags and $100) the file will be append
|
|
|
- when (flags and $1000) the file will be truncate/rewritten
|
|
|
- when (flags and $10000) there is no check for close (needed for textfiles)
|
|
|
-}
|
|
|
-var
|
|
|
- Action, Attrib, OpenFlags, FM: Cardinal;
|
|
|
-begin
|
|
|
- // convert unix slashes to normal slashes
|
|
|
- allowslash(p);
|
|
|
-
|
|
|
- // close first if opened
|
|
|
- if ((flags and $10000)=0) then
|
|
|
- begin
|
|
|
- case filerec(f).mode of
|
|
|
- fminput,fmoutput,fminout : Do_Close(filerec(f).handle);
|
|
|
- fmclosed:;
|
|
|
- else
|
|
|
- begin
|
|
|
- inoutres:=102; {not assigned}
|
|
|
- exit;
|
|
|
- end;
|
|
|
- end;
|
|
|
- end;
|
|
|
-
|
|
|
- // reset file handle
|
|
|
- filerec(f).handle := UnusedHandle;
|
|
|
-
|
|
|
- Attrib:=0;
|
|
|
- OpenFlags:=0;
|
|
|
-
|
|
|
- // convert filesharing
|
|
|
- FM := Flags and $FF and not (8);
|
|
|
-(* DenyNone if sharing not specified. *)
|
|
|
- if FM and 112 = 0 then
|
|
|
- FM := FM or 64;
|
|
|
- // convert filemode to filerec modes and access mode
|
|
|
- case (FM and 3) of
|
|
|
- 0: filerec(f).mode:=fminput;
|
|
|
- 1: filerec(f).mode:=fmoutput;
|
|
|
- 2: filerec(f).mode:=fminout;
|
|
|
- end;
|
|
|
-
|
|
|
- if (flags and $1000)<>0 then
|
|
|
- OpenFlags:=OpenFlags or 2 {doOverwrite} or 16 {doCreate} // Create/overwrite
|
|
|
- else
|
|
|
- OpenFlags:=OpenFlags or 1 {doOpen}; // Open existing
|
|
|
-
|
|
|
- // Handle Std I/O
|
|
|
- if p[0]=#0 then
|
|
|
- begin
|
|
|
- case FileRec(f).mode of
|
|
|
- fminput :
|
|
|
- FileRec(f).Handle:=StdInputHandle;
|
|
|
- fminout, // this is set by rewrite
|
|
|
- fmoutput :
|
|
|
- FileRec(f).Handle:=StdOutputHandle;
|
|
|
- fmappend :
|
|
|
- begin
|
|
|
- FileRec(f).Handle:=StdOutputHandle;
|
|
|
- FileRec(f).mode:=fmoutput; // fool fmappend
|
|
|
- end;
|
|
|
- end;
|
|
|
- exit;
|
|
|
- end;
|
|
|
-
|
|
|
- Attrib:=32 {faArchive};
|
|
|
-
|
|
|
- InOutRes:=DosOpen(p, FileRec(F).Handle, Action, 0, Attrib, OpenFlags, FM, nil);
|
|
|
-
|
|
|
- // If too many open files try to set more file handles and open again
|
|
|
- if (InOutRes = 4) then
|
|
|
- if Increase_File_Handle_Count then
|
|
|
- InOutRes:=DosOpen(p, FileRec(F).Handle, Action, 0, Attrib, OpenFlags, FM, nil);
|
|
|
-
|
|
|
- If InOutRes<>0 then FileRec(F).Handle:=UnusedHandle;
|
|
|
-
|
|
|
- // If Handle created -> make some things
|
|
|
- if (FileRec(F).Handle <> UnusedHandle) then
|
|
|
- begin
|
|
|
-
|
|
|
- // Move to end of file for Append command
|
|
|
- if ((Flags and $100) <> 0) then
|
|
|
- begin
|
|
|
- do_seekend(FileRec(F).Handle);
|
|
|
- FileRec(F).Mode := fmOutput;
|
|
|
- end;
|
|
|
-
|
|
|
- end;
|
|
|
-
|
|
|
-{$ifdef IODEBUG}
|
|
|
- writeln('do_open,', filerec(f).handle, ',', filerec(f).name, ',', filerec(f).mode, ', InOutRes=', InOutRes);
|
|
|
-{$endif}
|
|
|
-end;
|
|
|
-
|
|
|
-function do_isdevice (Handle: THandle): boolean;
|
|
|
-var
|
|
|
- HT, Attr: cardinal;
|
|
|
-begin
|
|
|
- do_isdevice:=false;
|
|
|
- If DosQueryHType(Handle, HT, Attr)<>0 then exit;
|
|
|
- if ht=1 then do_isdevice:=true;
|
|
|
-end;
|
|
|
-{$ASMMODE ATT}
|
|
|
-
|
|
|
-
|
|
|
-{*****************************************************************************
|
|
|
- UnTyped File Handling
|
|
|
-*****************************************************************************}
|
|
|
-
|
|
|
-{$i file.inc}
|
|
|
-
|
|
|
-{*****************************************************************************
|
|
|
- Typed File Handling
|
|
|
-*****************************************************************************}
|
|
|
-
|
|
|
-{$i typefile.inc}
|
|
|
-
|
|
|
-{*****************************************************************************
|
|
|
- Text File Handling
|
|
|
-*****************************************************************************}
|
|
|
-
|
|
|
-{$DEFINE EOF_CTRLZ}
|
|
|
-
|
|
|
-{$i text.inc}
|
|
|
-
|
|
|
-{****************************************************************************
|
|
|
-
|
|
|
- Directory related routines.
|
|
|
-
|
|
|
-****************************************************************************}
|
|
|
-
|
|
|
-{*****************************************************************************
|
|
|
- Directory Handling
|
|
|
-*****************************************************************************}
|
|
|
-
|
|
|
-procedure MkDir (const S: string);[IOCHECK];
|
|
|
-var buffer:array[0..255] of char;
|
|
|
- Rc : word;
|
|
|
-begin
|
|
|
- If (s='') or (InOutRes <> 0) then
|
|
|
- exit;
|
|
|
- move(s[1],buffer,length(s));
|
|
|
- buffer[length(s)]:=#0;
|
|
|
- allowslash(Pchar(@buffer));
|
|
|
- Rc := DosCreateDir(buffer,nil);
|
|
|
- if Rc <> 0 then
|
|
|
- begin
|
|
|
- InOutRes := Rc;
|
|
|
- Errno2Inoutres;
|
|
|
- end;
|
|
|
-end;
|
|
|
-
|
|
|
-
|
|
|
-procedure rmdir(const s : string);[IOCHECK];
|
|
|
-var buffer:array[0..255] of char;
|
|
|
- Rc : word;
|
|
|
-begin
|
|
|
- if (s = '.' ) then
|
|
|
- InOutRes := 16;
|
|
|
- If (s='') or (InOutRes <> 0) then
|
|
|
- exit;
|
|
|
- move(s[1],buffer,length(s));
|
|
|
- buffer[length(s)]:=#0;
|
|
|
- allowslash(Pchar(@buffer));
|
|
|
- Rc := DosDeleteDir(buffer);
|
|
|
- if Rc <> 0 then
|
|
|
- begin
|
|
|
- InOutRes := Rc;
|
|
|
- Errno2Inoutres;
|
|
|
- end;
|
|
|
-end;
|
|
|
-
|
|
|
-{$ASMMODE INTEL}
|
|
|
-
|
|
|
-procedure ChDir (const S: string);[IOCheck];
|
|
|
-
|
|
|
-var RC: cardinal;
|
|
|
- Buffer: array [0..255] of char;
|
|
|
-
|
|
|
-begin
|
|
|
- If (s='') or (InOutRes <> 0) then exit;
|
|
|
- if (Length (S) >= 2) and (S [2] = ':') then
|
|
|
- begin
|
|
|
- RC := DosSetDefaultDisk ((Ord (S [1]) and not ($20)) - $40);
|
|
|
- if RC <> 0 then
|
|
|
- InOutRes := RC
|
|
|
- else
|
|
|
- if Length (S) > 2 then
|
|
|
- begin
|
|
|
- Move (S [1], Buffer, Length (S));
|
|
|
- Buffer [Length (S)] := #0;
|
|
|
- AllowSlash (PChar (@Buffer));
|
|
|
- RC := DosSetCurrentDir (@Buffer);
|
|
|
- if RC <> 0 then
|
|
|
- begin
|
|
|
- InOutRes := RC;
|
|
|
- Errno2InOutRes;
|
|
|
- end;
|
|
|
- end;
|
|
|
- end else begin
|
|
|
- Move (S [1], Buffer, Length (S));
|
|
|
- Buffer [Length (S)] := #0;
|
|
|
- AllowSlash (PChar (@Buffer));
|
|
|
- RC := DosSetCurrentDir (@Buffer);
|
|
|
- if RC <> 0 then
|
|
|
- begin
|
|
|
- InOutRes:= RC;
|
|
|
- Errno2InOutRes;
|
|
|
- end;
|
|
|
- end;
|
|
|
-end;
|
|
|
-
|
|
|
-{$ASMMODE ATT}
|
|
|
-
|
|
|
-procedure GetDir (DriveNr: byte; var Dir: ShortString);
|
|
|
-{Written by Michael Van Canneyt.}
|
|
|
-var sof: Pchar;
|
|
|
- i:byte;
|
|
|
- l,l2:cardinal;
|
|
|
-begin
|
|
|
- Dir [4] := #0;
|
|
|
- { Used in case the specified drive isn't available }
|
|
|
- sof:=pchar(@dir[4]);
|
|
|
- { dir[1..3] will contain '[drivenr]:\', but is not }
|
|
|
- { supplied by DOS, so we let dos string start at }
|
|
|
- { dir[4] }
|
|
|
- { Get dir from drivenr : 0=default, 1=A etc... }
|
|
|
- l:=255-3;
|
|
|
- InOutRes:=longint (DosQueryCurrentDir(DriveNr, sof^, l));
|
|
|
-{$WARNING Result code should be translated in some cases!}
|
|
|
- { Now Dir should be filled with directory in ASCIIZ, }
|
|
|
- { starting from dir[4] }
|
|
|
- dir[0]:=#3;
|
|
|
- dir[2]:=':';
|
|
|
- dir[3]:='\';
|
|
|
- i:=4;
|
|
|
- {Conversion to Pascal string }
|
|
|
- while (dir[i]<>#0) do
|
|
|
- begin
|
|
|
- { convert path name to DOS }
|
|
|
- if dir[i]='/' then
|
|
|
- dir[i]:='\';
|
|
|
- dir[0]:=char(i);
|
|
|
- inc(i);
|
|
|
- end;
|
|
|
- { upcase the string (FPC function) }
|
|
|
- if drivenr<>0 then { Drive was supplied. We know it }
|
|
|
- dir[1]:=chr(64+drivenr)
|
|
|
- else
|
|
|
- begin
|
|
|
- { We need to get the current drive from DOS function 19H }
|
|
|
- { because the drive was the default, which can be unknown }
|
|
|
- DosQueryCurrentDisk(l, l2);
|
|
|
- dir[1]:=chr(64+l);
|
|
|
- end;
|
|
|
- if not (FileNameCaseSensitive) then dir:=upcase(dir);
|
|
|
-end;
|
|
|
-
|
|
|
|
|
|
{*****************************************************************************
|
|
|
|
|
@@ -1574,6 +740,7 @@ begin
|
|
|
DefaultCreator := '';
|
|
|
DefaultFileType := '';
|
|
|
|
|
|
+ InitSystemThreads;
|
|
|
{$ifdef HASVARIANT}
|
|
|
initvariantmanager;
|
|
|
{$endif HASVARIANT}
|
|
@@ -1599,11 +766,13 @@ begin
|
|
|
else
|
|
|
DosFreeMem (P);
|
|
|
end;
|
|
|
-
|
|
|
end.
|
|
|
{
|
|
|
$Log$
|
|
|
- Revision 1.77 2004-12-05 14:36:38 hajny
|
|
|
+ Revision 1.78 2005-02-06 16:57:18 peter
|
|
|
+ * threads for go32v2,os,emx,netware
|
|
|
+
|
|
|
+ Revision 1.77 2004/12/05 14:36:38 hajny
|
|
|
+ GetProcessID added
|
|
|
|
|
|
Revision 1.76 2004/11/04 09:32:31 peter
|