2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 #include <dos/dosextens.h>
8 /*****************************************************************************
13 // #include <aros/debug.h>
15 #include <libraries/nonvolatile.h>
16 #include <proto/exec.h>
17 #include <proto/nvdisk.h>
19 AROS_LH5(LONG
, StoreNV
,
23 AROS_LHA(STRPTR
, appName
, A0
),
24 AROS_LHA(STRPTR
, itemName
, A1
),
25 AROS_LHA(APTR
, data
, A2
),
26 AROS_LHA(ULONG
, length
, D0
),
27 AROS_LHA(BOOL
, killRequesters
, D1
),
31 struct Library
*, nvBase
, 7, Nonvolatile
)
35 Save data in the nonvolatile storage.
39 appName -- the application to save an item in the nonvolatile
41 itemName -- the name of the item to save
42 data -- the data to save
43 length -- number of tens of bytes of the data to save rounded
44 upwards (for instance to save 24 bytes specify 3).
45 killRequesters -- if TRUE no system requesters will be displayed during
46 the operation of this function
50 Indication of the success of the operation
53 NVERR_BADNAME -- 'appName' or 'itemName' were not correctly
55 NVERR_WRITEPROT -- the nonvolatile storage is read only
56 NVERR_FAIL -- failure in data saving (storage is full or write
58 NVERR_FATAL -- fatal error (possible loss of previously saved
63 The strings 'appName' and 'itemName' should be descripive but short as the
64 size of the nonvolatile storage may be very limited. The strings may not
65 contatin the characters ':' or '/'. The maximum length for each of these
74 GetCopyNV(), GetNVInfo()
78 ******************************************************************************/
83 struct Process
*me
= (struct Process
*)FindTask(NULL
);
84 APTR oldReq
= me
->pr_WindowPtr
;
88 return NVERR_FAIL
; /* There is no good (defined) error to
91 if(appName
== NULL
|| itemName
== NULL
)
94 if(strpbrk(appName
, ":/") != NULL
||
95 strpbrk(itemName
, ":/") != NULL
)
99 me
->pr_WindowPtr
= (APTR
)-1;
101 // kprintf("Calling writedata");
103 retval
= WriteData(appName
, itemName
, data
, length
*10);
106 me
->pr_WindowPtr
= oldReq
;