2 **      Apple Macintosh Developer Technical Support 
   4 **      The long lost high-level and FSSpec File Manager functions. 
   6 **      by Jim Luther, Apple Developer Technical Support Emeritus 
  10 **      Copyright © 1992-1998 Apple Computer, Inc. 
  11 **      All rights reserved. 
  13 **      You may incorporate this sample code into your applications without 
  14 **      restriction, though the sample code has been provided "AS IS" and the 
  15 **      responsibility for its operation is 100% yours.  However, what you are 
  16 **      not permitted to do is to redistribute the source as "DSC Sample Code" 
  17 **      after having made changes. If you're going to re-distribute the source, 
  18 **      we require that you make it clear in the source that the code was 
  19 **      descended from Apple Sample Code, but that you've made changes. 
  39 /*****************************************************************************/ 
  41 pascal  OSErr   
HGetVolParms(ConstStr255Param volName
, 
  43                                                          GetVolParmsInfoBuffer 
*volParmsInfo
, 
  45 /*      ¦ Determine the characteristics of a volume. 
  46         The HGetVolParms function returns information about the characteristics 
  47         of a volume. A result of paramErr usually just means the volume doesn't 
  48         support PBHGetVolParms and the feature you were going to check 
  51         volName                 input:  A pointer to the name of a mounted volume 
  53         vRefNum                 input:  Volume specification. 
  54         volParmsInfo    input:  Pointer to GetVolParmsInfoBuffer where the 
  55                                                         volume attributes information is returned. 
  56                                         output: Atributes information. 
  57         infoSize                input:  Size of buffer pointed to by volParmsInfo. 
  58                                         output: Size of data actually returned. 
  62                 nsvErr                          -35             Volume not found 
  63                 paramErr                        -50             Volume doesn't support this function 
  67         Also see the macros for checking attribute bits in MoreFilesExtras.h 
  70 /*****************************************************************************/ 
  72 pascal  OSErr   
HCreateMinimum(short vRefNum
, 
  74                                                            ConstStr255Param fileName
); 
  75 /*      ¦ Create a new file with no creator or file type. 
  76         The HCreateMinimum function creates a new file without attempting to set 
  77         the creator and file type of the new file.  This function is needed to 
  78         create a file in an AppleShare "drop box" where the user can make 
  79         changes, but cannot see folder or files. 
  81         vRefNum         input:  Volume specification. 
  82         dirID           input:  Directory ID. 
  83         fileName        input:  The name of the new file. 
  87                 dirFulErr                       -33             File directory full 
  88                 dskFulErr                       -34             Disk is full 
  89                 nsvErr                          -35             No such volume 
  91                 bdNamErr                        -37             Bad filename 
  92                 fnfErr                          -43             Directory not found or incomplete pathname 
  93                 wPrErr                          -44             Hardware volume lock 
  94                 vLckdErr                        -46             Software volume lock 
  95                 dupFNErr                        -48             Duplicate filename and version 
  96                 dirNFErrdirNFErr        -120    Directory not found or incomplete pathname 
  97                 afpAccessDenied         -5000   User does not have the correct access 
  98                 afpObjectTypeErr        -5025   A directory exists with that name 
 102         Also see:       FSpCreateMinimum 
 105 /*****************************************************************************/ 
 107 pascal  OSErr   
FSpCreateMinimum(const FSSpec 
*spec
); 
 108 /*      ¦ Create a new file with no creator or file type. 
 109         The FSpCreateMinimum function creates a new file without attempting to set  
 110         the the creator and file type of the new file.  This function is needed to 
 111         create a file in an AppleShare "dropbox" where the user can make 
 112         changes, but cannot see folder or files.  
 114         spec            input:  An FSSpec record specifying the file to create. 
 118                 dirFulErr                       -33             File directory full 
 119                 dskFulErr                       -34             Disk is full 
 120                 nsvErr                          -35             No such volume 
 122                 bdNamErr                        -37             Bad filename 
 123                 fnfErr                          -43             Directory not found or incomplete pathname 
 124                 wPrErr                          -44             Hardware volume lock 
 125                 vLckdErr                        -46             Software volume lock 
 126                 dupFNErr                        -48             Duplicate filename and version 
 127                 dirNFErrdirNFErr        -120    Directory not found or incomplete pathname 
 128                 afpAccessDenied         -5000   User does not have the correct access 
 129                 afpObjectTypeErr        -5025   A directory exists with that name 
 133         Also see:       HCreateMinimum 
 136 /*****************************************************************************/ 
 138 pascal  OSErr   
ExchangeFiles(short vRefNum
, 
 140                                                           ConstStr255Param srcName
, 
 142                                                           ConstStr255Param dstName
); 
 143 /*      ¦ Exchange the data stored in two files on the same volume. 
 144         The ExchangeFiles function swaps the data in two files on the same 
 145         volume by changing some of the information in the volume catalog and, 
 146         if the files are open, in the file control blocks. 
 148         vRefNum         input:  Volume specification. 
 149         srcDirID        input:  Source directory ID. 
 150         srcName         input:  Source file name. 
 151         dstDirID        input:  Destination directory ID. 
 152         dstName         input:  Destination file name. 
 156                 nsvErr                          -35             Volume not found 
 158                 fnfErr                          -43             File not found 
 159                 fLckdErr                        -45             File is locked 
 160                 vLckdErr                        -46             Volume is locked or read-only 
 161                 paramErr                        -50             Function not supported by volume 
 162                 volOfflinErr            -53             Volume is offline 
 163                 wrgVolTypErr            -123    Not an HFS volume 
 164                 diffVolErr                      -1303   Files on different volumes 
 165                 afpAccessDenied         -5000   User does not have the correct access 
 166                 afpObjectTypeErr        -5025   Object is a directory, not a file 
 167                 afpSameObjectErr        -5038   Source and destination are the same 
 171         Also see:       FSpExchangeFilesCompat 
 174 /*****************************************************************************/ 
 176 pascal  OSErr   
ResolveFileIDRef(ConstStr255Param volName
, 
 181 /*      ¦ Retrieve the location of the file with the specified file ID reference. 
 182         The ResolveFileIDRef function returns the filename and parent directory ID 
 183         of the file with the specified file ID reference. 
 185         volName input:  A pointer to the name of a mounted volume 
 187         vRefNum input:  Volume specification. 
 188         fileID  input:  The file ID reference. 
 189         parID   output: The parent directory ID of the file. 
 190         name    input:  Points to a buffer (minimum Str63) where the filename 
 191                                         is to be returned or must be nil. 
 192                         output: The filename. 
 196                 nsvErr                          -35             Volume not found 
 198                 fnfErr                          -43             File not found 
 199                 paramErr                        -50             Function not supported by volume 
 200                 volOfflinErr            -53             Volume is offline 
 201                 extFSErr                        -58             External file system error - no file 
 202                                                                         system claimed this call. 
 203                 wrgVolTypErr            -123    Not an HFS volume 
 204                 fidNotFoundErr          -1300   File ID reference not found 
 205                 notAFileErr                     -1302   Specified file is a directory 
 206                 afpAccessDenied         -5000   User does not have the correct access 
 207                 afpObjectTypeErr        -5025   Specified file is a directory 
 208                 afpIDNotFound           -5034   File ID reference not found 
 209                 afpBadIDErr                     -5039   File ID reference not found 
 213         Also see:       FSpResolveFileIDRef, CreateFileIDRef, FSpCreateFileIDRef, 
 217 /*****************************************************************************/ 
 219 pascal  OSErr   
FSpResolveFileIDRef(ConstStr255Param volName
, 
 223 /*      ¦ Retrieve the location of the file with the specified file ID reference. 
 224         The FSpResolveFileIDRef function fills in an FSSpec with the location 
 225         of the file with the specified file ID reference. 
 227         volName input:  A pointer to the name of a mounted volume 
 229         vRefNum input:  Volume specification. 
 230         fileID  input:  The file ID reference. 
 231         spec    input:  A pointer to a FSSpec record. 
 232                         output: A file system specification to be filled in by 
 237                 nsvErr                          -35             Volume not found 
 239                 fnfErr                          -43             File not found 
 240                 paramErr                        -50             Function not supported by volume or 
 242                 volOfflinErr            -53             Volume is offline 
 243                 extFSErr                        -58             External file system error - no file 
 244                                                                         system claimed this call. 
 245                 wrgVolTypErr            -123    Not an HFS volume 
 246                 fidNotFoundErr          -1300   File ID reference not found 
 247                 notAFileErr                     -1302   Specified file is a directory 
 248                 afpAccessDenied         -5000   User does not have the correct access 
 249                 afpObjectTypeErr        -5025   Specified file is a directory 
 250                 afpIDNotFound           -5034   File ID reference not found 
 251                 afpBadIDErr                     -5039   File ID reference not found 
 255         Also see:       ResolveFileIDRef, CreateFileIDRef, FSpCreateFileIDRef, 
 259 /*****************************************************************************/ 
 261 pascal  OSErr   
CreateFileIDRef(short vRefNum
, 
 263                                                                 ConstStr255Param fileName
, 
 265 /*      ¦ Establish a file ID reference for a file. 
 266         The CreateFileIDRef function creates a file ID reference for the 
 267         specified file, or if a file ID reference already exists, supplies 
 268         the file ID reference and returns the result code fidExists. 
 270         vRefNum         input:  Volume specification. 
 271         parID           input:  Directory ID. 
 272         fileName        input:  The name of the file. 
 273         fileID          output: The file ID reference. 
 277                 nsvErr                          -35             Volume not found 
 279                 fnfErr                          -43             File not found 
 280                 wPrErr                          -44             Hardware volume lock 
 281                 vLckdErr                        -46             Software volume lock 
 282                 paramErr                        -50             Function not supported by volume 
 283                 volOfflinErr            -53             Volume is offline 
 284                 extFSErr                        -58             External file system error - no file 
 285                                                                         system claimed this call. 
 286                 wrgVolTypErr            -123    Not an HFS volume 
 287                 fidExists                       -1301   File ID reference already exists 
 288                 notAFileErrn            -1302   Specified file is a directory 
 289                 afpAccessDenied         -5000   User does not have the correct access 
 290                 afpObjectTypeErr        -5025   Specified file is a directory 
 291                 afpIDExists                     -5035   File ID reference already exists 
 295         Also see:       FSpResolveFileIDRef, ResolveFileIDRef, FSpCreateFileIDRef, 
 299 /*****************************************************************************/ 
 301 pascal  OSErr   
FSpCreateFileIDRef(const FSSpec 
*spec
, 
 303 /*      ¦ Establish a file ID reference for a file. 
 304         The FSpCreateFileIDRef function creates a file ID reference for the 
 305         specified file, or if a file ID reference already exists, supplies 
 306         the file ID reference and returns the result code fidExists. 
 308         spec            input:  An FSSpec record specifying the file. 
 309         fileID          output: The file ID reference. 
 313                 nsvErr                          -35             Volume not found 
 315                 fnfErr                          -43             File not found 
 316                 wPrErr                          -44             Hardware volume lock 
 317                 vLckdErr                        -46             Software volume lock 
 318                 paramErr                        -50             Function not supported by volume 
 319                 volOfflinErr            -53             Volume is offline 
 320                 extFSErr                        -58             External file system error - no file 
 321                                                                         system claimed this call. 
 322                 wrgVolTypErr            -123    Not an HFS volume 
 323                 fidExists                       -1301   File ID reference already exists 
 324                 notAFileErrn            -1302   Specified file is a directory 
 325                 afpAccessDenied         -5000   User does not have the correct access 
 326                 afpObjectTypeErr        -5025   Specified file is a directory 
 327                 afpIDExists                     -5035   File ID reference already exists 
 331         Also see:       FSpResolveFileIDRef, ResolveFileIDRef, CreateFileIDRef, 
 335 /*****************************************************************************/ 
 337 pascal  OSErr   
DeleteFileIDRef(ConstStr255Param volName
, 
 340 /*      ¦ Delete a file ID reference. 
 341         The DeleteFileIDRef function deletes a file ID reference. 
 343         volName input:  A pointer to the name of a mounted volume 
 345         vRefNum input:  Volume specification. 
 346         fileID  input:  The file ID reference. 
 350                 nsvErr                          -35             Volume not found 
 352                 fnfErr                          -43             File not found 
 353                 wPrErr                          -44             Hardware volume lock 
 354                 vLckdErr                        -46             Software volume lock 
 355                 paramErr                        -50             Function not supported by volume 
 356                 volOfflinErr            -53             Volume is offline 
 357                 extFSErr                        -58             External file system error - no file 
 358                                                                         system claimed this call. 
 359                 wrgVolTypErr            -123    Function is not supported by volume 
 360                 fidNotFoundErr          -1300   File ID reference not found 
 361                 afpAccessDenied         -5000   User does not have the correct access 
 362                 afpObjectTypeErr        -5025   Specified file is a directory 
 363                 afpIDNotFound           -5034   File ID reference not found 
 367         Also see:       FSpResolveFileIDRef, ResolveFileIDRef, CreateFileIDRef, 
 371 /*****************************************************************************/ 
 373 pascal  OSErr   
FlushFile(short refNum
); 
 374 /*      ¦ Write the contents of a file's access path buffer (the fork data). 
 375         The FlushFile function writes the contents of a file's access path 
 376         buffer (the fork data) to the volume. Note: some of the file's catalog 
 377         information stored on the volume may not be correct until FlushVol 
 380         refNum  input:  The file reference number of an open file. 
 384                 nsvErr                          -35             Volume not found 
 386                 fnOpnErr                        -38             File not open 
 387                 fnfErr                          -43             File not found 
 388                 rfNumErr                        -51             Bad reference number 
 389                 extFSErr                        -58             External file system error - no file 
 390                                                                         system claimed this call. 
 393 /*****************************************************************************/ 
 395 pascal  OSErr   
LockRange(short refNum
, 
 398 /*      ¦ Lock a portion of a file. 
 399         The LockRange function locks (denies access to) a portion of a file 
 400         that was opened with shared read/write permission. 
 402         refNum          input:  The file reference number of an open file. 
 403         rangeLength     input:  The number of bytes in the range. 
 404         rangeStart      input:  The starting byte in the range to lock. 
 409                 fnOpnErr                        -38             File not open 
 410                 eofErr                          -39             Logical end-of-file reached 
 411                 fLckdErr                        -45             File is locked by another user 
 412                 paramErr                        -50             Negative ioReqCount 
 413                 rfNumErr                        -51             Bad reference number 
 414                 extFSErr                        -58             External file system error - no file 
 415                                                                         system claimed this call. 
 416                 volGoneErr                      -124    Server volume has been disconnected 
 417                 afpNoMoreLocks          -5015   No more ranges can be locked 
 418                 afpRangeOverlap         -5021   Part of range is already locked 
 422         Also see:       UnlockRange 
 425 /*****************************************************************************/ 
 427 pascal  OSErr   
UnlockRange(short refNum
, 
 430 /*      ¦ Unlock a previously locked range. 
 431         The UnlockRange function unlocks (allows access to) a previously locked 
 432         portion of a file that was opened with shared read/write permission. 
 434         refNum          input:  The file reference number of an open file. 
 435         rangeLength     input:  The number of bytes in the range. 
 436         rangeStart      input:  The starting byte in the range to unlock. 
 441                 fnOpnErr                        -38             File not open 
 442                 eofErr                          -39             Logical end-of-file reached 
 443                 paramErr                        -50             Negative ioReqCount 
 444                 rfNumErr                        -51             Bad reference number 
 445                 extFSErr                        -58             External file system error - no file 
 446                                                                         system claimed this call. 
 447                 volGoneErr                      -124    Server volume has been disconnected 
 448                 afpRangeNotLocked       -5020   Specified range was not locked 
 455 /*****************************************************************************/ 
 457 pascal  OSErr   
GetForeignPrivs(short vRefNum
, 
 459                                                                 ConstStr255Param name
, 
 460                                                                 void *foreignPrivBuffer
, 
 461                                                                 long *foreignPrivSize
, 
 462                                                                 long *foreignPrivInfo1
, 
 463                                                                 long *foreignPrivInfo2
, 
 464                                                                 long *foreignPrivInfo3
, 
 465                                                                 long *foreignPrivInfo4
); 
 466 /*      ¦ Retrieve the native access-control information. 
 467         The GetForeignPrivs function retrieves the native access-control 
 468         information for a file or directory stored on a volume managed by 
 469         a foreign file system. 
 471         vRefNum                         input:  Volume specification. 
 472         dirID                           input:  Directory ID. 
 473         name                            input:  Pointer to object name, or nil when dirID 
 474                                                                 specifies a directory that's the object. 
 475         foreignPrivBuffer       input:  Pointer to buffer where the privilege 
 476                                                                 information is returned. 
 477                                                 output: Privilege information. 
 478         foreignPrivSize         input:  Size of buffer pointed to by 
 480                                                 output: Amount of buffer actually used. 
 481         foreignPrivInfo1        output: Information specific to privilege model. 
 482         foreignPrivInfo2        output: Information specific to privilege model. 
 483         foreignPrivInfo3        output: Information specific to privilege model. 
 484         foreignPrivInfo4        output: Information specific to privilege model. 
 488                 nsvErr                          -35             Volume not found 
 489                 paramErr                        -50             Volume is HFS or MFS (that is, it has 
 490                                                                         no foreign privilege model), or foreign 
 491                                                                         volume does not support these calls 
 495         Also see:       FSpGetForeignPrivs, SetForeignPrivs, FSpSetForeignPrivs 
 498 /*****************************************************************************/ 
 500 pascal  OSErr   
FSpGetForeignPrivs(const FSSpec 
*spec
, 
 501                                                                    void *foreignPrivBuffer
, 
 502                                                                    long *foreignPrivSize
, 
 503                                                                    long *foreignPrivInfo1
, 
 504                                                                    long *foreignPrivInfo2
, 
 505                                                                    long *foreignPrivInfo3
, 
 506                                                                    long *foreignPrivInfo4
); 
 507 /*      ¦ Retrieve the native access-control information. 
 508         The FSpGetForeignPrivs function retrieves the native access-control 
 509         information for a file or directory stored on a volume managed by 
 510         a foreign file system. 
 512         spec                            input:  An FSSpec record specifying the object. 
 513         foreignPrivBuffer       input:  Pointer to buffer where the privilege 
 514                                                                 information is returned. 
 515                                                 output: Privilege information. 
 516         foreignPrivSize         input:  Size of buffer pointed to by 
 518                                                 output: Amount of buffer actually used. 
 519         foreignPrivInfo1        output: Information specific to privilege model. 
 520         foreignPrivInfo2        output: Information specific to privilege model. 
 521         foreignPrivInfo3        output: Information specific to privilege model. 
 522         foreignPrivInfo4        output: Information specific to privilege model. 
 526                 nsvErr                          -35             Volume not found 
 527                 paramErr                        -50             Volume is HFS or MFS (that is, it has 
 528                                                                         no foreign privilege model), or foreign 
 529                                                                         volume does not support these calls 
 533         Also see:       GetForeignPrivs, SetForeignPrivs, FSpSetForeignPrivs 
 536 /*****************************************************************************/ 
 538 pascal  OSErr   
SetForeignPrivs(short vRefNum
, 
 540                                                                 ConstStr255Param name
, 
 541                                                                 const void *foreignPrivBuffer
, 
 542                                                                 long *foreignPrivSize
, 
 543                                                                 long foreignPrivInfo1
, 
 544                                                                 long foreignPrivInfo2
, 
 545                                                                 long foreignPrivInfo3
, 
 546                                                                 long foreignPrivInfo4
); 
 547 /*      ¦ Change the native access-control information. 
 548         The SetForeignPrivs function changes the native access-control 
 549         information for a file or directory stored on a volume managed by 
 550         a foreign file system. 
 552         vRefNum                         input:  Volume specification. 
 553         dirID                           input:  Directory ID. 
 554         name                            input:  Pointer to object name, or nil when dirID 
 555                                                                 specifies a directory that's the object. 
 556         foreignPrivBuffer       input:  Pointer to privilege information buffer. 
 557         foreignPrivSize         input:  Size of buffer pointed to by 
 559                                                 output: Amount of buffer actually used. 
 560         foreignPrivInfo1        input:  Information specific to privilege model. 
 561         foreignPrivInfo2        input:  Information specific to privilege model. 
 562         foreignPrivInfo3        input:  Information specific to privilege model. 
 563         foreignPrivInfo4        input:  Information specific to privilege model. 
 567                 nsvErr                          -35             Volume not found 
 568                 paramErr                        -50             Volume is HFS or MFS (that is, it has 
 569                                                                         no foreign privilege model), or foreign 
 570                                                                         volume does not support these calls 
 574         Also see:       GetForeignPrivs, FSpGetForeignPrivs, FSpSetForeignPrivs 
 577 /*****************************************************************************/ 
 579 pascal  OSErr   
FSpSetForeignPrivs(const FSSpec 
*spec
, 
 580                                                                    const void *foreignPrivBuffer
, 
 581                                                                    long *foreignPrivSize
, 
 582                                                                    long foreignPrivInfo1
, 
 583                                                                    long foreignPrivInfo2
, 
 584                                                                    long foreignPrivInfo3
, 
 585                                                                    long foreignPrivInfo4
); 
 586 /*      ¦ Change the native access-control information. 
 587         The FSpSetForeignPrivs function changes the native access-control 
 588         information for a file or directory stored on a volume managed by 
 589         a foreign file system. 
 591         spec                            input:  An FSSpec record specifying the object. 
 592         foreignPrivBuffer       input:  Pointer to privilege information buffer. 
 593         foreignPrivSize         input:  Size of buffer pointed to by 
 595                                                 output: Amount of buffer actually used. 
 596         foreignPrivInfo1        input:  Information specific to privilege model. 
 597         foreignPrivInfo2        input:  Information specific to privilege model. 
 598         foreignPrivInfo3        input:  Information specific to privilege model. 
 599         foreignPrivInfo4        input:  Information specific to privilege model. 
 603                 nsvErr                          -35             Volume not found 
 604                 paramErr                        -50             Volume is HFS or MFS (that is, it has 
 605                                                                         no foreign privilege model), or foreign 
 606                                                                         volume does not support these calls 
 610         Also see:       GetForeignPrivs, FSpGetForeignPrivs, SetForeignPrivs 
 613 /*****************************************************************************/ 
 615 pascal  OSErr   
HGetLogInInfo(ConstStr255Param volName
, 
 619 /*      ¦ Get the login method and user name used to log on to a shared volume. 
 620         The HGetLogInInfo function retrieves the login method and user name 
 621         used to log on to a particular shared volume. 
 623         volName         input:  A pointer to the name of a mounted volume 
 625         vRefNum         input:  The volume reference number. 
 626         loginMethod     output: The login method used (kNoUserAuthentication, 
 627                                                 kPassword, kEncryptPassword, or 
 628                                                 kTwoWayEncryptPassword). 
 629         userName        input:  Points to a buffer (minimum Str31) where the user 
 630                                                 name is to be returned or must be nil. 
 631                                 output: The user name. 
 635                 nsvErr                          -35             Specified volume doesnÕt exist 
 636                 paramErr                        -50             Function not supported by volume 
 640         Also see:       HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 
 641                                 FSpSetDirAccess, HMapName, HMapID 
 644 /*****************************************************************************/ 
 646 pascal  OSErr   
HGetDirAccess(short vRefNum
, 
 648                                                           ConstStr255Param name
, 
 652 /*      ¦ Get a directory's access control information on a shared volume. 
 653         The HGetDirAccess function retrieves the directory access control 
 654         information for a directory on a shared volume. 
 656         vRefNum                 input:  Volume specification. 
 657         dirID                   input:  Directory ID. 
 658         name                    input:  Pointer to directory name, or nil if dirID 
 659                                                         specifies the directory. 
 660         ownerID                 output: The directory's owner ID. 
 661         groupID                 output: The directory's group ID or 
 662                                                         0 if no group affiliation. 
 663         accessRights    output: The directory's access rights. 
 667                 fnfErr                          -43             Directory not found 
 668                 paramErr                        -50             Function not supported by volume 
 669                 afpAccessDenied         -5000   User does not have the correct access 
 674         Also see:       HGetLogInInfo, FSpGetDirAccess, HSetDirAccess, 
 675                                 FSpSetDirAccess, HMapName, HMapID 
 678 /*****************************************************************************/ 
 680 pascal  OSErr   
FSpGetDirAccess(const FSSpec 
*spec
, 
 684 /*      ¦ Get a directory's access control information on a shared volume. 
 685         The FSpGetDirAccess function retrieves the directory access control 
 686         information for a directory on a shared volume. 
 688         spec                    input:  An FSSpec record specifying the directory. 
 689         ownerID                 output: The directory's owner ID. 
 690         groupID                 output: The directory's group ID or 
 691                                                         0 if no group affiliation. 
 692         accessRights    output: The directory's access rights. 
 696                 fnfErr                          -43             Directory not found 
 697                 paramErr                        -50             Function not supported by volume 
 698                 afpAccessDenied         -5000   User does not have the correct access 
 703         Also see:       HGetLogInInfo, HGetDirAccess, HSetDirAccess, 
 704                                 FSpSetDirAccess, HMapName, HMapID 
 707 /*****************************************************************************/ 
 709 pascal  OSErr   
HSetDirAccess(short vRefNum
, 
 711                                                           ConstStr255Param name
, 
 715 /*      ¦ Set a directory's access control information on a shared volume. 
 716         The HSetDirAccess function changes the directory access control 
 717         information for a directory on a shared volume. You must own a directory 
 718         to change its access control information. 
 720         vRefNum                 input:  Volume specification. 
 721         dirID                   input:  Directory ID. 
 722         name                    input:  Pointer to directory name, or nil if dirID 
 723                                                         specifies the directory. 
 724         ownerID                 input:  The directory's owner ID. 
 725         groupID                 input:  The directory's group ID or 
 726                                                         0 if no group affiliation. 
 727         accessRights    input:  The directory's access rights. 
 731                 fnfErr                          -43             Directory not found 
 732                 vLckdErr                        -46             Volume is locked or read-only 
 733                 paramErr                        -50             Parameter error 
 734                 afpAccessDenied         -5000   User does not have the correct access 
 736                 afpObjectTypeErr        -5025   Object is a file, not a directory 
 740         Also see:       HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, 
 741                                 FSpSetDirAccess, HMapName, HMapID 
 744 /*****************************************************************************/ 
 746 pascal  OSErr   
FSpSetDirAccess(const FSSpec 
*spec
, 
 750 /*      ¦ Set a directory's access control information on a shared volume. 
 751         The FSpSetDirAccess function changes the directory access control 
 752         information for a directory on a shared volume. You must own a directory 
 753         to change its access control information. 
 755         spec                    input:  An FSSpec record specifying the directory. 
 756         ownerID                 input:  The directory's owner ID. 
 757         groupID                 input:  The directory's group ID or 
 758                                                         0 if no group affiliation. 
 759         accessRights    input:  The directory's access rights. 
 763                 fnfErr                          -43             Directory not found 
 764                 vLckdErr                        -46             Volume is locked or read-only 
 765                 paramErr                        -50             Parameter error 
 766                 afpAccessDenied         -5000   User does not have the correct access 
 768                 afpObjectTypeErr        -5025   Object is a file, not a directory 
 772         Also see:       HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 
 776 /*****************************************************************************/ 
 778 pascal  OSErr   
HMapID(ConstStr255Param volName
, 
 783 /*      ¦ Map a user or group ID to a user or group name. 
 784         The HMapID function determines the name of a user or group if you know 
 785         the user or group ID. 
 787         volName         input:  A pointer to the name of a mounted volume 
 789         vRefNum         input:  Volume specification. 
 790         objType         input:  The mapping function code: 1 if you're mapping a 
 791                                                 user ID to a user name or 2 if you're mapping a 
 792                                                 group ID to a group name. 
 793         name            input:  Points to a buffer (minimum Str31) where the user 
 794                                                 or group name is to be returned or must be nil. 
 795                                 output: The user or group name. 
 799                 fnfErr                          -43             Unrecognizable owner or group name 
 800                 paramErr                        -50             Function not supported by volume 
 804         Also see:       HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 
 805                                 FSpSetDirAccess, HMapName 
 808 /*****************************************************************************/ 
 810 pascal  OSErr   
HMapName(ConstStr255Param volName
, 
 812                                                  ConstStr255Param name
, 
 815 /*      ¦ Map a user or group name to a user or group ID. 
 816         The HMapName function determines the user or group ID if you know the 
 819         volName         input:  A pointer to the name of a mounted volume 
 821         vRefNum         input:  Volume specification. 
 822         name            input:  The user or group name. 
 823         objType         input:  The mapping function code: 3 if you're mapping a 
 824                                                 user name to a user ID or 4 if you're mapping a 
 825                                                 group name to a group ID. 
 826         ugID            output: The user or group ID. 
 830                 fnfErr                          -43             Unrecognizable owner or group name 
 831                 paramErr                        -50             Function not supported by volume 
 835         Also see:       HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 
 836                                 FSpSetDirAccess, HMapID 
 839 /*****************************************************************************/ 
 841 pascal  OSErr   
HCopyFile(short srcVRefNum
, 
 843                                                   ConstStr255Param srcName
, 
 846                                                   ConstStr255Param dstPathname
, 
 847                                                   ConstStr255Param copyName
); 
 848 /*      ¦ Duplicate a file on a file server and optionally to rename it. 
 849         The HCopyFile function duplicates a file and optionally to renames it. 
 850         The source and destination volumes must be on the same file server. 
 851         This function instructs the server to copy the file. 
 853         srcVRefNum      input:  Source volume specification. 
 854         srcDirID        input:  Source directory ID. 
 855         srcName         input:  Source file name. 
 856         dstVRefNum      input:  Destination volume specification. 
 857         dstDirID        input:  Destination directory ID. 
 858         dstPathname     input:  Pointer to destination directory name, or 
 859                                                 nil when dstDirID specifies a directory. 
 860         copyName        input:  Points to the new file name if the file is to be 
 861                                                 renamed or nil if the file isn't to be renamed. 
 865                 dskFulErr                       -34             Destination volume is full 
 866                 fnfErr                          -43             Source file not found, or destination 
 867                                                                         directory does not exist 
 868                 vLckdErr                        -46             Destination volume is read-only 
 869                 fBsyErr                         -47             The source or destination file could 
 870                                                                         not be opened with the correct access 
 872                 dupFNErr                        -48             Destination file already exists 
 873                 paramErr                        -50             Function not supported by volume 
 874                 wrgVolTypErr            -123    Function not supported by volume 
 875                 afpAccessDenied         -5000   The user does not have the right to 
 876                                                                         read the source or write to the 
 878                 afpDenyConflict         -5006   The source or destination file could 
 879                                                                         not be opened with the correct access 
 881                 afpObjectTypeErr        -5025   Source is a directory 
 885         Also see:       FSpCopyFile, FileCopy, FSpFileCopy 
 888 /*****************************************************************************/ 
 890 pascal  OSErr   
FSpCopyFile(const FSSpec 
*srcSpec
, 
 891                                                         const FSSpec 
*dstSpec
, 
 892                                                         ConstStr255Param copyName
); 
 893 /*      ¦ Duplicate a file on a file server and optionally to rename it. 
 894         The FSpCopyFile function duplicates a file and optionally to renames it. 
 895         The source and destination volumes must be on the same file server. 
 896         This function instructs the server to copy the file. 
 898         srcSpec         input:  An FSSpec record specifying the source file. 
 899         dstSpec         input:  An FSSpec record specifying the destination 
 901         copyName        input:  Points to the new file name if the file is to be 
 902                                                 renamed or nil if the file isn't to be renamed. 
 906                 dskFulErr                       -34             Destination volume is full 
 907                 fnfErr                          -43             Source file not found, or destination 
 908                                                                         directory does not exist 
 909                 vLckdErr                        -46             Destination volume is read-only 
 910                 fBsyErr                         -47             The source or destination file could 
 911                                                                         not be opened with the correct access 
 913                 dupFNErr                        -48             Destination file already exists 
 914                 paramErr                        -50             Function not supported by volume 
 915                 wrgVolTypErr            -123    Function not supported by volume 
 916                 afpAccessDenied         -5000   The user does not have the right to 
 917                                                                         read the source or write to the 
 919                 afpDenyConflict         -5006   The source or destination file could 
 920                                                                         not be opened with the correct access 
 922                 afpObjectTypeErr        -5025   Source is a directory 
 926         Also see:       HCopyFile, FileCopy, FSpFileCopy 
 929 /*****************************************************************************/ 
 931 pascal  OSErr   
HMoveRename(short vRefNum
, 
 933                                                         ConstStr255Param srcName
, 
 935                                                         ConstStr255Param dstpathName
, 
 936                                                         ConstStr255Param copyName
); 
 937 /*      ¦ Move a file or directory on a file server and optionally to rename it. 
 938         The HMoveRename function moves a file or directory and optionally 
 939         renames it. The source and destination locations must be on the same 
 942         vRefNum         input:  Volume specification. 
 943         srcDirID        input:  Source directory ID. 
 944         srcName         input:  The source object name. 
 945         dstDirID        input:  Destination directory ID. 
 946         dstName         input:  Pointer to destination directory name, or 
 947                                                 nil when dstDirID specifies a directory. 
 948         copyName        input:  Points to the new name if the object is to be 
 949                                                 renamed or nil if the object isn't to be renamed. 
 953                 fnfErr                          -43             Source file or directory not found 
 954                 fLckdErr                        -45             File is locked 
 955                 vLckdErr                        -46             Destination volume is read-only 
 956                 dupFNErr                        -48             Destination already exists 
 957                 paramErr                        -50             Function not supported by volume 
 958                 badMovErr                       -122    Attempted to move directory into 
 960                 afpAccessDenied         -5000   The user does not have the right to 
 961                                                                         move the file  or directory 
 965         Also see:       FSpMoveRename, HMoveRenameCompat, FSpMoveRenameCompat 
 968 /*****************************************************************************/ 
 970 pascal  OSErr   
FSpMoveRename(const FSSpec 
*srcSpec
, 
 971                                                           const FSSpec 
*dstSpec
, 
 972                                                           ConstStr255Param copyName
); 
 973 /*      ¦ Move a file or directory on a file server and optionally to rename it. 
 974         The FSpMoveRename function moves a file or directory and optionally 
 975         renames it. The source and destination locations must be on the same 
 978         srcSpec         input:  An FSSpec record specifying the source object. 
 979         dstSpec         input:  An FSSpec record specifying the destination 
 981         copyName        input:  Points to the new name if the object is to be 
 982                                                 renamed or nil if the object isn't to be renamed. 
 986                 fnfErr                          -43             Source file or directory not found 
 987                 fLckdErr                        -45             File is locked 
 988                 vLckdErr                        -46             Destination volume is read-only 
 989                 dupFNErr                        -48             Destination already exists 
 990                 paramErr                        -50             Function not supported by volume 
 991                 badMovErr                       -122    Attempted to move directory into 
 993                 afpAccessDenied         -5000   The user does not have the right to 
 994                                                                         move the file  or directory 
 998         Also see:       HMoveRename, HMoveRenameCompat, FSpMoveRenameCompat 
1001 /*****************************************************************************/ 
1003 pascal  OSErr   
GetVolMountInfoSize(ConstStr255Param volName
, 
1006 /*      ¦ Get the size of a volume mounting information record. 
1007         The GetVolMountInfoSize function determines the how much space the 
1008         program needs to allocate for a volume mounting information record. 
1010         volName         input:  A pointer to the name of a mounted volume 
1012         vRefNum         input:  Volume specification. 
1013         size            output: The space needed (in bytes) of the volume mounting 
1018                 nsvErr                          -35             Volume not found 
1019                 paramErr                        -50             Parameter error 
1020                 extFSErr                        -58             External file system error - no file 
1021                                                                         system claimed this call. 
1025         Also see:       GetVolMountInfo, VolumeMount BuildAFPVolMountInfo, 
1026                                 RetrieveAFPVolMountInfo 
1029 /*****************************************************************************/ 
1031 pascal  OSErr   
GetVolMountInfo(ConstStr255Param volName
, 
1033                                                                 void *volMountInfo
); 
1034 /*      ¦ Retrieve a volume mounting information record. 
1035         The GetVolMountInfo function retrieves a volume mounting information 
1036         record containing all the information needed to mount the volume, 
1037         except for passwords. 
1039         volName                 input:  A pointer to the name of a mounted volume 
1041         vRefNum                 input:  Volume specification. 
1042         volMountInfo    output: Points to a volume mounting information 
1043                                                         record where the mounting information is to 
1048                 nsvErr                          -35             Volume not found         
1049                 paramErr                        -50             Parameter error  
1050                 extFSErr                        -58             External file system error - no file 
1051                                                                         system claimed this call. 
1055         Also see:       GetVolMountInfoSize, VolumeMount, BuildAFPVolMountInfo, 
1056                                 RetrieveAFPVolMountInfo 
1059 /*****************************************************************************/ 
1061 pascal  OSErr   
VolumeMount(const void *volMountInfo
, 
1063 /*      ¦ Mount a volume using a volume mounting information record. 
1064         The VolumeMount function mounts a volume using a volume mounting 
1067         volMountInfo    input:  Points to a volume mounting information record. 
1068         vRefNum                 output: A volume reference number. 
1072                 notOpenErr                      -28             AppleTalk is not open 
1073                 nsvErr                          -35             Volume not found 
1074                 paramErr                        -50             Parameter error; typically, zone, server, 
1075                                                                         and volume name combination is not valid 
1076                                                                         or not complete, or the user name is not 
1078                 extFSErr                        -58             External file system error - no file 
1079                                                                         system claimed this call. 
1080                 memFullErr                      -108    Not enough memory to create a new volume 
1081                                                                         control block for mounting the volume 
1082                 afpBadUAM                       -5002   User authentication method is unknown 
1083                 afpBadVersNum           -5003   Workstation is using an AFP version that 
1084                                                                         the server doesnÕt recognize 
1085                 afpNoServer                     -5016   Server is not responding 
1086                 afpUserNotAuth          -5023   User authentication failed (usually, 
1087                                                                         password  is not correct) 
1088                 afpPwdExpired           -5042   Password has expired on server 
1089                 afpBadDirIDType         -5060   Not a fixed directory ID volume 
1090                 afpCantMountMoreSrvrs -5061     Maximum number of volumes has been 
1092                 afpAlreadyMounted       -5062   Volume already mounted 
1093                 afpSameNodeErr          -5063   Attempt to log on to a server running 
1098         Also see:       GetVolMountInfoSize, GetVolMountInfo, BuildAFPVolMountInfo, 
1099                                 RetrieveAFPVolMountInfo 
1102 /*****************************************************************************/ 
1104 pascal  OSErr   
Share(short vRefNum
, 
1106                                           ConstStr255Param name
); 
1107 /*      ¦ Establish a local volume or directory as a share point. 
1108         The Share function establishes a local volume or directory as a 
1111         vRefNum                 input:  Volume specification. 
1112         dirID                   input:  Directory ID. 
1113         name                    input:  Pointer to directory name, or nil if dirID 
1114                                                         specifies the directory. 
1118                 tmfoErr                         -42             Too many share points    
1119                 fnfErr                          -43             File not found   
1120                 dupFNErr                        -48             Already a share point with this name     
1121                 paramErr                        -50             Function not supported by volume         
1122                 dirNFErrdirNFErr        -120    Directory not found      
1123                 afpAccessDenied         -5000   This directory cannot be shared  
1124                 afpObjectTypeErr        -5025   Object was a file, not a directory       
1125                 afpContainsSharedErr -5033      The directory contains a share point     
1126                 afpInsideSharedErr      -5043   The directory is inside a shared directory       
1130         Also see:       FSpShare, Unshare, FSpUnshare 
1133 /*****************************************************************************/ 
1135 pascal  OSErr   
FSpShare(const FSSpec 
*spec
); 
1136 /*      ¦ Establish a local volume or directory as a share point. 
1137         The FSpShare function establishes a local volume or directory as a 
1140         spec    input:  An FSSpec record specifying the share point. 
1144                 tmfoErr                         -42             Too many share points    
1145                 fnfErr                          -43             File not found   
1146                 dupFNErr                        -48             Already a share point with this name     
1147                 paramErr                        -50             Function not supported by volume         
1148                 dirNFErrdirNFErr        -120    Directory not found      
1149                 afpAccessDenied         -5000   This directory cannot be shared  
1150                 afpObjectTypeErr        -5025   Object was a file, not a directory       
1151                 afpContainsSharedErr -5033      The directory contains a share point     
1152                 afpInsideSharedErr      -5043   The directory is inside a shared directory       
1156         Also see:       Share, Unshare, FSpUnshare 
1159 /*****************************************************************************/ 
1161 pascal  OSErr   
Unshare(short vRefNum
, 
1163                                                 ConstStr255Param name
); 
1164 /*      ¦ Remove a share point. 
1165         The Unshare function removes a share point. 
1167         vRefNum                 input:  Volume specification. 
1168         dirID                   input:  Directory ID. 
1169         name                    input:  Pointer to directory name, or nil if dirID 
1170                                                         specifies the directory. 
1174                 fnfErr                          -43             File not found   
1175                 paramErr                        -50             Function not supported by volume         
1176                 dirNFErrdirNFErr        -120    Directory not found      
1177                 afpObjectTypeErr        -5025   Object was a file, not a directory; or, 
1178                                                                         this directory is not a share point      
1182         Also see:       Share, FSpShare, FSpUnshare 
1185 /*****************************************************************************/ 
1187 pascal  OSErr   
FSpUnshare(const FSSpec 
*spec
); 
1188 /*      ¦ Remove a share point. 
1189         The FSpUnshare function removes a share point. 
1191         spec    input:  An FSSpec record specifying the share point. 
1195                 fnfErr                          -43             File not found   
1196                 paramErr                        -50             Function not supported by volume         
1197                 dirNFErrdirNFErr        -120    Directory not found      
1198                 afpObjectTypeErr        -5025   Object was a file, not a directory; or, 
1199                                                                         this directory is not a share point      
1203         Also see:       Share, FSpShare, Unshare 
1206 /*****************************************************************************/ 
1208 pascal  OSErr   
GetUGEntry(short objType
, 
1211 /*      ¦ Retrieve a user or group entry from the local file server. 
1212         The GetUGEntry function retrieves user or group entries from the 
1215         objType         input:  The object type: -1 = group; 0 = user 
1216         objName         input:  Points to a buffer (minimum Str31) where the user 
1217                                                 or group name is to be returned or must be nil. 
1218                                 output: The user or group name. 
1219         objID           input:  O to get the first user or group. If the entry objID 
1220                                                 last returned by GetUGEntry is passed, then user or 
1221                                                 group whose alphabetically next in the list of entries 
1223                                 output: The user or group ID. 
1227                 fnfErr                          -43             No more users or groups  
1228                 paramErr                        -50             Function not supported; or, ioObjID is 
1233         Also see:       GetUGEntries 
1236 /*****************************************************************************/ 
1242 #include "OptimEnd.h" 
1244 #endif  /* __MOREFILES__ */