Jump to content

DosVerifyPidTid: Difference between revisions

From EDM2
Created page with "==Description== 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 thre..."
 
Ak120 (talk | contribs)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Description==
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.  
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.  


Line 5: Line 4:
<PRE>
<PRE>
#define INCL_DOSMISC
#define INCL_DOSMISC
#include os2.h>
#include <os2.h>


    APIRET APIENTRY DosVerifyPidTid
  APIRET APIENTRY DosVerifyPidTid (PID pid, TID tid)
        (PID pid, TID tid)
</PRE>
</PRE>
==Parameters==
==Parameters==
; pid (PID) input
;pid (PID) input
 
;tid (TID) input
; tid (TID) input


==Return Code==
==Return Code==
ulrc (APIRET) returns
;ulrc (APIRET) returns:DosVerifyPidTid returns one of the following values:
 
*0 NO_ERROR
DosVerifyPidTid returns one of the following values
*303 ERROR_INVALID_PROCID
 
*309 ERROR_INVALID_THREADID
* 0         NO_ERROR
* 303       ERROR_INVALID_PROCID  
* 309       ERROR_INVALID_THREADID
 
==Remarks==
 


==Example Code==
==Example Code==
Line 58: Line 50:
}
}
</PRE>
</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosCreateThread|DosCreateThread]]
*[[DosCreateThread]]
* [[OS2 API:CPI:DosExecPgm|DosExecPgm]]
*[[DosExecPgm]]
 


[[Category:The OS/2 API Project]]
[[Category:Dos]]

Latest revision as of 18:32, 29 August 2021

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