Tabs to spaces, more consistent formatting.
[AROS.git] / workbench / libs / nonvolatile / setnvprotection.c
blob5cf0f35e1d4ed2588996a3e11664e7f9182329f9
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>
11 /*****************************************************************************
13 NAME */
15 #include <libraries/nonvolatile.h>
16 #include <proto/exec.h>
17 #include <proto/nvdisk.h>
19 #include <string.h>
21 AROS_LH4(BOOL, SetNVProtection,
23 /* SYNOPSIS */
25 AROS_LHA(STRPTR, appName, A0),
26 AROS_LHA(STRPTR, itemName, A1),
27 AROS_LHA(LONG, mask, D2),
28 AROS_LHA(BOOL, killRequesters, D1),
30 /* LOCATION */
32 struct Library *, nvBase, 11, Nonvolatile)
34 /* FUNCTION
36 Set the protection attributes for a nonvolatile item.
38 INPUTS
40 appName -- the application owning the item stored in nonvolatile
41 memory
42 itemName -- the name of the item to change the protection of
43 mask -- the new protection status
45 killRequesters -- if TRUE no system requesters will be displayed during
46 the operation of this function
48 RESULT
50 Success / failure indicator.
52 NOTES
54 The only bit that should currently be used in the 'mask' is the DELETE bit.
56 EXAMPLE
58 BUGS
60 SEE ALSO
62 GetNVList(), <libraries/nonvolatile.h>
64 INTERNALS
66 ******************************************************************************/
69 AROS_LIBFUNC_INIT
71 struct Process *me = (struct Process *)FindTask(NULL);
72 APTR oldReq = me->pr_WindowPtr;
73 BOOL result;
75 if(appName == NULL || itemName == NULL)
76 return FALSE;
78 if(strpbrk(appName, ":/") != NULL ||
79 strpbrk(itemName, ":/") != NULL)
80 return FALSE;
82 if(killRequesters)
83 me->pr_WindowPtr = (APTR)-1;
85 result = SetNVDProtection(appName, itemName, mask);
87 if(killRequesters)
88 me->pr_WindowPtr = oldReq;
90 return result;
92 AROS_LIBFUNC_EXIT
93 } /* SetNVProtection */