[comp.sys.mac.programmer] PBHGetFInfo help needed

sthomas@library.adelaide.edu.au (Steve Thomas) (07/11/90)

I am getting an odd result from PGHGetFInfo, using vRefNum and DirID rather
than WDRefNum. After my call to PBHGetFInfo, the DirID has been changed to 
something else. At first I thought it might be the Parent DirID, but I checked
that and it's different for different files in the same folder. Can anyone
tell me what it is (or what I'm doing wrong)? Here is a fragment of my code:

		var
			paramBlock: HParamBlockRec;
			vRefNum: INTEGER; 
			dirID: LONGINT; 
			fileName: Str255;
			fndrInfo: FInfo
			theErr: OSErr;

	begin
		with paramBlock do
			begin
				ioCompletion := nil;
				ioFVersNum := 0;
				ioFDirIndex := 0;
				ioNamePtr := @fileName;
				ioVrefNum := vRefNum;
				ioDirID := dirID;
			end;
		theErr := PBHGetFInfo(@paramBlock, FALSE);

I also tried it with ioFDirIndex = -1, but got the same result.

(-----------------------------------------------------------------------------)
( Stephen Thomas, Senior Systems Analyst
( Mail  : Barr Smith Library, University of Adelaide,
(         GPO Box 498, Adelaide S.AUSTRALIA 5001
( Phone : (08) 228 5190
( Fax   : (08) 232 3689
( E-mail: sthomas@library.adelaide.edu.au  
(-----------------------------------------------------------------------------)

jholt@adobe.COM (Joe Holt) (07/11/90)

>I am getting an odd result from PGHGetFInfo, using vRefNum and DirID rather
>than WDRefNum. After my call to PBHGetFInfo, the DirID has been changed to 
>something else. [...]

If you're getting cat info for files, HFS sticks the file's "file number"
into the ioDirID slot.  This is meaningless to you and me and is primarily
an annoyance -- ya gotta stick the file's dirID back in every time.

If you want to see for yourself, try creating a directory, a file, and then
another directory.  Bet you dollars to donuts the file's "file number" lies
numerically right between directory A and directory B's dirID's.  Hmmm.

Mac OS followers may notice that such file numbers were announced as part of
System 7.0 nifty new file tracking abilities.  Ever get the feeling we've
been beta testing System 7.0 all along?

-- joe