Subject: Window bugs in Finder
From: [email-masked] (Brian Wells)
Date: 26 Sep 1996 00:59:44 -0400
Newsgroups: comp.sys.apple2.programmer

Hello! Just started reading this newsgroup and thought I'd share some bugs
I found in the way the Finder handles some of it's windows...

In the System 6.0.1 Finder, both the "About..." and "Help" windows are opened
with the wContDraw bits set even though they shouldn't be - the draw routines
assume the setting of the ResourceApp setting :/

Just to remind everyone what the flag bits of wContDraw are for, here is
the definition of the two bits:

 bit 31  Set this bit if your content-draw routine is self-contained and
         can be called from _any_ environment. This means unknown Bank
         and Direct Page register, unknown ResourceApp and CtlParamPtr
         settings.

 bit 30  Set this bit if your content-draw routine does not use GS/OS
         calls, even indirectly by loading resources.

You can read more about this in the _Programmer's Reference for System
6.0.1_, but that's the general idea. Setting the bits and NOT conforming
to the requirements can cause Bad Things to happen, like crashes to the
System Failure Mgr. because your app couldn't load resources for a
control. This is what happens because the Finder wrongly sets the bits -
It causes well written NDAs to seemingly crash the system just because the
Finder assumed it's environment. :(

Enough lecturing! :) Here are the bytes to patch in memory:

  Segment     Offset  Original   Patched

  B           002C    F4 xx 80   F4 xx 00
  C           0018    F4 xx C0   F4 xx 00

Both these segments are dynamic, making the patch difficult. :(

Another bug is that in both the System 6.0 and 6.0.1 Finders, the
"Preferences" window doesn't work properly. It has the proper wContDraw
setting, even though I didn't think so at first (will cause similar
resource problems like the first bug).. What IS wrong is the flags bits
passed to DoModalWindow. For some reason they thought it was OK for the
user to be able to bring NDAs to the front while the dialog box was up
(They set the mwDeskAcc bit by mistake :) . This obviously doesn't conform
to the HIG! (Try clicking on an open NDA window while in the dialog).

The bytes to patch in memory:

  Finder    Segment   Offset  Original  Patched

  6.0       1         9AB7    F4 10 C0  F4 00 C0
  6.0.1     1         9B70    F4 10 C0  F4 00 C0

These are easy to patch, being in the Finder's main (static) segment. :)

I did things the 'hard way' and located the bytes to patch in the Finder's OMF
load segments. Here they are:

  6.0

  Offset           Orignal        Patched

  #40725           F4 10 C0       F4 00 C0

  6.0.1

  Offset   Where    Orignal                           Patched

  #40910   LCONST   F4 10 C0                          F4 00 C0
  #144700  RLOC     E2 02 F0 2D 00 00 00 8A 05 00 80  Set last byte to 00
  #144711  RLOC     E2 02 00 30 00 00 00 8A 05 00 80  Set last byte to 00
  #145678  RLOC     E2 02 F0 19 00 00 00 E1 00 00 C0  Set last byte to 00
  #145689  RLOC     E2 02 00 19 00 00 00 E1 00 00 C0  Set last byte to 00

A nice desktop app that does all this patching will be uploaded to
comp.binaries.apple2 as soon as I figure out how to do it :)

-- 
 |)     \    /                            [email-masked]
 |_)RIAN \/\/ELLS                       [email-masked]
                                    http://www.iag.net/~bwells