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