<<< NOTED::NOTES$7:[NOTES$LIBRARY]HACKERS.NOTE;1 >>> -< ** Hackers ** >- ================================================================================ Note 1832.14 ldr$unload_image 14 of 15 UTRTSC::VDBURG "Change mode to PANIC" 137 lines 27-MAR-1997 01:40 -< PROCPROC.C >- -------------------------------------------------------------------------------- #ifdef ALPHA #include #else typedef struct _pcb { char dummy1[26]; unsigned short pcb$w_state; char dummy2[284]; unsigned char pcb$t_lname[16]; } PCB; #endif #include #include int p_strlen(); int p_strncmp(); char *p_strcpy(); void p_bzero(); globalref unsigned long int sch$gl_pcbvec; globalref unsigned long int sch$gl_maxpix; struct proctbl { char proclen; char procname[15]; int statarray[15]; int starttime[2]; }; static struct proctbl procs[1000]; static char *namtbl[] = { "PWRK$MASTER", "PWRK$LMSRV", "PWRK$LMMCP", "PWRK$LMDMN", "PWRK$ADMIN_0", "PWRK$LICENSE_R", "PWRK$KNBDAEMON", "PWRK$NBDAEMON", "PWRK$MONITOR", "NETBIOS", "" }; int procinit() { struct proctbl *p; char **namp; int stat, starttime[2]; if (sch$gl_maxpix > 1000) return (SS$_INSFMEM); stat = sys$gettim(starttime); if (stat & 1) { namp = namtbl; p = procs; for (; *namp[0]; p++, namp++) { p_strcpy(p->procname,*namp); p->proclen = p_strlen(p->procname); p_bzero(p->statarray,sizeof(p->statarray)); p->starttime[0] = starttime[0]; p->starttime[1] = starttime[1]; } p->proclen = 0; } return stat; } int procproc() { unsigned int maxindex, *tblpnt; PCB *pcbpnt, *nullpcb; struct proctbl *p; int j, namesize; maxindex = sch$gl_maxpix - 2; tblpnt = (unsigned int *) sch$gl_pcbvec; nullpcb = (PCB *) *tblpnt++; /* pcb of null process */ tblpnt++; /* skip swapper */ for (j = 0; j <= maxindex; j++) { pcbpnt = (PCB *) *tblpnt++; if (pcbpnt != nullpcb) { namesize = *pcbpnt->pcb$t_lname & 0xff; for (p = procs; p->proclen > 0; p++) { if ((p->proclen == namesize) && (p_strncmp(pcbpnt->pcb$t_lname+1,p->procname,namesize) == 0)) { #ifdef ALPHA p->statarray[pcbpnt->pcb$l_state]++; #else p->statarray[pcbpnt->pcb$w_state]++; #endif } } } } return 1; } int p_strncmp(s1, s2, n) register unsigned char *s1, *s2; register n; { while (--n >= 0 && *s1 == *s2++) if (*s1++ == '\0') return(0); return(n<0 ? 0 : *s1 - *--s2); } char *p_strcpy(s1, s2) register char *s1, *s2; { register char *os1; os1 = s1; while (*s1++ = *s2++); return(os1); } int p_strlen(s) register char *s; { register n; n = 0; while (*s++) n++; return(n); } void p_bzero(p, n) register char *p; register n; { while (--n >= 0) *p++ = 0; }