mdavis@pro-sol.cts.com (Morgan Davis) (07/10/90)
Question for the experts: what is the process under HFS for getting SFGetFile or SFPutFile to open up to a specific folder, namely the "blessed" System Folder. I know all about SFSaveDisk and CurDiskStore and what is supposed to go in them. My problem is generating the right values to store there. 1. How do I obtain the value for SFSaveDisk? 2. How do I obtain the value for CurDiskStore? UUCP: crash!pnet01!pro-sol!mdavis ProLine: mdavis@pro-sol ARPA: crash!pnet01!pro-sol!mdavis@nosc.mil MCI Mail: 137-6036 INET: mdavis@pro-sol.cts.com America Online, BIX: mdavis
ccc_ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (07/11/90)
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.