Path: utzoo!attcan!uunet!comp.vuw.ac.nz!virtue!ccc_ldo From: ccc_ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) Newsgroups: comp.sys.mac.programmer Subject: Re: StdFile Magic Message-ID: <1001.269b1056@waikato.ac.nz> Date: 10 Jul 90 23:41:10 GMT References: <3459@crash.cts.com> Organization: University of Waikato, Hamilton, New Zealand Lines: 49 SFSaveDisk is the negative (don't ask me why) of the volume reference number of the volume you last looked at in Standard File. CurDirStore is the (longword) directory ID of the folder you were looking at. So if you want to force the context to the Blessed Folder, you would do the following: * get a working directory refnum for the Blessed Folder (SysEnvirons will give you one); * use GetWDInfo to convert this to a VRefNum and a DirID * poke the DirID into CurDirStore, and the _negative_ of the VRefNum into SFSaveDisk * then call Get/PutFile. Here are a couple of useful Pascal inlines that let you get/set these two low memory globals. They handle the negation of SFSaveDisk for you, so you can deal with straight VRefNums. Procedure SetVolDir ( vRefNum : Integer; DirID : LongInt ); { sets SFSaveDisk to (- vRefNum) and CurDirStore to DirID. } Inline $21DF, $0398, {move.l (sp)+, CurDirStore} $301F, {move.w (sp)+, d0} $4440, {neg.w d0} $31C0, $0214; {move.w d0, SFSaveDisk} Procedure GetVolDir ( var vRefNum : Integer; var DirID : LongInt ); { gets the current value of SFSaveDisk (negated) and CurDirStore. } Inline $205F, {move.l (sp)+, a0} $20B8, $0398, {move.l CurDirStore, (a0)} $205F, {move.l (sp)+, a0} $3038, $0214, {move.w SFSaveDisk, d0} $4440, {neg.w d0} $3080; {move.w d0, (a0)} Lawrence D'Oliveiro fone: +64-71-562-889 Computer Services Dept fax: +64-71-384-066 University of Waikato electric mail: ldo@waikato.ac.nz Hamilton, New Zealand 37^ 47' 29" S, 175^ 19' 16" E, GMT+12:00 Disclaimer: no, these aren't my discs.