Compaq AA-RH99A-TE Remote Starter User Manual


 
Example 3–4: Extension That Uses Arrays: file.c (cont.)
field_errors(fields, NUM_UTASK_FIELDS);
quit(1);
}
if(!read_sym_addr("vnops", &vn_addr, &error) ||
!read_sym_addr("socketops", &socket_addr, &error)){
fprintf(stderr, "Couldnt read vnops or socketops:\n");
fprintf(stderr, "%s\n", error);
quit(1);
}
print("Addr Type Ref Msg Fileops F_data Cred Offset
Flags");
print("=========== ==== === === ======= =========== =========== ======
=====");
if(argc == 0){
/*
* New code added to access open files in processes, in
* the absence of static file table, file, nfile, etc..
*/
/*
* get the size of proc structure
*/
sprintf(buffer, "set $hexints=0");
dbx(buffer, False);
sprintf(buffer, "print sizeof(struct proc)");
dbx(buffer, True);
if((resp = read_response(&status)) == NULL){
print_status("Couldnt read sizeof proc", &status);
proc_size = sizeof(struct proc);
}
else
proc_size = strtoul(resp, (char**)NULL, 10);
free(resp);
if ( get_all_open_files_from_active_processes() ) {
fprintf(stderr, "Couldnt get open files from processes:\n");
quit(1);
}
}
else {
while(*argv){
addr = strtoul(*argv, &ptr, 16);
if(*ptr != \0){
fprintf(stderr, "Couldnt parse %s to a number\n", *argv);
quit(1);
}
if(!cast(addr, "struct file", &fil, &error)){
fprintf(stderr, "Couldnt cast address to a file:\n");
fprintf(stderr, "%s\n", error);
quit(1);
}
if(!prfile(fil))
fprintf(stderr, "Continuing with next file address.\n");
argv++;
}
}
quit(0);
}
/*
Writing Extensions to the kdbx Debugger 3–31