2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <dos/dosextens.h>
8 #include <proto/exec.h>
9 #include <proto/nvdisk.h>
13 #include LC_LIBDEFS_FILE
15 /*****************************************************************************
19 #include <libraries/nonvolatile.h>
21 AROS_LH5(LONG
, StoreNV
,
25 AROS_LHA(STRPTR
, appName
, A0
),
26 AROS_LHA(STRPTR
, itemName
, A1
),
27 AROS_LHA(APTR
, data
, A2
),
28 AROS_LHA(ULONG
, length
, D0
),
29 AROS_LHA(BOOL
, killRequesters
, D1
),
33 struct Library
*, nvBase
, 7, Nonvolatile
)
37 Save data in the nonvolatile storage.
41 appName -- the application to save an item in the nonvolatile
43 itemName -- the name of the item to save
44 data -- the data to save
45 length -- number of tens of bytes of the data to save rounded
46 upwards (for instance to save 24 bytes specify 3).
47 killRequesters -- if TRUE no system requesters will be displayed during
48 the operation of this function
52 Indication of the success of the operation
55 NVERR_BADNAME -- 'appName' or 'itemName' were not correctly
57 NVERR_WRITEPROT -- the nonvolatile storage is read only
58 NVERR_FAIL -- failure in data saving (storage is full or write
60 NVERR_FATAL -- fatal error (possible loss of previously saved
65 The strings 'appName' and 'itemName' should be descripive but short as the
66 size of the nonvolatile storage may be very limited. The strings may not
67 contatin the characters ':' or '/'. The maximum length for each of these
76 GetCopyNV(), GetNVInfo()
80 ******************************************************************************/
85 struct Process
*me
= (struct Process
*)FindTask(NULL
);
86 APTR oldReq
= me
->pr_WindowPtr
;
90 return NVERR_FAIL
; /* There is no good (defined) error to
93 if(appName
== NULL
|| itemName
== NULL
)
96 if(strpbrk(appName
, ":/") != NULL
||
97 strpbrk(itemName
, ":/") != NULL
)
101 me
->pr_WindowPtr
= (APTR
)-1;
103 // kprintf("Calling writedata");
105 retval
= WriteNVDData(appName
, itemName
, data
, length
*10);
108 me
->pr_WindowPtr
= oldReq
;