home *** CD-ROM | disk | FTP | other *** search
- (*
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓·── ──·▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓│ │░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ Unit was conceived, designed and written ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ by Floor A.C. Naaijkens for ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ UltiHouse Software / The ECO Group. ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ (C) MCMXCIII by EUROCON PANATIONAL CORPORATION ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ All Rights Reserved for The ECO Group. ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓ ░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓│ │░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓·── ──·░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
- *)
- unit eco_exe;
- interface
- uses
- dos
-
- ;
-
-
- type
- combuffer = record { exec communications buffer }
- ident : array[1..8] of char; { identification }
- comvector : word; { address stored here }
- common : pointer; { common data address }
- comsize : word; { common data size }
- progpath : string[67]; { next program }
- cmdline : string[127]; { next command line }
- default : string[67]; { default program }
- comspec : string[67]; { command full path }
- lasterror : word; { last dos 4b error }
- end;
- combufptr = ^combuffer;
-
-
- function getptr(vector : byte) : combufptr;
- function cseg_t(var comseg,compars : word; vector : byte) : word;
- function chain_t(prog,cmd : string; vector : byte) : word;
- function default_t(prog : string; vector : byte) : word;
-
-
-
-
-
-
- implementation
-
-
-
-
-
-
-
- {
- getptr return a pointer to the exec communication buffer.
- if exec is not installed, then the nil pointer is returned.
- }
- function getptr(vector : byte) : combufptr;
- var
- intvec : byte;
- reg : registers;
- chainptr : combufptr;
- execid : string[7];
-
- begin
- if (vector = 0) then intvec := $60 else intvec := vector;
- with reg do begin
- ah := $35; al := intvec; intr($21,reg); chainptr := ptr(es,bx)
- end;
- if (chainptr^.ident<>'DISPATCH') then getptr := nil else getptr := chainptr
- end;
-
-
-
- { chain_t
- { place the program path and command line into the exec }
- { communication buffer. if the special paths 'exit' or 'dos' }
- { are used, they must be in upper case. to invoke a }
- { secondary copy of command, specify the path dos and pass }
- { the command line ' /c doscommand'. for example, to invoke }
- { the batch file foobar.bat, the call sequence is: }
- { }
- { errcode := chain_t('dos',' /c foobar'); }
- { }
- { to return to command and terminate any further chaining, }
- { use the special path 'exit' and the program path. the }
- { program path is placed in the communications buffer as a }
- { nul terminated string (no leading length byte - an asciiz }
- { string in the parlance of dos). the command line also has }
- { a special format. it does have a leading length byte, but }
- { also has a trailing carriage return (#13) and nul byte, }
- { neither of which are included in the length. }
- { }
- { if the buffer is successfully altered, 0 is returned as }
- { the functional value; otherwise 1 is returned. }
-
- function chain_t(prog,cmd : string; vector : byte) : word;
- var
- chainptr : combufptr;
- command : string;
-
- begin
- chainptr := getptr(vector);
- if (chainptr <> nil) then with chainptr^ do begin
- fillchar(progpath,sizeof(progpath),#0);
- fillchar(cmdline,sizeof(cmdline),#0);
- move(prog[1],progpath,length(prog));
- command := cmd + #13 + #0;
- move(command,cmdline,length(command));
- cmdline[0] := chr(length(command) - 2);
- chain_t := 0
- end else chain_t := 1
- end;
-
-
-
- { cseg_t
- { return the segment address of command data area. if the }
- { communication buffer cannot be found, the address returned }
- { address is $ffff (65535), and if no common area has been }
- { allocated, 0 is returned. the size of the common data area }
- { in paragraphs is also returned. like chain_t, 0 is }
- { returned as the function value if the buffer is success- }
- { fully accessed, and 1 is returned otherwise. }
-
- function cseg_t(var comseg,compars : word; vector : byte) : word;
- var chainptr : combufptr;
- begin
- chainptr := getptr(vector);
- if (chainptr = nil) then begin
- comseg := $ffff; compars := 0; cseg_t := 1
- end else with chainptr^ do begin
- comseg := seg(common^); compars := comsize; cseg_t := 0
- end
- end;
-
-
-
- function default_t(prog : string; vector : byte) : word;
- var
- chainptr : combufptr;
-
- begin
- chainptr := getptr(vector);
- if (chainptr <> nil) then with chainptr^ do begin
- fillchar(default,sizeof(default),#0);
- move(prog[1],default,length(prog));
- default_t := 0
- end else default_t := 1
- end;
-
-
-
-
- end.
-