Compaq AA-RH99A-TE Remote Starter User Manual


 
3.2.29 Reading the Value of a Symbol
The read_sym_val function returns the value of the specified symbol. This
function has the following format:
Boolean read_sym_val(
char* name,
int type,
long* ret_val,
char** error);
Argument
Input/Output
Description
name
Input Names the symbol for which a value is needed
type
Input Specifies the data type of the symbol
ret_val
Output Returns the value of the symbol
error
Output Returns a pointer to an error message
when the status is FALSE
You use the read_sym_val function to retrieve the value of a global
variable. The value returned by the read_sym_val function has the type
long, unlike the value returned by the read_sym function which has the
type DataStruct.
For example:
if(argc == 0) fil = read_sym("file");
if(!read_sym_val("nfile", NUMBER, &nfile, &error) ||
!read_sym_addr("vnops", &vn_addr, &error) ||
!read_sym_addr("socketops", &socket_addr, &error)){
fprintf(stderr, "Couldnt read nfile:\n");
fprintf(stderr, "%s\n", error);
quit(1);
}
3.2.30 Getting the Address of a Data Representation
The struct_addr function returns the address of a data representation.
This function has the following format:
char* struct_addr(
DataStruct data);
Argument Input/Output Description
data
Input Specifies the structure for which an
address is needed
For example:
if(bus_fields[1].data != 0){
sprintf(buf, "Bus #%d (0x%p): Name - \"%s\"\tConnected to - \"%s\,
i, struct_addr(bus), bus_fields[1].data, bus_fields[2].data);
Writing Extensions to the kdbx Debugger 3–21