🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #11106

Re: Little-known DOS calls

#11106
From: Bill W. Kelly
Date: Sun, 22 Jan 1989 09:16
54 lines
3516 bytes
shimoda@infohh.rmi.de (Markus Schmidt) writes:
>In article <3734@crash.cts.com> billk@pnet01.cts.com (Bill W. Kelly) writes:
>>Anyway, if you set pr_WindowPtr to -1, the "Please insert volume..."
>>requesters will not come up in the first place.  (For YOUR process, at least.)
>Is this guaranteed to be so in WB 1.4, 1.5 and 2.0 too?
>Or is it just another "break the amiga soon"-hack?

No.  This is perfectly legal, and is documented pretty clearly in the AmigaDOS
Technical Reference Manual.

Quoted without permission:
"The value of WindowPtr is used when AmigaDOS detects an error that normally
requires the user to take some action.  Examples of these errors are
attempting to write to a write-protected disk, or when the disk is full.  If
the value of WindowPtr is -1, then the error is returned to the calling
program as an error code from the AmigaDOS call of Open, Write, or whatever. 
If the value is zero, then AmigaDOS places a request box on the WorkBench
screen informing the user of the error and providing the oppertunity to retry
the operation or to cancel it.  If the user selects cancel then AmigaDOS
returns the error code to the calling program.  If the user selects retry, or
inserts a disk, then AmigaDOS attempts the operation once more.

"If you place a positive value into the WindowPtr field, then AmigaDOS takes
this to be a pointer to a Window structure.  Normally you would place the
Window structure of the window you are currently using here.  In this case,
AmigaDOS displays the error message within the window you have specified,
rather than using the Workbench screen.  You can always leave the WindowPtr as
zero, but if you are using another screen, then the messages AmigaDOS displays
appear on the Workbench screen, possibly obscured by your own screen. [not
true anymore because Workbench Screen is always brought to front]

"The initial value of WindowPtr is inherited from the process that created the
current one.  If you decide to alter the WindowPtr from within a program that
runs under the CLI, then you should save the original value and restore it
when you finish; otherwise, the CLI process contains a WindowPtr that refers
to a window that is no longer present."

IN FACT, IT REALLY ****BUGS**** ME WHEN PROGRAMMERS OPEN CUSTOM SCREENS AND
WINDOWS AND FAIL TO SET THIS POINTER!!!!!!!   :-/

Anyway, a couple years ago, I wrote tiny (276-byte) program called FixReq that
fixes this problem for those naughty programs.  FixReq is meant to be run in
your Startup-Sequence.  It installs itself (patches AutoRequest()) and returns
(so there is no need to actually 'RUN' fixreq.  Once installed, all "System
Requests" will pop up in the active window, on the active screen. (As opposed
to bringing the Workbench Screen to front.))

I'll be happy to UUEncode it and post it, if anyone's interested.

NOTE: Programmers should STILL set pr_WindowPtr whether they have FixReq or
not. :-)
--
Bill W. Kelly                                         billk@pnet01.cts.com
{nosc ucsd hplabs!hp-sdd}!crash!pnet01!billk   crash!pnet01!billk@nosc.mil
Technical Details
Message-ID: <3745@crash.cts.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!bloom-beacon!apple!rutgers!ucsd!orion.cf.uci.edu!elroy!gryphon!crash!pnet01!billk

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!bloom-beacon!apple!rutgers!ucsd!orion.cf.uci.edu!elroy!gryphon!crash!pnet01!billk
From: billk@pnet01.cts.com (Bill W. Kelly)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Little-known DOS calls
Message-ID: <3745@crash.cts.com>
Date: 22 Jan 89 09:16:21 GMT
Sender: news@crash.cts.com
Organization: People-Net [pnet01], El Cajon CA
Lines: 54