ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Q
I'm writing a backup program and I'd like to find the VM Storage file, so as to avoid
backing it up.
How do I do this?
A The best way of finding the current VM Storage file is to use a previously undocumented Gestalt selector: enum { gestaltVMBackingStoreFileRefNum = 'vmbs' }; The result of this selector is an file reference number to the active "VM Storage" file.
You can convert that reference number to an FSSpec by calling OSErr FindVMStorage(FSSpec *fss) { OSErr err; long gestaltResult; FCBPBRec fcbPB; Str255 theName; err = Gestalt(gestaltVMBackingStoreFileRefNum, &gestaltResult); if (err == noErr) { fcbPB.ioNamePtr = theName; fcbPB.ioVRefNum = 0; fcbPB.ioRefNum = gestaltResult; fcbPB.ioFCBIndx = 0; err = PBGetFCBInfoSync(&fcbPB); if (err == noErr) { err = FSMakeFSSpec(fcbPB.ioFCBVRefNum, fcbPB.ioFCBParID, theName, fss); } } return err; } [Mar 30 2001] |
|