<< Previous | Next >>

registry_enumerate

int registry_enumerate( RegistryContext * r, int (*f)(), int keyvalues, void far * ptr);

Description

Enumerate registry r->old_spec, calling the specified function "f" for each section header and, optionally, key=value pair.

The registry_get() function also performs enumeration; in fact it is a wrapper for this function.

Parameters

r
RegistryContext structure, with at least the old_spec field initialized. For example, use registry_prep_read() to set up the struct correctly.

r->old_spec: Open resource handle of a readable resource containing the registry settings. This is read from the current seek position, thus in most cases call this function with a freshly opened resource handle.

f
Callback function to be invoked. The function prototype must be as follows:

int f(void far * ptr,
int new_sect,
char * sect,
char far * key,
char far * value) { ... }

where the parameters are:

  • ptr - this is passed through from the 4th parameter to the registry_enumerate() function (see below).

  • new_sect - boolean indicating whether this call is to introduce a new section. If true, then 'sect' is the new section name, and 'key' and 'value' are not relevant.

  • sect - name of section if new_sect flag is true

  • key - key (field) ascii string if new_sect is false

  • value - value as an ascii string if new_sect is false.

keyvalues
Boolean indicating whether the callback function is to be invoked for key=value pairs (if true). In either case, the callback is inkoked whenever a new section is found, and the new_sect callback parameter will be set true.

ptr
An arbitrary pointer which will be passed through to the callback on each invocation.

Return Value

<0: failure to write or read the resource
 0: success

Library

registry.lib

See Also

sspec_open, registry_read, registry_update, registry_get, registry_prep_read, registry_finish_read


Dynamic C Functions << Previous | Next >> rabbit.com