revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / nonvolatile / setnvprotection.c
blob49fe3e43d20aa0ff52b8f841d45ad8e0002774ae
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <dos/dosextens.h>
10 #include <proto/exec.h>
11 #include <proto/nvdisk.h>
13 #include <string.h>
15 #include LC_LIBDEFS_FILE
17 /*****************************************************************************
19 NAME */
20 #include <libraries/nonvolatile.h>
22 AROS_LH4(BOOL, SetNVProtection,
24 /* SYNOPSIS */
26 AROS_LHA(STRPTR, appName, A0),
27 AROS_LHA(STRPTR, itemName, A1),
28 AROS_LHA(LONG, mask, D2),
29 AROS_LHA(BOOL, killRequesters, D1),
31 /* LOCATION */
33 struct Library *, nvBase, 11, Nonvolatile)
35 /* FUNCTION
37 Set the protection attributes for a nonvolatile item.
39 INPUTS
41 appName -- the application owning the item stored in nonvolatile
42 memory
43 itemName -- the name of the item to change the protection of
44 mask -- the new protection status
46 killRequesters -- if TRUE no system requesters will be displayed during
47 the operation of this function
49 RESULT
51 Success / failure indicator.
53 NOTES
55 The only bit that should currently be used in the 'mask' is the DELETE bit.
57 EXAMPLE
59 BUGS
61 SEE ALSO
63 GetNVList(), <libraries/nonvolatile.h>
65 INTERNALS
67 ******************************************************************************/
70 AROS_LIBFUNC_INIT
72 struct Process *me = (struct Process *)FindTask(NULL);
73 APTR oldReq = me->pr_WindowPtr;
74 BOOL result;
76 if(appName == NULL || itemName == NULL)
77 return FALSE;
79 if(strpbrk(appName, ":/") != NULL ||
80 strpbrk(itemName, ":/") != NULL)
81 return FALSE;
83 if(killRequesters)
84 me->pr_WindowPtr = (APTR)-1;
86 result = SetNVDProtection(appName, itemName, mask);
88 if(killRequesters)
89 me->pr_WindowPtr = oldReq;
91 return result;
93 AROS_LIBFUNC_EXIT
94 } /* SetNVProtection */