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