Do not try to get stack pointer from invalid ESP field, which coincidentally
[AROS.git] / rom / dos / setprogramdir.c
blob7fa281f5e9da62fe2a150fca1669cbe6d7be6ddb
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Set the home directory for a program (PROGDIR:)
6 Lang: english
7 */
8 #include "dos_intern.h"
9 #include <proto/exec.h>
11 /*****************************************************************************
13 NAME */
14 #include <proto/dos.h>
16 AROS_LH1(BPTR, SetProgramDir,
18 /* SYNOPSIS */
19 AROS_LHA(BPTR, lock, D1),
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 99, Dos)
24 /* FUNCTION
25 This function will set a shared lock on the directory that the
26 current program was loaded from. This can be accessed through
27 the path PROGDIR:. The use of this path is to allow the program
28 to easily access files which are supplied with the program.
30 INPUTS
31 lock - The lock to set as the new program directory. NULL
32 is a valid value.
34 RESULT
35 This function will return the old program directory lock.
37 NOTES
38 This function will not duplicate the lock, so you should not
39 free the lock.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 GetProgramDir()
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct Process *pr;
55 BPTR oldLock;
57 pr = (struct Process *)FindTask(NULL);
58 oldLock = pr->pr_HomeDir;
59 pr->pr_HomeDir = lock;
61 return oldLock;
63 AROS_LIBFUNC_EXIT
64 } /* SetProgramDir */