1/* 2 File: MoreFiles.h 3 4 Contains: The long lost high-level and FSSpec File Manager functions. 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 __MOREFILES__ 29#define __MOREFILES__ 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 64EXTERN_API( OSErr ) 65HGetVolParms( 66 ConstStr255Param volName, 67 short vRefNum, 68 GetVolParmsInfoBuffer * volParmsInfo, 69 long * infoSize); 70 71 72/* 73 The HGetVolParms function returns information about the characteristics 74 of a volume. A result of paramErr usually just means the volume doesn't 75 support PBHGetVolParms and the feature you were going to check 76 for isn't available. 77 78 volName input: A pointer to the name of a mounted volume 79 or nil. 80 vRefNum input: Volume specification. 81 volParmsInfo input: Pointer to GetVolParmsInfoBuffer where the 82 volume attributes information is returned. 83 output: Atributes information. 84 infoSize input: Size of buffer pointed to by volParmsInfo. 85 output: Size of data actually returned. 86 87 Result Codes 88 noErr 0 No error 89 nsvErr -35 Volume not found 90 paramErr -50 Volume doesn't support this function 91 92 __________ 93 94 Also see the macros for checking attribute bits in MoreFilesExtras.h 95*/ 96 97/*****************************************************************************/ 98 99EXTERN_API( OSErr ) 100HCreateMinimum( 101 short vRefNum, 102 long dirID, 103 ConstStr255Param fileName); 104 105 106/* 107 The HCreateMinimum function creates a new file without attempting to set 108 the creator and file type of the new file. This function is needed to 109 create a file in an AppleShare "drop box" where the user can make 110 changes, but cannot see folder or files. 111 112 vRefNum input: Volume specification. 113 dirID input: Directory ID. 114 fileName input: The name of the new file. 115 116 Result Codes 117 noErr 0 No error 118 dirFulErr -33 File directory full 119 dskFulErr -34 Disk is full 120 nsvErr -35 No such volume 121 ioErr -36 I/O error 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 130 131 __________ 132 133 Also see: FSpCreateMinimum 134*/ 135 136/*****************************************************************************/ 137 138EXTERN_API( OSErr ) 139FSpCreateMinimum(const FSSpec * spec); 140 141 142/* 143 The FSpCreateMinimum function creates a new file without attempting to set 144 the the creator and file type of the new file. This function is needed to 145 create a file in an AppleShare "dropbox" where the user can make 146 changes, but cannot see folder or files. 147 148 spec input: An FSSpec record specifying the file to create. 149 150 Result Codes 151 noErr 0 No error 152 dirFulErr -33 File directory full 153 dskFulErr -34 Disk is full 154 nsvErr -35 No such volume 155 ioErr -36 I/O error 156 bdNamErr -37 Bad filename 157 fnfErr -43 Directory not found or incomplete pathname 158 wPrErr -44 Hardware volume lock 159 vLckdErr -46 Software volume lock 160 dupFNErr -48 Duplicate filename and version 161 dirNFErrdirNFErr -120 Directory not found or incomplete pathname 162 afpAccessDenied -5000 User does not have the correct access 163 afpObjectTypeErr -5025 A directory exists with that name 164 165 __________ 166 167 Also see: HCreateMinimum 168*/ 169 170/*****************************************************************************/ 171 172EXTERN_API( OSErr ) 173ExchangeFiles( 174 short vRefNum, 175 long srcDirID, 176 ConstStr255Param srcName, 177 long dstDirID, 178 ConstStr255Param dstName); 179 180 181/* 182 The ExchangeFiles function swaps the data in two files on the same 183 volume by changing some of the information in the volume catalog and, 184 if the files are open, in the file control blocks. 185 186 vRefNum input: Volume specification. 187 srcDirID input: Source directory ID. 188 srcName input: Source file name. 189 dstDirID input: Destination directory ID. 190 dstName input: Destination file name. 191 192 Result Codes 193 noErr 0 No error 194 nsvErr -35 Volume not found 195 ioErr -36 I/O error 196 fnfErr -43 File not found 197 fLckdErr -45 File is locked 198 vLckdErr -46 Volume is locked or read-only 199 paramErr -50 Function not supported by volume 200 volOfflinErr -53 Volume is offline 201 wrgVolTypErr -123 Not an HFS volume 202 diffVolErr -1303 Files on different volumes 203 afpAccessDenied -5000 User does not have the correct access 204 afpObjectTypeErr -5025 Object is a directory, not a file 205 afpSameObjectErr -5038 Source and destination are the same 206 207 __________ 208 209 Also see: FSpExchangeFilesCompat 210*/ 211 212/*****************************************************************************/ 213 214EXTERN_API( OSErr ) 215ResolveFileIDRef( 216 ConstStr255Param volName, 217 short vRefNum, 218 long fileID, 219 long * parID, 220 StringPtr fileName); 221 222 223/* 224 The ResolveFileIDRef function returns the filename and parent directory ID 225 of the file with the specified file ID reference. 226 227 volName input: A pointer to the name of a mounted volume 228 or nil. 229 vRefNum input: Volume specification. 230 fileID input: The file ID reference. 231 parID output: The parent directory ID of the file. 232 name input: Points to a buffer (minimum Str63) where the filename 233 is to be returned or must be nil. 234 output: The filename. 235 236 Result Codes 237 noErr 0 No error 238 nsvErr -35 Volume not found 239 ioErr -36 I/O error 240 fnfErr -43 File not found 241 paramErr -50 Function not supported by volume 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 252 253 __________ 254 255 Also see: FSpResolveFileIDRef, CreateFileIDRef, FSpCreateFileIDRef, 256 DeleteFileIDRef 257*/ 258 259/*****************************************************************************/ 260 261EXTERN_API( OSErr ) 262FSpResolveFileIDRef( 263 ConstStr255Param volName, 264 short vRefNum, 265 long fileID, 266 FSSpecPtr spec); 267 268 269/* 270 The FSpResolveFileIDRef function fills in an FSSpec with the location 271 of the file with the specified file ID reference. 272 273 volName input: A pointer to the name of a mounted volume 274 or nil. 275 vRefNum input: Volume specification. 276 fileID input: The file ID reference. 277 spec input: A pointer to a FSSpec record. 278 output: A file system specification to be filled in by 279 FSpResolveFileIDRef. 280 281 Result Codes 282 noErr 0 No error 283 nsvErr -35 Volume not found 284 ioErr -36 I/O error 285 fnfErr -43 File not found 286 paramErr -50 Function not supported by volume or 287 no default volume 288 volOfflinErr -53 Volume is offline 289 extFSErr -58 External file system error - no file 290 system claimed this call. 291 wrgVolTypErr -123 Not an HFS volume 292 fidNotFoundErr -1300 File ID reference not found 293 notAFileErr -1302 Specified file is a directory 294 afpAccessDenied -5000 User does not have the correct access 295 afpObjectTypeErr -5025 Specified file is a directory 296 afpIDNotFound -5034 File ID reference not found 297 afpBadIDErr -5039 File ID reference not found 298 299 __________ 300 301 Also see: ResolveFileIDRef, CreateFileIDRef, FSpCreateFileIDRef, 302 DeleteFileIDRef 303*/ 304 305/*****************************************************************************/ 306 307EXTERN_API( OSErr ) 308CreateFileIDRef( 309 short vRefNum, 310 long parID, 311 ConstStr255Param fileName, 312 long * fileID); 313 314 315/* 316 The CreateFileIDRef function creates a file ID reference for the 317 specified file, or if a file ID reference already exists, supplies 318 the file ID reference and returns the result code fidExists or afpIDExists. 319 320 vRefNum input: Volume specification. 321 parID input: Directory ID. 322 fileName input: The name of the file. 323 fileID output: The file ID reference (if result is noErr, 324 fidExists, or afpIDExists). 325 326 Result Codes 327 noErr 0 No error 328 nsvErr -35 Volume not found 329 ioErr -36 I/O error 330 fnfErr -43 File not found 331 wPrErr -44 Hardware volume lock 332 vLckdErr -46 Software volume lock 333 paramErr -50 Function not supported by volume 334 volOfflinErr -53 Volume is offline 335 extFSErr -58 External file system error - no file 336 system claimed this call. 337 wrgVolTypErr -123 Not an HFS volume 338 fidExists -1301 File ID reference already exists 339 notAFileErrn -1302 Specified file is a directory 340 afpAccessDenied -5000 User does not have the correct access 341 afpObjectTypeErr -5025 Specified file is a directory 342 afpIDExists -5035 File ID reference already exists 343 344 __________ 345 346 Also see: FSpResolveFileIDRef, ResolveFileIDRef, FSpCreateFileIDRef, 347 DeleteFileIDRef 348*/ 349 350/*****************************************************************************/ 351 352EXTERN_API( OSErr ) 353FSpCreateFileIDRef( 354 const FSSpec * spec, 355 long * fileID); 356 357 358/* 359 The FSpCreateFileIDRef function creates a file ID reference for the 360 specified file, or if a file ID reference already exists, supplies 361 the file ID reference and returns the result code fidExists or afpIDExists. 362 363 spec input: An FSSpec record specifying the file. 364 fileID output: The file ID reference (if result is noErr, 365 fidExists, or afpIDExists). 366 367 Result Codes 368 noErr 0 No error 369 nsvErr -35 Volume not found 370 ioErr -36 I/O error 371 fnfErr -43 File not found 372 wPrErr -44 Hardware volume lock 373 vLckdErr -46 Software volume lock 374 paramErr -50 Function not supported by volume 375 volOfflinErr -53 Volume is offline 376 extFSErr -58 External file system error - no file 377 system claimed this call. 378 wrgVolTypErr -123 Not an HFS volume 379 fidExists -1301 File ID reference already exists 380 notAFileErrn -1302 Specified file is a directory 381 afpAccessDenied -5000 User does not have the correct access 382 afpObjectTypeErr -5025 Specified file is a directory 383 afpIDExists -5035 File ID reference already exists 384 385 __________ 386 387 Also see: FSpResolveFileIDRef, ResolveFileIDRef, CreateFileIDRef, 388 DeleteFileIDRef 389*/ 390 391/*****************************************************************************/ 392 393EXTERN_API( OSErr ) 394DeleteFileIDRef( 395 ConstStr255Param volName, 396 short vRefNum, 397 long fileID); 398 399 400/* 401 The DeleteFileIDRef function deletes a file ID reference. 402 403 volName input: A pointer to the name of a mounted volume 404 or nil. 405 vRefNum input: Volume specification. 406 fileID input: The file ID reference. 407 408 Result Codes 409 noErr 0 No error 410 nsvErr -35 Volume not found 411 ioErr -36 I/O error 412 fnfErr -43 File not found 413 wPrErr -44 Hardware volume lock 414 vLckdErr -46 Software volume lock 415 paramErr -50 Function not supported by volume 416 volOfflinErr -53 Volume is offline 417 extFSErr -58 External file system error - no file 418 system claimed this call. 419 wrgVolTypErr -123 Function is not supported by volume 420 fidNotFoundErr -1300 File ID reference not found 421 afpAccessDenied -5000 User does not have the correct access 422 afpObjectTypeErr -5025 Specified file is a directory 423 afpIDNotFound -5034 File ID reference not found 424 425 __________ 426 427 Also see: FSpResolveFileIDRef, ResolveFileIDRef, CreateFileIDRef, 428 FSpCreateFileIDRef 429*/ 430 431/*****************************************************************************/ 432 433EXTERN_API( OSErr ) 434FlushFile(short refNum); 435 436 437/* 438 The FlushFile function writes the contents of a file's access path 439 buffer (the fork data) to the volume. Note: some of the file's catalog 440 information stored on the volume may not be correct until FlushVol 441 is called. 442 443 refNum input: The file reference number of an open file. 444 445 Result Codes 446 noErr 0 No error 447 nsvErr -35 Volume not found 448 ioErr -36 I/O error 449 fnOpnErr -38 File not open 450 fnfErr -43 File not found 451 rfNumErr -51 Bad reference number 452 extFSErr -58 External file system error - no file 453 system claimed this call. 454*/ 455 456/*****************************************************************************/ 457 458EXTERN_API( OSErr ) 459LockRange( 460 short refNum, 461 long rangeLength, 462 long rangeStart); 463 464 465/* 466 The LockRange function locks (denies access to) a portion of a file 467 that was opened with shared read/write permission. 468 469 refNum input: The file reference number of an open file. 470 rangeLength input: The number of bytes in the range. 471 rangeStart input: The starting byte in the range to lock. 472 473 Result Codes 474 noErr 0 No error 475 ioErr -36 I/O error 476 fnOpnErr -38 File not open 477 eofErr -39 Logical end-of-file reached 478 fLckdErr -45 File is locked by another user 479 paramErr -50 Negative ioReqCount 480 rfNumErr -51 Bad reference number 481 extFSErr -58 External file system error - no file 482 system claimed this call. 483 volGoneErr -124 Server volume has been disconnected 484 afpNoMoreLocks -5015 No more ranges can be locked 485 afpRangeOverlap -5021 Part of range is already locked 486 487 __________ 488 489 Also see: UnlockRange 490*/ 491 492/*****************************************************************************/ 493 494EXTERN_API( OSErr ) 495UnlockRange( 496 short refNum, 497 long rangeLength, 498 long rangeStart); 499 500 501/* 502 The UnlockRange function unlocks (allows access to) a previously locked 503 portion of a file that was opened with shared read/write permission. 504 505 refNum input: The file reference number of an open file. 506 rangeLength input: The number of bytes in the range. 507 rangeStart input: The starting byte in the range to unlock. 508 509 Result Codes 510 noErr 0 No error 511 ioErr -36 I/O error 512 fnOpnErr -38 File not open 513 eofErr -39 Logical end-of-file reached 514 paramErr -50 Negative ioReqCount 515 rfNumErr -51 Bad reference number 516 extFSErr -58 External file system error - no file 517 system claimed this call. 518 volGoneErr -124 Server volume has been disconnected 519 afpRangeNotLocked -5020 Specified range was not locked 520 521 __________ 522 523 Also see: LockRange 524*/ 525 526/*****************************************************************************/ 527 528EXTERN_API( OSErr ) 529GetForeignPrivs( 530 short vRefNum, 531 long dirID, 532 ConstStr255Param name, 533 void * foreignPrivBuffer, 534 long * foreignPrivSize, 535 long * foreignPrivInfo1, 536 long * foreignPrivInfo2, 537 long * foreignPrivInfo3, 538 long * foreignPrivInfo4); 539 540 541/* 542 The GetForeignPrivs function retrieves the native access-control 543 information for a file or directory stored on a volume managed by 544 a foreign file system. 545 546 vRefNum input: Volume specification. 547 dirID input: Directory ID. 548 name input: Pointer to object name, or nil when dirID 549 specifies a directory that's the object. 550 foreignPrivBuffer input: Pointer to buffer where the privilege 551 information is returned. 552 output: Privilege information. 553 foreignPrivSize input: Size of buffer pointed to by 554 foreignPrivBuffer. 555 output: Amount of buffer actually used. 556 foreignPrivInfo1 output: Information specific to privilege model. 557 foreignPrivInfo2 output: Information specific to privilege model. 558 foreignPrivInfo3 output: Information specific to privilege model. 559 foreignPrivInfo4 output: Information specific to privilege model. 560 561 Result Codes 562 noErr 0 No error 563 nsvErr -35 Volume not found 564 paramErr -50 Volume is HFS or MFS (that is, it has 565 no foreign privilege model), or foreign 566 volume does not support these calls 567 568 __________ 569 570 Also see: FSpGetForeignPrivs, SetForeignPrivs, FSpSetForeignPrivs 571*/ 572 573/*****************************************************************************/ 574 575EXTERN_API( OSErr ) 576FSpGetForeignPrivs( 577 const FSSpec * spec, 578 void * foreignPrivBuffer, 579 long * foreignPrivSize, 580 long * foreignPrivInfo1, 581 long * foreignPrivInfo2, 582 long * foreignPrivInfo3, 583 long * foreignPrivInfo4); 584 585 586/* 587 The FSpGetForeignPrivs function retrieves the native access-control 588 information for a file or directory stored on a volume managed by 589 a foreign file system. 590 591 spec input: An FSSpec record specifying the object. 592 foreignPrivBuffer input: Pointer to buffer where the privilege 593 information is returned. 594 output: Privilege information. 595 foreignPrivSize input: Size of buffer pointed to by 596 foreignPrivBuffer. 597 output: Amount of buffer actually used. 598 foreignPrivInfo1 output: Information specific to privilege model. 599 foreignPrivInfo2 output: Information specific to privilege model. 600 foreignPrivInfo3 output: Information specific to privilege model. 601 foreignPrivInfo4 output: Information specific to privilege model. 602 603 Result Codes 604 noErr 0 No error 605 nsvErr -35 Volume not found 606 paramErr -50 Volume is HFS or MFS (that is, it has 607 no foreign privilege model), or foreign 608 volume does not support these calls 609 610 __________ 611 612 Also see: GetForeignPrivs, SetForeignPrivs, FSpSetForeignPrivs 613*/ 614 615/*****************************************************************************/ 616 617EXTERN_API( OSErr ) 618SetForeignPrivs( 619 short vRefNum, 620 long dirID, 621 ConstStr255Param name, 622 const void * foreignPrivBuffer, 623 long * foreignPrivSize, 624 long foreignPrivInfo1, 625 long foreignPrivInfo2, 626 long foreignPrivInfo3, 627 long foreignPrivInfo4); 628 629 630/* 631 The SetForeignPrivs function changes the native access-control 632 information for a file or directory stored on a volume managed by 633 a foreign file system. 634 635 vRefNum input: Volume specification. 636 dirID input: Directory ID. 637 name input: Pointer to object name, or nil when dirID 638 specifies a directory that's the object. 639 foreignPrivBuffer input: Pointer to privilege information buffer. 640 foreignPrivSize input: Size of buffer pointed to by 641 foreignPrivBuffer. 642 output: Amount of buffer actually used. 643 foreignPrivInfo1 input: Information specific to privilege model. 644 foreignPrivInfo2 input: Information specific to privilege model. 645 foreignPrivInfo3 input: Information specific to privilege model. 646 foreignPrivInfo4 input: Information specific to privilege model. 647 648 Result Codes 649 noErr 0 No error 650 nsvErr -35 Volume not found 651 paramErr -50 Volume is HFS or MFS (that is, it has 652 no foreign privilege model), or foreign 653 volume does not support these calls 654 655 __________ 656 657 Also see: GetForeignPrivs, FSpGetForeignPrivs, FSpSetForeignPrivs 658*/ 659 660/*****************************************************************************/ 661 662EXTERN_API( OSErr ) 663FSpSetForeignPrivs( 664 const FSSpec * spec, 665 const void * foreignPrivBuffer, 666 long * foreignPrivSize, 667 long foreignPrivInfo1, 668 long foreignPrivInfo2, 669 long foreignPrivInfo3, 670 long foreignPrivInfo4); 671 672 673/* 674 The FSpSetForeignPrivs function changes the native access-control 675 information for a file or directory stored on a volume managed by 676 a foreign file system. 677 678 spec input: An FSSpec record specifying the object. 679 foreignPrivBuffer input: Pointer to privilege information buffer. 680 foreignPrivSize input: Size of buffer pointed to by 681 foreignPrivBuffer. 682 output: Amount of buffer actually used. 683 foreignPrivInfo1 input: Information specific to privilege model. 684 foreignPrivInfo2 input: Information specific to privilege model. 685 foreignPrivInfo3 input: Information specific to privilege model. 686 foreignPrivInfo4 input: Information specific to privilege model. 687 688 Result Codes 689 noErr 0 No error 690 nsvErr -35 Volume not found 691 paramErr -50 Volume is HFS or MFS (that is, it has 692 no foreign privilege model), or foreign 693 volume does not support these calls 694 695 __________ 696 697 Also see: GetForeignPrivs, FSpGetForeignPrivs, SetForeignPrivs 698*/ 699 700/*****************************************************************************/ 701 702EXTERN_API( OSErr ) 703HGetLogInInfo( 704 ConstStr255Param volName, 705 short vRefNum, 706 short * loginMethod, 707 StringPtr userName); 708 709 710/* 711 The HGetLogInInfo function retrieves the login method and user name 712 used to log on to a particular shared volume. 713 714 volName input: A pointer to the name of a mounted volume 715 or nil. 716 vRefNum input: The volume reference number. 717 loginMethod output: The login method used (kNoUserAuthentication, 718 kPassword, kEncryptPassword, or 719 kTwoWayEncryptPassword). 720 userName input: Points to a buffer (minimum Str31) where the user 721 name is to be returned or must be nil. 722 output: The user name. 723 724 Result Codes 725 noErr 0 No error 726 nsvErr -35 Specified volume doesn�t exist 727 paramErr -50 Function not supported by volume 728 729 __________ 730 731 Also see: HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 732 FSpSetDirAccess, HMapName, HMapID 733*/ 734 735/*****************************************************************************/ 736 737EXTERN_API( OSErr ) 738HGetDirAccess( 739 short vRefNum, 740 long dirID, 741 ConstStr255Param name, 742 long * ownerID, 743 long * groupID, 744 long * accessRights); 745 746 747/* 748 The HGetDirAccess function retrieves the directory access control 749 information for a directory on a shared volume. 750 751 vRefNum input: Volume specification. 752 dirID input: Directory ID. 753 name input: Pointer to directory name, or nil if dirID 754 specifies the directory. 755 ownerID output: The directory's owner ID. 756 groupID output: The directory's group ID or 757 0 if no group affiliation. 758 accessRights output: The directory's access rights. 759 760 Result Codes 761 noErr 0 No error 762 fnfErr -43 Directory not found 763 paramErr -50 Function not supported by volume 764 afpAccessDenied -5000 User does not have the correct access 765 to the directory 766 767 __________ 768 769 Also see: HGetLogInInfo, FSpGetDirAccess, HSetDirAccess, 770 FSpSetDirAccess, HMapName, HMapID 771*/ 772 773/*****************************************************************************/ 774 775EXTERN_API( OSErr ) 776FSpGetDirAccess( 777 const FSSpec * spec, 778 long * ownerID, 779 long * groupID, 780 long * accessRights); 781 782 783/* 784 The FSpGetDirAccess function retrieves the directory access control 785 information for a directory on a shared volume. 786 787 spec input: An FSSpec record specifying the directory. 788 ownerID output: The directory's owner ID. 789 groupID output: The directory's group ID or 790 0 if no group affiliation. 791 accessRights output: The directory's access rights. 792 793 Result Codes 794 noErr 0 No error 795 fnfErr -43 Directory not found 796 paramErr -50 Function not supported by volume 797 afpAccessDenied -5000 User does not have the correct access 798 to the directory 799 800 __________ 801 802 Also see: HGetLogInInfo, HGetDirAccess, HSetDirAccess, 803 FSpSetDirAccess, HMapName, HMapID 804*/ 805 806/*****************************************************************************/ 807 808EXTERN_API( OSErr ) 809HSetDirAccess( 810 short vRefNum, 811 long dirID, 812 ConstStr255Param name, 813 long ownerID, 814 long groupID, 815 long accessRights); 816 817 818/* 819 The HSetDirAccess function changes the directory access control 820 information for a directory on a shared volume. You must own a directory 821 to change its access control information. 822 823 vRefNum input: Volume specification. 824 dirID input: Directory ID. 825 name input: Pointer to directory name, or nil if dirID 826 specifies the directory. 827 ownerID input: The directory's owner ID. 828 groupID input: The directory's group ID or 829 0 if no group affiliation. 830 accessRights input: The directory's access rights. 831 832 Result Codes 833 noErr 0 No error 834 fnfErr -43 Directory not found 835 vLckdErr -46 Volume is locked or read-only 836 paramErr -50 Parameter error 837 afpAccessDenied -5000 User does not have the correct access 838 to the directory 839 afpObjectTypeErr -5025 Object is a file, not a directory 840 841 __________ 842 843 Also see: HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, 844 FSpSetDirAccess, HMapName, HMapID 845*/ 846 847/*****************************************************************************/ 848 849EXTERN_API( OSErr ) 850FSpSetDirAccess( 851 const FSSpec * spec, 852 long ownerID, 853 long groupID, 854 long accessRights); 855 856 857/* 858 The FSpSetDirAccess function changes the directory access control 859 information for a directory on a shared volume. You must own a directory 860 to change its access control information. 861 862 spec input: An FSSpec record specifying the directory. 863 ownerID input: The directory's owner ID. 864 groupID input: The directory's group ID or 865 0 if no group affiliation. 866 accessRights input: The directory's access rights. 867 868 Result Codes 869 noErr 0 No error 870 fnfErr -43 Directory not found 871 vLckdErr -46 Volume is locked or read-only 872 paramErr -50 Parameter error 873 afpAccessDenied -5000 User does not have the correct access 874 to the directory 875 afpObjectTypeErr -5025 Object is a file, not a directory 876 877 __________ 878 879 Also see: HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 880 HMapName, HMapID 881*/ 882 883/*****************************************************************************/ 884 885EXTERN_API( OSErr ) 886HMapID( 887 ConstStr255Param volName, 888 short vRefNum, 889 long ugID, 890 short objType, 891 StringPtr name); 892 893 894/* 895 The HMapID function determines the name of a user or group if you know 896 the user or group ID. 897 898 volName input: A pointer to the name of a mounted volume 899 or nil. 900 vRefNum input: Volume specification. 901 objType input: The mapping function code: 1 if you're mapping a 902 user ID to a user name or 2 if you're mapping a 903 group ID to a group name. 904 name input: Points to a buffer (minimum Str31) where the user 905 or group name is to be returned or must be nil. 906 output: The user or group name. 907 908 Result Codes 909 noErr 0 No error 910 fnfErr -43 Unrecognizable owner or group name 911 paramErr -50 Function not supported by volume 912 913 __________ 914 915 Also see: HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 916 FSpSetDirAccess, HMapName 917*/ 918 919/*****************************************************************************/ 920 921EXTERN_API( OSErr ) 922HMapName( 923 ConstStr255Param volName, 924 short vRefNum, 925 ConstStr255Param name, 926 short objType, 927 long * ugID); 928 929 930/* 931 The HMapName function determines the user or group ID if you know the 932 user or group name. 933 934 volName input: A pointer to the name of a mounted volume 935 or nil. 936 vRefNum input: Volume specification. 937 name input: The user or group name. 938 objType input: The mapping function code: 3 if you're mapping a 939 user name to a user ID or 4 if you're mapping a 940 group name to a group ID. 941 ugID output: The user or group ID. 942 943 Result Codes 944 noErr 0 No error 945 fnfErr -43 Unrecognizable owner or group name 946 paramErr -50 Function not supported by volume 947 948 __________ 949 950 Also see: HGetLogInInfo, HGetDirAccess, FSpGetDirAccess, HSetDirAccess, 951 FSpSetDirAccess, HMapID 952*/ 953 954/*****************************************************************************/ 955 956EXTERN_API( OSErr ) 957HCopyFile( 958 short srcVRefNum, 959 long srcDirID, 960 ConstStr255Param srcName, 961 short dstVRefNum, 962 long dstDirID, 963 ConstStr255Param dstPathname, 964 ConstStr255Param copyName); 965 966 967/* 968 The HCopyFile function duplicates a file and optionally renames it. 969 The source and destination volumes must be on the same file server. 970 This function instructs the server to copy the file. 971 972 srcVRefNum input: Source volume specification. 973 srcDirID input: Source directory ID. 974 srcName input: Source file name. 975 dstVRefNum input: Destination volume specification. 976 dstDirID input: Destination directory ID. 977 dstPathname input: Pointer to destination directory name, or 978 nil when dstDirID specifies a directory. 979 copyName input: Points to the new file name if the file is to be 980 renamed or nil if the file isn't to be renamed. 981 982 Result Codes 983 noErr 0 No error 984 dskFulErr -34 Destination volume is full 985 fnfErr -43 Source file not found, or destination 986 directory does not exist 987 vLckdErr -46 Destination volume is read-only 988 fBsyErr -47 The source or destination file could 989 not be opened with the correct access 990 modes 991 dupFNErr -48 Destination file already exists 992 paramErr -50 Function not supported by volume 993 wrgVolTypErr -123 Function not supported by volume 994 afpAccessDenied -5000 The user does not have the right to 995 read the source or write to the 996 destination 997 afpDenyConflict -5006 The source or destination file could 998 not be opened with the correct access 999 modes 1000 afpObjectTypeErr -5025 Source is a directory 1001 1002 __________ 1003 1004 Also see: FSpCopyFile, FileCopy, FSpFileCopy 1005*/ 1006 1007/*****************************************************************************/ 1008 1009EXTERN_API( OSErr ) 1010FSpCopyFile( 1011 const FSSpec * srcSpec, 1012 const FSSpec * dstSpec, 1013 ConstStr255Param copyName); 1014 1015 1016/* 1017 The FSpCopyFile function duplicates a file and optionally renames it. 1018 The source and destination volumes must be on the same file server. 1019 This function instructs the server to copy the file. 1020 1021 srcSpec input: An FSSpec record specifying the source file. 1022 dstSpec input: An FSSpec record specifying the destination 1023 directory. 1024 copyName input: Points to the new file name if the file is to be 1025 renamed or nil if the file isn't to be renamed. 1026 1027 Result Codes 1028 noErr 0 No error 1029 dskFulErr -34 Destination volume is full 1030 fnfErr -43 Source file not found, or destination 1031 directory does not exist 1032 vLckdErr -46 Destination volume is read-only 1033 fBsyErr -47 The source or destination file could 1034 not be opened with the correct access 1035 modes 1036 dupFNErr -48 Destination file already exists 1037 paramErr -50 Function not supported by volume 1038 wrgVolTypErr -123 Function not supported by volume 1039 afpAccessDenied -5000 The user does not have the right to 1040 read the source or write to the 1041 destination 1042 afpDenyConflict -5006 The source or destination file could 1043 not be opened with the correct access 1044 modes 1045 afpObjectTypeErr -5025 Source is a directory 1046 1047 __________ 1048 1049 Also see: HCopyFile, FileCopy, FSpFileCopy 1050*/ 1051 1052/*****************************************************************************/ 1053 1054EXTERN_API( OSErr ) 1055HMoveRename( 1056 short vRefNum, 1057 long srcDirID, 1058 ConstStr255Param srcName, 1059 long dstDirID, 1060 ConstStr255Param dstpathName, 1061 ConstStr255Param copyName); 1062 1063 1064/* 1065 The HMoveRename function moves a file or directory and optionally 1066 renames it. The source and destination locations must be on the same 1067 shared volume. 1068 1069 vRefNum input: Volume specification. 1070 srcDirID input: Source directory ID. 1071 srcName input: The source object name. 1072 dstDirID input: Destination directory ID. 1073 dstName input: Pointer to destination directory name, or 1074 nil when dstDirID specifies a directory. 1075 copyName input: Points to the new name if the object is to be 1076 renamed or nil if the object isn't to be renamed. 1077 1078 Result Codes 1079 noErr 0 No error 1080 fnfErr -43 Source file or directory not found 1081 fLckdErr -45 File is locked 1082 vLckdErr -46 Destination volume is read-only 1083 dupFNErr -48 Destination already exists 1084 paramErr -50 Function not supported by volume 1085 badMovErr -122 Attempted to move directory into 1086 offspring 1087 afpAccessDenied -5000 The user does not have the right to 1088 move the file or directory 1089 1090 __________ 1091 1092 Also see: FSpMoveRename, HMoveRenameCompat, FSpMoveRenameCompat 1093*/ 1094 1095/*****************************************************************************/ 1096 1097EXTERN_API( OSErr ) 1098FSpMoveRename( 1099 const FSSpec * srcSpec, 1100 const FSSpec * dstSpec, 1101 ConstStr255Param copyName); 1102 1103 1104/* 1105 The FSpMoveRename function moves a file or directory and optionally 1106 renames it. The source and destination locations must be on the same 1107 shared volume. 1108 1109 srcSpec input: An FSSpec record specifying the source object. 1110 dstSpec input: An FSSpec record specifying the destination 1111 directory. 1112 copyName input: Points to the new name if the object is to be 1113 renamed or nil if the object isn't to be renamed. 1114 1115 Result Codes 1116 noErr 0 No error 1117 fnfErr -43 Source file or directory not found 1118 fLckdErr -45 File is locked 1119 vLckdErr -46 Destination volume is read-only 1120 dupFNErr -48 Destination already exists 1121 paramErr -50 Function not supported by volume 1122 badMovErr -122 Attempted to move directory into 1123 offspring 1124 afpAccessDenied -5000 The user does not have the right to 1125 move the file or directory 1126 1127 __________ 1128 1129 Also see: HMoveRename, HMoveRenameCompat, FSpMoveRenameCompat 1130*/ 1131 1132/*****************************************************************************/ 1133 1134EXTERN_API( OSErr ) 1135GetVolMountInfoSize( 1136 ConstStr255Param volName, 1137 short vRefNum, 1138 short * size); 1139 1140 1141/* 1142 The GetVolMountInfoSize function determines the how much space the 1143 program needs to allocate for a volume mounting information record. 1144 1145 volName input: A pointer to the name of a mounted volume 1146 or nil. 1147 vRefNum input: Volume specification. 1148 size output: The space needed (in bytes) of the volume mounting 1149 information record. 1150 1151 Result Codes 1152 noErr 0 No error 1153 nsvErr -35 Volume not found 1154 paramErr -50 Parameter error 1155 extFSErr -58 External file system error - no file 1156 system claimed this call. 1157 1158 __________ 1159 1160 Also see: GetVolMountInfo, VolumeMount BuildAFPVolMountInfo, 1161 RetrieveAFPVolMountInfo 1162*/ 1163 1164/*****************************************************************************/ 1165 1166EXTERN_API( OSErr ) 1167GetVolMountInfo( 1168 ConstStr255Param volName, 1169 short vRefNum, 1170 void * volMountInfo); 1171 1172 1173/* 1174 The GetVolMountInfo function retrieves a volume mounting information 1175 record containing all the information needed to mount the volume, 1176 except for passwords. 1177 1178 volName input: A pointer to the name of a mounted volume 1179 or nil. 1180 vRefNum input: Volume specification. 1181 volMountInfo output: Points to a volume mounting information 1182 record where the mounting information is to 1183 be returned. 1184 1185 Result Codes 1186 noErr 0 No error 1187 nsvErr -35 Volume not found 1188 paramErr -50 Parameter error 1189 extFSErr -58 External file system error - no file 1190 system claimed this call. 1191 1192 __________ 1193 1194 Also see: GetVolMountInfoSize, VolumeMount, BuildAFPVolMountInfo, 1195 RetrieveAFPVolMountInfo 1196*/ 1197 1198/*****************************************************************************/ 1199 1200EXTERN_API( OSErr ) 1201VolumeMount( 1202 const void * volMountInfo, 1203 short * vRefNum); 1204 1205 1206/* 1207 The VolumeMount function mounts a volume using a volume mounting 1208 information record. 1209 1210 volMountInfo input: Points to a volume mounting information record. 1211 vRefNum output: A volume reference number. 1212 1213 Result Codes 1214 noErr 0 No error 1215 notOpenErr -28 AppleTalk is not open 1216 nsvErr -35 Volume not found 1217 paramErr -50 Parameter error; typically, zone, server, 1218 and volume name combination is not valid 1219 or not complete, or the user name is not 1220 recognized 1221 extFSErr -58 External file system error - no file 1222 system claimed this call. 1223 memFullErr -108 Not enough memory to create a new volume 1224 control block for mounting the volume 1225 afpBadUAM -5002 User authentication method is unknown 1226 afpBadVersNum -5003 Workstation is using an AFP version that 1227 the server doesn�t recognize 1228 afpNoServer -5016 Server is not responding 1229 afpUserNotAuth -5023 User authentication failed (usually, 1230 password is not correct) 1231 afpPwdExpired -5042 Password has expired on server 1232 afpBadDirIDType -5060 Not a fixed directory ID volume 1233 afpCantMountMoreSrvrs -5061 Maximum number of volumes has been 1234 mounted 1235 afpAlreadyMounted -5062 Volume already mounted 1236 afpSameNodeErr -5063 Attempt to log on to a server running 1237 on the same machine 1238 1239 __________ 1240 1241 Also see: GetVolMountInfoSize, GetVolMountInfo, BuildAFPVolMountInfo, 1242 RetrieveAFPVolMountInfo 1243*/ 1244 1245/*****************************************************************************/ 1246 1247EXTERN_API( OSErr ) 1248Share( 1249 short vRefNum, 1250 long dirID, 1251 ConstStr255Param name); 1252 1253 1254/* 1255 The Share function establishes a local volume or directory as a 1256 share point. 1257 1258 vRefNum input: Volume specification. 1259 dirID input: Directory ID. 1260 name input: Pointer to directory name, or nil if dirID 1261 specifies the directory. 1262 1263 Result Codes 1264 noErr 0 No error 1265 tmfoErr -42 Too many share points 1266 fnfErr -43 File not found 1267 dupFNErr -48 Already a share point with this name 1268 paramErr -50 Function not supported by volume 1269 dirNFErrdirNFErr -120 Directory not found 1270 afpAccessDenied -5000 This directory cannot be shared 1271 afpObjectTypeErr -5025 Object was a file, not a directory 1272 afpContainsSharedErr -5033 The directory contains a share point 1273 afpInsideSharedErr -5043 The directory is inside a shared directory 1274 1275 __________ 1276 1277 Also see: FSpShare, Unshare, FSpUnshare 1278*/ 1279 1280/*****************************************************************************/ 1281 1282EXTERN_API( OSErr ) 1283FSpShare(const FSSpec * spec); 1284 1285 1286/* 1287 The FSpShare function establishes a local volume or directory as a 1288 share point. 1289 1290 spec input: An FSSpec record specifying the share point. 1291 1292 Result Codes 1293 noErr 0 No error 1294 tmfoErr -42 Too many share points 1295 fnfErr -43 File not found 1296 dupFNErr -48 Already a share point with this name 1297 paramErr -50 Function not supported by volume 1298 dirNFErrdirNFErr -120 Directory not found 1299 afpAccessDenied -5000 This directory cannot be shared 1300 afpObjectTypeErr -5025 Object was a file, not a directory 1301 afpContainsSharedErr -5033 The directory contains a share point 1302 afpInsideSharedErr -5043 The directory is inside a shared directory 1303 1304 __________ 1305 1306 Also see: Share, Unshare, FSpUnshare 1307*/ 1308 1309/*****************************************************************************/ 1310 1311EXTERN_API( OSErr ) 1312Unshare( 1313 short vRefNum, 1314 long dirID, 1315 ConstStr255Param name); 1316 1317 1318/* 1319 The Unshare function removes a share point. 1320 1321 vRefNum input: Volume specification. 1322 dirID input: Directory ID. 1323 name input: Pointer to directory name, or nil if dirID 1324 specifies the directory. 1325 1326 Result Codes 1327 noErr 0 No error 1328 fnfErr -43 File not found 1329 paramErr -50 Function not supported by volume 1330 dirNFErrdirNFErr -120 Directory not found 1331 afpObjectTypeErr -5025 Object was a file, not a directory; or, 1332 this directory is not a share point 1333 1334 __________ 1335 1336 Also see: Share, FSpShare, FSpUnshare 1337*/ 1338 1339/*****************************************************************************/ 1340 1341EXTERN_API( OSErr ) 1342FSpUnshare(const FSSpec * spec); 1343 1344 1345/* 1346 The FSpUnshare function removes a share point. 1347 1348 spec input: An FSSpec record specifying the share point. 1349 1350 Result Codes 1351 noErr 0 No error 1352 fnfErr -43 File not found 1353 paramErr -50 Function not supported by volume 1354 dirNFErrdirNFErr -120 Directory not found 1355 afpObjectTypeErr -5025 Object was a file, not a directory; or, 1356 this directory is not a share point 1357 1358 __________ 1359 1360 Also see: Share, FSpShare, Unshare 1361*/ 1362 1363/*****************************************************************************/ 1364 1365EXTERN_API( OSErr ) 1366GetUGEntry( 1367 short objType, 1368 StringPtr objName, 1369 long * objID); 1370 1371 1372/* 1373 The GetUGEntry function retrieves user or group entries from the 1374 local file server. 1375 1376 objType input: The object type: -1 = group; 0 = user 1377 objName input: Points to a buffer (minimum Str31) where the user 1378 or group name is to be returned or must be nil. 1379 output: The user or group name. 1380 objID input: O to get the first user or group. If the entry objID 1381 last returned by GetUGEntry is passed, then user or 1382 group whose alphabetically next in the list of entries 1383 is returned. 1384 output: The user or group ID. 1385 1386 Result Codes 1387 noErr 0 No error 1388 fnfErr -43 No more users or groups 1389 paramErr -50 Function not supported; or, ioObjID is 1390 negative 1391 1392 __________ 1393 1394 Also see: GetUGEntries 1395*/ 1396 1397/*****************************************************************************/ 1398 1399#include "OptimizationEnd.h" 1400 1401#if PRAGMA_STRUCT_ALIGN 1402 #pragma options align=reset 1403#elif PRAGMA_STRUCT_PACKPUSH 1404 #pragma pack(pop) 1405#elif PRAGMA_STRUCT_PACK 1406 #pragma pack() 1407#endif 1408 1409#ifdef PRAGMA_IMPORT_OFF 1410#pragma import off 1411#elif PRAGMA_IMPORT 1412#pragma import reset 1413#endif 1414 1415#ifdef __cplusplus 1416} 1417#endif 1418 1419#endif /* __MOREFILES__ */ 1420 1421