DosVerifyPidTid

From EDM2
Jump to: navigation, search

DosVerifyPidTid validates a PID/TID pair. If the thread and process exist, then a zero return code is set; otherwise the return code indicates whether the thread or the process is invalid.

Syntax

#define INCL_DOSMISC
#include <os2.h>

  APIRET APIENTRY DosVerifyPidTid (PID pid, TID tid)

Parameters

pid (PID) input
tid (TID) input

Return Code

ulrc (APIRET) returns

DosVerifyPidTid returns one of the following values

  • 0 NO_ERROR
  • 303 ERROR_INVALID_PROCID
  • 309 ERROR_INVALID_THREADID

Example Code

int main(int argc, char *argv[], char *envp[]){
   PID pid=0;
   TID tid=1;
   int i;
   APIRET rc;

   if (argc 2) {
      printf("VPIDTID /P=pid [/T=tid]\n");
      return;
   } /* endif */

   for (i=1; i(argc ;++i ) {
   if (strnicmp (argv[i],"/P=",3)==0) pid=strtoul (argv[i]+3, NULL,16);
   else if (strnicmp (argv[i],"/T=",3)==0)
   tid=strtoul (argv[i]+3, NULL,16);
   } /* endfor */

   if (pid == 0) {
      printf("VPIDTID /P=pid [/T=tid\n");
      return;
   } /* endif */

   rc=DosVerifyPidTid (pid,tid);

   printf("Verify pid=0x%04x tid=0x%04x rc=%u\n", pid,tid,rc);

   return 0;
}

Related Functions