Compaq AA-RH99A-TE Remote Starter User Manual


 
Example 3–4: Extension That Uses Arrays: file.c (cont.)
* Figure out the location of the utask structure in the supertask
* #define proc_to_utask(p) (long)(p+sizeof(struct proc))
*/
/*
* Figure out if this a system with the capability of
* extending the number of open files per process above 64
*/
#ifdef NOFILE_IN_U
# define OFILE_EXTEND
#else
# define NOFILE_IN_U NOFILE
#endif
/*
* Define a generic NULL pointer
*/
#define NIL_PTR(type) (type *) 0x0
get_all_open_files_from_active_processes()
{
long pidtab_base; /* Start address of the process table */
long npid; /* Number of processes in the process table */
char *error;
if (!read_sym_val("pidtab", NUMBER, &pidtab_base, &error) ||
!read_sym_val("npid", NUMBER, &npid, &error) ){
fprintf(stderr, "Couldnt read pid or npid:\n");
fprintf(stderr, "%s\n", error);
quit(1);
}
if ( check_procs (pidtab_base, npid) )
return(0);
else
return(1);
}
check_procs(pidtab_base, npid)
long pidtab_base;
long npid;
{
int i, index, first_file;
long addr;
DataStruct pid_entry_struct, pid_entry_ele, utask_struct, fil;
DataStruct ofile, pofile;
char *error;
long addr_of_proc, start_addr, val1, fp, last_fp;
char buf[256];
/*
* Walk the pid table
*/
pid_entry_struct = read_sym("pidtab");
for (index = 0; index < npid; index++)
3–32 Writing Extensions to the kdbx Debugger