[comp.sys.mac.programmer] _Launch Goofiness

topix@gpu.utcs.utoronto.ca (R. Munroe) (06/13/91)

Has anyone had much success calling _Launch from other than SFGetFile?
An application that I am writing needs, for very specific reasons,
to be able to launch another app from either a direct SFGetFile choice
or a menu selection (the volume name, dirID, and filename are stored
in a prefs file).  Forgive me for ignoring all the warnings about 
launching from my app (and the potential Sys 7 problems).  As I mentioned
earlier, my app has to be able to launch for very specific reasons over
which I have no control, and it needs to work on Sys 6.x.x.

Getting back to the problem - I have absolutely no trouble launching
directly from a SFGetFile choice (I lifted the code directly from TN 126).
The tech note is a bit vague, however, when dealing with launching an
app whose parameters I have stored earlier.  I call PBOpenWD with the
volume name and dirID that I have stored (the volume name is passed in
ioNamePtr and the dirID is passed in ioWDirID).  I then do a PBSetVol
with the volume name returned in the PBOpenWD ioNamePtr.  Next, I extract
a full file pathname using my volume refnum and dirID.  Finally, I call
PBGetFInfo with my full pathname in order to get the apps finder flags.
Then I launch.

Some apps launch with no trouble.  Others drop directly into Macsbug,
returning:

System error #26 at 0003AC06 DISKREQS+003A

The same apps that crash can, however, be launched when I choose it directly
from SFGetFile.

Whatever I am doing wrong with the stored parameters method is made even
more confusing by the fact that it sometimes works.  I've been struggling
with this for quite some time, so I now humbly ask for help.

If anyone has any ideas what I'm doing wrong (other than using the _Launch
and _PBOpenWD calls in the first place), I sure would appreciate hearing
from you.

Thanks much.

Bob Munroe
topix@utcs.utoronto.ca