2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
9 #include "dos_intern.h"
10 #include <proto/utility.h>
11 #include <exec/lists.h>
14 /*****************************************************************************
17 #include <proto/dos.h>
19 AROS_LH3(LONG
, ScanVars
,
22 AROS_LHA(struct Hook
*, hook
, D1
),
23 AROS_LHA(ULONG
, flags
, D2
),
24 AROS_LHA(APTR
, userdata
, D3
),
27 struct DosLibrary
*, DOSBase
, 167, Dos
)
30 Scan local and/or global variables accordingly to specified flags. For
31 each scanned variable hook function is called. Scanning process will
32 continue as long as hook returns 0. If hook returns a non-zero value,
33 scanning will be aborted and ScanVars will return this value.
36 userdata - Any user-specific data passed to hook function.
37 flags - Same as in GetVar().
38 hook - Hook function that will be called for each scanned variable as:
39 result = hook_function(hook,userdata,message) with ScanVarsMsg
40 structure as message parameter containing information about given
44 !=0 returned by hook function if scan process was aborted, 0 otherwise.
47 ScanVarsMsg structure content is valid only during hook call.
48 See <dos/var.h> for description of ScanVarsMsg structure.
53 Currently only local variables scanning is implemented.
56 DeleteVar(), FindVar(), GetVar(), SetVar(), <dos/var.h>
60 *****************************************************************************/
64 /* We scan through the process->pr_LocalVars list */
67 struct ScanVarsMsg msg
;
70 msg
.sv_SVMSize
= sizeof(struct ScanVarsMsg
);
72 pr
= (struct Process
*)FindTask(NULL
);
74 /* not global only? */
75 if(0 == (flags
& GVF_GLOBAL_ONLY
))
77 var
= (struct LocalVar
*)pr
->pr_LocalVars
.mlh_Head
;
79 ForeachNode(&pr
->pr_LocalVars
, var
)
81 if (var
->lv_Node
.ln_Type
== LV_VAR
)
83 msg
.sv_Name
= var
->lv_Node
.ln_Name
;
84 msg
.sv_Var
= var
->lv_Value
;
85 msg
.sv_VarLen
= var
->lv_Len
;
87 res
= CallHookPkt(hook
, userdata
, &msg
);