[comp.sys.mac.programmer] SFGetFile and Launch

twu@caip.rutgers.edu (Theodore Wu) (11/27/88)

I am trying to add several menu items in addition to "Transfer..."
which transfer to predefined applications, For example, "MacWrite"
will transfer to "MyDisk:Applications:Mac Write:MacWrite 5.0". The
"Transfer..." item works fine, but for the "MacWrite" item, I don't 
know how to find the volume reference number for the folder. (e.g. 
"MyDist:Applications:Mac Write:".) I tried open that as a working
directory (use PBOpenWD), set volume to that directory (use SetVol),
and then do launch as in TN52. This works with all other applications
except MacWrite 5.0. (It gave me a BOMB!! Error Code = 3, illegal
instruction) Does anyone know why this happens and how to make this
work?

I think the difference between the "transfer..." item and the
"MacWrite" item is the SFGetFile call. If anybody know what is
actually being done in SFGetFile, or how to deassemble "PACK" resource
ID=3 from system file, it might be helpful too.

						Ted from Rutgers.

brecher@well.UUCP (Steve Brecher) (11/30/88)

In article <Nov.26.21.37.08.1988.18163@caip.rutgers.edu>, twu@caip.rutgers.edu
(Theodore Wu) cites a problem in programmatically launching MacWrite 5.0.

The problem is a bug in MacWrite 5.0's initialization.  It passes whatever
happens to be in a certain stack location, namely 0(A6) after the first
Link instruction, as the address of a record buffer for _SysEnvirons.
The contents of that stack location happen to be innocuous when Finder
and some other launching facilities do the launch.

To fix the bug, apply the following hexadecimal patch to MacWrite 5.0:

search for: 2F0A 2056 303C 0001 A090 245F 4A6E
change to:  41EE FFF0 303C 0001 A090 4E71 4A68

This code is at offset $CA from the start of CODE 1.