[comp.windows.ms] windows print thru BIOS ??

hench@ee.uwm.edu (Mike Hench) (06/26/91)

Hi.
Sorry if this is well known question but, Could anyone tell me if it is
possible to get windows 3.0 to print thru the BIOS ???
I want to redirect int 17 and it appears to be talking directly to the
hardware.

Thanks Much in advance,
Mike Hench
hench@ee.uwm.edu

lleonard@hayes.uucp (06/27/91)

I discovered a simple but sneaky way to get Windows to print to BIOS.
Edit your WIN.INI file and go to the "[ports]" entry and then create 
a port called "lpt1.=" - the key is the period.  If you have just
"lpt1:=", Windows will intercept your data.  With the period, Windows
is fooled into thinking it's printing to a file, then BIOS can get
it.  I assume this same trick will work with prn, com1, etc.

Lee Leonard
lleonard@hayes.uucp
hayes!lleonard@uunet.uu.net

aaron@jessica.stanford.edu (Aaron Wallace) (06/28/91)

In article <4039.2869b175@hayes.uucp> lleonard@hayes.uucp writes:
>I discovered a simple but sneaky way to get Windows to print to BIOS.
>Edit your WIN.INI file and go to the "[ports]" entry and then create 
>a port called "lpt1.=" - the key is the period.  If you have just
>"lpt1:=", Windows will intercept your data.  With the period, Windows
>is fooled into thinking it's printing to a file, then BIOS can get
>it.  I assume this same trick will work with prn, com1, etc.

It will.  The MS Resource Kit for Windows ($14.95) discusses this (and
why it works--it's not a bug or anything like that) and much else.  It's
a good way to get an intuition on how Windows does its thing.  And the Fish
program can't be beat--a great way to kill system performance and use
a $2000 machine as a $40 fish tank!

Oh, basically in the Ports section Windows looks for LPT1,2,3 and COM1,2,3.
If it finds these it uses the hardware.  Anything else is considered to be
a DOS device and is handled using DOS file open conventions.  LPT1.anything
is considered to be the printer by DOS.  Thus, you could probably hook up 
to PRN, AUX, NUL...  Wonder if CON works...?  EPT, for those of you with that
dreadful IBM PS printer, is handled as a DOS device.  You can probably put
filenames in the [ports] section, too, but there are already enough ways to
print to a file in Windows.  (Mac allusion:) Wonder if holding down command-K
after hitting OK to print works...?

BTW, the exception to the above is if Windows detects that the LPTx has been
redirected (i.e. thru mode).  If this is so, DOS is used.  So it's probably 
faster to be truthful to Windows than have it print to redirected ports.
A port is redirected when the port base in the BIOS data area is non-zero
and less than 100h.  In debug:

-d 40:0
0040:0000  aa aa bb bb cc cc dd dd - ee ee ff ff gg gg

The a-d's are the COM ports; the e-g's parallel ports.  Remember, this is
Intel stuff, so when you see FC 03 that's 03FC to us mortals...

Aaron Wallace