Important: The information in this document is obsolete and should not be used for new development.
PBHCopyFile
You can use thePBHCopyFilefunction to duplicate a file and optionally to rename it.
FUNCTION PBHCopyFile (paramBlock: HParmBlkPtr; async: Boolean): OSErr;
paramBlock- A pointer to a
copyParam variant of the HFS parameter block.async- A Boolean value that specifies asynchronous (
TRUE) or synchronous (FALSE) execution.
--> ioCompletionProcPtrA pointer to a completion routine. <-- ioResultOSErrThe result code of the function. --> ioNamePtrStringPtrA pointer to a pathname. --> ioVRefNumIntegerA volume specification. --> ioDstVRefNumIntegerDestination volume identifier. --> ioNewNamePtrA pointer to the destination pathname (may be NIL).--> ioCopyNamePtrA pointer to the file's new name (may be NIL).--> ioNewDirIDLongIntThe destination directory ID. --> ioDirIDLongIntThe source directory ID. DESCRIPTION
ThePBHCopyFilefunction duplicates a file on the specified volume and optionally renames it. It is an optional call for AppleShare file servers. Your application should examine the information returned by thePBHGetVolParmsfunction to see if the volume supportsPBHCopyFile.For AppleShare file servers, the source and destination pathnames must indicate the same file server; however, the parameter block may specify different source and destination volumes on that file server. A useful way to tell if two file server volumes are on the same file server is to call the
PBHGetVolParmsfunction for each volume and compare the server addresses returned. The server opens source files with read/deny write enabled and destination files with write/deny read and write enabled.You specify the source file with the
ioVRefNum,ioDirID, andioNamePtrfields. You specify the destination directory with theioDstVRefNum,ioNewDirID, andioNewNamefields. IfioNewNameisNIL, the destination directory is the directory having IDioNewDirIDon the specified volume; ifioNewNameis notNIL, the destination directory is the directory having the partial pathname pointed to byioNewNamein the directory having IDioNewDirIDon the specified volume.The
ioCopyNamefield may contain a pointer to an optional string to be used in copying the file; if it is notNIL, the file copy is renamed to the name specified inioCopyName. The string pointed to byioCopyNamemust be a filename, not a partial pathname.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forPBHCopyFileare
Trap macro Selector _HFSDispatch $0036 RESULT CODES