Article View: net.micro.pc
Article #8641Re: DOS funtion 37H
From: [alan i. vymetalik]
Date: Fri, 31 Oct 1986 08:12
Date: Fri, 31 Oct 1986 08:12
117 lines
3949 bytes
3949 bytes
In article <2234@mtgzz.UUCP> rosen@mtgzz.UUCP (t.rosenfeld) writes:
>Can anyone tell me what DOS function 37H does? I saw it used in the
>SWITCHAR.COM patch, but I don't see it in any of my manuals?
>
>Thanks in advance
>Thomas Rosenfeld
>@ AT&T Information Systems Labs, Middletown, NJ
Ok net-land, here's another demo of the (in)famous 37h function ...
The DOS 37h function has circulated around for a while. I dug this
out of a program I wrote a while back. I added a quick main program
to demo the functions. Should work fine with DOS 2.05 and up.
The program segments demonstrate the use of MS/PC-DOS function 37h
which can be used to view or alter the "switch character" (the Un*x-
like parameter indicator) used by various DOS functions and programs
that receive data from the command line when invoked.
Be careful in using the function since many DOS functions and programs
may become 'confused' or may error when the switch character is not
what is expected. There is a reason that it is undocumented ....
enjoy,
Alan
"I can't claim anything...The d*mn*d IRS would find a way to tax it!"
=================================================
alan i. vymetalik
uucp: {allegra,seismo}!rochester!ritcv!iav1917
=================================================
---- SOURCE FOLLOWS ---------------------------------------------
{
DOS 37h routines. These routines utilize the 'MsDos' function
of Turbo to pass data to the DOS functions and 'ParamStr(1)' which
retrieves the first parameter from the command line when the
compiled program is executed. Please note values set in the
AL register before calling DOS.
}
type
{ required DOS interrupt record - See Turbo Pascal manual }
DOSRegPack = record
case integer of
1 : (AX,BX,CX,DX,BP,SI,DI,DS,ES,FLAGS: integer);
2 : (AL,AH,BL,BH,CL,CH,DL,DH : byte);
end;
var
regpack : DOSRegPack; { used for interrupts to DOS }
{
-----------------------------------------------------
Function - CurrentSwitchCharacter
Arguments -
Input : none
Output : single character, the "switch character"
-----------------------------------------------------
}
function CurrentSwitchCharacter : char;
begin
regpack.AH := $37;
regpack.AL := $00;
msdos(regpack);
CurrentSwitchCharacter := chr(regpack.DL)
end;
{
-----------------------------------------------------
Procedure - SetSwitchCharacter
Arguments -
Input : any single ASCII character
Output : none
-----------------------------------------------------
}
procedure SetSwitchCharacter ( new_switch : char );
begin
regpack.AH := $37;
regpack.AL := $01;
regpack.DX := ord(new_switch);
msdos(regpack)
end;
begin { main program }
writeln('The switchar is "',CurrentSwitchCharacter,'"');
if length(paramstr(1)) <> 1 then
writeln('Switch character can only be a single character')
else
begin
SetSwitchCharacter(paramstr(1));
writeln('Switchar is now "',paramstr(1),'"');
end
end. { main program }
Technical Details
Message-ID:
<174@ritcv.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!ritcv!iav1917References:
<2234@mtgzz.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rochester!ritcv!iav1917 From: iav1917@ritcv.UUCP ([alan i. vymetalik]) Newsgroups: net.micro.pc Subject: Re: DOS funtion 37H Message-ID: <174@ritcv.UUCP> Date: Fri, 31-Oct-86 03:12:08 EST Article-I.D.: ritcv.174 Posted: Fri Oct 31 03:12:08 1986 Date-Received: Fri, 31-Oct-86 14:43:15 EST References: <2234@mtgzz.UUCP> Reply-To: iav1917@ritcv.UUCP (alan i. vymetalik) Organization: Rochester Institute of Technology, Rochester, NY Lines: 117 Summary: Here's a TP demo of the function call