Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
en:docs:fapi:dosgetpid [2021/09/19 05:48] – created prokushev | en:docs:fapi:dosgetpid [2021/10/16 14:09] – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{page> | ||
+ | |||
+ | ====== 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> | ||
| | ||
+ | </ | ||
+ | ===== 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: | ||
- | ==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: | + | |
- | *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 | pidi_pid | ||
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' | PID pid; /* current process' | ||
Line 55: | Line 65: | ||
PPIDINFO ProcessIDsArea; | PPIDINFO ProcessIDsArea; | ||
USHORT | USHORT | ||
- | </PRE> | + | </code> |
+ | |||
+ | ===== Example ===== | ||
- | ==Example== | ||
The following example demonstrates how to create a process, obtain process ID information, | The following example demonstrates how to create a process, obtain process ID information, | ||
- | <PRE> | + | <code c> |
/* ---- process1.c ---- */ | /* ---- process1.c ---- */ | ||
#define INCL_DOSPROCESS | #define INCL_DOSPROCESS | ||
Line 103: | Line 114: | ||
printf(" | printf(" | ||
} | } | ||
- | </PRE> | + | </code> |
- | <PRE> | + | <code c> |
/* ---- process2.c ---- */ | /* ---- process2.c ---- */ | ||
Line 123: | Line 134: | ||
RETURN_CODE); | RETURN_CODE); | ||
} | } | ||
- | </PRE> | + | </code> |
- | [[Category: | ||