Add czech.ct locale for WiMP (tools)
[AROS.git] / rom / dos / changemode.c
blob68958faff2fe436d468f44b69b2a8a232b298073
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Change the mode of a filehandle or lock.
6 Lang: English
7 */
8 #include <aros/debug.h>
9 #include <proto/exec.h>
10 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/dos.h>
19 AROS_LH3(BOOL, ChangeMode,
21 /* SYNOPSIS */
22 AROS_LHA(ULONG, type, D1),
23 AROS_LHA(BPTR, object, D2),
24 AROS_LHA(ULONG, newmode, D3),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 75, Dos)
29 /* FUNCTION
30 Try to change the access mode of a lock or filehandle.
32 INPUTS
33 type - CHANGE_FH or CHANGE_LOCK.
34 object - Filehandle or lock.
35 newmode - New mode, either SHARED_LOCK or EXCLUSIVE_LOCK.
37 RESULT
38 != 0 if all went well, otherwise 0. IoErr() gives additional
39 information in the latter case.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
50 Since filehandles and locks are identical under AROS the type
51 argument is ignored.
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 /* Get pointer to filehandle */
58 struct FileHandle *fh = (struct FileHandle*)BADDR(object);
59 struct FileLock *fl = (struct FileLock*)BADDR(object);
60 LONG ret;
62 if (type != CHANGE_LOCK && type != CHANGE_FH) {
63 SetIoErr(ERROR_BAD_NUMBER);
64 return FALSE;
66 D(bug("[ChangeMode] %d %x %d\n", type, fh, newmode));
67 ret = dopacket3(DOSBase, NULL, type == CHANGE_LOCK ? fl->fl_Task : fh->fh_Type, ACTION_CHANGE_MODE, type, object, newmode);
68 return ret;
70 AROS_LIBFUNC_EXIT
71 } /* ChangeMode */