]> git.saurik.com Git - wxWidgets.git/blob - src/mac/morefile/MoreExtr.h
fixed typo (IsOK instead of IsOk)
[wxWidgets.git] / src / mac / morefile / MoreExtr.h
1 /*
2 ** Apple Macintosh Developer Technical Support
3 **
4 ** A collection of useful high-level File Manager routines.
5 **
6 ** by Jim Luther, Apple Developer Technical Support Emeritus
7 **
8 ** File: MoreFilesExtras.h
9 **
10 ** Copyright © 1992-1998 Apple Computer, Inc.
11 ** All rights reserved.
12 **
13 ** You may incorporate this sample code into your applications without
14 ** restriction, though the sample code has been provided "AS IS" and the
15 ** responsibility for its operation is 100% yours. However, what you are
16 ** not permitted to do is to redistribute the source as "DSC Sample Code"
17 ** after having made changes. If you're going to re-distribute the source,
18 ** we require that you make it clear in the source that the code was
19 ** descended from Apple Sample Code, but that you've made changes.
20 */
21
22 #ifndef __MOREFILESEXTRAS__
23 #define __MOREFILESEXTRAS__
24
25 #include <Types.h>
26 #include <Files.h>
27
28 #ifndef true
29 #define true 1
30 #define false 0
31 #endif
32
33 #include "optim.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /*****************************************************************************/
40
41 /* Constants and types from Universal Interfaces 3.0.1 Files.h */
42
43 #if UNIVERSAL_INTERFACES_VERSION < 0x0301
44
45 enum {
46 volMountNoLoginMsgFlagBit = 0, /* Input to VolumeMount: If set, the file system */
47 volMountNoLoginMsgFlagMask = 0x0001, /* should suppresss any log-in message/greeting dialog */
48 volMountExtendedFlagsBit = 7, /* Input to VolumeMount: If set, the mount info is a */
49 volMountExtendedFlagsMask = 0x0080 /* AFPXVolMountInfo record for 3.7 AppleShare Client */
50 };
51
52 /* AFPXVolMountInfo is the new AFP volume mount info record, requires the 3.7 AppleShare Client */
53
54 struct AFPXVolMountInfo {
55 short length; /* length of location data (including self) */
56 VolumeType media; /* type of media */
57 short flags; /* bits for no messages, no reconnect */
58 SInt8 nbpInterval; /* NBP Interval parameter (IM2, p.322) */
59 SInt8 nbpCount; /* NBP Interval parameter (IM2, p.322) */
60 short uamType; /* User Authentication Method type */
61 short zoneNameOffset; /* short positive offset from start of struct to Zone Name */
62 short serverNameOffset; /* offset to pascal Server Name string */
63 short volNameOffset; /* offset to pascal Volume Name string */
64 short userNameOffset; /* offset to pascal User Name string */
65 short userPasswordOffset; /* offset to pascal User Password string */
66 short volPasswordOffset; /* offset to pascal Volume Password string */
67 short extendedFlags; /* extended flags word */
68 short uamNameOffset; /* offset to a pascal UAM name string */
69 short alternateAddressOffset; /* offset to Alternate Addresses in tagged format */
70 char AFPData[176]; /* variable length data may follow */
71 };
72 typedef struct AFPXVolMountInfo AFPXVolMountInfo;
73 typedef AFPXVolMountInfo * AFPXVolMountInfoPtr;
74
75 enum {
76 kAFPExtendedFlagsAlternateAddressMask = 1 /* bit in AFPXVolMountInfo.extendedFlags that means alternateAddressOffset is used*/
77 };
78
79 enum {
80 /* constants for use in AFPTagData.fType field*/
81 kAFPTagTypeIP = 0x01,
82 kAFPTagTypeIPPort = 0x02,
83 kAFPTagTypeDDP = 0x03 /* Currently unused*/
84 };
85
86 enum {
87 /* constants for use in AFPTagData.fLength field*/
88 kAFPTagLengthIP = 0x06,
89 kAFPTagLengthIPPort = 0x08,
90 kAFPTagLengthDDP = 0x06
91 };
92
93 struct AFPTagData {
94 UInt8 fLength; /* length of this data tag including the fLength field */
95 UInt8 fType;
96 UInt8 fData[1]; /* variable length data */
97 };
98 typedef struct AFPTagData AFPTagData;
99
100 struct AFPAlternateAddress {
101 UInt8 fAddressCount;
102 UInt8 fAddressList[1]; /* actually variable length packed set of AFPTagData */
103 };
104 typedef struct AFPAlternateAddress AFPAlternateAddress;
105
106 #endif
107
108 /*****************************************************************************/
109
110 /*
111 ** Macros to get information out of GetVolParmsInfoBuffer
112 */
113
114 #define isNetworkVolume(volParms) ((volParms).vMServerAdr != 0)
115 #define hasLimitFCBs(volParms) (((volParms).vMAttrib & (1L << bLimitFCBs)) != 0)
116 #define hasLocalWList(volParms) (((volParms).vMAttrib & (1L << bLocalWList)) != 0)
117 #define hasNoMiniFndr(volParms) (((volParms).vMAttrib & (1L << bNoMiniFndr)) != 0)
118 #define hasNoVNEdit(volParms) (((volParms).vMAttrib & (1L << bNoVNEdit)) != 0)
119 #define hasNoLclSync(volParms) (((volParms).vMAttrib & (1L << bNoLclSync)) != 0)
120 #define hasTrshOffLine(volParms) (((volParms).vMAttrib & (1L << bTrshOffLine)) != 0)
121 #define hasNoSwitchTo(volParms) (((volParms).vMAttrib & (1L << bNoSwitchTo)) != 0)
122 #define hasNoDeskItems(volParms) (((volParms).vMAttrib & (1L << bNoDeskItems)) != 0)
123 #define hasNoBootBlks(volParms) (((volParms).vMAttrib & (1L << bNoBootBlks)) != 0)
124 #define hasAccessCntl(volParms) (((volParms).vMAttrib & (1L << bAccessCntl)) != 0)
125 #define hasNoSysDir(volParms) (((volParms).vMAttrib & (1L << bNoSysDir)) != 0)
126 #define hasExtFSVol(volParms) (((volParms).vMAttrib & (1L << bHasExtFSVol)) != 0)
127 #define hasOpenDeny(volParms) (((volParms).vMAttrib & (1L << bHasOpenDeny)) != 0)
128 #define hasCopyFile(volParms) (((volParms).vMAttrib & (1L << bHasCopyFile)) != 0)
129 #define hasMoveRename(volParms) (((volParms).vMAttrib & (1L << bHasMoveRename)) != 0)
130 #define hasDesktopMgr(volParms) (((volParms).vMAttrib & (1L << bHasDesktopMgr)) != 0)
131 #define hasShortName(volParms) (((volParms).vMAttrib & (1L << bHasShortName)) != 0)
132 #define hasFolderLock(volParms) (((volParms).vMAttrib & (1L << bHasFolderLock)) != 0)
133 #define hasPersonalAccessPrivileges(volParms) \
134 (((volParms).vMAttrib & (1L << bHasPersonalAccessPrivileges)) != 0)
135 #define hasUserGroupList(volParms) (((volParms).vMAttrib & (1L << bHasUserGroupList)) != 0)
136 #define hasCatSearch(volParms) (((volParms).vMAttrib & (1L << bHasCatSearch)) != 0)
137 #define hasFileIDs(volParms) (((volParms).vMAttrib & (1L << bHasFileIDs)) != 0)
138 #define hasBTreeMgr(volParms) (((volParms).vMAttrib & (1L << bHasBTreeMgr)) != 0)
139 #define hasBlankAccessPrivileges(volParms) \
140 (((volParms).vMAttrib & (1L << bHasBlankAccessPrivileges)) != 0)
141
142 /*****************************************************************************/
143
144
145 /*
146 ** Bit masks and macros to get common information out of ioACUser returned
147 ** by PBGetCatInfo (remember to clear ioACUser before calling PBGetCatInfo
148 ** since some file systems don't bother to set this field).
149 **
150 ** Use the GetDirAccessRestrictions or FSpGetDirAccessRestrictions
151 ** functions to retrieve the ioACUser access restrictions byte for
152 ** a folder.
153 **
154 ** Note: The access restriction byte returned by PBGetCatInfo is the
155 ** 2's complement of the user's privileges byte returned in
156 ** ioACAccess by PBHGetDirAccess.
157 */
158
159 enum
160 {
161 /* bits defined in ioACUser */
162 acUserNoSeeFoldersMask = 0x01,
163 acUserNoSeeFilesMask = 0x02,
164 acUserNoMakeChangesMask = 0x04,
165 acUserNotOwnerMask = 0x80,
166
167 /* mask for just the access restriction bits */
168 acUserAccessMask = 0x07,
169
170 /* common access privilege settings */
171 acUserFull = 0x00, /* no access restiction bits on */
172 acUserNone = acUserAccessMask, /* all access restiction bits on */
173 acUserDropBox = acUserNoSeeFoldersMask + acUserNoSeeFilesMask, /* make changes, but not see files or folders */
174 acUserBulletinBoard = acUserNoMakeChangesMask /* see files and folders, but not make changes */
175 };
176
177 /* Macros for testing ioACUser bits */
178 #define userIsOwner(ioACUser) \
179 (((ioACUser) & acUserNotOwnerMask) == 0)
180 #define userHasFullAccess(ioACUser) \
181 (((ioACUser) & (acUserAccessMask)) == acUserFull)
182 #define userHasDropBoxAccess(ioACUser) \
183 (((ioACUser) & acUserAccessMask) == acUserDropBox)
184 #define userHasBulletinBoard(ioACUser) \
185 (((ioACUser) & acUserAccessMask) == acUserBulletinBoard)
186 #define userHasNoAccess(ioACUser) \
187 (((ioACUser) & acUserAccessMask) == acUserNone)
188
189 /*****************************************************************************/
190
191 /*
192 ** Deny mode permissions for use with the HOpenAware, HOpenRFAware,
193 ** FSpOpenAware, and FSpOpenRFAware functions.
194 */
195
196 enum
197 {
198 dmNone = 0x0000,
199 dmNoneDenyRd = 0x0010,
200 dmNoneDenyWr = 0x0020,
201 dmNoneDenyRdWr = 0x0030,
202 dmRd = 0x0001, /* Single writer, multiple readers; the readers */
203 dmRdDenyRd = 0x0011,
204 dmRdDenyWr = 0x0021, /* Browsing - equivalent to fsRdPerm */
205 dmRdDenyRdWr = 0x0031,
206 dmWr = 0x0002,
207 dmWrDenyRd = 0x0012,
208 dmWrDenyWr = 0x0022,
209 dmWrDenyRdWr = 0x0032,
210 dmRdWr = 0x0003, /* Shared access - equivalent to fsRdWrShPerm */
211 dmRdWrDenyRd = 0x0013,
212 dmRdWrDenyWr = 0x0023, /* Single writer, multiple readers; the writer */
213 dmRdWrDenyRdWr = 0x0033 /* Exclusive access - equivalent to fsRdWrPerm */
214 };
215
216 /*****************************************************************************/
217
218 #if PRAGMA_STRUCT_ALIGN
219 #pragma options align=mac68k
220 #elif PRAGMA_STRUCT_PACKPUSH
221 #pragma pack(push, 2)
222 #elif PRAGMA_STRUCT_PACK
223 #pragma pack(2)
224 #endif
225
226 /*
227 ** For those times where you need to use more than one kind of File Manager parameter
228 ** block but don't feel like wasting stack space, here's a parameter block you can reuse.
229 */
230
231 union UniversalFMPB
232 {
233 ParamBlockRec PB;
234 CInfoPBRec ciPB;
235 DTPBRec dtPB;
236 HParamBlockRec hPB;
237 CMovePBRec cmPB;
238 WDPBRec wdPB;
239 FCBPBRec fcbPB;
240 XVolumeParam xPB;
241 };
242 typedef union UniversalFMPB UniversalFMPB;
243 typedef UniversalFMPB *UniversalFMPBPtr, **UniversalFMPBHandle;
244
245
246 /*
247 ** Used by GetUGEntries to return user or group lists
248 */
249
250 struct UGEntry
251 {
252 short objType; /* object type: -1 = group; 0 = user */
253 long objID; /* the user or group ID */
254 Str31 name; /* the user or group name */
255 };
256 typedef struct UGEntry UGEntry;
257 typedef UGEntry *UGEntryPtr, **UGEntryHandle;
258
259
260 typedef unsigned char Str8[9];
261
262
263 /*
264 ** I use the following records instead of the AFPVolMountInfo and AFPXVolMountInfo structures in Files.h
265 */
266
267 struct MyAFPVolMountInfo
268 {
269 short length; /* length of this record */
270 VolumeType media; /* type of media, always AppleShareMediaType */
271 short flags; /* 0 = normal mount; set bit 0 to inhibit greeting messages */
272 char nbpInterval; /* NBP interval parameter; 7 is a good choice */
273 char nbpCount; /* NBP count parameter; 5 is a good choice */
274 short uamType; /* User Authentication Method */
275 short zoneNameOffset; /* offset from start of record to zoneName */
276 short serverNameOffset; /* offset from start of record to serverName */
277 short volNameOffset; /* offset from start of record to volName */
278 short userNameOffset; /* offset from start of record to userName */
279 short userPasswordOffset; /* offset from start of record to userPassword */
280 short volPasswordOffset; /* offset from start of record to volPassword */
281 Str32 zoneName; /* server's AppleTalk zone name */
282 char filler1; /* to word align volPassword */
283 Str32 serverName; /* server name */
284 char filler2; /* to word align volPassword */
285 Str27 volName; /* volume name */
286 Str31 userName; /* user name (zero length Pascal string for guest) */
287 Str8 userPassword; /* user password (zero length Pascal string if no user password) */
288 char filler3; /* to word align volPassword */
289 Str8 volPassword; /* volume password (zero length Pascal string if no volume password) */
290 char filler4; /* to end record on word boundry */
291 };
292 typedef struct MyAFPVolMountInfo MyAFPVolMountInfo;
293 typedef MyAFPVolMountInfo *MyAFPVolMountInfoPtr, **MyAFPVolMountInfoHandle;
294
295 struct MyAFPXVolMountInfo
296 {
297 short length; /* length of this record */
298 VolumeType media; /* type of media, always AppleShareMediaType */
299 short flags; /* bits for no messages, no reconnect, etc */
300 char nbpInterval; /* NBP interval parameter; 7 is a good choice */
301 char nbpCount; /* NBP count parameter; 5 is a good choice */
302 short uamType; /* User Authentication Method */
303 short zoneNameOffset; /* offset from start of record to zoneName */
304 short serverNameOffset; /* offset from start of record to serverName */
305 short volNameOffset; /* offset from start of record to volName */
306 short userNameOffset; /* offset from start of record to userName */
307 short userPasswordOffset; /* offset from start of record to userPassword */
308 short volPasswordOffset; /* offset from start of record to volPassword */
309 short extendedFlags; /* extended flags word */
310 short uamNameOffset; /* offset to a pascal UAM name string */
311 short alternateAddressOffset; /* offset to Alternate Addresses in tagged format */
312 Str32 zoneName; /* server's AppleTalk zone name */
313 char filler1; /* to word align volPassword */
314 Str32 serverName; /* server name */
315 char filler2; /* to word align volPassword */
316 Str27 volName; /* volume name */
317 Str31 userName; /* user name (zero length Pascal string for guest) */
318 Str8 userPassword; /* user password (zero length Pascal string if no user password) */
319 char filler3; /* to word align volPassword */
320 Str8 volPassword; /* volume password (zero length Pascal string if no volume password) */
321 char filler4; /* to word align uamNameOffset */
322 Str32 uamName; /* UAM name */
323 char filler5; /* to word align alternateAddress */
324 char alternateAddress[kVariableLengthArray]; /* AFPAlternateAddress */
325 };
326 typedef struct MyAFPXVolMountInfo MyAFPXVolMountInfo;
327 typedef MyAFPXVolMountInfo *MyAFPXVolMountInfoPtr, **MyAFPXVolMountInfoHandle;
328
329 #if PRAGMA_STRUCT_ALIGN
330 #pragma options align=reset
331 #elif PRAGMA_STRUCT_PACKPUSH
332 #pragma pack(pop)
333 #elif PRAGMA_STRUCT_PACK
334 #pragma pack()
335 #endif
336
337 /*****************************************************************************/
338
339 pascal void TruncPString(StringPtr destination,
340 ConstStr255Param source,
341 short maxLength);
342 /* ¦ International friendly string truncate routine.
343 The TruncPString function copies up to maxLength characters from
344 the source Pascal string to the destination Pascal string. TruncPString
345 ensures that the truncated string ends on a single-byte character, or on
346 the last byte of a multi-byte character.
347
348 destination output: destination Pascal string.
349 source input: source Pascal string.
350 maxLength output: The maximum allowable length of the destination
351 string.
352 */
353
354 /*****************************************************************************/
355
356 pascal Ptr GetTempBuffer(long buffReqSize,
357 long *buffActSize);
358 /* ¦ Allocate a temporary copy or search buffer.
359 The GetTempBuffer function allocates a temporary buffer for file system
360 operations which is at least 1024 bytes (1K) and a multiple of
361 1024 bytes.
362
363 buffReqSize input: Size you'd like the buffer to be.
364 buffActSize output: Size of buffer allocated.
365 function result output: Pointer to memory allocated or nil if no memory
366 was available. The caller is responsible for
367 disposing of this buffer with DisposePtr.
368 */
369
370 /*****************************************************************************/
371
372 pascal OSErr GetVolumeInfoNoName(ConstStr255Param pathname,
373 short vRefNum,
374 HParmBlkPtr pb);
375 /* ¦ Call PBHGetVInfoSync ignoring returned name.
376 GetVolumeInfoNoName uses pathname and vRefNum to call PBHGetVInfoSync
377 in cases where the returned volume name is not needed by the caller.
378 The pathname and vRefNum parameters are not touched, and the pb
379 parameter is initialized by PBHGetVInfoSync except that ioNamePtr in
380 the parameter block is always returned as NULL (since it might point
381 to GetVolumeInfoNoName's local variable tempPathname).
382
383 I noticed using this code in several places, so here it is once.
384 This reduces the code size of MoreFiles.
385
386 pathName input: Pointer to a full pathname or nil. If you pass in a
387 partial pathname, it is ignored. A full pathname to a
388 volume must end with a colon character (:).
389 vRefNum input: Volume specification (volume reference number, working
390 directory number, drive number, or 0).
391 pb input: A pointer to HParamBlockRec.
392 output: The parameter block as filled in by PBHGetVInfoSync
393 except that ioNamePtr will always be NULL.
394
395 Result Codes
396 noErr 0 No error
397 nsvErr -35 No such volume
398 paramErr -50 No default volume, or pb was NULL
399 */
400
401 /*****************************************************************************/
402
403 pascal OSErr XGetVolumeInfoNoName(ConstStr255Param pathname,
404 short vRefNum,
405 XVolumeParamPtr pb);
406 /* ¦ Call PBXGetVolInfoSync ignoring returned name.
407 XGetVolumeInfoNoName uses pathname and vRefNum to call PBXGetVolInfoSync
408 in cases where the returned volume name is not needed by the caller.
409 The pathname and vRefNum parameters are not touched, and the pb
410 parameter is initialized by PBXGetVolInfoSync except that ioNamePtr in
411 the parameter block is always returned as NULL (since it might point
412 to XGetVolumeInfoNoName's local variable tempPathname).
413
414 pathName input: Pointer to a full pathname or nil. If you pass in a
415 partial pathname, it is ignored. A full pathname to a
416 volume must end with a colon character (:).
417 vRefNum input: Volume specification (volume reference number, working
418 directory number, drive number, or 0).
419 pb input: A pointer to HParamBlockRec.
420 output: The parameter block as filled in by PBXGetVolInfoSync
421 except that ioNamePtr will always be NULL.
422
423 Result Codes
424 noErr 0 No error
425 nsvErr -35 No such volume
426 paramErr -50 No default volume, or pb was NULL
427 */
428
429 /*****************************************************************************/
430
431 pascal OSErr GetCatInfoNoName(short vRefNum,
432 long dirID,
433 ConstStr255Param name,
434 CInfoPBPtr pb);
435 /* ¦ Call PBGetCatInfoSync ignoring returned name.
436 GetCatInfoNoName uses vRefNum, dirID and name to call PBGetCatInfoSync
437 in cases where the returned object is not needed by the caller.
438 The vRefNum, dirID and name parameters are not touched, and the pb
439 parameter is initialized by PBGetCatInfoSync except that ioNamePtr in
440 the parameter block is always returned as NULL (since it might point
441 to GetCatInfoNoName's local variable tempName).
442
443 I noticed using this code in several places, so here it is once.
444 This reduces the code size of MoreFiles.
445
446 vRefNum input: Volume specification.
447 dirID input: Directory ID.
448 name input: Pointer to object name, or nil when dirID
449 specifies a directory that's the object.
450 pb input: A pointer to CInfoPBRec.
451 output: The parameter block as filled in by
452 PBGetCatInfoSync except that ioNamePtr will
453 always be NULL.
454
455 Result Codes
456 noErr 0 No error
457 nsvErr -35 No such volume
458 ioErr -36 I/O error
459 bdNamErr -37 Bad filename
460 fnfErr -43 File not found
461 paramErr -50 No default volume
462 dirNFErr -120 Directory not found or incomplete pathname
463 afpAccessDenied -5000 User does not have the correct access
464 afpObjectTypeErr -5025 Directory not found or incomplete pathname
465
466 */
467
468 /*****************************************************************************/
469
470 pascal OSErr DetermineVRefNum(ConstStr255Param pathname,
471 short vRefNum,
472 short *realVRefNum);
473 /* ¦ Determine the real volume reference number.
474 The DetermineVRefNum function determines the volume reference number of
475 a volume from a pathname, a volume specification, or a combination
476 of the two.
477 WARNING: Volume names on the Macintosh are *not* unique -- Multiple
478 mounted volumes can have the same name. For this reason, the use of a
479 volume name or full pathname to identify a specific volume may not
480 produce the results you expect. If more than one volume has the same
481 name and a volume name or full pathname is used, the File Manager
482 currently uses the first volume it finds with a matching name in the
483 volume queue.
484
485 pathName input: Pointer to a full pathname or nil. If you pass in a
486 partial pathname, it is ignored. A full pathname to a
487 volume must end with a colon character (:).
488 vRefNum input: Volume specification (volume reference number, working
489 directory number, drive number, or 0).
490 realVRefNum output: The real volume reference number.
491
492 Result Codes
493 noErr 0 No error
494 nsvErr -35 No such volume
495 paramErr -50 No default volume
496 */
497
498 /*****************************************************************************/
499
500 pascal OSErr HGetVInfo(short volReference,
501 StringPtr volName,
502 short *vRefNum,
503 unsigned long *freeBytes,
504 unsigned long *totalBytes);
505 /* ¦ Get information about a mounted volume.
506 The HGetVInfo function returns the name, volume reference number,
507 available space (in bytes), and total space (in bytes) for the
508 specified volume. You can specify the volume by providing its drive
509 number, volume reference number, or 0 for the default volume.
510 This routine is compatible with volumes up to 4 gigabytes.
511
512 volReference input: The drive number, volume reference number,
513 or 0 for the default volume.
514 volName input: A pointer to a buffer (minimum Str27) where
515 the volume name is to be returned or must
516 be nil.
517 output: The volume name.
518 vRefNum output: The volume reference number.
519 freeBytes output: The number of free bytes on the volume.
520 freeBytes is an unsigned long value.
521 totalBytes output: The total number of bytes on the volume.
522 totalBytes is an unsigned long value.
523
524 Result Codes
525 noErr 0 No error
526 nsvErr -35 No such volume
527 paramErr -50 No default volume
528
529 __________
530
531 Also see: XGetVInfo
532 */
533
534 /*****************************************************************************/
535
536 pascal OSErr XGetVInfo(short volReference,
537 StringPtr volName,
538 short *vRefNum,
539 UnsignedWide *freeBytes,
540 UnsignedWide *totalBytes);
541 /* ¦ Get extended information about a mounted volume.
542 The XGetVInfo function returns the name, volume reference number,
543 available space (in bytes), and total space (in bytes) for the
544 specified volume. You can specify the volume by providing its drive
545 number, volume reference number, or 0 for the default volume.
546 This routine is compatible with volumes up to 2 terabytes.
547
548 volReference input: The drive number, volume reference number,
549 or 0 for the default volume.
550 volName input: A pointer to a buffer (minimum Str27) where
551 the volume name is to be returned or must
552 be nil.
553 output: The volume name.
554 vRefNum output: The volume reference number.
555 freeBytes output: The number of free bytes on the volume.
556 freeBytes is an UnsignedWide value.
557 totalBytes output: The total number of bytes on the volume.
558 totalBytes is an UnsignedWide value.
559
560 Result Codes
561 noErr 0 No error
562 nsvErr -35 No such volume
563 paramErr -50 No default volume
564
565 __________
566
567 Also see: HGetVInfo
568 */
569
570 /*****************************************************************************/
571
572 pascal OSErr CheckVolLock(ConstStr255Param pathname,
573 short vRefNum);
574 /* ¦ Determine if a volume is locked.
575 The CheckVolLock function determines if a volume is locked - either by
576 hardware or by software. If CheckVolLock returns noErr, then the volume
577 is not locked.
578
579 pathName input: Pointer to a full pathname or nil. If you pass in a
580 partial pathname, it is ignored. A full pathname to a
581 volume must end with a colon character (:).
582 vRefNum input: Volume specification (volume reference number, working
583 directory number, drive number, or 0).
584
585 Result Codes
586 noErr 0 No error - volume not locked
587 nsvErr -35 No such volume
588 wPrErr -44 Volume locked by hardware
589 vLckdErr -46 Volume locked by software
590 paramErr -50 No default volume
591 */
592
593 /*****************************************************************************/
594
595 pascal OSErr GetDriverName(short driverRefNum,
596 Str255 driverName);
597 /* ¦ Get a device driver's name.
598 The GetDriverName function returns a device driver's name.
599
600 driverRefNum input: The driver reference number.
601 driverName output: The driver's name.
602
603 Result Codes
604 noErr 0 No error
605 badUnitErr -21 Bad driver reference number
606 */
607
608 /*****************************************************************************/
609
610 pascal OSErr FindDrive(ConstStr255Param pathname,
611 short vRefNum,
612 DrvQElPtr *driveQElementPtr);
613 /* ¦ Find a volume's drive queue element in the drive queue.
614 The FindDrive function returns a pointer to a mounted volume's
615 drive queue element.
616
617 pathName input: Pointer to a full pathname or nil. If you
618 pass in a partial pathname, it is ignored.
619 A full pathname to a volume must end with
620 a colon character (:).
621 vRefNum input: Volume specification (volume reference
622 number, working directory number, drive
623 number, or 0).
624 driveQElementPtr output: Pointer to a volume's drive queue element
625 in the drive queue. DO NOT change the
626 DrvQEl.
627
628 Result Codes
629 noErr 0 No error
630 nsvErr -35 No such volume
631 paramErr -50 No default volume
632 nsDrvErr -56 No such drive
633 */
634
635 /*****************************************************************************/
636
637 pascal OSErr GetDiskBlocks(ConstStr255Param pathname,
638 short vRefNum,
639 unsigned long *numBlocks);
640 /* ¦ Return the number of physical disk blocks on a disk drive.
641 The GetDiskBlocks function returns the number of physical disk
642 blocks on a disk drive. NOTE: This is not the same as volume
643 allocation blocks!
644
645 pathName input: Pointer to a full pathname or nil. If you
646 pass in a partial pathname, it is ignored.
647 A full pathname to a volume must end with
648 a colon character (:).
649 vRefNum input: Volume specification (volume reference
650 number, working directory number, drive
651 number, or 0).
652 numBlocks output: The number of physical disk blocks on the disk drive.
653
654 Result Codes
655 noErr 0 No error
656 nsvErr -35 No such volume
657 paramErr -50 No default volume, driver reference
658 number is zero, ReturnFormatList
659 returned zero blocks, DriveStatus
660 returned an unknown value, or
661 driveQElementPtr->qType is unknown
662 nsDrvErr -56 No such drive
663 statusErr Ð18 Driver does not respond to this
664 status request
665 badUnitErr Ð21 Driver reference number does not
666 match unit table
667 unitEmptyErr Ð22 Driver reference number specifies
668 a nil handle in unit table
669 abortErr Ð27 Request aborted by KillIO
670 notOpenErr Ð28 Driver not open
671 */
672
673 /*****************************************************************************/
674
675 pascal OSErr GetVolFileSystemID(ConstStr255Param pathname,
676 short vRefNum,
677 short *fileSystemID);
678 /* ¦ Get a volume's file system ID.
679 The GetVolFileSystemID function returned the file system ID of
680 a mounted volume. The file system ID identifies the file system
681 that handles requests to a particular volume. Here's a partial list
682 of file system ID numbers (only Apple's file systems are listed):
683 FSID File System
684 ----- -----------------------------------------------------
685 $0000 Macintosh HFS or MFS
686 $0100 ProDOS File System
687 $0101 PowerTalk Mail Enclosures
688 $4147 ISO 9660 File Access (through Foreign File Access)
689 $4242 High Sierra File Access (through Foreign File Access)
690 $464D QuickTake File System (through Foreign File Access)
691 $4953 Macintosh PC Exchange (MS-DOS)
692 $4A48 Audio CD Access (through Foreign File Access)
693 $4D4B Apple Photo Access (through Foreign File Access)
694
695 See the Technical Note "FL 35 - Determining Which File System
696 Is Active" and the "Guide to the File System Manager" for more
697 information.
698
699 pathName input: Pointer to a full pathname or nil. If you pass
700 in a partial pathname, it is ignored. A full
701 pathname to a volume must contain at least
702 one colon character (:) and must not start with
703 a colon character.
704 vRefNum input: Volume specification (volume reference number,
705 working directory number, drive number, or 0).
706 fileSystemID output: The volume's file system ID.
707
708 Result Codes
709 noErr 0 No error
710 nsvErr -35 No such volume
711 paramErr -50 No default volume, or pb was NULL
712 */
713
714 /*****************************************************************************/
715
716 pascal OSErr GetVolState(ConstStr255Param pathname,
717 short vRefNum,
718 Boolean *volumeOnline,
719 Boolean *volumeEjected,
720 Boolean *driveEjectable,
721 Boolean *driverWantsEject);
722 /* ¦ Returns a volume's online and eject information.
723 The GetVolState function determines if a volume is online or offline,
724 if an offline volume is ejected, and if the volume's driver is
725 ejectable or wants eject calls.
726
727 pathName input: Pointer to a full pathname or nil.
728 vRefNum input: Volume specification (volume reference number,
729 working directory number, drive number, or 0).
730 volumeOnline output: True if the volume is online;
731 False if the volume is offline.
732 volumeEjected output: True if the volume is ejected (ejected
733 volumes are always offline); False if the
734 volume is not ejected.
735 driveEjectable output: True if the volume's drive is ejectable;
736 False if the volume's drive is not ejectable.
737 driverWantsEject output: True if the volume's driver wants an Eject
738 request after unmount (even if the drive
739 is not ejectable); False if the volume's
740 driver does not need an eject request.
741
742 Result Codes
743 noErr 0 No error
744 nsvErr -35 No such volume
745 paramErr -50 No default volume, or pb was NULL
746 */
747
748 /*****************************************************************************/
749
750 pascal OSErr UnmountAndEject(ConstStr255Param pathname,
751 short vRefNum);
752 /* ¦ Unmount and eject a volume.
753 The UnmountAndEject function unmounts and ejects a volume. The volume
754 is ejected only if it is ejectable and not already ejected.
755
756 pathName input: Pointer to a full pathname or nil. If you pass in a
757 partial pathname, it is ignored. A full pathname to a
758 volume must end with a colon character (:).
759 vRefNum input: Volume specification (volume reference number, working
760 directory number, drive number, or 0).
761
762 Result Codes
763 noErr 0 No error
764 nsvErr -35 No such volume
765 ioErr -36 I/O error
766 bdNamErr -37 Bad volume name
767 fBsyErr -47 One or more files are open
768 paramErr -50 No default volume
769 nsDrvErr -56 No such drive
770 extFSErr -58 External file system error - no file
771 system claimed this call.
772 */
773
774 /*****************************************************************************/
775
776 pascal OSErr OnLine(FSSpecPtr volumes,
777 short reqVolCount,
778 short *actVolCount,
779 short *volIndex);
780 /* ¦ Return the list of volumes currently mounted.
781 The OnLine function returns the list of volumes currently mounted in
782 an array of FSSpec records.
783
784 A noErr result indicates that the volumes array was filled
785 (actVolCount == reqVolCount) and there may be additional volumes
786 mounted. A nsvErr result indicates that the end of the volume list
787 was found and actVolCount volumes were actually found this time.
788
789 volumes input: Pointer to array of FSSpec where the volume list
790 is returned.
791 reqVolCount input: Maximum number of volumes to return (the number of
792 elements in the volumes array).
793 actVolCount output: The number of volumes actually returned.
794 volIndex input: The current volume index position. Set to 1 to
795 start with the first volume.
796 output: The volume index position to get the next volume.
797 Pass this value the next time you call OnLine to
798 start where you left off.
799
800 Result Codes
801 noErr 0 No error, but there are more volumes
802 to list
803 nsvErr -35 No more volumes to be listed
804 paramErr -50 volIndex was <= 0
805 */
806
807 /*****************************************************************************/
808
809 pascal OSErr SetDefault(short newVRefNum,
810 long newDirID,
811 short *oldVRefNum,
812 long *oldDirID);
813 /* ¦ Set the default volume before making Standard I/O requests.
814 The SetDefault function sets the default volume and directory to the
815 volume specified by newVRefNum and the directory specified by newDirID.
816 The current default volume reference number and directory ID are
817 returned in oldVRefNum and oldDir and must be used to restore the
818 default volume and directory to their previous state *as soon as
819 possible* with the RestoreDefault function. These two functions are
820 designed to be used as a wrapper around Standard I/O routines where
821 the location of the file is implied to be the default volume and
822 directory. In other words, this is how you should use these functions:
823
824 error = SetDefault(newVRefNum, newDirID, &oldVRefNum, &oldDirID);
825 if ( error == noErr )
826 {
827 // call the Stdio functions like remove, rename, tmpfile,
828 // fopen, freopen, etc. or non-ANSI extensions like
829 // fdopen,fsetfileinfo, -- create, open, unlink, etc. here!
830
831 error = RestoreDefault(oldVRefNum, oldDirID);
832 }
833
834 By using these functions as a wrapper, you won't need to open a working
835 directory (because SetDefault and RestoreDefault use HSetVol) and you
836 won't have to worry about the effects of using HSetVol (documented in
837 Technical Note "FL 11 - PBHSetVol is Dangerous" and in the
838 Inside Macintosh: Files book in the description of the HSetVol and
839 PBHSetVol functions) because the default volume/directory is restored
840 before giving up control to code that might be affected by HSetVol.
841
842 newVRefNum input: Volume specification (volume reference number,
843 working directory number, drive number, or 0) of
844 the new default volume.
845 newDirID input: Directory ID of the new default directory.
846 oldVRefNum output: The volume specification to save for use with
847 RestoreDefault.
848 oldDirID output: The directory ID to save for use with
849 RestoreDefault.
850
851 Result Codes
852 noErr 0 No error
853 nsvErr -35 No such volume
854 bdNamErr -37 Bad volume name
855 fnfErr -43 Directory not found
856 paramErr -50 No default volume
857 afpAccessDenied -5000 User does not have access to the directory
858
859 __________
860
861 Also see: RestoreDefault
862 */
863
864 /*****************************************************************************/
865
866 pascal OSErr RestoreDefault(short oldVRefNum,
867 long oldDirID);
868 /* ¦ Restore the default volume after making Standard C I/O requests.
869 The RestoreDefault function restores the default volume and directory
870 to the volume specified by oldVRefNum and the directory specified by
871 oldDirID. The oldVRefNum and oldDirID parameters were previously
872 obtained from the SetDefault function. These two functions are designed
873 to be used as a wrapper around Standard C I/O routines where the
874 location of the file is implied to be the default volume and directory.
875 In other words, this is how you should use these functions:
876
877 error = SetDefault(newVRefNum, newDirID, &oldVRefNum, &oldDirID);
878 if ( error == noErr )
879 {
880 // call the Stdio functions like remove, rename, tmpfile,
881 // fopen, freopen, etc. or non-ANSI extensions like
882 // fdopen,fsetfileinfo, -- create, open, unlink, etc. here!
883
884 error = RestoreDefault(oldVRefNum, oldDirID);
885 }
886
887 By using these functions as a wrapper, you won't need to open a working
888 directory (because SetDefault and RestoreDefault use HSetVol) and you
889 won't have to worry about the effects of using HSetVol (documented in
890 Technical Note "FL 11 - PBHSetVol is Dangerous" and in the
891 Inside Macintosh: Files book in the description of the HSetVol and
892 PBHSetVol functions) because the default volume/directory is restored
893 before giving up control to code that might be affected by HSetVol.
894
895 oldVRefNum input: The volume specification to restore.
896 oldDirID input: The directory ID to restore.
897
898 Result Codes
899 noErr 0 No error
900 nsvErr -35 No such volume
901 bdNamErr -37 Bad volume name
902 fnfErr -43 Directory not found
903 paramErr -50 No default volume
904 rfNumErr -51 Bad working directory reference number
905 afpAccessDenied -5000 User does not have access to the directory
906
907 __________
908
909 Also see: SetDefault
910 */
911
912 /*****************************************************************************/
913
914 pascal OSErr GetDInfo(short vRefNum,
915 long dirID,
916 ConstStr255Param name,
917 DInfo *fndrInfo);
918 /* ¦ Get the finder information for a directory.
919 The GetDInfo function gets the finder information for a directory.
920
921 vRefNum input: Volume specification.
922 dirID input: Directory ID.
923 name input: Pointer to object name, or nil when dirID
924 specifies a directory that's the object.
925 fndrInfo output: If the object is a directory, then its DInfo.
926
927 Result Codes
928 noErr 0 No error
929 nsvErr -35 No such volume
930 ioErr -36 I/O error
931 bdNamErr -37 Bad filename
932 fnfErr -43 File not found
933 paramErr -50 No default volume
934 dirNFErr -120 Directory not found or incomplete pathname
935 afpAccessDenied -5000 User does not have the correct access
936 afpObjectTypeErr -5025 Directory not found or incomplete pathname
937
938 __________
939
940 Also see: FSpGetDInfo, FSpGetFInfoCompat
941 */
942
943 /*****************************************************************************/
944
945 pascal OSErr FSpGetDInfo(const FSSpec *spec,
946 DInfo *fndrInfo);
947 /* ¦ Get the finder information for a directory.
948 The FSpGetDInfo function gets the finder information for a directory.
949
950 spec input: An FSSpec record specifying the directory.
951 fndrInfo output: If the object is a directory, then its DInfo.
952
953 Result Codes
954 noErr 0 No error
955 nsvErr -35 No such volume
956 ioErr -36 I/O error
957 bdNamErr -37 Bad filename
958 fnfErr -43 File not found
959 paramErr -50 No default volume
960 dirNFErr -120 Directory not found or incomplete pathname
961 afpAccessDenied -5000 User does not have the correct access
962 afpObjectTypeErr -5025 Directory not found or incomplete pathname
963
964 __________
965
966 Also see: FSpGetFInfoCompat, GetDInfo
967 */
968
969 /*****************************************************************************/
970
971 pascal OSErr SetDInfo(short vRefNum,
972 long dirID,
973 ConstStr255Param name,
974 const DInfo *fndrInfo);
975 /* ¦ Set the finder information for a directory.
976 The SetDInfo function sets the finder information for a directory.
977
978 vRefNum input: Volume specification.
979 dirID input: Directory ID.
980 name input: Pointer to object name, or nil when dirID
981 specifies a directory that's the object.
982 fndrInfo input: The DInfo.
983
984 Result Codes
985 noErr 0 No error
986 nsvErr -35 No such volume
987 ioErr -36 I/O error
988 bdNamErr -37 Bad filename
989 fnfErr -43 File not found
990 fLckdErr -45 File is locked
991 vLckdErr -46 Volume is locked or read-only
992 paramErr -50 No default volume
993 dirNFErr -120 Directory not found or incomplete pathname
994 afpAccessDenied -5000 User does not have the correct access
995 afpObjectTypeErr -5025 Directory not found or incomplete pathname
996
997 __________
998
999 Also see: FSpSetDInfo, FSpSetFInfoCompat
1000 */
1001
1002 /*****************************************************************************/
1003
1004 pascal OSErr FSpSetDInfo(const FSSpec *spec,
1005 const DInfo *fndrInfo);
1006 /* ¦ Set the finder information for a directory.
1007 The FSpSetDInfo function sets the finder information for a directory.
1008
1009 spec input: An FSSpec record specifying the directory.
1010 fndrInfo input: The DInfo.
1011
1012 Result Codes
1013 noErr 0 No error
1014 nsvErr -35 No such volume
1015 ioErr -36 I/O error
1016 bdNamErr -37 Bad filename
1017 fnfErr -43 File not found
1018 fLckdErr -45 File is locked
1019 vLckdErr -46 Volume is locked or read-only
1020 paramErr -50 No default volume
1021 dirNFErr -120 Directory not found or incomplete pathname
1022 afpAccessDenied -5000 User does not have the correct access
1023 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1024
1025 __________
1026
1027 Also see: FSpSetFInfoCompat, SetDInfo
1028 */
1029
1030 /*****************************************************************************/
1031
1032 #if OLDROUTINENAMES
1033 #define GetDirID(vRefNum, dirID, name, theDirID, isDirectory) \
1034 GetDirectoryID(vRefNum, dirID, name, theDirID, isDirectory)
1035 #endif
1036
1037 pascal OSErr GetDirectoryID(short vRefNum,
1038 long dirID,
1039 ConstStr255Param name,
1040 long *theDirID,
1041 Boolean *isDirectory);
1042 /* ¦ Get the directory ID number of the directory specified.
1043 The GetDirectoryID function gets the directory ID number of the
1044 directory specified. If a file is specified, then the parent
1045 directory of the file is returned and isDirectory is false. If
1046 a directory is specified, then that directory's ID number is
1047 returned and isDirectory is true.
1048 WARNING: Volume names on the Macintosh are *not* unique -- Multiple
1049 mounted volumes can have the same name. For this reason, the use of a
1050 volume name or full pathname to identify a specific volume may not
1051 produce the results you expect. If more than one volume has the same
1052 name and a volume name or full pathname is used, the File Manager
1053 currently uses the first volume it finds with a matching name in the
1054 volume queue.
1055
1056 vRefNum input: Volume specification.
1057 dirID input: Directory ID.
1058 name input: Pointer to object name, or nil when dirID
1059 specifies a directory that's the object.
1060 theDirID output: If the object is a file, then its parent directory
1061 ID. If the object is a directory, then its ID.
1062 isDirectory output: True if object is a directory; false if
1063 object is a file.
1064
1065 Result Codes
1066 noErr 0 No error
1067 nsvErr -35 No such volume
1068 ioErr -36 I/O error
1069 bdNamErr -37 Bad filename
1070 fnfErr -43 File not found
1071 paramErr -50 No default volume
1072 dirNFErr -120 Directory not found or incomplete pathname
1073 afpAccessDenied -5000 User does not have the correct access
1074 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1075 */
1076
1077 /*****************************************************************************/
1078
1079 #if OLDROUTINENAMES
1080 #define DirIDFromFSSpec(spec, theDirID, isDirectory) \
1081 FSpGetDirectoryID(spec, theDirID, isDirectory)
1082 #endif
1083
1084 pascal OSErr FSpGetDirectoryID(const FSSpec *spec,
1085 long *theDirID,
1086 Boolean *isDirectory);
1087 /* ¦ Get the directory ID number of a directory.
1088 The FSpGetDirectoryID function gets the directory ID number of the
1089 directory specified by spec. If spec is to a file, then the parent
1090 directory of the file is returned and isDirectory is false. If
1091 spec is to a directory, then that directory's ID number is
1092 returned and isDirectory is true.
1093
1094 spec input: An FSSpec record specifying the directory.
1095 theDirID output: The directory ID.
1096 isDirectory output: True if object is a directory; false if
1097 object is a file.
1098
1099 Result Codes
1100 noErr 0 No error
1101 nsvErr -35 No such volume
1102 ioErr -36 I/O error
1103 bdNamErr -37 Bad filename
1104 fnfErr -43 File not found
1105 paramErr -50 No default volume
1106 dirNFErr -120 Directory not found or incomplete pathname
1107 afpAccessDenied -5000 User does not have the correct access
1108 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1109 */
1110
1111 /*****************************************************************************/
1112
1113 pascal OSErr GetDirName(short vRefNum,
1114 long dirID,
1115 Str31 name);
1116 /* ¦ Get the name of a directory from its directory ID.
1117 The GetDirName function gets the name of a directory from its
1118 directory ID.
1119
1120 vRefNum input: Volume specification.
1121 dirID input: Directory ID.
1122 name output: Points to a Str31 where the directory name is to be
1123 returned.
1124
1125 Result Codes
1126 noErr 0 No error
1127 nsvErr -35 No such volume
1128 ioErr -36 I/O error
1129 bdNamErr -37 Bad filename
1130 fnfErr -43 File not found
1131 paramErr -50 No default volume or
1132 name parameter was NULL
1133 dirNFErr -120 Directory not found or incomplete pathname
1134 afpAccessDenied -5000 User does not have the correct access
1135 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1136 */
1137
1138 /*****************************************************************************/
1139
1140 pascal OSErr GetIOACUser(short vRefNum,
1141 long dirID,
1142 ConstStr255Param name,
1143 SInt8 *ioACUser);
1144 /* ¦ Get a directory's access restrictions byte.
1145 GetIOACUser returns a directory's access restrictions byte.
1146 Use the masks and macro defined in MoreFilesExtras to check for
1147 specific access priviledges.
1148
1149 vRefNum input: Volume specification.
1150 dirID input: Directory ID.
1151 name input: Pointer to object name, or nil when dirID
1152 specifies a directory that's the object.
1153 ioACUser output: The access restriction byte
1154
1155 Result Codes
1156 noErr 0 No error
1157 nsvErr -35 No such volume
1158 ioErr -36 I/O error
1159 bdNamErr -37 Bad filename
1160 fnfErr -43 File not found
1161 paramErr -50 No default volume
1162 dirNFErr -120 Directory not found or incomplete pathname
1163 afpAccessDenied -5000 User does not have the correct access
1164 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1165 */
1166
1167 /*****************************************************************************/
1168
1169 pascal OSErr FSpGetIOACUser(const FSSpec *spec,
1170 SInt8 *ioACUser);
1171 /* ¦ Get a directory's access restrictions byte.
1172 FSpGetIOACUser returns a directory's access restrictions byte.
1173 Use the masks and macro defined in MoreFilesExtras to check for
1174 specific access priviledges.
1175
1176 spec input: An FSSpec record specifying the directory.
1177 ioACUser output: The access restriction byte
1178
1179 Result Codes
1180 noErr 0 No error
1181 nsvErr -35 No such volume
1182 ioErr -36 I/O error
1183 bdNamErr -37 Bad filename
1184 fnfErr -43 File not found
1185 paramErr -50 No default volume
1186 dirNFErr -120 Directory not found or incomplete pathname
1187 afpAccessDenied -5000 User does not have the correct access
1188 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1189 */
1190
1191 /*****************************************************************************/
1192
1193 pascal OSErr GetParentID(short vRefNum,
1194 long dirID,
1195 ConstStr255Param name,
1196 long *parID);
1197 /* ¦ Get the parent directory ID number of the specified object.
1198 The GetParentID function gets the parent directory ID number of the
1199 specified object.
1200
1201 vRefNum input: Volume specification.
1202 dirID input: Directory ID.
1203 name input: Pointer to object name, or nil when dirID specifies
1204 a directory that's the object.
1205 parID output: The parent directory ID of the specified object.
1206
1207 Result Codes
1208 noErr 0 No error
1209 nsvErr -35 No such volume
1210 ioErr -36 I/O error
1211 bdNamErr -37 Bad filename
1212 fnfErr -43 File not found
1213 paramErr -50 No default volume
1214 dirNFErr -120 Directory not found or incomplete pathname
1215 afpAccessDenied -5000 User does not have the correct access
1216 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1217 */
1218
1219 /*****************************************************************************/
1220
1221 pascal OSErr GetFilenameFromPathname(ConstStr255Param pathname,
1222 Str255 filename);
1223 /* ¦ Get the object name from the end of a full or partial pathname.
1224 The GetFilenameFromPathname function gets the file (or directory) name
1225 from the end of a full or partial pathname. Returns notAFileErr if the
1226 pathname is nil, the pathname is empty, or the pathname cannot refer to
1227 a filename (with a noErr result, the pathname could still refer to a
1228 directory).
1229
1230 pathname input: A full or partial pathname.
1231 filename output: The file (or directory) name.
1232
1233 Result Codes
1234 noErr 0 No error
1235 notAFileErr -1302 The pathname is nil, the pathname
1236 is empty, or the pathname cannot refer
1237 to a filename
1238
1239 __________
1240
1241 See also: GetObjectLocation.
1242 */
1243
1244 /*****************************************************************************/
1245
1246 pascal OSErr GetObjectLocation(short vRefNum,
1247 long dirID,
1248 ConstStr255Param pathname,
1249 short *realVRefNum,
1250 long *realParID,
1251 Str255 realName,
1252 Boolean *isDirectory);
1253 /* ¦ Get a file system object's location.
1254 The GetObjectLocation function gets a file system object's location -
1255 that is, its real volume reference number, real parent directory ID,
1256 and name. While we're at it, determine if the object is a file or directory.
1257 If GetObjectLocation returns fnfErr, then the location information
1258 returned is valid, but it describes an object that doesn't exist.
1259 You can use the location information for another operation, such as
1260 creating a file or directory.
1261
1262 vRefNum input: Volume specification.
1263 dirID input: Directory ID.
1264 pathname input: Pointer to object name, or nil when dirID specifies
1265 a directory that's the object.
1266 realVRefNum output: The real volume reference number.
1267 realParID output: The parent directory ID of the specified object.
1268 realName output: The name of the specified object (the case of the
1269 object name may not be the same as the object's
1270 catalog entry on disk - since the Macintosh file
1271 system is not case sensitive, it shouldn't matter).
1272 isDirectory output: True if object is a directory; false if object
1273 is a file.
1274
1275 Result Codes
1276 noErr 0 No error
1277 nsvErr -35 No such volume
1278 ioErr -36 I/O error
1279 bdNamErr -37 Bad filename
1280 fnfErr -43 File not found
1281 paramErr -50 No default volume
1282 dirNFErr -120 Directory not found or incomplete pathname
1283 notAFileErr -1302 The pathname is nil, the pathname
1284 is empty, or the pathname cannot refer
1285 to a filename
1286 afpAccessDenied -5000 User does not have the correct access
1287 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1288
1289 __________
1290
1291 See also: FSMakeFSSpecCompat
1292 */
1293
1294 /*****************************************************************************/
1295
1296 pascal OSErr GetDirItems(short vRefNum,
1297 long dirID,
1298 ConstStr255Param name,
1299 Boolean getFiles,
1300 Boolean getDirectories,
1301 FSSpecPtr items,
1302 short reqItemCount,
1303 short *actItemCount,
1304 short *itemIndex);
1305 /* ¦ Return a list of items in a directory.
1306 The GetDirItems function returns a list of items in the specified
1307 directory in an array of FSSpec records. File, subdirectories, or
1308 both can be returned in the list.
1309
1310 A noErr result indicates that the items array was filled
1311 (actItemCount == reqItemCount) and there may be additional items
1312 left in the directory. A fnfErr result indicates that the end of
1313 the directory list was found and actItemCount items were actually
1314 found this time.
1315
1316 vRefNum input: Volume specification.
1317 dirID input: Directory ID.
1318 name input: Pointer to object name, or nil when dirID
1319 specifies a directory that's the object.
1320 getFiles input: Pass true to have files added to the items list.
1321 getDirectories input: Pass true to have directories added to the
1322 items list.
1323 items input: Pointer to array of FSSpec where the item list
1324 is returned.
1325 reqItemCount input: Maximum number of items to return (the number
1326 of elements in the items array).
1327 actItemCount output: The number of items actually returned.
1328 itemIndex input: The current item index position. Set to 1 to
1329 start with the first item in the directory.
1330 output: The item index position to get the next item.
1331 Pass this value the next time you call
1332 GetDirItems to start where you left off.
1333
1334 Result Codes
1335 noErr 0 No error, but there are more items
1336 to list
1337 nsvErr -35 No such volume
1338 ioErr -36 I/O error
1339 bdNamErr -37 Bad filename
1340 fnfErr -43 File not found, there are no more items
1341 to be listed.
1342 paramErr -50 No default volume or itemIndex was <= 0
1343 dirNFErr -120 Directory not found or incomplete pathname
1344 afpAccessDenied -5000 User does not have the correct access
1345 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1346 */
1347
1348 /*****************************************************************************/
1349
1350 pascal OSErr DeleteDirectoryContents(short vRefNum,
1351 long dirID,
1352 ConstStr255Param name);
1353 /* ¦ Delete the contents of a directory.
1354 The DeleteDirectoryContents function deletes the contents of a directory.
1355 All files and subdirectories in the specified directory are deleted.
1356 If a locked file or directory is encountered, it is unlocked and then
1357 deleted. If any unexpected errors are encountered,
1358 DeleteDirectoryContents quits and returns to the caller.
1359
1360 vRefNum input: Volume specification.
1361 dirID input: Directory ID.
1362 name input: Pointer to directory name, or nil when dirID specifies
1363 a directory that's the object.
1364
1365 Result Codes
1366 noErr 0 No error
1367 nsvErr -35 No such volume
1368 ioErr -36 I/O error
1369 bdNamErr -37 Bad filename
1370 fnfErr -43 File not found
1371 wPrErr -44 Hardware volume lock
1372 fLckdErr -45 File is locked
1373 vLckdErr -46 Software volume lock
1374 fBsyErr -47 File busy, directory not empty, or working directory control block open
1375 paramErr -50 No default volume
1376 dirNFErr -120 Directory not found or incomplete pathname
1377 afpAccessDenied -5000 User does not have the correct access
1378 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1379
1380 __________
1381
1382 Also see: DeleteDirectory
1383 */
1384
1385 /*****************************************************************************/
1386
1387 pascal OSErr DeleteDirectory(short vRefNum,
1388 long dirID,
1389 ConstStr255Param name);
1390 /* ¦ Delete a directory and its contents.
1391 The DeleteDirectory function deletes a directory and its contents.
1392 All files and subdirectories in the specified directory are deleted.
1393 If a locked file or directory is encountered, it is unlocked and then
1394 deleted. After deleting the directories contents, the directory is
1395 deleted. If any unexpected errors are encountered, DeleteDirectory
1396 quits and returns to the caller.
1397
1398 vRefNum input: Volume specification.
1399 dirID input: Directory ID.
1400 name input: Pointer to directory name, or nil when dirID specifies
1401 a directory that's the object.
1402
1403 Result Codes
1404 noErr 0 No error
1405 nsvErr -35 No such volume
1406 ioErr -36 I/O error
1407 bdNamErr -37 Bad filename
1408 fnfErr -43 File not found
1409 wPrErr -44 Hardware volume lock
1410 fLckdErr -45 File is locked
1411 vLckdErr -46 Software volume lock
1412 fBsyErr -47 File busy, directory not empty, or working directory control block open
1413 paramErr -50 No default volume
1414 dirNFErr -120 Directory not found or incomplete pathname
1415 afpAccessDenied -5000 User does not have the correct access
1416 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1417
1418 __________
1419
1420 Also see: DeleteDirectoryContents
1421 */
1422
1423 /*****************************************************************************/
1424
1425 pascal OSErr CheckObjectLock(short vRefNum,
1426 long dirID,
1427 ConstStr255Param name);
1428 /* ¦ Determine if a file or directory is locked.
1429 The CheckObjectLock function determines if a file or directory is locked.
1430 If CheckObjectLock returns noErr, then the file or directory
1431 is not locked. If CheckObjectLock returns fLckdErr, the it is locked.
1432
1433 vRefNum input: Volume specification.
1434 dirID input: Directory ID.
1435 name input: Pointer to object name, or nil when dirID specifies
1436 a directory that's the object.
1437
1438 Result Codes
1439 noErr 0 No error
1440 nsvErr -35 No such volume
1441 ioErr -36 I/O error
1442 bdNamErr -37 Bad filename
1443 fnfErr -43 File not found
1444 fLckdErr -45 File is locked
1445 paramErr -50 No default volume
1446 dirNFErr -120 Directory not found or incomplete pathname
1447 afpAccessDenied -5000 User does not have the correct access
1448 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1449
1450 __________
1451
1452 Also see: FSpCheckObjectLock
1453 */
1454
1455 /*****************************************************************************/
1456
1457 pascal OSErr FSpCheckObjectLock(const FSSpec *spec);
1458 /* ¦ Determine if a file or directory is locked.
1459 The FSpCheckObjectLock function determines if a file or directory is locked.
1460 If FSpCheckObjectLock returns noErr, then the file or directory
1461 is not locked.
1462
1463 spec input: An FSSpec record specifying the object.
1464
1465 Result Codes
1466 noErr 0 No error
1467 nsvErr -35 No such volume
1468 ioErr -36 I/O error
1469 bdNamErr -37 Bad filename
1470 fnfErr -43 File not found
1471 fLckdErr -45 File is locked
1472 paramErr -50 No default volume
1473 dirNFErr -120 Directory not found or incomplete pathname
1474 afpAccessDenied -5000 User does not have the correct access
1475 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1476
1477 __________
1478
1479 Also see: CheckObjectLock
1480 */
1481
1482 /*****************************************************************************/
1483
1484 pascal OSErr GetFileSize(short vRefNum,
1485 long dirID,
1486 ConstStr255Param fileName,
1487 long *dataSize,
1488 long *rsrcSize);
1489 /* ¦ Get the logical sizes of a file's forks.
1490 The GetFileSize function returns the logical size of a file's
1491 data and resource fork.
1492
1493 vRefNum input: Volume specification.
1494 dirID input: Directory ID.
1495 name input: The name of the file.
1496 dataSize output: The number of bytes in the file's data fork.
1497 rsrcSize output: The number of bytes in the file's resource fork.
1498
1499 Result Codes
1500 noErr 0 No error
1501 nsvErr -35 No such volume
1502 ioErr -36 I/O error
1503 bdNamErr -37 Bad filename
1504 fnfErr -43 File not found
1505 paramErr -50 No default volume
1506 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
1507 afpAccessDenied -5000 User does not have the correct access
1508 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1509
1510 __________
1511
1512 See also: FSpGetFileSize
1513 */
1514
1515 /*****************************************************************************/
1516
1517 pascal OSErr FSpGetFileSize(const FSSpec *spec,
1518 long *dataSize,
1519 long *rsrcSize);
1520 /* ¦ Get the logical sizes of a file's forks.
1521 The FSpGetFileSize function returns the logical size of a file's
1522 data and resource fork.
1523
1524 spec input: An FSSpec record specifying the file.
1525 dataSize output: The number of bytes in the file's data fork.
1526 rsrcSize output: The number of bytes in the file's resource fork.
1527
1528 Result Codes
1529 noErr 0 No error
1530 nsvErr -35 No such volume
1531 ioErr -36 I/O error
1532 bdNamErr -37 Bad filename
1533 fnfErr -43 File not found
1534 paramErr -50 No default volume
1535 dirNFErrdirNFErr -120 Directory not found or incomplete pathname
1536 afpAccessDenied -5000 User does not have the correct access
1537 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1538
1539 __________
1540
1541 See also: GetFileSize
1542 */
1543
1544 /*****************************************************************************/
1545
1546 pascal OSErr BumpDate(short vRefNum,
1547 long dirID,
1548 ConstStr255Param name);
1549 /* ¦ Update the modification date of a file or directory.
1550 The BumpDate function changes the modification date of a file or
1551 directory to the current date/time. If the modification date is already
1552 equal to the current date/time, then add one second to the
1553 modification date.
1554
1555 vRefNum input: Volume specification.
1556 dirID input: Directory ID.
1557 name input: Pointer to object name, or nil when dirID specifies
1558 a directory that's the object.
1559
1560 Result Codes
1561 noErr 0 No error
1562 nsvErr -35 No such volume
1563 ioErr -36 I/O error
1564 bdNamErr -37 Bad filename
1565 fnfErr -43 File not found
1566 fLckdErr -45 File is locked
1567 vLckdErr -46 Volume is locked or read-only
1568 paramErr -50 No default volume
1569 dirNFErr -120 Directory not found or incomplete pathname
1570 afpAccessDenied -5000 User does not have the correct access
1571 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1572
1573 __________
1574
1575 See also: FSpBumpDate
1576 */
1577
1578 /*****************************************************************************/
1579
1580 pascal OSErr FSpBumpDate(const FSSpec *spec);
1581 /* ¦ Update the modification date of a file or directory.
1582 The FSpBumpDate function changes the modification date of a file or
1583 directory to the current date/time. If the modification date is already
1584 equal to the current date/time, then add one second to the
1585 modification date.
1586
1587 spec input: An FSSpec record specifying the object.
1588
1589 Result Codes
1590 noErr 0 No error
1591 nsvErr -35 No such volume
1592 ioErr -36 I/O error
1593 bdNamErr -37 Bad filename
1594 fnfErr -43 File not found
1595 fLckdErr -45 File is locked
1596 vLckdErr -46 Volume is locked or read-only
1597 paramErr -50 No default volume
1598 dirNFErr -120 Directory not found or incomplete pathname
1599 afpAccessDenied -5000 User does not have the correct access
1600 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1601
1602 __________
1603
1604 See also: BumpDate
1605 */
1606
1607 /*****************************************************************************/
1608
1609 pascal OSErr ChangeCreatorType(short vRefNum,
1610 long dirID,
1611 ConstStr255Param name,
1612 OSType creator,
1613 OSType fileType);
1614 /* ¦ Change the creator or file type of a file.
1615 The ChangeCreatorType function changes the creator or file type of a file.
1616
1617 vRefNum input: Volume specification.
1618 dirID input: Directory ID.
1619 name input: The name of the file.
1620 creator input: The new creator type or 0x00000000 to leave
1621 the creator type alone.
1622 fileType input: The new file type or 0x00000000 to leave the
1623 file type alone.
1624
1625 Result Codes
1626 noErr 0 No error
1627 nsvErr -35 No such volume
1628 ioErr -36 I/O error
1629 bdNamErr -37 Bad filename
1630 fnfErr -43 File not found
1631 fLckdErr -45 File is locked
1632 vLckdErr -46 Volume is locked or read-only
1633 paramErr -50 No default volume
1634 dirNFErr -120 Directory not found or incomplete pathname
1635 notAFileErr -1302 Name was not a file
1636 afpAccessDenied -5000 User does not have the correct access
1637 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1638
1639 __________
1640
1641 See also: FSpChangeCreatorType
1642 */
1643
1644 /*****************************************************************************/
1645
1646 pascal OSErr FSpChangeCreatorType(const FSSpec *spec,
1647 OSType creator,
1648 OSType fileType);
1649 /* ¦ Change the creator or file type of a file.
1650 The FSpChangeCreatorType function changes the creator or file type of a file.
1651
1652 spec input: An FSSpec record specifying the file.
1653 creator input: The new creator type or 0x00000000 to leave
1654 the creator type alone.
1655 fileType input: The new file type or 0x00000000 to leave the
1656 file type alone.
1657
1658 Result Codes
1659 noErr 0 No error
1660 nsvErr -35 No such volume
1661 ioErr -36 I/O error
1662 bdNamErr -37 Bad filename
1663 fnfErr -43 File not found
1664 fLckdErr -45 File is locked
1665 vLckdErr -46 Volume is locked or read-only
1666 paramErr -50 No default volume
1667 dirNFErr -120 Directory not found or incomplete pathname
1668 notAFileErr -1302 Name was not a file
1669 afpAccessDenied -5000 User does not have the correct access
1670 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1671
1672 __________
1673
1674 See also: ChangeCreatorType
1675 */
1676
1677 /*****************************************************************************/
1678
1679 pascal OSErr ChangeFDFlags(short vRefNum,
1680 long dirID,
1681 ConstStr255Param name,
1682 Boolean setBits,
1683 unsigned short flagBits);
1684 /* ¦ Set or clear Finder Flag bits.
1685 The ChangeFDFlags function sets or clears Finder Flag bits in the
1686 fdFlags field of a file or directory's FInfo record.
1687
1688 vRefNum input: Volume specification.
1689 dirID input: Directory ID.
1690 name input: Pointer to object name, or nil when dirID specifies
1691 a directory that's the object.
1692 setBits input: If true, then set the bits specified in flagBits.
1693 If false, then clear the bits specified in flagBits.
1694 flagBits input: The flagBits parameter specifies which Finder Flag
1695 bits to set or clear. If a bit in flagBits is set,
1696 then the same bit in fdFlags is either set or
1697 cleared depending on the state of the setBits
1698 parameter.
1699
1700 Result Codes
1701 noErr 0 No error
1702 nsvErr -35 No such volume
1703 ioErr -36 I/O error
1704 bdNamErr -37 Bad filename
1705 fnfErr -43 File not found
1706 fLckdErr -45 File is locked
1707 vLckdErr -46 Volume is locked or read-only
1708 paramErr -50 No default volume
1709 dirNFErr -120 Directory not found or incomplete pathname
1710 afpAccessDenied -5000 User does not have the correct access
1711 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1712
1713 __________
1714
1715 See also: FSpChangeFDFlags
1716 */
1717
1718 /*****************************************************************************/
1719
1720 pascal OSErr FSpChangeFDFlags(const FSSpec *spec,
1721 Boolean setBits,
1722 unsigned short flagBits);
1723 /* ¦ Set or clear Finder Flag bits.
1724 The FSpChangeFDFlags function sets or clears Finder Flag bits in the
1725 fdFlags field of a file or directory's FInfo record.
1726
1727 spec input: An FSSpec record specifying the object.
1728 setBits input: If true, then set the bits specified in flagBits.
1729 If false, then clear the bits specified in flagBits.
1730 flagBits input: The flagBits parameter specifies which Finder Flag
1731 bits to set or clear. If a bit in flagBits is set,
1732 then the same bit in fdFlags is either set or
1733 cleared depending on the state of the setBits
1734 parameter.
1735
1736 Result Codes
1737 noErr 0 No error
1738 nsvErr -35 No such volume
1739 ioErr -36 I/O error
1740 bdNamErr -37 Bad filename
1741 fnfErr -43 File not found
1742 fLckdErr -45 File is locked
1743 vLckdErr -46 Volume is locked or read-only
1744 paramErr -50 No default volume
1745 dirNFErr -120 Directory not found or incomplete pathname
1746 afpAccessDenied -5000 User does not have the correct access
1747 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1748
1749 __________
1750
1751 See also: ChangeFDFlags
1752 */
1753
1754 /*****************************************************************************/
1755
1756 pascal OSErr SetIsInvisible(short vRefNum,
1757 long dirID,
1758 ConstStr255Param name);
1759 /* ¦ Set the invisible Finder Flag bit.
1760 The SetIsInvisible function sets the invisible bit in the fdFlags
1761 word of the specified file or directory's finder information.
1762
1763 vRefNum input: Volume specification.
1764 dirID input: Directory ID.
1765 name input: Pointer to object name, or nil when dirID specifies
1766 a directory that's the object.
1767
1768 Result Codes
1769 noErr 0 No error
1770 nsvErr -35 No such volume
1771 ioErr -36 I/O error
1772 bdNamErr -37 Bad filename
1773 fnfErr -43 File not found
1774 fLckdErr -45 File is locked
1775 vLckdErr -46 Volume is locked or read-only
1776 paramErr -50 No default volume
1777 dirNFErr -120 Directory not found or incomplete pathname
1778 afpAccessDenied -5000 User does not have the correct access
1779 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1780
1781 __________
1782
1783 See also: FSpSetIsInvisible, ClearIsInvisible, FSpClearIsInvisible
1784 */
1785
1786 /*****************************************************************************/
1787
1788 pascal OSErr FSpSetIsInvisible(const FSSpec *spec);
1789 /* ¦ Set the invisible Finder Flag bit.
1790 The FSpSetIsInvisible function sets the invisible bit in the fdFlags
1791 word of the specified file or directory's finder information.
1792
1793 spec input: An FSSpec record specifying the object.
1794
1795 Result Codes
1796 noErr 0 No error
1797 nsvErr -35 No such volume
1798 ioErr -36 I/O error
1799 bdNamErr -37 Bad filename
1800 fnfErr -43 File not found
1801 fLckdErr -45 File is locked
1802 vLckdErr -46 Volume is locked or read-only
1803 paramErr -50 No default volume
1804 dirNFErr -120 Directory not found or incomplete pathname
1805 afpAccessDenied -5000 User does not have the correct access
1806 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1807
1808 __________
1809
1810 See also: SetIsInvisible, ClearIsInvisible, FSpClearIsInvisible
1811 */
1812
1813 /*****************************************************************************/
1814
1815 pascal OSErr ClearIsInvisible(short vRefNum,
1816 long dirID,
1817 ConstStr255Param name);
1818 /* ¦ Clear the invisible Finder Flag bit.
1819 The ClearIsInvisible function clears the invisible bit in the fdFlags
1820 word of the specified file or directory's finder information.
1821
1822 vRefNum input: Volume specification.
1823 dirID input: Directory ID.
1824 name input: Pointer to object name, or nil when dirID specifies
1825 a directory that's the object.
1826
1827 Result Codes
1828 noErr 0 No error
1829 nsvErr -35 No such volume
1830 ioErr -36 I/O error
1831 bdNamErr -37 Bad filename
1832 fnfErr -43 File not found
1833 fLckdErr -45 File is locked
1834 vLckdErr -46 Volume is locked or read-only
1835 paramErr -50 No default volume
1836 dirNFErr -120 Directory not found or incomplete pathname
1837 afpAccessDenied -5000 User does not have the correct access
1838 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1839
1840 __________
1841
1842 See also: SetIsInvisible, FSpSetIsInvisible, FSpClearIsInvisible
1843 */
1844
1845 /*****************************************************************************/
1846
1847 pascal OSErr FSpClearIsInvisible(const FSSpec *spec);
1848 /* ¦ Clear the invisible Finder Flag bit.
1849 The FSpClearIsInvisible function clears the invisible bit in the fdFlags
1850 word of the specified file or directory's finder information.
1851
1852 spec input: An FSSpec record specifying the object.
1853
1854 Result Codes
1855 noErr 0 No error
1856 nsvErr -35 No such volume
1857 ioErr -36 I/O error
1858 bdNamErr -37 Bad filename
1859 fnfErr -43 File not found
1860 fLckdErr -45 File is locked
1861 vLckdErr -46 Volume is locked or read-only
1862 paramErr -50 No default volume
1863 dirNFErr -120 Directory not found or incomplete pathname
1864 afpAccessDenied -5000 User does not have the correct access
1865 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1866
1867 __________
1868
1869 See also: SetIsInvisible, FSpSetIsInvisible, ClearIsInvisible
1870 */
1871
1872 /*****************************************************************************/
1873
1874 pascal OSErr SetNameLocked(short vRefNum,
1875 long dirID,
1876 ConstStr255Param name);
1877 /* ¦ Set the nameLocked Finder Flag bit.
1878 The SetNameLocked function sets the nameLocked bit in the fdFlags word
1879 of the specified file or directory's finder information.
1880
1881 vRefNum input: Volume specification.
1882 dirID input: Directory ID.
1883 name input: Pointer to object name, or nil when dirID specifies
1884 a directory that's the object.
1885
1886 Result Codes
1887 noErr 0 No error
1888 nsvErr -35 No such volume
1889 ioErr -36 I/O error
1890 bdNamErr -37 Bad filename
1891 fnfErr -43 File not found
1892 fLckdErr -45 File is locked
1893 vLckdErr -46 Volume is locked or read-only
1894 paramErr -50 No default volume
1895 dirNFErr -120 Directory not found or incomplete pathname
1896 afpAccessDenied -5000 User does not have the correct access
1897 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1898
1899 __________
1900
1901 See also: FSpSetNameLocked, ClearNameLocked, FSpClearNameLocked
1902 */
1903
1904 /*****************************************************************************/
1905
1906 pascal OSErr FSpSetNameLocked(const FSSpec *spec);
1907 /* ¦ Set the nameLocked Finder Flag bit.
1908 The FSpSetNameLocked function sets the nameLocked bit in the fdFlags word
1909 of the specified file or directory's finder information.
1910
1911 spec input: An FSSpec record specifying the object.
1912
1913 Result Codes
1914 noErr 0 No error
1915 nsvErr -35 No such volume
1916 ioErr -36 I/O error
1917 bdNamErr -37 Bad filename
1918 fnfErr -43 File not found
1919 fLckdErr -45 File is locked
1920 vLckdErr -46 Volume is locked or read-only
1921 paramErr -50 No default volume
1922 dirNFErr -120 Directory not found or incomplete pathname
1923 afpAccessDenied -5000 User does not have the correct access
1924 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1925
1926 __________
1927
1928 See also: SetNameLocked, ClearNameLocked, FSpClearNameLocked
1929 */
1930
1931 /*****************************************************************************/
1932
1933 pascal OSErr ClearNameLocked(short vRefNum,
1934 long dirID,
1935 ConstStr255Param name);
1936 /* ¦ Clear the nameLocked Finder Flag bit.
1937 The ClearNameLocked function clears the nameLocked bit in the fdFlags
1938 word of the specified file or directory's finder information.
1939
1940 vRefNum input: Volume specification.
1941 dirID input: Directory ID.
1942 name input: Pointer to object name, or nil when dirID specifies
1943 a directory that's the object.
1944
1945 Result Codes
1946 noErr 0 No error
1947 nsvErr -35 No such volume
1948 ioErr -36 I/O error
1949 bdNamErr -37 Bad filename
1950 fnfErr -43 File not found
1951 fLckdErr -45 File is locked
1952 vLckdErr -46 Volume is locked or read-only
1953 paramErr -50 No default volume
1954 dirNFErr -120 Directory not found or incomplete pathname
1955 afpAccessDenied -5000 User does not have the correct access
1956 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1957
1958 __________
1959
1960 See also: SetNameLocked, FSpSetNameLocked, FSpClearNameLocked
1961 */
1962
1963 /*****************************************************************************/
1964
1965 pascal OSErr FSpClearNameLocked(const FSSpec *spec);
1966 /* ¦ Clear the nameLocked Finder Flag bit.
1967 The FSpClearNameLocked function clears the nameLocked bit in the fdFlags
1968 word of the specified file or directory's finder information.
1969
1970 spec input: An FSSpec record specifying the object.
1971
1972 Result Codes
1973 noErr 0 No error
1974 nsvErr -35 No such volume
1975 ioErr -36 I/O error
1976 bdNamErr -37 Bad filename
1977 fnfErr -43 File not found
1978 fLckdErr -45 File is locked
1979 vLckdErr -46 Volume is locked or read-only
1980 paramErr -50 No default volume
1981 dirNFErr -120 Directory not found or incomplete pathname
1982 afpAccessDenied -5000 User does not have the correct access
1983 afpObjectTypeErr -5025 Directory not found or incomplete pathname
1984
1985 __________
1986
1987 See also: SetNameLocked, FSpSetNameLocked, ClearNameLocked
1988 */
1989
1990 /*****************************************************************************/
1991
1992 pascal OSErr SetIsStationery(short vRefNum,
1993 long dirID,
1994 ConstStr255Param name);
1995 /* ¦ Set the isStationery Finder Flag bit.
1996 The SetIsStationery function sets the isStationery bit in the
1997 fdFlags word of the specified file or directory's finder information.
1998
1999 vRefNum input: Volume specification.
2000 dirID input: Directory ID.
2001 name input: Pointer to object name, or nil when dirID specifies
2002 a directory that's the object.
2003
2004 Result Codes
2005 noErr 0 No error
2006 nsvErr -35 No such volume
2007 ioErr -36 I/O error
2008 bdNamErr -37 Bad filename
2009 fnfErr -43 File not found
2010 fLckdErr -45 File is locked
2011 vLckdErr -46 Volume is locked or read-only
2012 paramErr -50 No default volume
2013 dirNFErr -120 Directory not found or incomplete pathname
2014 afpAccessDenied -5000 User does not have the correct access
2015 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2016
2017 __________
2018
2019 See also: FSpSetIsStationery, ClearIsStationery, FSpClearIsStationery
2020 */
2021
2022 /*****************************************************************************/
2023
2024 pascal OSErr FSpSetIsStationery(const FSSpec *spec);
2025 /* ¦ Set the isStationery Finder Flag bit.
2026 The FSpSetIsStationery function sets the isStationery bit in the
2027 fdFlags word of the specified file or directory's finder information.
2028
2029 spec input: An FSSpec record specifying the object.
2030
2031 Result Codes
2032 noErr 0 No error
2033 nsvErr -35 No such volume
2034 ioErr -36 I/O error
2035 bdNamErr -37 Bad filename
2036 fnfErr -43 File not found
2037 fLckdErr -45 File is locked
2038 vLckdErr -46 Volume is locked or read-only
2039 paramErr -50 No default volume
2040 dirNFErr -120 Directory not found or incomplete pathname
2041 afpAccessDenied -5000 User does not have the correct access
2042 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2043
2044 __________
2045
2046 See also: SetIsStationery, ClearIsStationery, FSpClearIsStationery
2047 */
2048
2049 /*****************************************************************************/
2050
2051 pascal OSErr ClearIsStationery(short vRefNum,
2052 long dirID,
2053 ConstStr255Param name);
2054 /* ¦ Clear the isStationery Finder Flag bit.
2055 The ClearIsStationery function clears the isStationery bit in the
2056 fdFlags word of the specified file or directory's finder information.
2057
2058 vRefNum input: Volume specification.
2059 dirID input: Directory ID.
2060 name input: Pointer to object name, or nil when dirID specifies
2061 a directory that's the object.
2062
2063 Result Codes
2064 noErr 0 No error
2065 nsvErr -35 No such volume
2066 ioErr -36 I/O error
2067 bdNamErr -37 Bad filename
2068 fnfErr -43 File not found
2069 fLckdErr -45 File is locked
2070 vLckdErr -46 Volume is locked or read-only
2071 paramErr -50 No default volume
2072 dirNFErr -120 Directory not found or incomplete pathname
2073 afpAccessDenied -5000 User does not have the correct access
2074 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2075
2076 __________
2077
2078 See also: SetIsStationery, FSpSetIsStationery, FSpClearIsStationery
2079 */
2080
2081 /*****************************************************************************/
2082
2083 pascal OSErr FSpClearIsStationery(const FSSpec *spec);
2084 /* ¦ Clear the isStationery Finder Flag bit.
2085 The FSpClearIsStationery function clears the isStationery bit in the
2086 fdFlags word of the specified file or directory's finder information.
2087
2088 spec input: An FSSpec record specifying the object.
2089
2090 Result Codes
2091 noErr 0 No error
2092 nsvErr -35 No such volume
2093 ioErr -36 I/O error
2094 bdNamErr -37 Bad filename
2095 fnfErr -43 File not found
2096 fLckdErr -45 File is locked
2097 vLckdErr -46 Volume is locked or read-only
2098 paramErr -50 No default volume
2099 dirNFErr -120 Directory not found or incomplete pathname
2100 afpAccessDenied -5000 User does not have the correct access
2101 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2102
2103 __________
2104
2105 See also: SetIsStationery, FSpSetIsStationery, ClearIsStationery
2106 */
2107
2108 /*****************************************************************************/
2109
2110 pascal OSErr SetHasCustomIcon(short vRefNum,
2111 long dirID,
2112 ConstStr255Param name);
2113 /* ¦ Set the hasCustomIcon Finder Flag bit.
2114 The SetHasCustomIcon function sets the hasCustomIcon bit in the
2115 fdFlags word of the specified file or directory's finder information.
2116
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.
2121
2122 Result Codes
2123 noErr 0 No error
2124 nsvErr -35 No such volume
2125 ioErr -36 I/O error
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
2134
2135 __________
2136
2137 See also: FSpSetHasCustomIcon, ClearHasCustomIcon, FSpClearHasCustomIcon
2138 */
2139
2140 /*****************************************************************************/
2141
2142 pascal OSErr FSpSetHasCustomIcon(const FSSpec *spec);
2143 /* ¦ Set the hasCustomIcon Finder Flag bit.
2144 The FSpSetHasCustomIcon function sets the hasCustomIcon bit in the
2145 fdFlags word of the specified file or directory's finder information.
2146
2147 spec input: An FSSpec record specifying the object.
2148
2149 Result Codes
2150 noErr 0 No error
2151 nsvErr -35 No such volume
2152 ioErr -36 I/O error
2153 bdNamErr -37 Bad filename
2154 fnfErr -43 File not found
2155 fLckdErr -45 File is locked
2156 vLckdErr -46 Volume is locked or read-only
2157 paramErr -50 No default volume
2158 dirNFErr -120 Directory not found or incomplete pathname
2159 afpAccessDenied -5000 User does not have the correct access
2160 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2161
2162 __________
2163
2164 See also: SetHasCustomIcon, ClearHasCustomIcon, FSpClearHasCustomIcon
2165 */
2166
2167 /*****************************************************************************/
2168
2169 pascal OSErr ClearHasCustomIcon(short vRefNum,
2170 long dirID,
2171 ConstStr255Param name);
2172 /* ¦ Clear the hasCustomIcon Finder Flag bit.
2173 The ClearHasCustomIcon function clears the hasCustomIcon bit in the
2174 fdFlags word of the specified file or directory's finder information.
2175
2176 vRefNum input: Volume specification.
2177 dirID input: Directory ID.
2178 name input: Pointer to object name, or nil when dirID specifies
2179 a directory that's the object.
2180
2181 Result Codes
2182 noErr 0 No error
2183 nsvErr -35 No such volume
2184 ioErr -36 I/O error
2185 bdNamErr -37 Bad filename
2186 fnfErr -43 File not found
2187 fLckdErr -45 File is locked
2188 vLckdErr -46 Volume is locked or read-only
2189 paramErr -50 No default volume
2190 dirNFErr -120 Directory not found or incomplete pathname
2191 afpAccessDenied -5000 User does not have the correct access
2192 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2193
2194 __________
2195
2196 See also: SetHasCustomIcon, FSpSetHasCustomIcon, FSpClearHasCustomIcon
2197 */
2198
2199 /*****************************************************************************/
2200
2201 pascal OSErr FSpClearHasCustomIcon(const FSSpec *spec);
2202 /* ¦ Clear the hasCustomIcon Finder Flag bit.
2203 The FSpClearHasCustomIcon function clears the hasCustomIcon bit in the
2204 fdFlags word of the specified file or directory's finder information.
2205
2206 spec input: An FSSpec record specifying the object.
2207
2208 Result Codes
2209 noErr 0 No error
2210 nsvErr -35 No such volume
2211 ioErr -36 I/O error
2212 bdNamErr -37 Bad filename
2213 fnfErr -43 File not found
2214 fLckdErr -45 File is locked
2215 vLckdErr -46 Volume is locked or read-only
2216 paramErr -50 No default volume
2217 dirNFErr -120 Directory not found or incomplete pathname
2218 afpAccessDenied -5000 User does not have the correct access
2219 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2220
2221 __________
2222
2223 See also: SetHasCustomIcon, FSpSetHasCustomIcon, ClearHasCustomIcon
2224 */
2225
2226 /*****************************************************************************/
2227
2228 pascal OSErr ClearHasBeenInited(short vRefNum,
2229 long dirID,
2230 ConstStr255Param name);
2231 /* ¦ Clear the hasBeenInited Finder Flag bit.
2232 The ClearHasBeenInited function clears the hasBeenInited bit in the
2233 fdFlags word of the specified file or directory's finder information.
2234
2235 vRefNum input: Volume specification.
2236 dirID input: Directory ID.
2237 name input: Pointer to object name, or nil when dirID specifies
2238 a directory that's the object.
2239
2240 Result Codes
2241 noErr 0 No error
2242 nsvErr -35 No such volume
2243 ioErr -36 I/O error
2244 bdNamErr -37 Bad filename
2245 fnfErr -43 File not found
2246 fLckdErr -45 File is locked
2247 vLckdErr -46 Volume is locked or read-only
2248 paramErr -50 No default volume
2249 dirNFErr -120 Directory not found or incomplete pathname
2250 afpAccessDenied -5000 User does not have the correct access
2251 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2252
2253 __________
2254
2255 See also: FSpClearHasBeenInited
2256 */
2257
2258 /*****************************************************************************/
2259
2260 pascal OSErr FSpClearHasBeenInited(const FSSpec *spec);
2261 /* ¦ Clear the hasBeenInited Finder Flag bit.
2262 The FSpClearHasBeenInited function clears the hasBeenInited bit in the
2263 fdFlags word of the specified file or directory's finder information.
2264
2265 spec input: An FSSpec record specifying the object.
2266
2267 Result Codes
2268 noErr 0 No error
2269 nsvErr -35 No such volume
2270 ioErr -36 I/O error
2271 bdNamErr -37 Bad filename
2272 fnfErr -43 File not found
2273 fLckdErr -45 File is locked
2274 vLckdErr -46 Volume is locked or read-only
2275 paramErr -50 No default volume
2276 dirNFErr -120 Directory not found or incomplete pathname
2277 afpAccessDenied -5000 User does not have the correct access
2278 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2279
2280 __________
2281
2282 See also: ClearHasBeenInited
2283 */
2284
2285 /*****************************************************************************/
2286
2287 pascal OSErr CopyFileMgrAttributes(short srcVRefNum,
2288 long srcDirID,
2289 ConstStr255Param srcName,
2290 short dstVRefNum,
2291 long dstDirID,
2292 ConstStr255Param dstName,
2293 Boolean copyLockBit);
2294 /* ¦ Copy all File Manager attributes from the source to the destination.
2295 The CopyFileMgrAttributes function copies all File Manager attributes
2296 from the source file or directory to the destination file or directory.
2297 If copyLockBit is true, then set the locked state of the destination
2298 to match the source.
2299
2300 srcVRefNum input: Source volume specification.
2301 srcDirID input: Source directory ID.
2302 srcName input: Pointer to source object name, or nil when
2303 srcDirID specifies a directory that's the object.
2304 dstVRefNum input: Destination volume specification.
2305 dstDirID input: Destination directory ID.
2306 dstName input: Pointer to destination object name, or nil when
2307 dstDirID specifies a directory that's the object.
2308 copyLockBit input: If true, set the locked state of the destination
2309 to match the source.
2310
2311 Result Codes
2312 noErr 0 No error
2313 nsvErr -35 No such volume
2314 ioErr -36 I/O error
2315 bdNamErr -37 Bad filename
2316 fnfErr -43 File not found
2317 fLckdErr -45 File is locked
2318 vLckdErr -46 Volume is locked or read-only
2319 paramErr -50 No default volume
2320 dirNFErr -120 Directory not found or incomplete pathname
2321 afpAccessDenied -5000 User does not have the correct access
2322 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2323
2324 __________
2325
2326 See also: FSpCopyFileMgrAttributes
2327 */
2328
2329 /*****************************************************************************/
2330
2331 pascal OSErr FSpCopyFileMgrAttributes(const FSSpec *srcSpec,
2332 const FSSpec *dstSpec,
2333 Boolean copyLockBit);
2334 /* ¦ Copy all File Manager attributes from the source to the destination.
2335 The FSpCopyFileMgrAttributes function copies all File Manager attributes
2336 from the source file or directory to the destination file or directory.
2337 If copyLockBit is true, then set the locked state of the destination
2338 to match the source.
2339
2340 srcSpec input: An FSSpec record specifying the source object.
2341 dstSpec input: An FSSpec record specifying the destination object.
2342 copyLockBit input: If true, set the locked state of the destination
2343 to match the source.
2344
2345 Result Codes
2346 noErr 0 No error
2347 nsvErr -35 No such volume
2348 ioErr -36 I/O error
2349 bdNamErr -37 Bad filename
2350 fnfErr -43 File not found
2351 fLckdErr -45 File is locked
2352 vLckdErr -46 Volume is locked or read-only
2353 paramErr -50 No default volume
2354 dirNFErr -120 Directory not found or incomplete pathname
2355 afpAccessDenied -5000 User does not have the correct access
2356 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2357
2358 __________
2359
2360 See also: CopyFileMgrAttributes
2361 */
2362
2363 /*****************************************************************************/
2364
2365 pascal OSErr HOpenAware(short vRefNum,
2366 long dirID,
2367 ConstStr255Param fileName,
2368 short denyModes,
2369 short *refNum);
2370 /* ¦ Open the data fork of a file using deny mode permissions.
2371 The HOpenAware function opens the data fork of a file using deny mode
2372 permissions instead the normal File Manager permissions. If OpenDeny
2373 is not available, then HOpenAware translates the deny modes to the
2374 closest File Manager permissions and tries to open the file with
2375 OpenDF first, and then Open if OpenDF isn't available. By using
2376 HOpenAware with deny mode permissions, a program can be "AppleShare
2377 aware" and fall back on the standard File Manager open calls
2378 automatically.
2379
2380 vRefNum input: Volume specification.
2381 dirID input: Directory ID.
2382 fileName input: The name of the file.
2383 denyModes input: The deny modes access under which to open the file.
2384 refNum output: The file reference number of the opened file.
2385
2386 Result Codes
2387 noErr 0 No error
2388 nsvErr -35 No such volume
2389 tmfoErr -42 Too many files open
2390 fnfErr -43 File not found
2391 wPrErr -44 Volume locked by hardware
2392 fLckdErr -45 File is locked
2393 vLckdErr -46 Volume is locked or read-only
2394 opWrErr -49 File already open for writing
2395 paramErr -50 No default volume
2396 permErr -54 File is already open and cannot be opened using specified deny modes
2397 afpAccessDenied -5000 User does not have the correct access to the file
2398 afpDenyConflict -5006 Requested access permission not possible
2399
2400 __________
2401
2402 See also: FSpOpenAware, HOpenRFAware, FSpOpenRFAware
2403 */
2404
2405 /*****************************************************************************/
2406
2407 pascal OSErr FSpOpenAware(const FSSpec *spec,
2408 short denyModes,
2409 short *refNum);
2410 /* ¦ Open the data fork of a file using deny mode permissions.
2411 The FSpOpenAware function opens the data fork of a file using deny mode
2412 permissions instead the normal File Manager permissions. If OpenDeny
2413 is not available, then FSpOpenAware translates the deny modes to the
2414 closest File Manager permissions and tries to open the file with
2415 OpenDF first, and then Open if OpenDF isn't available. By using
2416 FSpOpenAware with deny mode permissions, a program can be "AppleShare
2417 aware" and fall back on the standard File Manager open calls
2418 automatically.
2419
2420 spec input: An FSSpec record specifying the file.
2421 denyModes input: The deny modes access under which to open the file.
2422 refNum output: The file reference number of the opened file.
2423
2424 Result Codes
2425 noErr 0 No error
2426 nsvErr -35 No such volume
2427 tmfoErr -42 Too many files open
2428 fnfErr -43 File not found
2429 wPrErr -44 Volume locked by hardware
2430 fLckdErr -45 File is locked
2431 vLckdErr -46 Volume is locked or read-only
2432 opWrErr -49 File already open for writing
2433 paramErr -50 No default volume
2434 permErr -54 File is already open and cannot be opened using specified deny modes
2435 afpAccessDenied -5000 User does not have the correct access to the file
2436 afpDenyConflict -5006 Requested access permission not possible
2437
2438 __________
2439
2440 See also: HOpenAware, HOpenRFAware, FSpOpenRFAware
2441 */
2442
2443 /*****************************************************************************/
2444
2445 pascal OSErr HOpenRFAware(short vRefNum,
2446 long dirID,
2447 ConstStr255Param fileName,
2448 short denyModes,
2449 short *refNum);
2450 /* ¦ Open the resource fork of a file using deny mode permissions.
2451 The HOpenRFAware function opens the resource fork of a file using deny
2452 mode permissions instead the normal File Manager permissions. If
2453 OpenRFDeny is not available, then HOpenRFAware translates the deny
2454 modes to the closest File Manager permissions and tries to open the
2455 file with OpenRF. By using HOpenRFAware with deny mode permissions,
2456 a program can be "AppleShare aware" and fall back on the standard
2457 File Manager open calls automatically.
2458
2459 vRefNum input: Volume specification.
2460 dirID input: Directory ID.
2461 fileName input: The name of the file.
2462 denyModes input: The deny modes access under which to open the file.
2463 refNum output: The file reference number of the opened file.
2464
2465 Result Codes
2466 noErr 0 No error
2467 nsvErr -35 No such volume
2468 tmfoErr -42 Too many files open
2469 fnfErr -43 File not found
2470 wPrErr -44 Volume locked by hardware
2471 fLckdErr -45 File is locked
2472 vLckdErr -46 Volume is locked or read-only
2473 opWrErr -49 File already open for writing
2474 paramErr -50 No default volume
2475 permErr -54 File is already open and cannot be opened using specified deny modes
2476 afpAccessDenied -5000 User does not have the correct access to the file
2477 afpDenyConflict -5006 Requested access permission not possible
2478
2479 __________
2480
2481 See also: HOpenAware, FSpOpenAware, FSpOpenRFAware
2482 */
2483
2484 /*****************************************************************************/
2485
2486 pascal OSErr FSpOpenRFAware(const FSSpec *spec,
2487 short denyModes,
2488 short *refNum);
2489 /* ¦ Open the resource fork of a file using deny mode permissions.
2490 The FSpOpenRFAware function opens the resource fork of a file using deny
2491 mode permissions instead the normal File Manager permissions. If
2492 OpenRFDeny is not available, then FSpOpenRFAware translates the deny
2493 modes to the closest File Manager permissions and tries to open the
2494 file with OpenRF. By using FSpOpenRFAware with deny mode permissions,
2495 a program can be "AppleShare aware" and fall back on the standard
2496 File Manager open calls automatically.
2497
2498 spec input: An FSSpec record specifying the file.
2499 denyModes input: The deny modes access under which to open the file.
2500 refNum output: The file reference number of the opened file.
2501
2502 Result Codes
2503 noErr 0 No error
2504 nsvErr -35 No such volume
2505 tmfoErr -42 Too many files open
2506 fnfErr -43 File not found
2507 wPrErr -44 Volume locked by hardware
2508 fLckdErr -45 File is locked
2509 vLckdErr -46 Volume is locked or read-only
2510 opWrErr -49 File already open for writing
2511 paramErr -50 No default volume
2512 permErr -54 File is already open and cannot be opened using specified deny modes
2513 afpAccessDenied -5000 User does not have the correct access to the file
2514 afpDenyConflict -5006 Requested access permission not possible
2515
2516 __________
2517
2518 See also: HOpenAware, FSpOpenAware, HOpenRFAware
2519 */
2520
2521 /*****************************************************************************/
2522
2523 pascal OSErr FSReadNoCache(short refNum,
2524 long *count,
2525 void *buffPtr);
2526 /* ¦ Read any number of bytes from an open file requesting no caching.
2527 The FSReadNoCache function reads any number of bytes from an open file
2528 while asking the file system to bypass its cache mechanism.
2529
2530 refNum input: The file reference number of an open file.
2531 count input: The number of bytes to read.
2532 output: The number of bytes actually read.
2533 buffPtr input: A pointer to the data buffer into which the bytes are
2534 to be read.
2535
2536 Result Codes
2537 noErr 0 No error
2538 readErr Ð19 Driver does not respond to read requests
2539 badUnitErr Ð21 Driver reference number does not
2540 match unit table
2541 unitEmptyErr Ð22 Driver reference number specifies a
2542 nil handle in unit table
2543 abortErr Ð27 Request aborted by KillIO
2544 notOpenErr Ð28 Driver not open
2545 ioErr Ð36 Data does not match in read-verify mode
2546 fnOpnErr -38 File not open
2547 rfNumErr -51 Bad reference number
2548 afpAccessDenied -5000 User does not have the correct access to
2549 the file
2550
2551 __________
2552
2553 See also: FSWriteNoCache
2554 */
2555
2556 /*****************************************************************************/
2557
2558 pascal OSErr FSWriteNoCache(short refNum,
2559 long *count,
2560 const void *buffPtr);
2561 /* ¦ Write any number of bytes to an open file requesting no caching.
2562 The FSReadNoCache function writes any number of bytes to an open file
2563 while asking the file system to bypass its cache mechanism.
2564
2565 refNum input: The file reference number of an open file.
2566 count input: The number of bytes to write to the file.
2567 output: The number of bytes actually written.
2568 buffPtr input: A pointer to the data buffer from which the bytes are
2569 to be written.
2570
2571 Result Codes
2572 noErr 0 No error
2573 writErr Ð20 Driver does not respond to write requests
2574 badUnitErr Ð21 Driver reference number does not
2575 match unit table
2576 unitEmptyErr Ð22 Driver reference number specifies a
2577 nil handle in unit table
2578 abortErr Ð27 Request aborted by KillIO
2579 notOpenErr Ð28 Driver not open
2580 dskFulErr -34 Disk full
2581 ioErr Ð36 Data does not match in read-verify mode
2582 fnOpnErr -38 File not open
2583 wPrErr -44 Hardware volume lock
2584 fLckdErr -45 File is locked
2585 vLckdErr -46 Software volume lock
2586 rfNumErr -51 Bad reference number
2587 wrPermErr -61 Read/write permission doesnÕt
2588 allow writing
2589 afpAccessDenied -5000 User does not have the correct access to
2590 the file
2591
2592 __________
2593
2594 See also: FSReadNoCache
2595 */
2596
2597 /*****************************************************************************/
2598
2599 pascal OSErr FSWriteVerify(short refNum,
2600 long *count,
2601 const void *buffPtr);
2602 /* ¦ Write any number of bytes to an open file and then verify the data was written.
2603 The FSWriteVerify function writes any number of bytes to an open file
2604 and then verifies that the data was actually written to the device.
2605
2606 refNum input: The file reference number of an open file.
2607 count input: The number of bytes to write to the file.
2608 output: The number of bytes actually written and verified.
2609 buffPtr input: A pointer to the data buffer from which the bytes are
2610 to be written.
2611
2612 Result Codes
2613 noErr 0 No error
2614 readErr Ð19 Driver does not respond to read requests
2615 writErr Ð20 Driver does not respond to write requests
2616 badUnitErr Ð21 Driver reference number does not
2617 match unit table
2618 unitEmptyErr Ð22 Driver reference number specifies a
2619 nil handle in unit table
2620 abortErr Ð27 Request aborted by KillIO
2621 notOpenErr Ð28 Driver not open
2622 dskFulErr -34 Disk full
2623 ioErr Ð36 Data does not match in read-verify mode
2624 fnOpnErr -38 File not open
2625 eofErr -39 Logical end-of-file reached
2626 posErr -40 Attempt to position mark before start
2627 of file
2628 wPrErr -44 Hardware volume lock
2629 fLckdErr -45 File is locked
2630 vLckdErr -46 Software volume lock
2631 rfNumErr -51 Bad reference number
2632 gfpErr -52 Error during GetFPos
2633 wrPermErr -61 Read/write permission doesnÕt
2634 allow writing
2635 memFullErr -108 Not enough room in heap zone to allocate
2636 verify buffer
2637 afpAccessDenied -5000 User does not have the correct access to
2638 the file
2639 */
2640
2641 /*****************************************************************************/
2642
2643 pascal OSErr CopyFork(short srcRefNum,
2644 short dstRefNum,
2645 void *copyBufferPtr,
2646 long copyBufferSize);
2647 /* ¦ Copy all data from the source fork to the destination fork of open file forks.
2648 The CopyFork function copies all data from the source fork to the
2649 destination fork of open file forks and makes sure the destination EOF
2650 is equal to the source EOF.
2651
2652 srcRefNum input: The source file reference number.
2653 dstRefNum input: The destination file reference number.
2654 copyBufferPtr input: Pointer to buffer to use during copy. The
2655 buffer should be at least 512-bytes minimum.
2656 The larger the buffer, the faster the copy.
2657 copyBufferSize input: The size of the copy buffer.
2658
2659 Result Codes
2660 noErr 0 No error
2661 readErr Ð19 Driver does not respond to read requests
2662 writErr Ð20 Driver does not respond to write requests
2663 badUnitErr Ð21 Driver reference number does not
2664 match unit table
2665 unitEmptyErr Ð22 Driver reference number specifies a
2666 nil handle in unit table
2667 abortErr Ð27 Request aborted by KillIO
2668 notOpenErr Ð28 Driver not open
2669 dskFulErr -34 Disk full
2670 ioErr Ð36 Data does not match in read-verify mode
2671 fnOpnErr -38 File not open
2672 wPrErr -44 Hardware volume lock
2673 fLckdErr -45 File is locked
2674 vLckdErr -46 Software volume lock
2675 rfNumErr -51 Bad reference number
2676 wrPermErr -61 Read/write permission doesnÕt
2677 allow writing
2678 afpAccessDenied -5000 User does not have the correct access to
2679 the file
2680 */
2681
2682 /*****************************************************************************/
2683
2684 pascal OSErr GetFileLocation(short refNum,
2685 short *vRefNum,
2686 long *dirID,
2687 StringPtr fileName);
2688 /* ¦ Get the location of an open file.
2689 The GetFileLocation function gets the location (volume reference number,
2690 directory ID, and fileName) of an open file.
2691
2692 refNum input: The file reference number of an open file.
2693 vRefNum output: The volume reference number.
2694 dirID output: The parent directory ID.
2695 fileName input: Points to a buffer (minimum Str63) where the
2696 filename is to be returned or must be nil.
2697 output: The filename.
2698
2699 Result Codes
2700 noErr 0 No error
2701 nsvErr -35 Specified volume doesnÕt exist
2702 fnOpnErr -38 File not open
2703 rfNumErr -51 Reference number specifies nonexistent
2704 access path
2705
2706 __________
2707
2708 See also: FSpGetFileLocation
2709 */
2710
2711 /*****************************************************************************/
2712
2713 pascal OSErr FSpGetFileLocation(short refNum,
2714 FSSpec *spec);
2715 /* ¦ Get the location of an open file in an FSSpec record.
2716 The FSpGetFileLocation function gets the location of an open file in
2717 an FSSpec record.
2718
2719 refNum input: The file reference number of an open file.
2720 spec output: FSSpec record containing the file name and location.
2721
2722 Result Codes
2723 noErr 0 No error
2724 nsvErr -35 Specified volume doesnÕt exist
2725 fnOpnErr -38 File not open
2726 rfNumErr -51 Reference number specifies nonexistent
2727 access path
2728
2729 __________
2730
2731 See also: GetFileLocation
2732 */
2733
2734 /*****************************************************************************/
2735
2736 pascal OSErr CopyDirectoryAccess(short srcVRefNum,
2737 long srcDirID,
2738 ConstStr255Param srcName,
2739 short dstVRefNum,
2740 long dstDirID,
2741 ConstStr255Param dstName);
2742 /* ¦ Copy the AFP directory access privileges.
2743 The CopyDirectoryAccess function copies the AFP directory access
2744 privileges from one directory to another. Both directories must be on
2745 the same file server, but not necessarily on the same server volume.
2746
2747 srcVRefNum input: Source volume specification.
2748 srcDirID input: Source directory ID.
2749 srcName input: Pointer to source directory name, or nil when
2750 srcDirID specifies the directory.
2751 dstVRefNum input: Destination volume specification.
2752 dstDirID input: Destination directory ID.
2753 dstName input: Pointer to destination directory name, or nil when
2754 dstDirID specifies the directory.
2755
2756 Result Codes
2757 noErr 0 No error
2758 nsvErr -35 Volume not found
2759 fnfErr -43 Directory not found
2760 vLckdErr -46 Volume is locked or read-only
2761 paramErr -50 Volume doesn't support this function
2762 afpAccessDenied -5000 User does not have the correct access
2763 to the directory
2764 afpObjectTypeErr -5025 Object is a file, not a directory
2765
2766 __________
2767
2768 See also: FSpCopyDirectoryAccess
2769 */
2770
2771 /*****************************************************************************/
2772
2773 pascal OSErr FSpCopyDirectoryAccess(const FSSpec *srcSpec,
2774 const FSSpec *dstSpec);
2775 /* ¦ Copy the AFP directory access privileges.
2776 The FSpCopyDirectoryAccess function copies the AFP directory access
2777 privileges from one directory to another. Both directories must be on
2778 the same file server, but not necessarily on the same server volume.
2779
2780 srcSpec input: An FSSpec record specifying the source directory.
2781 dstSpec input: An FSSpec record specifying the destination directory.
2782
2783 Result Codes
2784 noErr 0 No error
2785 nsvErr -35 Volume not found
2786 fnfErr -43 Directory not found
2787 vLckdErr -46 Volume is locked or read-only
2788 paramErr -50 Volume doesn't support this function
2789 afpAccessDenied -5000 User does not have the correct access
2790 to the directory
2791 afpObjectTypeErr -5025 Object is a file, not a directory
2792
2793 __________
2794
2795 See also: CopyDirectoryAccess
2796 */
2797
2798 /*****************************************************************************/
2799
2800 pascal OSErr HMoveRenameCompat(short vRefNum,
2801 long srcDirID,
2802 ConstStr255Param srcName,
2803 long dstDirID,
2804 ConstStr255Param dstpathName,
2805 ConstStr255Param copyName);
2806 /* ¦ Move a file or directory and optionally rename it.
2807 The HMoveRenameCompat function moves a file or directory and optionally
2808 renames it. The source and destination locations must be on the same
2809 volume. This routine works even if the volume doesn't support MoveRename.
2810
2811 vRefNum input: Volume specification.
2812 srcDirID input: Source directory ID.
2813 srcName input: The source object name.
2814 dstDirID input: Destination directory ID.
2815 dstName input: Pointer to destination directory name, or
2816 nil when dstDirID specifies a directory.
2817 copyName input: Points to the new name if the object is to be
2818 renamed or nil if the object isn't to be renamed.
2819
2820 Result Codes
2821 noErr 0 No error
2822 dirFulErr -33 File directory full
2823 dskFulErr -34 Disk is full
2824 nsvErr -35 Volume not found
2825 ioErr -36 I/O error
2826 bdNamErr -37 Bad filename or attempt to move into
2827 a file
2828 fnfErr -43 Source file or directory not found
2829 wPrErr -44 Hardware volume lock
2830 fLckdErr -45 File is locked
2831 vLckdErr -46 Destination volume is read-only
2832 fBsyErr -47 File busy, directory not empty, or
2833 working directory control block open
2834 dupFNErr -48 Destination already exists
2835 paramErr -50 Volume doesn't support this function,
2836 no default volume, or source and
2837 volOfflinErr -53 Volume is offline
2838 fsRnErr -59 Problem during rename
2839 dirNFErr -120 Directory not found or incomplete pathname
2840 badMovErr -122 Attempted to move directory into
2841 offspring
2842 wrgVolTypErr -123 Not an HFS volume (it's a MFS volume)
2843 notAFileErr -1302 The pathname is nil, the pathname
2844 is empty, or the pathname cannot refer
2845 to a filename
2846 diffVolErr -1303 Files on different volumes
2847 afpAccessDenied -5000 The user does not have the right to
2848 move the file or directory
2849 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2850 afpSameObjectErr -5038 Source and destination files are the same
2851
2852 __________
2853
2854 See also: FSpMoveRenameCompat
2855 */
2856
2857 /*****************************************************************************/
2858
2859 pascal OSErr FSpMoveRenameCompat(const FSSpec *srcSpec,
2860 const FSSpec *dstSpec,
2861 ConstStr255Param copyName);
2862 /* ¦ Move a file or directory and optionally rename it.
2863 The FSpMoveRenameCompat function moves a file or directory and optionally
2864 renames it. The source and destination locations must be on the same
2865 volume. This routine works even if the volume doesn't support MoveRename.
2866
2867 srcSpec input: An FSSpec record specifying the source object.
2868 dstSpec input: An FSSpec record specifying the destination
2869 directory.
2870 copyName input: Points to the new name if the object is to be
2871 renamed or nil if the object isn't to be renamed.
2872
2873 Result Codes
2874 noErr 0 No error
2875 dirFulErr -33 File directory full
2876 dskFulErr -34 Disk is full
2877 nsvErr -35 Volume not found
2878 ioErr -36 I/O error
2879 bdNamErr -37 Bad filename or attempt to move into
2880 a file
2881 fnfErr -43 Source file or directory not found
2882 wPrErr -44 Hardware volume lock
2883 fLckdErr -45 File is locked
2884 vLckdErr -46 Destination volume is read-only
2885 fBsyErr -47 File busy, directory not empty, or
2886 working directory control block open
2887 dupFNErr -48 Destination already exists
2888 paramErr -50 Volume doesn't support this function,
2889 no default volume, or source and
2890 volOfflinErr -53 Volume is offline
2891 fsRnErr -59 Problem during rename
2892 dirNFErr -120 Directory not found or incomplete pathname
2893 badMovErr -122 Attempted to move directory into
2894 offspring
2895 wrgVolTypErr -123 Not an HFS volume (it's a MFS volume)
2896 notAFileErr -1302 The pathname is nil, the pathname
2897 is empty, or the pathname cannot refer
2898 to a filename
2899 diffVolErr -1303 Files on different volumes
2900 afpAccessDenied -5000 The user does not have the right to
2901 move the file or directory
2902 afpObjectTypeErr -5025 Directory not found or incomplete pathname
2903 afpSameObjectErr -5038 Source and destination files are the same
2904
2905 __________
2906
2907 See also: HMoveRenameCompat
2908 */
2909
2910 /*****************************************************************************/
2911
2912 pascal OSErr BuildAFPVolMountInfo(short flags,
2913 char nbpInterval,
2914 char nbpCount,
2915 short uamType,
2916 Str32 zoneName,
2917 Str31 serverName,
2918 Str27 volName,
2919 Str31 userName,
2920 Str8 userPassword,
2921 Str8 volPassword,
2922 AFPVolMountInfoPtr *afpInfoPtr);
2923 /* ¦ Allocate and initializes the fields of an AFPVolMountInfo record.
2924 The BuildAFPVolMountInfo function allocates and initializes the fields
2925 of an AFPVolMountInfo record before using that record to call
2926 the VolumeMount function.
2927
2928 flags input: The AFP mounting flags. 0 = normal mount;
2929 set bit 0 to inhibit greeting messages.
2930 nbpInterval input: The interval used for VolumeMount's
2931 NBP Lookup call. 7 is a good choice.
2932 nbpCount input: The retry count used for VolumeMount's
2933 NBP Lookup call. 5 is a good choice.
2934 uamType input: The user authentication method to use.
2935 zoneName input: The AppleTalk zone name of the server.
2936 serverName input: The AFP server name.
2937 volName input: The AFP volume name.
2938 userName input: The user name (zero length Pascal string for
2939 guest).
2940 userPassWord input: The user password (zero length Pascal string
2941 if no user password)
2942 volPassWord input: The volume password (zero length Pascal string
2943 if no volume password)
2944 afpInfoPtr output: A pointer to the newly created and initialized
2945 AFPVolMountInfo record. If the function fails to
2946 create an AFPVolMountInfo record, it sets
2947 afpInfoPtr to NULL and the function result is
2948 memFullErr. Your program is responsible
2949 for disposing of this pointer when it is finished
2950 with it.
2951
2952 Result Codes
2953 noErr 0 No error
2954 memFullErr -108 memory full error
2955
2956 __________
2957
2958 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
2959 RetrieveAFPVolMountInfo, BuildAFPXVolMountInfo,
2960 RetrieveAFPXVolMountInfo
2961 */
2962
2963 /*****************************************************************************/
2964
2965 pascal OSErr RetrieveAFPVolMountInfo(AFPVolMountInfoPtr afpInfoPtr,
2966 short *flags,
2967 short *uamType,
2968 StringPtr zoneName,
2969 StringPtr serverName,
2970 StringPtr volName,
2971 StringPtr userName);
2972 /* ¦ Retrieve the AFP mounting information from an AFPVolMountInfo record.
2973 The RetrieveAFPVolMountInfo function retrieves the AFP mounting
2974 information returned in an AFPVolMountInfo record by the
2975 GetVolMountInfo function.
2976
2977 afpInfoPtr input: Pointer to AFPVolMountInfo record that contains
2978 the AFP mounting information.
2979 flags output: The AFP mounting flags.
2980 uamType output: The user authentication method used.
2981 zoneName output: The AppleTalk zone name of the server.
2982 serverName output: The AFP server name.
2983 volName output: The AFP volume name.
2984 userName output: The user name (zero length Pascal string for
2985 guest).
2986
2987 Result Codes
2988 noErr 0 No error
2989 paramErr -50 media field in AFP mounting information
2990 was not AppleShareMediaType
2991
2992 __________
2993
2994 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
2995 BuildAFPVolMountInfo, BuildAFPXVolMountInfo,
2996 RetrieveAFPXVolMountInfo
2997 */
2998
2999 /*****************************************************************************/
3000
3001 pascal OSErr BuildAFPXVolMountInfo(short flags,
3002 char nbpInterval,
3003 char nbpCount,
3004 short uamType,
3005 Str32 zoneName,
3006 Str31 serverName,
3007 Str27 volName,
3008 Str31 userName,
3009 Str8 userPassword,
3010 Str8 volPassword,
3011 Str32 uamName,
3012 unsigned long alternateAddressLength,
3013 void *alternateAddress,
3014 AFPXVolMountInfoPtr *afpXInfoPtr);
3015 /* ¦ Allocate and initializes the fields of an AFPXVolMountInfo record.
3016 The BuildAFPXVolMountInfo function allocates and initializes the fields
3017 of an AFPXVolMountInfo record before using that record to call
3018 the VolumeMount function.
3019
3020 flags input: The AFP mounting flags.
3021 nbpInterval input: The interval used for VolumeMount's
3022 NBP Lookup call. 7 is a good choice.
3023 nbpCount input: The retry count used for VolumeMount's
3024 NBP Lookup call. 5 is a good choice.
3025 uamType input: The user authentication method to use.
3026 zoneName input: The AppleTalk zone name of the server.
3027 serverName input: The AFP server name.
3028 volName input: The AFP volume name.
3029 userName input: The user name (zero length Pascal string
3030 for guest).
3031 userPassWord input: The user password (zero length Pascal
3032 string if no user password)
3033 volPassWord input: The volume password (zero length Pascal
3034 string if no volume password)
3035 uamName input: The User Authentication Method name.
3036 alternateAddressLength input: Length of alternateAddress data.
3037 alternateAddress input The AFPAlternateAddress (variable length)
3038 afpXInfoPtr output: A pointer to the newly created and
3039 initialized AFPVolMountInfo record.
3040 If the function fails to create an
3041 AFPVolMountInfo record, it sets
3042 afpInfoPtr to NULL and the function
3043 result is memFullErr. Your program is
3044 responsible for disposing of this pointer
3045 when it is finished with it.
3046
3047 Result Codes
3048 noErr 0 No error
3049 memFullErr -108 memory full error
3050
3051 __________
3052
3053 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
3054 BuildAFPVolMountInfo, RetrieveAFPVolMountInfo,
3055 RetrieveAFPXVolMountInfo
3056 */
3057
3058 /*****************************************************************************/
3059
3060 pascal OSErr RetrieveAFPXVolMountInfo(AFPXVolMountInfoPtr afpXInfoPtr,
3061 short *flags,
3062 short *uamType,
3063 StringPtr zoneName,
3064 StringPtr serverName,
3065 StringPtr volName,
3066 StringPtr userName,
3067 StringPtr uamName,
3068 unsigned long *alternateAddressLength,
3069 AFPAlternateAddress **alternateAddress);
3070 /* ¦ Retrieve the AFP mounting information from an AFPXVolMountInfo record.
3071 The RetrieveAFPXVolMountInfo function retrieves the AFP mounting
3072 information returned in an AFPXVolMountInfo record by the
3073 GetVolMountInfo function.
3074
3075 afpXInfoPtr input: Pointer to AFPXVolMountInfo record that
3076 contains the AFP mounting information.
3077 flags output: The AFP mounting flags.
3078 uamType output: The user authentication method used.
3079 zoneName output: The AppleTalk zone name of the server.
3080 serverName output: The AFP server name.
3081 volName output: The AFP volume name.
3082 userName output: The user name (zero length Pascal
3083 string for guest).
3084 uamName output: The User Authentication Method name.
3085 alternateAddressLength output: Length of alternateAddress data returned.
3086 alternateAddress: output: A pointer to the newly created and
3087 AFPAlternateAddress record (a variable
3088 length record). If the function fails to
3089 create an AFPAlternateAddress record,
3090 it sets alternateAddress to NULL and the
3091 function result is memFullErr. Your
3092 program is responsible for disposing of
3093 this pointer when it is finished with it.
3094
3095 Result Codes
3096 noErr 0 No error
3097 paramErr -50 media field in AFP mounting information
3098 was not AppleShareMediaType
3099 memFullErr -108 memory full error
3100
3101 __________
3102
3103 Also see: GetVolMountInfoSize, GetVolMountInfo, VolumeMount,
3104 BuildAFPVolMountInfo, RetrieveAFXVolMountInfo,
3105 BuildAFPXVolMountInfo
3106 */
3107
3108 /*****************************************************************************/
3109
3110 pascal OSErr GetUGEntries(short objType,
3111 UGEntryPtr entries,
3112 long reqEntryCount,
3113 long *actEntryCount,
3114 long *objID);
3115 /* ¦ Retrieve a list of user or group entries from the local file server.
3116 The GetUGEntries functions retrieves a list of user or group entries
3117 from the local file server.
3118
3119 objType input: The object type: -1 = group; 0 = user
3120 UGEntries input: Pointer to array of UGEntry records where the list
3121 is returned.
3122 reqEntryCount input: The number of elements in the UGEntries array.
3123 actEntryCount output: The number of entries returned.
3124 objID input: The current index position. Set to 0 to start with
3125 the first entry.
3126 output: The index position to get the next entry. Pass this
3127 value the next time you call GetUGEntries to start
3128 where you left off.
3129
3130 Result Codes
3131 noErr 0 No error
3132 fnfErr -43 No more users or groups
3133 paramErr -50 Function not supported; or, ioObjID is
3134 negative
3135
3136 __________
3137
3138 Also see: GetUGEntry
3139 */
3140
3141 /*****************************************************************************/
3142
3143 #ifdef __cplusplus
3144 }
3145 #endif
3146
3147 #include "optimend.h"
3148
3149 #endif /* __MOREFILESEXTRAS__ */