2 File: MoreFilesExtras.h
4 Contains: A collection of useful high-level File Manager routines.
6 Version: Technology: MoreFiles
9 Copyright: © 1992-2001 by Apple Computer, Inc., all rights reserved.
11 Bugs?: For bug reports, consult the following page on
14 http://developer.apple.com/bugreporter/
19 You may incorporate this sample code into your applications without
20 restriction, though the sample code has been provided "AS IS" and the
21 responsibility for its operation is 100% yours. However, what you are
22 not permitted to do is to redistribute the source as "DSC Sample Code"
23 after having made changes. If you're going to re-distribute the source,
24 we require that you make it clear in the source that the code was
25 descended from Apple Sample Code, but that you've made changes.
28 #ifndef __MOREFILESEXTRAS__
29 #define __MOREFILESEXTRAS__
39 #include "Optimization.h"
54 #if PRAGMA_STRUCT_ALIGN
55 #pragma options align=mac68k
56 #elif PRAGMA_STRUCT_PACKPUSH
58 #elif PRAGMA_STRUCT_PACK
62 /*****************************************************************************/
65 ** Bit masks and macros to get common information out of ioACUser returned
66 ** by PBGetCatInfo (remember to clear ioACUser before calling PBGetCatInfo
67 ** since some file systems don't bother to set this field).
69 ** Use the GetDirAccessRestrictions or FSpGetDirAccessRestrictions
70 ** functions to retrieve the ioACUser access restrictions byte for
73 ** Note: The access restriction byte returned by PBGetCatInfo is the
74 ** 2's complement of the user's privileges byte returned in
75 ** ioACAccess by PBHGetDirAccess.
79 /* mask for just the access restriction bits */
80 acUserAccessMask
= (kioACUserNoSeeFolderMask
+ kioACUserNoSeeFilesMask
+ kioACUserNoMakeChangesMask
), /* common access privilege settings */
81 acUserFull
= 0x00, /* no access restiction bits on */
82 acUserNone
= acUserAccessMask
, /* all access restiction bits on */
83 acUserDropBox
= kioACUserNoSeeFolderMask
+ kioACUserNoSeeFilesMask
, /* make changes, but not see files or folders */
84 acUserBulletinBoard
= kioACUserNoMakeChangesMask
/* see files and folders, but not make changes */
88 /*****************************************************************************/
91 ** Deny mode permissions for use with the HOpenAware, HOpenRFAware,
92 ** FSpOpenAware, and FSpOpenRFAware functions.
93 ** Note: Common settings are the ones with comments.
98 dmNoneDenyRd
= fsRdDenyPerm
,
99 dmNoneDenyWr
= fsWrDenyPerm
,
100 dmNoneDenyRdWr
= (fsRdDenyPerm
+ fsWrDenyPerm
),
101 dmRd
= fsRdPerm
, /* Single writer, multiple readers; the readers */
102 dmRdDenyRd
= (fsRdPerm
+ fsRdDenyPerm
),
103 dmRdDenyWr
= (fsRdPerm
+ fsWrDenyPerm
), /* Browsing - equivalent to fsRdPerm */
104 dmRdDenyRdWr
= (fsRdPerm
+ fsRdDenyPerm
+ fsWrDenyPerm
),
106 dmWrDenyRd
= (fsWrPerm
+ fsRdDenyPerm
),
107 dmWrDenyWr
= (fsWrPerm
+ fsWrDenyPerm
),
108 dmWrDenyRdWr
= (fsWrPerm
+ fsRdDenyPerm
+ fsWrDenyPerm
),
109 dmRdWr
= fsRdWrPerm
, /* Shared access - equivalent to fsRdWrShPerm */
110 dmRdWrDenyRd
= (fsRdWrPerm
+ fsRdDenyPerm
),
111 dmRdWrDenyWr
= (fsRdWrPerm
+ fsWrDenyPerm
), /* Single writer, multiple readers; the writer */
112 dmRdWrDenyRdWr
= (fsRdWrPerm
+ fsRdDenyPerm
+ fsWrDenyPerm
) /* Exclusive access - equivalent to fsRdWrPerm */
116 /*****************************************************************************/
119 ** For those times where you need to use more than one kind of File Manager parameter
120 ** block but don't feel like wasting stack space, here's a parameter block you can reuse.
124 union UniversalFMPB
{
134 typedef union UniversalFMPB UniversalFMPB
;
135 typedef UniversalFMPB
* UniversalFMPBPtr
;
136 typedef UniversalFMPBPtr
* UniversalFMPBHandle
;
139 ** Used by GetUGEntries to return user or group lists
143 short objType
; /* object type: -1 = group; 0 = user */
144 long objID
; /* the user or group ID */
145 Str31 name
; /* the user or group name */
147 typedef struct UGEntry UGEntry
;
148 typedef UGEntry
* UGEntryPtr
;
149 typedef UGEntryPtr
* UGEntryHandle
;
152 ** I use the following records instead of the AFPVolMountInfo and AFPXVolMountInfo structures in Files.h
154 typedef unsigned char Str8
[9];
156 struct MyAFPVolMountInfo
{
157 short length
; /* length of this record */
158 VolumeType media
; /* type of media, always AppleShareMediaType */
159 short flags
; /* 0 = normal mount; set bit 0 to inhibit greeting messages */
160 char nbpInterval
; /* NBP interval parameter; 7 is a good choice */
161 char nbpCount
; /* NBP count parameter; 5 is a good choice */
162 short uamType
; /* User Authentication Method */
163 short zoneNameOffset
; /* offset from start of record to zoneName */
164 short serverNameOffset
; /* offset from start of record to serverName */
165 short volNameOffset
; /* offset from start of record to volName */
166 short userNameOffset
; /* offset from start of record to userName */
167 short userPasswordOffset
; /* offset from start of record to userPassword */
168 short volPasswordOffset
; /* offset from start of record to volPassword */
169 Str32 zoneName
; /* server's AppleTalk zone name */
170 char filler1
; /* to word align volPassword */
171 Str32 serverName
; /* server name */
172 char filler2
; /* to word align volPassword */
173 Str27 volName
; /* volume name */
174 Str31 userName
; /* user name (zero length Pascal string for guest) */
175 Str8 userPassword
; /* user password (zero length Pascal string if no user password) */
176 char filler3
; /* to word align volPassword */
177 Str8 volPassword
; /* volume password (zero length Pascal string if no volume password) */
178 char filler4
; /* to end record on word boundry */
180 typedef struct MyAFPVolMountInfo MyAFPVolMountInfo
;
181 typedef MyAFPVolMountInfo
* MyAFPVolMountInfoPtr
;
182 typedef MyAFPVolMountInfoPtr
* MyAFPVolMountInfoHandle
;
184 struct MyAFPXVolMountInfo
{
185 short length
; /* length of this record */
186 VolumeType media
; /* type of media, always AppleShareMediaType */
187 short flags
; /* bits for no messages, no reconnect, etc */
188 char nbpInterval
; /* NBP interval parameter; 7 is a good choice */
189 char nbpCount
; /* NBP count parameter; 5 is a good choice */
190 short uamType
; /* User Authentication Method */
191 short zoneNameOffset
; /* offset from start of record to zoneName */
192 short serverNameOffset
; /* offset from start of record to serverName */
193 short volNameOffset
; /* offset from start of record to volName */
194 short userNameOffset
; /* offset from start of record to userName */
195 short userPasswordOffset
; /* offset from start of record to userPassword */
196 short volPasswordOffset
; /* offset from start of record to volPassword */
197 short extendedFlags
; /* extended flags word */
198 short uamNameOffset
; /* offset to a pascal UAM name string */
199 short alternateAddressOffset
; /* offset to Alternate Addresses in tagged format */
200 Str32 zoneName
; /* server's AppleTalk zone name */
201 char filler1
; /* to word align volPassword */
202 Str32 serverName
; /* server name */
203 char filler2
; /* to word align volPassword */
204 Str27 volName
; /* volume name */
205 Str31 userName
; /* user name (zero length Pascal string for guest) */
206 Str8 userPassword
; /* user password (zero length Pascal string if no user password) */
207 char filler3
; /* to word align volPassword */
208 Str8 volPassword
; /* volume password (zero length Pascal string if no volume password) */
209 char filler4
; /* to word align uamNameOffset */
210 Str32 uamName
; /* UAM name */
211 char filler5
; /* to word align alternateAddress */
212 char alternateAddress
[1]; /* AFPAlternateAddress */
214 typedef struct MyAFPXVolMountInfo MyAFPXVolMountInfo
;
215 typedef MyAFPXVolMountInfo
* MyAFPXVolMountInfoPtr
;
216 typedef MyAFPXVolMountInfoPtr
* MyAFPXVolMountInfoHandle
;
218 /*****************************************************************************/
220 /* Functions to get information out of GetVolParmsInfoBuffer. */
222 /* version 1 field getters */
225 GetVolParmsInfoVersion(const GetVolParmsInfoBuffer
* volParms
);
229 GetVolParmsInfoAttrib(const GetVolParmsInfoBuffer
* volParms
);
233 GetVolParmsInfoLocalHand(const GetVolParmsInfoBuffer
* volParms
);
237 GetVolParmsInfoServerAdr(const GetVolParmsInfoBuffer
* volParms
);
241 /* version 2 field getters (assume zero result if version < 2) */
244 GetVolParmsInfoVolumeGrade(const GetVolParmsInfoBuffer
* volParms
);
248 GetVolParmsInfoForeignPrivID(const GetVolParmsInfoBuffer
* volParms
);
252 /* version 3 field getters (assume zero result if version < 3) */
255 GetVolParmsInfoExtendedAttributes(const GetVolParmsInfoBuffer
* volParms
);
259 /* attribute bits supported by all versions of GetVolParmsInfoBuffer */
261 EXTERN_API( Boolean
)
262 isNetworkVolume(const GetVolParmsInfoBuffer
* volParms
);
265 EXTERN_API( Boolean
)
266 hasLimitFCBs(const GetVolParmsInfoBuffer
* volParms
);
269 EXTERN_API( Boolean
)
270 hasLocalWList(const GetVolParmsInfoBuffer
* volParms
);
273 EXTERN_API( Boolean
)
274 hasNoMiniFndr(const GetVolParmsInfoBuffer
* volParms
);
277 EXTERN_API( Boolean
)
278 hasNoVNEdit(const GetVolParmsInfoBuffer
* volParms
);
281 EXTERN_API( Boolean
)
282 hasNoLclSync(const GetVolParmsInfoBuffer
* volParms
);
285 EXTERN_API( Boolean
)
286 hasTrshOffLine(const GetVolParmsInfoBuffer
* volParms
);
289 EXTERN_API( Boolean
)
290 hasNoSwitchTo(const GetVolParmsInfoBuffer
* volParms
);
293 EXTERN_API( Boolean
)
294 hasNoDeskItems(const GetVolParmsInfoBuffer
* volParms
);
297 EXTERN_API( Boolean
)
298 hasNoBootBlks(const GetVolParmsInfoBuffer
* volParms
);
301 EXTERN_API( Boolean
)
302 hasAccessCntl(const GetVolParmsInfoBuffer
* volParms
);
305 EXTERN_API( Boolean
)
306 hasNoSysDir(const GetVolParmsInfoBuffer
* volParms
);
309 EXTERN_API( Boolean
)
310 hasExtFSVol(const GetVolParmsInfoBuffer
* volParms
);
313 EXTERN_API( Boolean
)
314 hasOpenDeny(const GetVolParmsInfoBuffer
* volParms
);
317 EXTERN_API( Boolean
)
318 hasCopyFile(const GetVolParmsInfoBuffer
* volParms
);
321 EXTERN_API( Boolean
)
322 hasMoveRename(const GetVolParmsInfoBuffer
* volParms
);
325 EXTERN_API( Boolean
)
326 hasDesktopMgr(const GetVolParmsInfoBuffer
* volParms
);
329 EXTERN_API( Boolean
)
330 hasShortName(const GetVolParmsInfoBuffer
* volParms
);
333 EXTERN_API( Boolean
)
334 hasFolderLock(const GetVolParmsInfoBuffer
* volParms
);
337 EXTERN_API( Boolean
)
338 hasPersonalAccessPrivileges(const GetVolParmsInfoBuffer
* volParms
);
341 EXTERN_API( Boolean
)
342 hasUserGroupList(const GetVolParmsInfoBuffer
* volParms
);
345 EXTERN_API( Boolean
)
346 hasCatSearch(const GetVolParmsInfoBuffer
* volParms
);
349 EXTERN_API( Boolean
)
350 hasFileIDs(const GetVolParmsInfoBuffer
* volParms
);
353 EXTERN_API( Boolean
)
354 hasBTreeMgr(const GetVolParmsInfoBuffer
* volParms
);
357 EXTERN_API( Boolean
)
358 hasBlankAccessPrivileges(const GetVolParmsInfoBuffer
* volParms
);
361 EXTERN_API( Boolean
)
362 supportsAsyncRequests(const GetVolParmsInfoBuffer
* volParms
);
365 EXTERN_API( Boolean
)
366 supportsTrashVolumeCache(const GetVolParmsInfoBuffer
* volParms
);
370 /* attribute bits supported by version 3 and greater versions of GetVolParmsInfoBuffer */
372 EXTERN_API( Boolean
)
373 volIsEjectable(const GetVolParmsInfoBuffer
* volParms
);
376 EXTERN_API( Boolean
)
377 volSupportsHFSPlusAPIs(const GetVolParmsInfoBuffer
* volParms
);
380 EXTERN_API( Boolean
)
381 volSupportsFSCatalogSearch(const GetVolParmsInfoBuffer
* volParms
);
384 EXTERN_API( Boolean
)
385 volSupportsFSExchangeObjects(const GetVolParmsInfoBuffer
* volParms
);
388 EXTERN_API( Boolean
)
389 volSupports2TBFiles(const GetVolParmsInfoBuffer
* volParms
);
392 EXTERN_API( Boolean
)
393 volSupportsLongNames(const GetVolParmsInfoBuffer
* volParms
);
396 EXTERN_API( Boolean
)
397 volSupportsMultiScriptNames(const GetVolParmsInfoBuffer
* volParms
);
400 EXTERN_API( Boolean
)
401 volSupportsNamedForks(const GetVolParmsInfoBuffer
* volParms
);
404 EXTERN_API( Boolean
)
405 volSupportsSubtreeIterators(const GetVolParmsInfoBuffer
* volParms
);
408 EXTERN_API( Boolean
)
409 volL2PCanMapFileBlocks(const GetVolParmsInfoBuffer
* volParms
);
413 /*****************************************************************************/
415 /* Functions for testing ioACUser bits. */
417 EXTERN_API( Boolean
)
418 userIsOwner(SInt8 ioACUser
);
421 EXTERN_API( Boolean
)
422 userHasFullAccess(SInt8 ioACUser
);
425 EXTERN_API( Boolean
)
426 userHasDropBoxAccess(SInt8 ioACUser
);
429 EXTERN_API( Boolean
)
430 userHasBulletinBoard(SInt8 ioACUser
);
433 EXTERN_API( Boolean
)
434 userHasNoAccess(SInt8 ioACUser
);
438 /*****************************************************************************/
442 StringPtr destination
,
443 ConstStr255Param source
,
448 The TruncPString function copies up to maxLength characters from
449 the source Pascal string to the destination Pascal string. TruncPString
450 ensures that the truncated string ends on a single-byte character, or on
451 the last byte of a multi-byte character.
453 destination output: destination Pascal string.
454 source input: source Pascal string.
455 maxLength output: The maximum allowable length of the destination
459 /*****************************************************************************/
468 The GetTempBuffer function allocates a temporary buffer for file system
469 operations which is at least 1024 bytes (1K) and a multiple of
472 buffReqSize input: Size you'd like the buffer to be.
473 buffActSize output: Size of buffer allocated.
474 function result output: Pointer to memory allocated or nil if no memory
475 was available. The caller is responsible for
476 disposing of this buffer with DisposePtr.
479 /*****************************************************************************/
483 ConstStr255Param pathname
,
489 GetVolumeInfoNoName uses pathname and vRefNum to call PBHGetVInfoSync
490 in cases where the returned volume name is not needed by the caller.
491 The pathname and vRefNum parameters are not touched, and the pb
492 parameter is initialized by PBHGetVInfoSync except that ioNamePtr in
493 the parameter block is always returned as NULL (since it might point
494 to GetVolumeInfoNoName's local variable tempPathname).
496 I noticed using this code in several places, so here it is once.
497 This reduces the code size of MoreFiles.
499 pathName input: Pointer to a full pathname or nil. If you pass in a
500 partial pathname, it is ignored. A full pathname to a
501 volume must end with a colon character (:).
502 vRefNum input: Volume specification (volume reference number, working
503 directory number, drive number, or 0).
504 pb input: A pointer to HParamBlockRec.
505 output: The parameter block as filled in by PBHGetVInfoSync
506 except that ioNamePtr will always be NULL.
510 nsvErr -35 No such volume
511 paramErr -50 No default volume, or pb was NULL
514 /*****************************************************************************/
517 XGetVolumeInfoNoName(
518 ConstStr255Param pathname
,
524 XGetVolumeInfoNoName uses pathname and vRefNum to call PBXGetVolInfoSync
525 in cases where the returned volume name is not needed by the caller.
526 The pathname and vRefNum parameters are not touched, and the pb
527 parameter is initialized by PBXGetVolInfoSync except that ioNamePtr in
528 the parameter block is always returned as NULL (since it might point
529 to XGetVolumeInfoNoName's local variable tempPathname).
531 pathName input: Pointer to a full pathname or nil. If you pass in a
532 partial pathname, it is ignored. A full pathname to a
533 volume must end with a colon character (:).
534 vRefNum input: Volume specification (volume reference number, working
535 directory number, drive number, or 0).
536 pb input: A pointer to HParamBlockRec.
537 output: The parameter block as filled in by PBXGetVolInfoSync
538 except that ioNamePtr will always be NULL.
542 nsvErr -35 No such volume
543 paramErr -50 No default volume, or pb was NULL
546 /*****************************************************************************/
552 ConstStr255Param name
,
557 GetCatInfoNoName uses vRefNum, dirID and name to call PBGetCatInfoSync
558 in cases where the returned object is not needed by the caller.
559 The vRefNum, dirID and name parameters are not touched, and the pb
560 parameter is initialized by PBGetCatInfoSync except that ioNamePtr in
561 the parameter block is always returned as NULL (since it might point
562 to GetCatInfoNoName's local variable tempName).
564 I noticed using this code in several places, so here it is once.
565 This reduces the code size of MoreFiles.
567 vRefNum input: Volume specification.
568 dirID input: Directory ID.
569 name input: Pointer to object name, or nil when dirID
570 specifies a directory that's the object.
571 pb input: A pointer to CInfoPBRec.
572 output: The parameter block as filled in by
573 PBGetCatInfoSync except that ioNamePtr will
578 nsvErr -35 No such volume
580 bdNamErr -37 Bad filename
581 fnfErr -43 File not found
582 paramErr -50 No default volume
583 dirNFErr -120 Directory not found or incomplete pathname
584 afpAccessDenied -5000 User does not have the correct access
585 afpObjectTypeErr -5025 Directory not found or incomplete pathname
589 /*****************************************************************************/
593 ConstStr255Param pathname
,
595 short * realVRefNum
);
599 The DetermineVRefNum function determines the volume reference number of
600 a volume from a pathname, a volume specification, or a combination
602 WARNING: Volume names on the Macintosh are *not* unique -- Multiple
603 mounted volumes can have the same name. For this reason, the use of a
604 volume name or full pathname to identify a specific volume may not
605 produce the results you expect. If more than one volume has the same
606 name and a volume name or full pathname is used, the File Manager
607 currently uses the first volume it finds with a matching name in the
610 pathName input: Pointer to a full pathname or nil. If you pass in a
611 partial pathname, it is ignored. A full pathname to a
612 volume must end with a colon character (:).
613 vRefNum input: Volume specification (volume reference number, working
614 directory number, drive number, or 0).
615 realVRefNum output: The real volume reference number.
619 nsvErr -35 No such volume
620 paramErr -50 No default volume
623 /*****************************************************************************/
630 unsigned long * freeBytes
,
631 unsigned long * totalBytes
);
635 The HGetVInfo function returns the name, volume reference number,
636 available space (in bytes), and total space (in bytes) for the
637 specified volume. You can specify the volume by providing its drive
638 number, volume reference number, or 0 for the default volume.
639 This routine is compatible with volumes up to 4 gigabytes.
641 volReference input: The drive number, volume reference number,
642 or 0 for the default volume.
643 volName input: A pointer to a buffer (minimum Str27) where
644 the volume name is to be returned or must
646 output: The volume name.
647 vRefNum output: The volume reference number.
648 freeBytes output: The number of free bytes on the volume.
649 freeBytes is an unsigned long value.
650 totalBytes output: The total number of bytes on the volume.
651 totalBytes is an unsigned long value.
655 nsvErr -35 No such volume
656 paramErr -50 No default volume
663 /*****************************************************************************/
671 UInt64
* totalBytes
);
675 The XGetVInfo function returns the name, volume reference number,
676 available space (in bytes), and total space (in bytes) for the
677 specified volume. You can specify the volume by providing its drive
678 number, volume reference number, or 0 for the default volume.
679 This routine is compatible with volumes up to 2 terabytes.
681 volReference input: The drive number, volume reference number,
682 or 0 for the default volume.
683 volName input: A pointer to a buffer (minimum Str27) where
684 the volume name is to be returned or must
686 output: The volume name.
687 vRefNum output: The volume reference number.
688 freeBytes output: The number of free bytes on the volume.
689 freeBytes is an UnsignedWide value.
690 totalBytes output: The total number of bytes on the volume.
691 totalBytes is an UnsignedWide value.
695 nsvErr -35 No such volume
696 paramErr -50 No default volume
703 /*****************************************************************************/
707 ConstStr255Param pathname
,
712 The CheckVolLock function determines if a volume is locked - either by
713 hardware or by software. If CheckVolLock returns noErr, then the volume
716 pathName input: Pointer to a full pathname or nil. If you pass in a
717 partial pathname, it is ignored. A full pathname to a
718 volume must end with a colon character (:).
719 vRefNum input: Volume specification (volume reference number, working
720 directory number, drive number, or 0).
723 noErr 0 No error - volume not locked
724 nsvErr -35 No such volume
725 wPrErr -44 Volume locked by hardware
726 vLckdErr -46 Volume locked by software
727 paramErr -50 No default volume
730 /*****************************************************************************/
732 ** The following routines call Mac OS routines that are not supported by
741 #if !TARGET_API_MAC_CARBON // {
743 /*****************************************************************************/
752 The GetDriverName function returns a device driver's name.
754 driverRefNum input: The driver reference number.
755 driverName output: The driver's name.
759 badUnitErr -21 Bad driver reference number
762 /*****************************************************************************/
766 ConstStr255Param pathname
,
768 DrvQElPtr
* driveQElementPtr
);
772 The FindDrive function returns a pointer to a mounted volume's
775 pathName input: Pointer to a full pathname or nil. If you
776 pass in a partial pathname, it is ignored.
777 A full pathname to a volume must end with
778 a colon character (:).
779 vRefNum input: Volume specification (volume reference
780 number, working directory number, drive
782 driveQElementPtr output: Pointer to a volume's drive queue element
783 in the drive queue. DO NOT change the
788 nsvErr -35 No such volume
789 paramErr -50 No default volume
790 nsDrvErr -56 No such drive
793 /*****************************************************************************/
797 ConstStr255Param pathname
,
799 unsigned long * numBlocks
);
803 The GetDiskBlocks function returns the number of physical disk
804 blocks on a disk drive. NOTE: This is not the same as volume
807 pathName input: Pointer to a full pathname or nil. If you
808 pass in a partial pathname, it is ignored.
809 A full pathname to a volume must end with
810 a colon character (:).
811 vRefNum input: Volume specification (volume reference
812 number, working directory number, drive
814 numBlocks output: The number of physical disk blocks on the disk drive.
818 nsvErr -35 No such volume
819 paramErr -50 No default volume, driver reference
820 number is zero, ReturnFormatList
821 returned zero blocks, DriveStatus
822 returned an unknown value, or
823 driveQElementPtr->qType is unknown
824 nsDrvErr -56 No such drive
825 statusErr Ð18 Driver does not respond to this
827 badUnitErr Ð21 Driver reference number does not
829 unitEmptyErr Ð22 Driver reference number specifies
830 a nil handle in unit table
831 abortErr Ð27 Request aborted by KillIO
832 notOpenErr Ð28 Driver not open
835 /*****************************************************************************/
839 ConstStr255Param pathname
,
841 Boolean
* volumeOnline
,
842 Boolean
* volumeEjected
,
843 Boolean
* driveEjectable
,
844 Boolean
* driverWantsEject
);
848 The GetVolState function determines if a volume is online or offline,
849 if an offline volume is ejected, and if the volume's driver is
850 ejectable or wants eject calls.
852 pathName input: Pointer to a full pathname or nil.
853 vRefNum input: Volume specification (volume reference number,
854 working directory number, drive number, or 0).
855 volumeOnline output: True if the volume is online;
856 False if the volume is offline.
857 volumeEjected output: True if the volume is ejected (ejected
858 volumes are always offline); False if the
859 volume is not ejected.
860 driveEjectable output: True if the volume's drive is ejectable;
861 False if the volume's drive is not ejectable.
862 driverWantsEject output: True if the volume's driver wants an Eject
863 request after unmount (even if the drive
864 is not ejectable); False if the volume's
865 driver does not need an eject request.
869 nsvErr -35 No such volume
870 paramErr -50 No default volume, or pb was NULL
873 /*****************************************************************************/
875 #endif // } !TARGET_API_MAC_CARBON
877 /*****************************************************************************/
881 ConstStr255Param pathname
,
883 short * fileSystemID
);
887 The GetVolFileSystemID function returned the file system ID of
888 a mounted volume. The file system ID identifies the file system
889 that handles requests to a particular volume. Here's a partial list
890 of file system ID numbers (only Apple's file systems are listed):
892 ----- -----------------------------------------------------
893 $0000 Macintosh HFS or MFS
894 $0100 ProDOS File System
895 $0101 PowerTalk Mail Enclosures
896 $4147 ISO 9660 File Access (through Foreign File Access)
897 $4242 High Sierra File Access (through Foreign File Access)
898 $464D QuickTake File System (through Foreign File Access)
899 $4953 Macintosh PC Exchange (MS-DOS)
900 $4A48 Audio CD Access (through Foreign File Access)
901 $4D4B Apple Photo Access (through Foreign File Access)
903 See the Technical Note "FL 35 - Determining Which File System
904 Is Active" and the "Guide to the File System Manager" for more
907 pathName input: Pointer to a full pathname or nil. If you pass
908 in a partial pathname, it is ignored. A full
909 pathname to a volume must contain at least
910 one colon character (:) and must not start with
912 vRefNum input: Volume specification (volume reference number,
913 working directory number, drive number, or 0).
914 fileSystemID output: The volume's file system ID.
918 nsvErr -35 No such volume
919 paramErr -50 No default volume, or pb was NULL
922 /*****************************************************************************/
926 ConstStr255Param pathname
,
931 The UnmountAndEject function unmounts and ejects a volume. The volume
932 is ejected only if it is ejectable and not already ejected.
934 pathName input: Pointer to a full pathname or nil. If you pass in a
935 partial pathname, it is ignored. A full pathname to a
936 volume must end with a colon character (:).
937 vRefNum input: Volume specification (volume reference number, working
938 directory number, drive number, or 0).
942 nsvErr -35 No such volume
944 bdNamErr -37 Bad volume name
945 fBsyErr -47 One or more files are open
946 paramErr -50 No default volume
947 nsDrvErr -56 No such drive
948 extFSErr -58 External file system error - no file
949 system claimed this call.
952 /*****************************************************************************/
963 The OnLine function returns the list of volumes currently mounted in
964 an array of FSSpec records.
966 A noErr result indicates that the volumes array was filled
967 (actVolCount == reqVolCount) and there may be additional volumes
968 mounted. A nsvErr result indicates that the end of the volume list
969 was found and actVolCount volumes were actually found this time.
971 volumes input: Pointer to array of FSSpec where the volume list
973 reqVolCount input: Maximum number of volumes to return (the number of
974 elements in the volumes array).
975 actVolCount output: The number of volumes actually returned.
976 volIndex input: The current volume index position. Set to 1 to
977 start with the first volume.
978 output: The volume index position to get the next volume.
979 Pass this value the next time you call OnLine to
980 start where you left off.
983 noErr 0 No error, but there are more volumes
985 nsvErr -35 No more volumes to be listed
986 paramErr -50 volIndex was <= 0
989 /*****************************************************************************/
1000 The SetDefault function sets the default volume and directory to the
1001 volume specified by newVRefNum and the directory specified by newDirID.
1002 The current default volume reference number and directory ID are
1003 returned in oldVRefNum and oldDir and must be used to restore the
1004 default volume and directory to their previous state *as soon as
1005 possible* with the RestoreDefault function. These two functions are
1006 designed to be used as a wrapper around Standard I/O routines where
1007 the location of the file is implied to be the default volume and
1008 directory. In other words, this is how you should use these functions:
1010 error = SetDefault(newVRefNum, newDirID, &oldVRefNum, &oldDirID);
1011 if ( error == noErr )
1013 // call the Stdio functions like remove, rename, tmpfile,
1014 // fopen, freopen, etc. or non-ANSI extensions like
1015 // fdopen,fsetfileinfo, -- create, open, unlink, etc. here!
1017 error = RestoreDefault(oldVRefNum, oldDirID);
1020 By using these functions as a wrapper, you won't need to open a working
1021 directory (because SetDefault and RestoreDefault use HSetVol) and you
1022 won't have to worry about the effects of using HSetVol (documented in
1023 Technical Note "FL 11 - PBHSetVol is Dangerous" and in the
1024 Inside Macintosh: Files book in the description of the HSetVol and
1025 PBHSetVol functions) because the default volume/directory is restored
1026 before giving up control to code that might be affected by HSetVol.
1028 newVRefNum input: Volume specification (volume reference number,
1029 working directory number, drive number, or 0) of
1030 the new default volume.
1031 newDirID input: Directory ID of the new default directory.
1032 oldVRefNum output: The volume specification to save for use with
1034 oldDirID output: The directory ID to save for use with
1039 nsvErr -35 No such volume
1040 bdNamErr -37 Bad volume name
1041 fnfErr -43 Directory not found
1042 paramErr -50 No default volume
1043 afpAccessDenied -5000 User does not have access to the directory
1047 Also see: RestoreDefault
1050 /*****************************************************************************/
1059 The RestoreDefault function restores the default volume and directory
1060 to the volume specified by oldVRefNum and the directory specified by
1061 oldDirID. The oldVRefNum and oldDirID parameters were previously
1062 obtained from the SetDefault function. These two functions are designed
1063 to be used as a wrapper around Standard C I/O routines where the
1064 location of the file is implied to be the default volume and directory.
1065 In other words, this is how you should use these functions:
1067 error = SetDefault(newVRefNum, newDirID, &oldVRefNum, &oldDirID);
1068 if ( error == noErr )
1070 // call the Stdio functions like remove, rename, tmpfile,
1071 // fopen, freopen, etc. or non-ANSI extensions like
1072 // fdopen,fsetfileinfo, -- create, open, unlink, etc. here!
1074 error = RestoreDefault(oldVRefNum, oldDirID);
1077 By using these functions as a wrapper, you won't need to open a working
1078 directory (because SetDefault and RestoreDefault use HSetVol) and you
1079 won't have to worry about the effects of using HSetVol (documented in
1080 Technical Note "FL 11 - PBHSetVol is Dangerous" and in the
1081 Inside Macintosh: Files book in the description of the HSetVol and
1082 PBHSetVol functions) because the default volume/directory is restored
1083 before giving up control to code that might be affected by HSetVol.
1085 oldVRefNum input: The volume specification to restore.
1086 oldDirID input: The directory ID to restore.
1090 nsvErr -35 No such volume
1091 bdNamErr -37 Bad volume name
1092 fnfErr -43 Directory not found
1093 paramErr -50 No default volume
1094 rfNumErr -51 Bad working directory reference number
1095 afpAccessDenied -5000 User does not have access to the directory
1099 Also see: SetDefault
1102 /*****************************************************************************/
1108 ConstStr255Param name
,
1113 The GetDInfo function gets the finder information for a directory.
1115 vRefNum input: Volume specification.
1116 dirID input: Directory ID.
1117 name input: Pointer to object name, or nil when dirID
1118 specifies a directory that's the object.
1119 fndrInfo output: If the object is a directory, then its DInfo.
1123 nsvErr -35 No such volume
1125 bdNamErr -37 Bad filename
1126 fnfErr -43 File not found
1127 paramErr -50 No default volume
1128 dirNFErr -120 Directory not found or incomplete pathname
1129 afpAccessDenied -5000 User does not have the correct access
1130 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1134 Also see: FSpGetDInfo, FSpGetFInfoCompat
1137 /*****************************************************************************/
1141 const FSSpec
* spec
,
1146 The FSpGetDInfo function gets the finder information for a directory.
1148 spec input: An FSSpec record specifying the directory.
1149 fndrInfo output: If the object is a directory, then its DInfo.
1153 nsvErr -35 No such volume
1155 bdNamErr -37 Bad filename
1156 fnfErr -43 File not found
1157 paramErr -50 No default volume
1158 dirNFErr -120 Directory not found or incomplete pathname
1159 afpAccessDenied -5000 User does not have the correct access
1160 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1164 Also see: FSpGetFInfoCompat, GetDInfo
1167 /*****************************************************************************/
1173 ConstStr255Param name
,
1174 const DInfo
* fndrInfo
);
1178 The SetDInfo function sets the finder information for a directory.
1180 vRefNum input: Volume specification.
1181 dirID input: Directory ID.
1182 name input: Pointer to object name, or nil when dirID
1183 specifies a directory that's the object.
1184 fndrInfo input: The DInfo.
1188 nsvErr -35 No such volume
1190 bdNamErr -37 Bad filename
1191 fnfErr -43 File not found
1192 fLckdErr -45 File is locked
1193 vLckdErr -46 Volume is locked or read-only
1194 paramErr -50 No default volume
1195 dirNFErr -120 Directory not found or incomplete pathname
1196 afpAccessDenied -5000 User does not have the correct access
1197 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1201 Also see: FSpSetDInfo, FSpSetFInfoCompat
1204 /*****************************************************************************/
1208 const FSSpec
* spec
,
1209 const DInfo
* fndrInfo
);
1213 The FSpSetDInfo function sets the finder information for a directory.
1215 spec input: An FSSpec record specifying the directory.
1216 fndrInfo input: The DInfo.
1220 nsvErr -35 No such volume
1222 bdNamErr -37 Bad filename
1223 fnfErr -43 File not found
1224 fLckdErr -45 File is locked
1225 vLckdErr -46 Volume is locked or read-only
1226 paramErr -50 No default volume
1227 dirNFErr -120 Directory not found or incomplete pathname
1228 afpAccessDenied -5000 User does not have the correct access
1229 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1233 Also see: FSpSetFInfoCompat, SetDInfo
1236 /*****************************************************************************/
1239 #define GetDirID(vRefNum, dirID, name, theDirID, isDirectory) GetDirectoryID(vRefNum, dirID, name, theDirID, isDirectory)
1245 ConstStr255Param name
,
1247 Boolean
* isDirectory
);
1251 The GetDirectoryID function gets the directory ID number of the
1252 directory specified. If a file is specified, then the parent
1253 directory of the file is returned and isDirectory is false. If
1254 a directory is specified, then that directory's ID number is
1255 returned and isDirectory is true.
1256 WARNING: Volume names on the Macintosh are *not* unique -- Multiple
1257 mounted volumes can have the same name. For this reason, the use of a
1258 volume name or full pathname to identify a specific volume may not
1259 produce the results you expect. If more than one volume has the same
1260 name and a volume name or full pathname is used, the File Manager
1261 currently uses the first volume it finds with a matching name in the
1264 vRefNum input: Volume specification.
1265 dirID input: Directory ID.
1266 name input: Pointer to object name, or nil when dirID
1267 specifies a directory that's the object.
1268 theDirID output: If the object is a file, then its parent directory
1269 ID. If the object is a directory, then its ID.
1270 isDirectory output: True if object is a directory; false if
1275 nsvErr -35 No such volume
1277 bdNamErr -37 Bad filename
1278 fnfErr -43 File not found
1279 paramErr -50 No default volume
1280 dirNFErr -120 Directory not found or incomplete pathname
1281 afpAccessDenied -5000 User does not have the correct access
1282 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1285 /*****************************************************************************/
1288 #define DirIDFromFSSpec(spec, theDirID, isDirectory) FSpGetDirectoryID(spec, theDirID, isDirectory)
1292 const FSSpec
* spec
,
1294 Boolean
* isDirectory
);
1298 The FSpGetDirectoryID function gets the directory ID number of the
1299 directory specified by spec. If spec is to a file, then the parent
1300 directory of the file is returned and isDirectory is false. If
1301 spec is to a directory, then that directory's ID number is
1302 returned and isDirectory is true.
1304 spec input: An FSSpec record specifying the directory.
1305 theDirID output: The directory ID.
1306 isDirectory output: True if object is a directory; false if
1311 nsvErr -35 No such volume
1313 bdNamErr -37 Bad filename
1314 fnfErr -43 File not found
1315 paramErr -50 No default volume
1316 dirNFErr -120 Directory not found or incomplete pathname
1317 afpAccessDenied -5000 User does not have the correct access
1318 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1321 /*****************************************************************************/
1331 The GetDirName function gets the name of a directory from its
1334 vRefNum input: Volume specification.
1335 dirID input: Directory ID.
1336 name output: Points to a Str31 where the directory name is to be
1341 nsvErr -35 No such volume
1343 bdNamErr -37 Bad filename
1344 fnfErr -43 File not found
1345 paramErr -50 No default volume or
1346 name parameter was NULL
1347 dirNFErr -120 Directory not found or incomplete pathname
1348 afpAccessDenied -5000 User does not have the correct access
1349 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1352 /*****************************************************************************/
1358 ConstStr255Param name
,
1363 GetIOACUser returns a directory's access restrictions byte.
1364 Use the masks and macro defined in MoreFilesExtras to check for
1365 specific access priviledges.
1367 vRefNum input: Volume specification.
1368 dirID input: Directory ID.
1369 name input: Pointer to object name, or nil when dirID
1370 specifies a directory that's the object.
1371 ioACUser output: The access restriction byte
1375 nsvErr -35 No such volume
1377 bdNamErr -37 Bad filename
1378 fnfErr -43 File not found
1379 paramErr -50 No default volume
1380 dirNFErr -120 Directory not found or incomplete pathname
1381 afpAccessDenied -5000 User does not have the correct access
1382 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1385 /*****************************************************************************/
1389 const FSSpec
* spec
,
1394 FSpGetIOACUser returns a directory's access restrictions byte.
1395 Use the masks and macro defined in MoreFilesExtras to check for
1396 specific access priviledges.
1398 spec input: An FSSpec record specifying the directory.
1399 ioACUser output: The access restriction byte
1403 nsvErr -35 No such volume
1405 bdNamErr -37 Bad filename
1406 fnfErr -43 File not found
1407 paramErr -50 No default volume
1408 dirNFErr -120 Directory not found or incomplete pathname
1409 afpAccessDenied -5000 User does not have the correct access
1410 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1413 /*****************************************************************************/
1419 ConstStr255Param name
,
1424 The GetParentID function gets the parent directory ID number of the
1427 vRefNum input: Volume specification.
1428 dirID input: Directory ID.
1429 name input: Pointer to object name, or nil when dirID specifies
1430 a directory that's the object.
1431 parID output: The parent directory ID of the specified object.
1435 nsvErr -35 No such volume
1437 bdNamErr -37 Bad filename
1438 fnfErr -43 File not found
1439 paramErr -50 No default volume
1440 dirNFErr -120 Directory not found or incomplete pathname
1441 afpAccessDenied -5000 User does not have the correct access
1442 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1445 /*****************************************************************************/
1448 GetFilenameFromPathname(
1449 ConstStr255Param pathname
,
1454 The GetFilenameFromPathname function gets the file (or directory) name
1455 from the end of a full or partial pathname. Returns notAFileErr if the
1456 pathname is nil, the pathname is empty, or the pathname cannot refer to
1457 a filename (with a noErr result, the pathname could still refer to a
1460 pathname input: A full or partial pathname.
1461 filename output: The file (or directory) name.
1465 notAFileErr -1302 The pathname is nil, the pathname
1466 is empty, or the pathname cannot refer
1471 See also: GetObjectLocation.
1474 /*****************************************************************************/
1480 ConstStr255Param pathname
,
1481 short * realVRefNum
,
1484 Boolean
* isDirectory
);
1488 The GetObjectLocation function gets a file system object's location -
1489 that is, its real volume reference number, real parent directory ID,
1490 and name. While we're at it, determine if the object is a file or directory.
1491 If GetObjectLocation returns fnfErr, then the location information
1492 returned is valid, but it describes an object that doesn't exist.
1493 You can use the location information for another operation, such as
1494 creating a file or directory.
1496 vRefNum input: Volume specification.
1497 dirID input: Directory ID.
1498 pathname input: Pointer to object name, or nil when dirID specifies
1499 a directory that's the object.
1500 realVRefNum output: The real volume reference number.
1501 realParID output: The parent directory ID of the specified object.
1502 realName output: The name of the specified object (the case of the
1503 object name may not be the same as the object's
1504 catalog entry on disk - since the Macintosh file
1505 system is not case sensitive, it shouldn't matter).
1506 isDirectory output: True if object is a directory; false if object
1511 nsvErr -35 No such volume
1513 bdNamErr -37 Bad filename
1514 fnfErr -43 File not found
1515 paramErr -50 No default volume
1516 dirNFErr -120 Directory not found or incomplete pathname
1517 notAFileErr -1302 The pathname is nil, the pathname
1518 is empty, or the pathname cannot refer
1520 afpAccessDenied -5000 User does not have the correct access
1521 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1525 See also: FSMakeFSSpecCompat
1528 /*****************************************************************************/
1534 ConstStr255Param name
,
1536 Boolean getDirectories
,
1539 short * actItemCount
,
1544 The GetDirItems function returns a list of items in the specified
1545 directory in an array of FSSpec records. File, subdirectories, or
1546 both can be returned in the list.
1548 A noErr result indicates that the items array was filled
1549 (actItemCount == reqItemCount) and there may be additional items
1550 left in the directory. A fnfErr result indicates that the end of
1551 the directory list was found and actItemCount items were actually
1554 vRefNum input: Volume specification.
1555 dirID input: Directory ID.
1556 name input: Pointer to object name, or nil when dirID
1557 specifies a directory that's the object.
1558 getFiles input: Pass true to have files added to the items list.
1559 getDirectories input: Pass true to have directories added to the
1561 items input: Pointer to array of FSSpec where the item list
1563 reqItemCount input: Maximum number of items to return (the number
1564 of elements in the items array).
1565 actItemCount output: The number of items actually returned.
1566 itemIndex input: The current item index position. Set to 1 to
1567 start with the first item in the directory.
1568 output: The item index position to get the next item.
1569 Pass this value the next time you call
1570 GetDirItems to start where you left off.
1573 noErr 0 No error, but there are more items
1575 nsvErr -35 No such volume
1577 bdNamErr -37 Bad filename
1578 fnfErr -43 File not found, there are no more items
1580 paramErr -50 No default volume or itemIndex was <= 0
1581 dirNFErr -120 Directory not found or incomplete pathname
1582 afpAccessDenied -5000 User does not have the correct access
1583 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1586 /*****************************************************************************/
1589 DeleteDirectoryContents(
1592 ConstStr255Param name
);
1596 The DeleteDirectoryContents function deletes the contents of a directory.
1597 All files and subdirectories in the specified directory are deleted.
1598 If a locked file or directory is encountered, it is unlocked and then
1599 deleted. If any unexpected errors are encountered,
1600 DeleteDirectoryContents quits and returns to the caller.
1602 vRefNum input: Volume specification.
1603 dirID input: Directory ID.
1604 name input: Pointer to directory name, or nil when dirID specifies
1605 a directory that's the object.
1609 nsvErr -35 No such volume
1611 bdNamErr -37 Bad filename
1612 fnfErr -43 File not found
1613 wPrErr -44 Hardware volume lock
1614 fLckdErr -45 File is locked
1615 vLckdErr -46 Software volume lock
1616 fBsyErr -47 File busy, directory not empty, or working directory control block open
1617 paramErr -50 No default volume
1618 dirNFErr -120 Directory not found or incomplete pathname
1619 afpAccessDenied -5000 User does not have the correct access
1620 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1624 Also see: DeleteDirectory
1627 /*****************************************************************************/
1633 ConstStr255Param name
);
1637 The DeleteDirectory function deletes a directory and its contents.
1638 All files and subdirectories in the specified directory are deleted.
1639 If a locked file or directory is encountered, it is unlocked and then
1640 deleted. After deleting the directories contents, the directory is
1641 deleted. If any unexpected errors are encountered, DeleteDirectory
1642 quits and returns to the caller.
1644 vRefNum input: Volume specification.
1645 dirID input: Directory ID.
1646 name input: Pointer to directory name, or nil when dirID specifies
1647 a directory that's the object.
1651 nsvErr -35 No such volume
1653 bdNamErr -37 Bad filename
1654 fnfErr -43 File not found
1655 wPrErr -44 Hardware volume lock
1656 fLckdErr -45 File is locked
1657 vLckdErr -46 Software volume lock
1658 fBsyErr -47 File busy, directory not empty, or working directory control block open
1659 paramErr -50 No default volume
1660 dirNFErr -120 Directory not found or incomplete pathname
1661 afpAccessDenied -5000 User does not have the correct access
1662 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1666 Also see: DeleteDirectoryContents
1669 /*****************************************************************************/
1675 ConstStr255Param name
);
1679 The CheckObjectLock function determines if a file or directory is locked.
1680 If CheckObjectLock returns noErr, then the file or directory
1681 is not locked. If CheckObjectLock returns fLckdErr, the it is locked.
1683 vRefNum input: Volume specification.
1684 dirID input: Directory ID.
1685 name input: Pointer to object name, or nil when dirID specifies
1686 a directory that's the object.
1690 nsvErr -35 No such volume
1692 bdNamErr -37 Bad filename
1693 fnfErr -43 File not found
1694 fLckdErr -45 File is locked
1695 paramErr -50 No default volume
1696 dirNFErr -120 Directory not found or incomplete pathname
1697 afpAccessDenied -5000 User does not have the correct access
1698 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1702 Also see: FSpCheckObjectLock
1705 /*****************************************************************************/
1708 FSpCheckObjectLock(const FSSpec
* spec
);
1712 The FSpCheckObjectLock function determines if a file or directory is locked.
1713 If FSpCheckObjectLock returns noErr, then the file or directory
1716 spec input: An FSSpec record specifying the object.
1720 nsvErr -35 No such volume
1722 bdNamErr -37 Bad filename
1723 fnfErr -43 File not found
1724 fLckdErr -45 File is locked
1725 paramErr -50 No default volume
1726 dirNFErr -120 Directory not found or incomplete pathname
1727 afpAccessDenied -5000 User does not have the correct access
1728 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1732 Also see: CheckObjectLock
1735 /*****************************************************************************/
1741 ConstStr255Param fileName
,
1747 The GetFileSize function returns the logical size of a file's
1748 data and resource fork.
1750 vRefNum input: Volume specification.
1751 dirID input: Directory ID.
1752 name input: The name of the file.
1753 dataSize output: The number of bytes in the file's data fork.
1754 rsrcSize output: The number of bytes in the file's resource fork.
1758 nsvErr -35 No such volume
1760 bdNamErr -37 Bad filename
1761 fnfErr -43 File not found
1762 paramErr -50 No default volume
1763 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
1764 afpAccessDenied -5000 User does not have the correct access
1765 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1769 See also: FSpGetFileSize
1772 /*****************************************************************************/
1776 const FSSpec
* spec
,
1782 The FSpGetFileSize function returns the logical size of a file's
1783 data and resource fork.
1785 spec input: An FSSpec record specifying the file.
1786 dataSize output: The number of bytes in the file's data fork.
1787 rsrcSize output: The number of bytes in the file's resource fork.
1791 nsvErr -35 No such volume
1793 bdNamErr -37 Bad filename
1794 fnfErr -43 File not found
1795 paramErr -50 No default volume
1796 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
1797 afpAccessDenied -5000 User does not have the correct access
1798 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1802 See also: GetFileSize
1805 /*****************************************************************************/
1811 ConstStr255Param name
);
1815 The BumpDate function changes the modification date of a file or
1816 directory to the current date/time. If the modification date is already
1817 equal to the current date/time, then add one second to the
1820 vRefNum input: Volume specification.
1821 dirID input: Directory ID.
1822 name input: Pointer to object name, or nil when dirID specifies
1823 a directory that's the object.
1827 nsvErr -35 No such volume
1829 bdNamErr -37 Bad filename
1830 fnfErr -43 File not found
1831 fLckdErr -45 File is locked
1832 vLckdErr -46 Volume is locked or read-only
1833 paramErr -50 No default volume
1834 dirNFErr -120 Directory not found or incomplete pathname
1835 afpAccessDenied -5000 User does not have the correct access
1836 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1840 See also: FSpBumpDate
1843 /*****************************************************************************/
1846 FSpBumpDate(const FSSpec
* spec
);
1850 The FSpBumpDate function changes the modification date of a file or
1851 directory to the current date/time. If the modification date is already
1852 equal to the current date/time, then add one second to the
1855 spec input: An FSSpec record specifying the object.
1859 nsvErr -35 No such volume
1861 bdNamErr -37 Bad filename
1862 fnfErr -43 File not found
1863 fLckdErr -45 File is locked
1864 vLckdErr -46 Volume is locked or read-only
1865 paramErr -50 No default volume
1866 dirNFErr -120 Directory not found or incomplete pathname
1867 afpAccessDenied -5000 User does not have the correct access
1868 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1875 /*****************************************************************************/
1881 ConstStr255Param name
,
1887 The ChangeCreatorType function changes the creator or file type of a file.
1889 vRefNum input: Volume specification.
1890 dirID input: Directory ID.
1891 name input: The name of the file.
1892 creator input: The new creator type or 0x00000000 to leave
1893 the creator type alone.
1894 fileType input: The new file type or 0x00000000 to leave the
1899 nsvErr -35 No such volume
1901 bdNamErr -37 Bad filename
1902 fnfErr -43 File not found
1903 fLckdErr -45 File is locked
1904 vLckdErr -46 Volume is locked or read-only
1905 paramErr -50 No default volume
1906 dirNFErr -120 Directory not found or incomplete pathname
1907 notAFileErr -1302 Name was not a file
1908 afpAccessDenied -5000 User does not have the correct access
1909 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1913 See also: FSpChangeCreatorType
1916 /*****************************************************************************/
1919 FSpChangeCreatorType(
1920 const FSSpec
* spec
,
1926 The FSpChangeCreatorType function changes the creator or file type of a file.
1928 spec input: An FSSpec record specifying the file.
1929 creator input: The new creator type or 0x00000000 to leave
1930 the creator type alone.
1931 fileType input: The new file type or 0x00000000 to leave the
1936 nsvErr -35 No such volume
1938 bdNamErr -37 Bad filename
1939 fnfErr -43 File not found
1940 fLckdErr -45 File is locked
1941 vLckdErr -46 Volume is locked or read-only
1942 paramErr -50 No default volume
1943 dirNFErr -120 Directory not found or incomplete pathname
1944 notAFileErr -1302 Name was not a file
1945 afpAccessDenied -5000 User does not have the correct access
1946 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1950 See also: ChangeCreatorType
1953 /*****************************************************************************/
1959 ConstStr255Param name
,
1961 unsigned short flagBits
);
1965 The ChangeFDFlags function sets or clears Finder Flag bits in the
1966 fdFlags field of a file or directory's FInfo record.
1968 vRefNum input: Volume specification.
1969 dirID input: Directory ID.
1970 name input: Pointer to object name, or nil when dirID specifies
1971 a directory that's the object.
1972 setBits input: If true, then set the bits specified in flagBits.
1973 If false, then clear the bits specified in flagBits.
1974 flagBits input: The flagBits parameter specifies which Finder Flag
1975 bits to set or clear. If a bit in flagBits is set,
1976 then the same bit in fdFlags is either set or
1977 cleared depending on the state of the setBits
1982 nsvErr -35 No such volume
1984 bdNamErr -37 Bad filename
1985 fnfErr -43 File not found
1986 fLckdErr -45 File is locked
1987 vLckdErr -46 Volume is locked or read-only
1988 paramErr -50 No default volume
1989 dirNFErr -120 Directory not found or incomplete pathname
1990 afpAccessDenied -5000 User does not have the correct access
1991 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1995 See also: FSpChangeFDFlags
1998 /*****************************************************************************/
2002 const FSSpec
* spec
,
2004 unsigned short flagBits
);
2008 The FSpChangeFDFlags function sets or clears Finder Flag bits in the
2009 fdFlags field of a file or directory's FInfo record.
2011 spec input: An FSSpec record specifying the object.
2012 setBits input: If true, then set the bits specified in flagBits.
2013 If false, then clear the bits specified in flagBits.
2014 flagBits input: The flagBits parameter specifies which Finder Flag
2015 bits to set or clear. If a bit in flagBits is set,
2016 then the same bit in fdFlags is either set or
2017 cleared depending on the state of the setBits
2022 nsvErr -35 No such volume
2024 bdNamErr -37 Bad filename
2025 fnfErr -43 File not found
2026 fLckdErr -45 File is locked
2027 vLckdErr -46 Volume is locked or read-only
2028 paramErr -50 No default volume
2029 dirNFErr -120 Directory not found or incomplete pathname
2030 afpAccessDenied -5000 User does not have the correct access
2031 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2035 See also: ChangeFDFlags
2038 /*****************************************************************************/
2044 ConstStr255Param name
);
2048 The SetIsInvisible function sets the invisible bit in the fdFlags
2049 word of the specified file or directory's finder information.
2051 vRefNum input: Volume specification.
2052 dirID input: Directory ID.
2053 name input: Pointer to object name, or nil when dirID specifies
2054 a directory that's the object.
2058 nsvErr -35 No such volume
2060 bdNamErr -37 Bad filename
2061 fnfErr -43 File not found
2062 fLckdErr -45 File is locked
2063 vLckdErr -46 Volume is locked or read-only
2064 paramErr -50 No default volume
2065 dirNFErr -120 Directory not found or incomplete pathname
2066 afpAccessDenied -5000 User does not have the correct access
2067 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2071 See also: FSpSetIsInvisible, ClearIsInvisible, FSpClearIsInvisible
2074 /*****************************************************************************/
2077 FSpSetIsInvisible(const FSSpec
* spec
);
2081 The FSpSetIsInvisible function sets the invisible bit in the fdFlags
2082 word of the specified file or directory's finder information.
2084 spec input: An FSSpec record specifying the object.
2088 nsvErr -35 No such volume
2090 bdNamErr -37 Bad filename
2091 fnfErr -43 File not found
2092 fLckdErr -45 File is locked
2093 vLckdErr -46 Volume is locked or read-only
2094 paramErr -50 No default volume
2095 dirNFErr -120 Directory not found or incomplete pathname
2096 afpAccessDenied -5000 User does not have the correct access
2097 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2101 See also: SetIsInvisible, ClearIsInvisible, FSpClearIsInvisible
2104 /*****************************************************************************/
2110 ConstStr255Param name
);
2114 The ClearIsInvisible function clears the invisible bit in the fdFlags
2115 word of the specified file or directory's finder information.
2117 vRefNum input: Volume specification.
2118 dirID input: Directory ID.
2119 name input: Pointer to object name, or nil when dirID specifies
2120 a directory that's the object.
2124 nsvErr -35 No such volume
2126 bdNamErr -37 Bad filename
2127 fnfErr -43 File not found
2128 fLckdErr -45 File is locked
2129 vLckdErr -46 Volume is locked or read-only
2130 paramErr -50 No default volume
2131 dirNFErr -120 Directory not found or incomplete pathname
2132 afpAccessDenied -5000 User does not have the correct access
2133 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2137 See also: SetIsInvisible, FSpSetIsInvisible, FSpClearIsInvisible
2140 /*****************************************************************************/
2143 FSpClearIsInvisible(const FSSpec
* spec
);
2147 The FSpClearIsInvisible function clears the invisible bit in the fdFlags
2148 word of the specified file or directory's finder information.
2150 spec input: An FSSpec record specifying the object.
2154 nsvErr -35 No such volume
2156 bdNamErr -37 Bad filename
2157 fnfErr -43 File not found
2158 fLckdErr -45 File is locked
2159 vLckdErr -46 Volume is locked or read-only
2160 paramErr -50 No default volume
2161 dirNFErr -120 Directory not found or incomplete pathname
2162 afpAccessDenied -5000 User does not have the correct access
2163 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2167 See also: SetIsInvisible, FSpSetIsInvisible, ClearIsInvisible
2170 /*****************************************************************************/
2176 ConstStr255Param name
);
2180 The SetNameLocked function sets the nameLocked bit in the fdFlags word
2181 of the specified file or directory's finder information.
2183 vRefNum input: Volume specification.
2184 dirID input: Directory ID.
2185 name input: Pointer to object name, or nil when dirID specifies
2186 a directory that's the object.
2190 nsvErr -35 No such volume
2192 bdNamErr -37 Bad filename
2193 fnfErr -43 File not found
2194 fLckdErr -45 File is locked
2195 vLckdErr -46 Volume is locked or read-only
2196 paramErr -50 No default volume
2197 dirNFErr -120 Directory not found or incomplete pathname
2198 afpAccessDenied -5000 User does not have the correct access
2199 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2203 See also: FSpSetNameLocked, ClearNameLocked, FSpClearNameLocked
2206 /*****************************************************************************/
2209 FSpSetNameLocked(const FSSpec
* spec
);
2213 The FSpSetNameLocked function sets the nameLocked bit in the fdFlags word
2214 of the specified file or directory's finder information.
2216 spec input: An FSSpec record specifying the object.
2220 nsvErr -35 No such volume
2222 bdNamErr -37 Bad filename
2223 fnfErr -43 File not found
2224 fLckdErr -45 File is locked
2225 vLckdErr -46 Volume is locked or read-only
2226 paramErr -50 No default volume
2227 dirNFErr -120 Directory not found or incomplete pathname
2228 afpAccessDenied -5000 User does not have the correct access
2229 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2233 See also: SetNameLocked, ClearNameLocked, FSpClearNameLocked
2236 /*****************************************************************************/
2242 ConstStr255Param name
);
2246 The ClearNameLocked function clears the nameLocked bit in the fdFlags
2247 word of the specified file or directory's finder information.
2249 vRefNum input: Volume specification.
2250 dirID input: Directory ID.
2251 name input: Pointer to object name, or nil when dirID specifies
2252 a directory that's the object.
2256 nsvErr -35 No such volume
2258 bdNamErr -37 Bad filename
2259 fnfErr -43 File not found
2260 fLckdErr -45 File is locked
2261 vLckdErr -46 Volume is locked or read-only
2262 paramErr -50 No default volume
2263 dirNFErr -120 Directory not found or incomplete pathname
2264 afpAccessDenied -5000 User does not have the correct access
2265 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2269 See also: SetNameLocked, FSpSetNameLocked, FSpClearNameLocked
2272 /*****************************************************************************/
2275 FSpClearNameLocked(const FSSpec
* spec
);
2279 The FSpClearNameLocked function clears the nameLocked bit in the fdFlags
2280 word of the specified file or directory's finder information.
2282 spec input: An FSSpec record specifying the object.
2286 nsvErr -35 No such volume
2288 bdNamErr -37 Bad filename
2289 fnfErr -43 File not found
2290 fLckdErr -45 File is locked
2291 vLckdErr -46 Volume is locked or read-only
2292 paramErr -50 No default volume
2293 dirNFErr -120 Directory not found or incomplete pathname
2294 afpAccessDenied -5000 User does not have the correct access
2295 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2299 See also: SetNameLocked, FSpSetNameLocked, ClearNameLocked
2302 /*****************************************************************************/
2308 ConstStr255Param name
);
2312 The SetIsStationery function sets the isStationery bit in the
2313 fdFlags word of the specified file or directory's finder information.
2315 vRefNum input: Volume specification.
2316 dirID input: Directory ID.
2317 name input: Pointer to object name, or nil when dirID specifies
2318 a directory that's the object.
2322 nsvErr -35 No such volume
2324 bdNamErr -37 Bad filename
2325 fnfErr -43 File not found
2326 fLckdErr -45 File is locked
2327 vLckdErr -46 Volume is locked or read-only
2328 paramErr -50 No default volume
2329 dirNFErr -120 Directory not found or incomplete pathname
2330 afpAccessDenied -5000 User does not have the correct access
2331 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2335 See also: FSpSetIsStationery, ClearIsStationery, FSpClearIsStationery
2338 /*****************************************************************************/
2341 FSpSetIsStationery(const FSSpec
* spec
);
2345 The FSpSetIsStationery function sets the isStationery bit in the
2346 fdFlags word of the specified file or directory's finder information.
2348 spec input: An FSSpec record specifying the object.
2352 nsvErr -35 No such volume
2354 bdNamErr -37 Bad filename
2355 fnfErr -43 File not found
2356 fLckdErr -45 File is locked
2357 vLckdErr -46 Volume is locked or read-only
2358 paramErr -50 No default volume
2359 dirNFErr -120 Directory not found or incomplete pathname
2360 afpAccessDenied -5000 User does not have the correct access
2361 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2365 See also: SetIsStationery, ClearIsStationery, FSpClearIsStationery
2368 /*****************************************************************************/
2374 ConstStr255Param name
);
2378 The ClearIsStationery function clears the isStationery bit in the
2379 fdFlags word of the specified file or directory's finder information.
2381 vRefNum input: Volume specification.
2382 dirID input: Directory ID.
2383 name input: Pointer to object name, or nil when dirID specifies
2384 a directory that's the object.
2388 nsvErr -35 No such volume
2390 bdNamErr -37 Bad filename
2391 fnfErr -43 File not found
2392 fLckdErr -45 File is locked
2393 vLckdErr -46 Volume is locked or read-only
2394 paramErr -50 No default volume
2395 dirNFErr -120 Directory not found or incomplete pathname
2396 afpAccessDenied -5000 User does not have the correct access
2397 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2401 See also: SetIsStationery, FSpSetIsStationery, FSpClearIsStationery
2404 /*****************************************************************************/
2407 FSpClearIsStationery(const FSSpec
* spec
);
2411 The FSpClearIsStationery function clears the isStationery bit in the
2412 fdFlags word of the specified file or directory's finder information.
2414 spec input: An FSSpec record specifying the object.
2418 nsvErr -35 No such volume
2420 bdNamErr -37 Bad filename
2421 fnfErr -43 File not found
2422 fLckdErr -45 File is locked
2423 vLckdErr -46 Volume is locked or read-only
2424 paramErr -50 No default volume
2425 dirNFErr -120 Directory not found or incomplete pathname
2426 afpAccessDenied -5000 User does not have the correct access
2427 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2431 See also: SetIsStationery, FSpSetIsStationery, ClearIsStationery
2434 /*****************************************************************************/
2440 ConstStr255Param name
);
2444 The SetHasCustomIcon function sets the hasCustomIcon bit in the
2445 fdFlags word of the specified file or directory's finder information.
2447 vRefNum input: Volume specification.
2448 dirID input: Directory ID.
2449 name input: Pointer to object name, or nil when dirID specifies
2450 a directory that's the object.
2454 nsvErr -35 No such volume
2456 bdNamErr -37 Bad filename
2457 fnfErr -43 File not found
2458 fLckdErr -45 File is locked
2459 vLckdErr -46 Volume is locked or read-only
2460 paramErr -50 No default volume
2461 dirNFErr -120 Directory not found or incomplete pathname
2462 afpAccessDenied -5000 User does not have the correct access
2463 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2467 See also: FSpSetHasCustomIcon, ClearHasCustomIcon, FSpClearHasCustomIcon
2470 /*****************************************************************************/
2473 FSpSetHasCustomIcon(const FSSpec
* spec
);
2477 The FSpSetHasCustomIcon function sets the hasCustomIcon bit in the
2478 fdFlags word of the specified file or directory's finder information.
2480 spec input: An FSSpec record specifying the object.
2484 nsvErr -35 No such volume
2486 bdNamErr -37 Bad filename
2487 fnfErr -43 File not found
2488 fLckdErr -45 File is locked
2489 vLckdErr -46 Volume is locked or read-only
2490 paramErr -50 No default volume
2491 dirNFErr -120 Directory not found or incomplete pathname
2492 afpAccessDenied -5000 User does not have the correct access
2493 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2497 See also: SetHasCustomIcon, ClearHasCustomIcon, FSpClearHasCustomIcon
2500 /*****************************************************************************/
2506 ConstStr255Param name
);
2510 The ClearHasCustomIcon function clears the hasCustomIcon bit in the
2511 fdFlags word of the specified file or directory's finder information.
2513 vRefNum input: Volume specification.
2514 dirID input: Directory ID.
2515 name input: Pointer to object name, or nil when dirID specifies
2516 a directory that's the object.
2520 nsvErr -35 No such volume
2522 bdNamErr -37 Bad filename
2523 fnfErr -43 File not found
2524 fLckdErr -45 File is locked
2525 vLckdErr -46 Volume is locked or read-only
2526 paramErr -50 No default volume
2527 dirNFErr -120 Directory not found or incomplete pathname
2528 afpAccessDenied -5000 User does not have the correct access
2529 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2533 See also: SetHasCustomIcon, FSpSetHasCustomIcon, FSpClearHasCustomIcon
2536 /*****************************************************************************/
2539 FSpClearHasCustomIcon(const FSSpec
* spec
);
2543 The FSpClearHasCustomIcon function clears the hasCustomIcon bit in the
2544 fdFlags word of the specified file or directory's finder information.
2546 spec input: An FSSpec record specifying the object.
2550 nsvErr -35 No such volume
2552 bdNamErr -37 Bad filename
2553 fnfErr -43 File not found
2554 fLckdErr -45 File is locked
2555 vLckdErr -46 Volume is locked or read-only
2556 paramErr -50 No default volume
2557 dirNFErr -120 Directory not found or incomplete pathname
2558 afpAccessDenied -5000 User does not have the correct access
2559 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2563 See also: SetHasCustomIcon, FSpSetHasCustomIcon, ClearHasCustomIcon
2566 /*****************************************************************************/
2572 ConstStr255Param name
);
2576 The ClearHasBeenInited function clears the hasBeenInited bit in the
2577 fdFlags word of the specified file or directory's finder information.
2579 vRefNum input: Volume specification.
2580 dirID input: Directory ID.
2581 name input: Pointer to object name, or nil when dirID specifies
2582 a directory that's the object.
2586 nsvErr -35 No such volume
2588 bdNamErr -37 Bad filename
2589 fnfErr -43 File not found
2590 fLckdErr -45 File is locked
2591 vLckdErr -46 Volume is locked or read-only
2592 paramErr -50 No default volume
2593 dirNFErr -120 Directory not found or incomplete pathname
2594 afpAccessDenied -5000 User does not have the correct access
2595 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2599 See also: FSpClearHasBeenInited
2602 /*****************************************************************************/
2605 FSpClearHasBeenInited(const FSSpec
* spec
);
2609 The FSpClearHasBeenInited function clears the hasBeenInited bit in the
2610 fdFlags word of the specified file or directory's finder information.
2612 spec input: An FSSpec record specifying the object.
2616 nsvErr -35 No such volume
2618 bdNamErr -37 Bad filename
2619 fnfErr -43 File not found
2620 fLckdErr -45 File is locked
2621 vLckdErr -46 Volume is locked or read-only
2622 paramErr -50 No default volume
2623 dirNFErr -120 Directory not found or incomplete pathname
2624 afpAccessDenied -5000 User does not have the correct access
2625 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2629 See also: ClearHasBeenInited
2632 /*****************************************************************************/
2635 CopyFileMgrAttributes(
2638 ConstStr255Param srcName
,
2641 ConstStr255Param dstName
,
2642 Boolean copyLockBit
);
2646 The CopyFileMgrAttributes function copies all File Manager attributes
2647 from the source file or directory to the destination file or directory.
2648 If copyLockBit is true, then set the locked state of the destination
2649 to match the source.
2651 srcVRefNum input: Source volume specification.
2652 srcDirID input: Source directory ID.
2653 srcName input: Pointer to source object name, or nil when
2654 srcDirID specifies a directory that's the object.
2655 dstVRefNum input: Destination volume specification.
2656 dstDirID input: Destination directory ID.
2657 dstName input: Pointer to destination object name, or nil when
2658 dstDirID specifies a directory that's the object.
2659 copyLockBit input: If true, set the locked state of the destination
2660 to match the source.
2664 nsvErr -35 No such volume
2666 bdNamErr -37 Bad filename
2667 fnfErr -43 File not found
2668 fLckdErr -45 File is locked
2669 vLckdErr -46 Volume is locked or read-only
2670 paramErr -50 No default volume
2671 dirNFErr -120 Directory not found or incomplete pathname
2672 afpAccessDenied -5000 User does not have the correct access
2673 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2677 See also: FSpCopyFileMgrAttributes
2680 /*****************************************************************************/
2683 FSpCopyFileMgrAttributes(
2684 const FSSpec
* srcSpec
,
2685 const FSSpec
* dstSpec
,
2686 Boolean copyLockBit
);
2690 The FSpCopyFileMgrAttributes function copies all File Manager attributes
2691 from the source file or directory to the destination file or directory.
2692 If copyLockBit is true, then set the locked state of the destination
2693 to match the source.
2695 srcSpec input: An FSSpec record specifying the source object.
2696 dstSpec input: An FSSpec record specifying the destination object.
2697 copyLockBit input: If true, set the locked state of the destination
2698 to match the source.
2702 nsvErr -35 No such volume
2704 bdNamErr -37 Bad filename
2705 fnfErr -43 File not found
2706 fLckdErr -45 File is locked
2707 vLckdErr -46 Volume is locked or read-only
2708 paramErr -50 No default volume
2709 dirNFErr -120 Directory not found or incomplete pathname
2710 afpAccessDenied -5000 User does not have the correct access
2711 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2715 See also: CopyFileMgrAttributes
2718 /*****************************************************************************/
2724 ConstStr255Param fileName
,
2730 The HOpenAware function opens the data fork of a file using deny mode
2731 permissions instead the normal File Manager permissions. If OpenDeny
2732 is not available, then HOpenAware translates the deny modes to the
2733 closest File Manager permissions and tries to open the file with
2734 OpenDF first, and then Open if OpenDF isn't available. By using
2735 HOpenAware with deny mode permissions, a program can be "AppleShare
2736 aware" and fall back on the standard File Manager open calls
2739 vRefNum input: Volume specification.
2740 dirID input: Directory ID.
2741 fileName input: The name of the file.
2742 denyModes input: The deny modes access under which to open the file.
2743 refNum output: The file reference number of the opened file.
2747 nsvErr -35 No such volume
2748 tmfoErr -42 Too many files open
2749 fnfErr -43 File not found
2750 wPrErr -44 Volume locked by hardware
2751 fLckdErr -45 File is locked
2752 vLckdErr -46 Volume is locked or read-only
2753 opWrErr -49 File already open for writing
2754 paramErr -50 No default volume
2755 permErr -54 File is already open and cannot be opened using specified deny modes
2756 afpAccessDenied -5000 User does not have the correct access to the file
2757 afpDenyConflict -5006 Requested access permission not possible
2761 See also: FSpOpenAware, HOpenRFAware, FSpOpenRFAware
2764 /*****************************************************************************/
2768 const FSSpec
* spec
,
2774 The FSpOpenAware function opens the data fork of a file using deny mode
2775 permissions instead the normal File Manager permissions. If OpenDeny
2776 is not available, then FSpOpenAware translates the deny modes to the
2777 closest File Manager permissions and tries to open the file with
2778 OpenDF first, and then Open if OpenDF isn't available. By using
2779 FSpOpenAware with deny mode permissions, a program can be "AppleShare
2780 aware" and fall back on the standard File Manager open calls
2783 spec input: An FSSpec record specifying the file.
2784 denyModes input: The deny modes access under which to open the file.
2785 refNum output: The file reference number of the opened file.
2789 nsvErr -35 No such volume
2790 tmfoErr -42 Too many files open
2791 fnfErr -43 File not found
2792 wPrErr -44 Volume locked by hardware
2793 fLckdErr -45 File is locked
2794 vLckdErr -46 Volume is locked or read-only
2795 opWrErr -49 File already open for writing
2796 paramErr -50 No default volume
2797 permErr -54 File is already open and cannot be opened using specified deny modes
2798 afpAccessDenied -5000 User does not have the correct access to the file
2799 afpDenyConflict -5006 Requested access permission not possible
2803 See also: HOpenAware, HOpenRFAware, FSpOpenRFAware
2806 /*****************************************************************************/
2812 ConstStr255Param fileName
,
2818 The HOpenRFAware function opens the resource fork of a file using deny
2819 mode permissions instead the normal File Manager permissions. If
2820 OpenRFDeny is not available, then HOpenRFAware translates the deny
2821 modes to the closest File Manager permissions and tries to open the
2822 file with OpenRF. By using HOpenRFAware with deny mode permissions,
2823 a program can be "AppleShare aware" and fall back on the standard
2824 File Manager open calls automatically.
2826 vRefNum input: Volume specification.
2827 dirID input: Directory ID.
2828 fileName input: The name of the file.
2829 denyModes input: The deny modes access under which to open the file.
2830 refNum output: The file reference number of the opened file.
2834 nsvErr -35 No such volume
2835 tmfoErr -42 Too many files open
2836 fnfErr -43 File not found
2837 wPrErr -44 Volume locked by hardware
2838 fLckdErr -45 File is locked
2839 vLckdErr -46 Volume is locked or read-only
2840 opWrErr -49 File already open for writing
2841 paramErr -50 No default volume
2842 permErr -54 File is already open and cannot be opened using specified deny modes
2843 afpAccessDenied -5000 User does not have the correct access to the file
2844 afpDenyConflict -5006 Requested access permission not possible
2848 See also: HOpenAware, FSpOpenAware, FSpOpenRFAware
2851 /*****************************************************************************/
2855 const FSSpec
* spec
,
2861 The FSpOpenRFAware function opens the resource fork of a file using deny
2862 mode permissions instead the normal File Manager permissions. If
2863 OpenRFDeny is not available, then FSpOpenRFAware translates the deny
2864 modes to the closest File Manager permissions and tries to open the
2865 file with OpenRF. By using FSpOpenRFAware with deny mode permissions,
2866 a program can be "AppleShare aware" and fall back on the standard
2867 File Manager open calls automatically.
2869 spec input: An FSSpec record specifying the file.
2870 denyModes input: The deny modes access under which to open the file.
2871 refNum output: The file reference number of the opened file.
2875 nsvErr -35 No such volume
2876 tmfoErr -42 Too many files open
2877 fnfErr -43 File not found
2878 wPrErr -44 Volume locked by hardware
2879 fLckdErr -45 File is locked
2880 vLckdErr -46 Volume is locked or read-only
2881 opWrErr -49 File already open for writing
2882 paramErr -50 No default volume
2883 permErr -54 File is already open and cannot be opened using specified deny modes
2884 afpAccessDenied -5000 User does not have the correct access to the file
2885 afpDenyConflict -5006 Requested access permission not possible
2889 See also: HOpenAware, FSpOpenAware, HOpenRFAware
2892 /*****************************************************************************/
2902 The FSReadNoCache function reads any number of bytes from an open file
2903 while asking the file system to bypass its cache mechanism.
2905 refNum input: The file reference number of an open file.
2906 count input: The number of bytes to read.
2907 output: The number of bytes actually read.
2908 buffPtr input: A pointer to the data buffer into which the bytes are
2913 readErr Ð19 Driver does not respond to read requests
2914 badUnitErr Ð21 Driver reference number does not
2916 unitEmptyErr Ð22 Driver reference number specifies a
2917 nil handle in unit table
2918 abortErr Ð27 Request aborted by KillIO
2919 notOpenErr Ð28 Driver not open
2920 ioErr Ð36 Data does not match in read-verify mode
2921 fnOpnErr -38 File not open
2922 rfNumErr -51 Bad reference number
2923 afpAccessDenied -5000 User does not have the correct access to
2928 See also: FSWriteNoCache
2931 /*****************************************************************************/
2937 const void * buffPtr
);
2941 The FSReadNoCache function writes any number of bytes to an open file
2942 while asking the file system to bypass its cache mechanism.
2944 refNum input: The file reference number of an open file.
2945 count input: The number of bytes to write to the file.
2946 output: The number of bytes actually written.
2947 buffPtr input: A pointer to the data buffer from which the bytes are
2952 writErr Ð20 Driver does not respond to write requests
2953 badUnitErr Ð21 Driver reference number does not
2955 unitEmptyErr Ð22 Driver reference number specifies a
2956 nil handle in unit table
2957 abortErr Ð27 Request aborted by KillIO
2958 notOpenErr Ð28 Driver not open
2959 dskFulErr -34 Disk full
2960 ioErr Ð36 Data does not match in read-verify mode
2961 fnOpnErr -38 File not open
2962 wPrErr -44 Hardware volume lock
2963 fLckdErr -45 File is locked
2964 vLckdErr -46 Software volume lock
2965 rfNumErr -51 Bad reference number
2966 wrPermErr -61 Read/write permission doesnÕt
2968 afpAccessDenied -5000 User does not have the correct access to
2973 See also: FSReadNoCache
2976 /*****************************************************************************/
2982 const void * buffPtr
);
2986 The FSWriteVerify function writes any number of bytes to an open file
2987 and then verifies that the data was actually written to the device.
2989 refNum input: The file reference number of an open file.
2990 count input: The number of bytes to write to the file.
2991 output: The number of bytes actually written and verified.
2992 buffPtr input: A pointer to the data buffer from which the bytes are
2997 readErr Ð19 Driver does not respond to read requests
2998 writErr Ð20 Driver does not respond to write requests
2999 badUnitErr Ð21 Driver reference number does not
3001 unitEmptyErr Ð22 Driver reference number specifies a
3002 nil handle in unit table
3003 abortErr Ð27 Request aborted by KillIO
3004 notOpenErr Ð28 Driver not open
3005 dskFulErr -34 Disk full
3006 ioErr Ð36 Data does not match in read-verify mode
3007 fnOpnErr -38 File not open
3008 eofErr -39 Logical end-of-file reached
3009 posErr -40 Attempt to position mark before start
3011 wPrErr -44 Hardware volume lock
3012 fLckdErr -45 File is locked
3013 vLckdErr -46 Software volume lock
3014 rfNumErr -51 Bad reference number
3015 gfpErr -52 Error during GetFPos
3016 wrPermErr -61 Read/write permission doesnÕt
3018 memFullErr -108 Not enough room in heap zone to allocate
3020 afpAccessDenied -5000 User does not have the correct access to
3024 /*****************************************************************************/
3030 void * copyBufferPtr
,
3031 long copyBufferSize
);
3035 The CopyFork function copies all data from the source fork to the
3036 destination fork of open file forks and makes sure the destination EOF
3037 is equal to the source EOF.
3039 srcRefNum input: The source file reference number.
3040 dstRefNum input: The destination file reference number.
3041 copyBufferPtr input: Pointer to buffer to use during copy. The
3042 buffer should be at least 512-bytes minimum.
3043 The larger the buffer, the faster the copy.
3044 copyBufferSize input: The size of the copy buffer.
3048 readErr Ð19 Driver does not respond to read requests
3049 writErr Ð20 Driver does not respond to write requests
3050 badUnitErr Ð21 Driver reference number does not
3052 unitEmptyErr Ð22 Driver reference number specifies a
3053 nil handle in unit table
3054 abortErr Ð27 Request aborted by KillIO
3055 notOpenErr Ð28 Driver not open
3056 dskFulErr -34 Disk full
3057 ioErr Ð36 Data does not match in read-verify mode
3058 fnOpnErr -38 File not open
3059 wPrErr -44 Hardware volume lock
3060 fLckdErr -45 File is locked
3061 vLckdErr -46 Software volume lock
3062 rfNumErr -51 Bad reference number
3063 wrPermErr -61 Read/write permission doesnÕt
3065 afpAccessDenied -5000 User does not have the correct access to
3069 /*****************************************************************************/
3076 StringPtr fileName
);
3080 The GetFileLocation function gets the location (volume reference number,
3081 directory ID, and fileName) of an open file.
3083 refNum input: The file reference number of an open file.
3084 vRefNum output: The volume reference number.
3085 dirID output: The parent directory ID.
3086 fileName input: Points to a buffer (minimum Str63) where the
3087 filename is to be returned or must be nil.
3088 output: The filename.
3092 nsvErr -35 Specified volume doesnÕt exist
3093 fnOpnErr -38 File not open
3094 rfNumErr -51 Reference number specifies nonexistent
3099 See also: FSpGetFileLocation
3102 /*****************************************************************************/
3111 The FSpGetFileLocation function gets the location of an open file in
3114 refNum input: The file reference number of an open file.
3115 spec output: FSSpec record containing the file name and location.
3119 nsvErr -35 Specified volume doesnÕt exist
3120 fnOpnErr -38 File not open
3121 rfNumErr -51 Reference number specifies nonexistent
3126 See also: GetFileLocation
3129 /*****************************************************************************/
3132 CopyDirectoryAccess(
3135 ConstStr255Param srcName
,
3138 ConstStr255Param dstName
);
3142 The CopyDirectoryAccess function copies the AFP directory access
3143 privileges from one directory to another. Both directories must be on
3144 the same file server, but not necessarily on the same server volume.
3146 srcVRefNum input: Source volume specification.
3147 srcDirID input: Source directory ID.
3148 srcName input: Pointer to source directory name, or nil when
3149 srcDirID specifies the directory.
3150 dstVRefNum input: Destination volume specification.
3151 dstDirID input: Destination directory ID.
3152 dstName input: Pointer to destination directory name, or nil when
3153 dstDirID specifies the directory.
3157 nsvErr -35 Volume not found
3158 fnfErr -43 Directory not found
3159 vLckdErr -46 Volume is locked or read-only
3160 paramErr -50 Volume doesn't support this function
3161 afpAccessDenied -5000 User does not have the correct access
3163 afpObjectTypeErr -5025 Object is a file, not a directory
3167 See also: FSpCopyDirectoryAccess
3170 /*****************************************************************************/
3173 FSpCopyDirectoryAccess(
3174 const FSSpec
* srcSpec
,
3175 const FSSpec
* dstSpec
);
3179 The FSpCopyDirectoryAccess function copies the AFP directory access
3180 privileges from one directory to another. Both directories must be on
3181 the same file server, but not necessarily on the same server volume.
3183 srcSpec input: An FSSpec record specifying the source directory.
3184 dstSpec input: An FSSpec record specifying the destination directory.
3188 nsvErr -35 Volume not found
3189 fnfErr -43 Directory not found
3190 vLckdErr -46 Volume is locked or read-only
3191 paramErr -50 Volume doesn't support this function
3192 afpAccessDenied -5000 User does not have the correct access
3194 afpObjectTypeErr -5025 Object is a file, not a directory
3198 See also: CopyDirectoryAccess
3201 /*****************************************************************************/
3207 ConstStr255Param srcName
,
3209 ConstStr255Param dstpathName
,
3210 ConstStr255Param copyName
);
3214 The HMoveRenameCompat function moves a file or directory and optionally
3215 renames it. The source and destination locations must be on the same
3216 volume. This routine works even if the volume doesn't support MoveRename.
3218 vRefNum input: Volume specification.
3219 srcDirID input: Source directory ID.
3220 srcName input: The source object name.
3221 dstDirID input: Destination directory ID.
3222 dstName input: Pointer to destination directory name, or
3223 nil when dstDirID specifies a directory.
3224 copyName input: Points to the new name if the object is to be
3225 renamed or nil if the object isn't to be renamed.
3229 dirFulErr -33 File directory full
3230 dskFulErr -34 Disk is full
3231 nsvErr -35 Volume not found
3233 bdNamErr -37 Bad filename or attempt to move into
3235 fnfErr -43 Source file or directory not found
3236 wPrErr -44 Hardware volume lock
3237 fLckdErr -45 File is locked
3238 vLckdErr -46 Destination volume is read-only
3239 fBsyErr -47 File busy, directory not empty, or
3240 working directory control block open
3241 dupFNErr -48 Destination already exists
3242 paramErr -50 Volume doesn't support this function,
3243 no default volume, or source and
3244 volOfflinErr -53 Volume is offline
3245 fsRnErr -59 Problem during rename
3246 dirNFErr -120 Directory not found or incomplete pathname
3247 badMovErr -122 Attempted to move directory into
3249 wrgVolTypErr -123 Not an HFS volume (it's a MFS volume)
3250 notAFileErr -1302 The pathname is nil, the pathname
3251 is empty, or the pathname cannot refer
3253 diffVolErr -1303 Files on different volumes
3254 afpAccessDenied -5000 The user does not have the right to
3255 move the file or directory
3256 afpObjectTypeErr -5025 Directory not found or incomplete pathname
3257 afpSameObjectErr -5038 Source and destination files are the same
3261 See also: FSpMoveRenameCompat
3264 /*****************************************************************************/
3267 FSpMoveRenameCompat(
3268 const FSSpec
* srcSpec
,
3269 const FSSpec
* dstSpec
,
3270 ConstStr255Param copyName
);
3274 The FSpMoveRenameCompat function moves a file or directory and optionally
3275 renames it. The source and destination locations must be on the same
3276 volume. This routine works even if the volume doesn't support MoveRename.
3278 srcSpec input: An FSSpec record specifying the source object.
3279 dstSpec input: An FSSpec record specifying the destination
3281 copyName input: Points to the new name if the object is to be
3282 renamed or nil if the object isn't to be renamed.
3286 dirFulErr -33 File directory full
3287 dskFulErr -34 Disk is full
3288 nsvErr -35 Volume not found
3290 bdNamErr -37 Bad filename or attempt to move into
3292 fnfErr -43 Source file or directory not found
3293 wPrErr -44 Hardware volume lock
3294 fLckdErr -45 File is locked
3295 vLckdErr -46 Destination volume is read-only
3296 fBsyErr -47 File busy, directory not empty, or
3297 working directory control block open
3298 dupFNErr -48 Destination already exists
3299 paramErr -50 Volume doesn't support this function,
3300 no default volume, or source and
3301 volOfflinErr -53 Volume is offline
3302 fsRnErr -59 Problem during rename
3303 dirNFErr -120 Directory not found or incomplete pathname
3304 badMovErr -122 Attempted to move directory into
3306 wrgVolTypErr -123 Not an HFS volume (it's a MFS volume)
3307 notAFileErr -1302 The pathname is nil, the pathname
3308 is empty, or the pathname cannot refer
3310 diffVolErr -1303 Files on different volumes
3311 afpAccessDenied -5000 The user does not have the right to
3312 move the file or directory
3313 afpObjectTypeErr -5025 Directory not found or incomplete pathname
3314 afpSameObjectErr -5038 Source and destination files are the same
3318 See also: HMoveRenameCompat
3321 /*****************************************************************************/
3324 BuildAFPVolMountInfo(
3335 AFPVolMountInfoPtr
* afpInfoPtr
);
3339 The BuildAFPVolMountInfo function allocates and initializes the fields
3340 of an AFPVolMountInfo record before using that record to call
3341 the VolumeMount function.
3343 flags input: The AFP mounting flags. 0 = normal mount;
3344 set bit 0 to inhibit greeting messages.
3345 nbpInterval input: The interval used for VolumeMount's
3346 NBP Lookup call. 7 is a good choice.
3347 nbpCount input: The retry count used for VolumeMount's
3348 NBP Lookup call. 5 is a good choice.
3349 uamType input: The user authentication method to use.
3350 zoneName input: The AppleTalk zone name of the server.
3351 serverName input: The AFP server name.
3352 volName input: The AFP volume name.
3353 userName input: The user name (zero length Pascal string for
3355 userPassWord input: The user password (zero length Pascal string
3356 if no user password)
3357 volPassWord input: The volume password (zero length Pascal string
3358 if no volume password)
3359 afpInfoPtr output: A pointer to the newly created and initialized
3360 AFPVolMountInfo record. If the function fails to
3361 create an AFPVolMountInfo record, it sets
3362 afpInfoPtr to NULL and the function result is
3363 memFullErr. Your program is responsible
3364 for disposing of this pointer when it is finished
3369 memFullErr -108 memory full error
3373 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
3374 RetrieveAFPVolMountInfo, BuildAFPXVolMountInfo,
3375 RetrieveAFPXVolMountInfo
3378 /*****************************************************************************/
3381 RetrieveAFPVolMountInfo(
3382 AFPVolMountInfoPtr afpInfoPtr
,
3386 StringPtr serverName
,
3388 StringPtr userName
);
3392 The RetrieveAFPVolMountInfo function retrieves the AFP mounting
3393 information returned in an AFPVolMountInfo record by the
3394 GetVolMountInfo function.
3396 afpInfoPtr input: Pointer to AFPVolMountInfo record that contains
3397 the AFP mounting information.
3398 flags output: The AFP mounting flags.
3399 uamType output: The user authentication method used.
3400 zoneName output: The AppleTalk zone name of the server.
3401 serverName output: The AFP server name.
3402 volName output: The AFP volume name.
3403 userName output: The user name (zero length Pascal string for
3408 paramErr -50 media field in AFP mounting information
3409 was not AppleShareMediaType
3413 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
3414 BuildAFPVolMountInfo, BuildAFPXVolMountInfo,
3415 RetrieveAFPXVolMountInfo
3418 /*****************************************************************************/
3421 BuildAFPXVolMountInfo(
3433 unsigned long alternateAddressLength
,
3434 void * alternateAddress
,
3435 AFPXVolMountInfoPtr
* afpXInfoPtr
);
3439 The BuildAFPXVolMountInfo function allocates and initializes the fields
3440 of an AFPXVolMountInfo record before using that record to call
3441 the VolumeMount function.
3443 flags input: The AFP mounting flags.
3444 nbpInterval input: The interval used for VolumeMount's
3445 NBP Lookup call. 7 is a good choice.
3446 nbpCount input: The retry count used for VolumeMount's
3447 NBP Lookup call. 5 is a good choice.
3448 uamType input: The user authentication method to use.
3449 zoneName input: The AppleTalk zone name of the server.
3450 serverName input: The AFP server name.
3451 volName input: The AFP volume name.
3452 userName input: The user name (zero length Pascal string
3454 userPassWord input: The user password (zero length Pascal
3455 string if no user password)
3456 volPassWord input: The volume password (zero length Pascal
3457 string if no volume password)
3458 uamName input: The User Authentication Method name.
3459 alternateAddressLength input: Length of alternateAddress data.
3460 alternateAddress input The AFPAlternateAddress (variable length)
3461 afpXInfoPtr output: A pointer to the newly created and
3462 initialized AFPVolMountInfo record.
3463 If the function fails to create an
3464 AFPVolMountInfo record, it sets
3465 afpInfoPtr to NULL and the function
3466 result is memFullErr. Your program is
3467 responsible for disposing of this pointer
3468 when it is finished with it.
3472 memFullErr -108 memory full error
3476 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
3477 BuildAFPVolMountInfo, RetrieveAFPVolMountInfo,
3478 RetrieveAFPXVolMountInfo
3481 /*****************************************************************************/
3484 RetrieveAFPXVolMountInfo(
3485 AFPXVolMountInfoPtr afpXInfoPtr
,
3489 StringPtr serverName
,
3493 unsigned long * alternateAddressLength
,
3494 AFPAlternateAddress
** alternateAddress
);
3498 The RetrieveAFPXVolMountInfo function retrieves the AFP mounting
3499 information returned in an AFPXVolMountInfo record by the
3500 GetVolMountInfo function.
3502 afpXInfoPtr input: Pointer to AFPXVolMountInfo record that
3503 contains the AFP mounting information.
3504 flags output: The AFP mounting flags.
3505 uamType output: The user authentication method used.
3506 zoneName output: The AppleTalk zone name of the server.
3507 serverName output: The AFP server name.
3508 volName output: The AFP volume name.
3509 userName output: The user name (zero length Pascal
3511 uamName output: The User Authentication Method name.
3512 alternateAddressLength output: Length of alternateAddress data returned.
3513 alternateAddress: output: A pointer to the newly created and
3514 AFPAlternateAddress record (a variable
3515 length record). If the function fails to
3516 create an AFPAlternateAddress record,
3517 it sets alternateAddress to NULL and the
3518 function result is memFullErr. Your
3519 program is responsible for disposing of
3520 this pointer when it is finished with it.
3524 paramErr -50 media field in AFP mounting information
3525 was not AppleShareMediaType
3526 memFullErr -108 memory full error
3530 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
3531 BuildAFPVolMountInfo, RetrieveAFXVolMountInfo,
3532 BuildAFPXVolMountInfo
3535 /*****************************************************************************/
3542 long * actEntryCount
,
3547 The GetUGEntries functions retrieves a list of user or group entries
3548 from the local file server.
3550 objType input: The object type: -1 = group; 0 = user
3551 UGEntries input: Pointer to array of UGEntry records where the list
3553 reqEntryCount input: The number of elements in the UGEntries array.
3554 actEntryCount output: The number of entries returned.
3555 objID input: The current index position. Set to 0 to start with
3557 output: The index position to get the next entry. Pass this
3558 value the next time you call GetUGEntries to start
3563 fnfErr -43 No more users or groups
3564 paramErr -50 Function not supported; or, ioObjID is
3569 Also see: GetUGEntry
3572 /*****************************************************************************/
3576 #include "OptimizationEnd.h"
3578 #if PRAGMA_STRUCT_ALIGN
3579 #pragma options align=reset
3580 #elif PRAGMA_STRUCT_PACKPUSH
3582 #elif PRAGMA_STRUCT_PACK
3586 #ifdef PRAGMA_IMPORT_OFF
3589 #pragma import reset
3596 #endif /* __MOREFILESEXTRAS__ */