en:docs:fapi:dosgetpid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:docs:fapi:dosgetpid [2021/09/19 05:48] – created prokusheven:docs:fapi:dosgetpid [2021/11/04 13:29] (current) prokushev
Line 1: Line 1:
 +{{page>en:templates:fapiint}}
 +
 +====== DosGetPID ======
 +
 This call returns the current process ID, thread ID, and the process ID of the parent process. This call returns the current process ID, thread ID, and the process ID of the parent process.
  
-==Syntax==+===== Syntax ===== 
 +<code c>
  DosGetPID (ProcessIDs)  DosGetPID (ProcessIDs)
 +</code>
 +===== Parameters =====
 +
 +  *ProcessIDs (PPIDINFO) - output : Address of the structure where the ID information is returned.
 +    * pid (PID) : Current process identifier.
 +    * tid (TID) : Thread (of the current process) identifier.
 +    * pidParent (PID) : Parent process (of the current process) identifier.
 +
 +===== Return Code =====
 +
 +rc (USHORT) - return:Return code description is:
  
-==Parameters== +  *0 NO_ERROR
-;ProcessIDs (PPIDINFO) - output : Address of the structure where the ID information is returned. +
-::pid (PID) : Current process identifier. +
-::tid (TID) : Thread (of the current process) identifier. +
-::pidParent (PID) : Parent process (of the current process) identifier.+
  
-==Return Code== +===== Remarks =====
-;rc (USHORT) - return:Return code description is: +
-*0 NO_ERROR+
  
-==Remarks== 
 The process ID may be used to generate uniquely named temporary files, or for communication with signals. For more information on signals, see DosFlagProcess and DosSendSignal. The process ID may be used to generate uniquely named temporary files, or for communication with signals. For more information on signals, see DosFlagProcess and DosSendSignal.
  
Line 23: Line 32:
 To get an ID for a process other than the current process or its parent process, issue [[DosGetPPID]]. To get an ID for a process other than the current process or its parent process, issue [[DosGetPPID]].
  
-==Bindings== +===== Bindings ===== 
-===MASM=== + 
-<PRE>+====MASM==== 
 +<code asm>
 PIDINFO struc PIDINFO struc
   pidi_pid       dw  ? ;current process' process ID   pidi_pid       dw  ? ;current process' process ID
Line 39: Line 49:
  
 Returns NONE Returns NONE
-</PRE>+</code>
  
-===C=== +====C==== 
-<PRE>+<code c>
 typedef struct _PIDINFO { /* pidi */ typedef struct _PIDINFO { /* pidi */
   PID pid;                /* current process' process ID */   PID pid;                /* current process' process ID */
Line 55: Line 65:
 PPIDINFO ProcessIDsArea; /* Process IDs (returned) */ PPIDINFO ProcessIDsArea; /* Process IDs (returned) */
 USHORT   rc;             /* return code */ USHORT   rc;             /* return code */
-</PRE>+</code> 
 + 
 +===== Example =====
  
-==Example== 
 The following example demonstrates how to create a process, obtain process ID information, and kill a process. Process1 invokes process2 to run asynchronously. It obtains and prints some PID information, and then kills process2. The following example demonstrates how to create a process, obtain process ID information, and kill a process. Process1 invokes process2 to run asynchronously. It obtains and prints some PID information, and then kills process2.
-<PRE>+<code c>
 /* ---- process1.c ---- */ /* ---- process1.c ---- */
 #define INCL_DOSPROCESS #define INCL_DOSPROCESS
Line 103: Line 114:
     printf("Process2 terminated by process1.\n");     printf("Process2 terminated by process1.\n");
 } }
-</PRE+</code
-<PRE>+<code c>
 /* ---- process2.c ---- */ /* ---- process2.c ---- */
  
Line 123: Line 134:
           RETURN_CODE);               /* Result Code */           RETURN_CODE);               /* Result Code */
 } }
-</PRE>+</code> 
  
-[[Category:Dos16]]+{{page>en:templates:fapi}}