
structure = deref_pointer(struct_pointer);
3.2.12 Displaying the Error Messages Stored in Fields
The field_errors function displays the error messages stored in fields by
the check_fields function. This function has the following syntax:
void
field_errors(
FieldRec* fields,
int nfields);
Argument
Input/Output
Description
fields
Input Names the fields that contain the error messages
nfields
Input Specifies the size of the fields argument
For example:
if(!read_field_vals(proc, fields, NUM_FIELDS)){
field_errors(fields, NUM_FIELDS);
return(False);
}
3.2.13 Converting a Long Address to a String Address
The format_addr function converts a 64-bit address of type long into a
32-bit address of type char. This function has the following syntax:
extern char* format_addr(
long addr,
char* buffer);
Argument
Input/Output
Description
addr
Input Specifies the address to be converted
buffer
Output Returns the converted address and must
be at least 12 characters long
Use this function to save space on the output line. For example, the 64-bit
address 0xffffffff12345678 is converted into v0x12345678.
For example:
static Boolean prfile(DataStruct ele, long vn_addr, long socket_addr)
{
char *error, op_buf[12], *ops, buf[256], address[12], cred[12], data[12];
if(!read_field_vals(ele, fields, NUM_FIELDS)){
field_errors(fields, NUM_FIELDS);
return(False);
}
if((long) fields[1].data == 0) return(True);
if((long) (fields[5].data) == 0) ops = " *Null* ";
else if((long) (fields[5].data) == vn_addr) ops = " vnops ";
else if((long) (fields[5].data) == socket_addr) ops = " socketops ";
else format_addr((long) fields[5].data, op_buf);
3–10 Writing Extensions to the kdbx Debugger