2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Retrieve the full pathname from a filehandle.
8 #include <proto/exec.h>
9 #include "dos_intern.h"
11 #include <aros/debug.h>
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH3(BOOL
, NameFromFH
,
21 AROS_LHA(BPTR
, fh
, D1
),
22 AROS_LHA(STRPTR
, buffer
, D2
),
23 AROS_LHA(LONG
, length
, D3
),
26 struct DosLibrary
*, DOSBase
, 68, Dos
)
30 Get the full path name associated with file-handle into a
34 fh - File-handle to file or directory.
35 buffer - Buffer to fill. Contains a NUL terminated string if
37 length - Size of the buffer in bytes.
40 !=0 if all went well, 0 in case of an error. IoErr() will
41 give additional information in that case.
43 *****************************************************************************/
48 struct FileInfoBlock
*fib
;
49 BPTR parentlock
= BNULL
;
52 /* DupLock() calls are not allowed because they fail
53 * if FH has exclusive lock (MODE_NEWFILE)
56 fib
= AllocDosObject(DOS_FIB
, NULL
);
58 parentlock
= ParentOfFH(fh
);
60 if (NameFromLock(parentlock
, buffer
, length
)) {
61 if (ExamineFH(fh
, fib
)) {
62 if (AddPart(buffer
, fib
->fib_FileName
, length
)) {
68 err
= IoErr(); /* UnLock() clears pr_Result2 */
69 FreeDosObject(DOS_FIB
, fib
);
71 err
= ERROR_NO_FREE_STORE
;