Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:docs:fapi:dosgetenv [2018/08/31 08:20] – created prokushev | en:docs:fapi:dosgetenv [2021/12/05 09:57] (current) – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{page> | ||
+ | |||
+ | ====== DosGetEnv ====== | ||
This call returns the address of the process environment string for the current process. | This call returns the address of the process environment string for the current process. | ||
- | ==Syntax== | + | ===== Syntax ===== |
- | | + | |
- | ==Parameters== | + | <code c> |
- | ;EnvSegment | + | DosGetEnv (EnvSegment, CmdOffset) |
- | ;CmdOffset (PUSHORT) - output : Address of the offset to the command line within the environment segment. | + | </ |
- | ==Return Code== | + | ===== Parameters ===== |
- | ;rc (USHORT) - return: | + | |
- | * 0 NO_ERROR | + | * EnvSegment ([[PSEL]]) - output : Address of the selector for the environment segment. |
- | * 12 ERROR_INVALID_ACCESS | + | * CmdOffset ([[PUSHORT]]) - output : Address of the offset to the command line within the environment segment. |
+ | |||
+ | ===== Return Code ===== | ||
+ | |||
+ | rc ([[USHORT]]) - return: | ||
+ | |||
+ | | ||
+ | * 12 ERROR_INVALID_ACCESS | ||
+ | |||
+ | ===== Remarks ===== | ||
- | ==Remarks== | ||
DosGetEnv can be used by dynamic link library routines that need to determine the environment for the current process. | DosGetEnv can be used by dynamic link library routines that need to determine the environment for the current process. | ||
When a process issues [[DosExecPgm]] to start another process, the program that receives control is returned a pointer to the environment segment. | When a process issues [[DosExecPgm]] to start another process, the program that receives control is returned a pointer to the environment segment. | ||
- | ==Bindings== | + | ===== Bindings |
- | ===C Binding=== | + | ==== C Binding ==== |
- | <PRE> | + | |
+ | <code c> | ||
#define INCL_DOSMISC | #define INCL_DOSMISC | ||
Line 30: | Line 41: | ||
USHORT | USHORT | ||
- | </PRE> | + | </code> |
- | ===MASM=== | + | ==== MASM ==== |
- | <PRE> | + | <code asm> |
EXTRN DosGetEnv: | EXTRN DosGetEnv: | ||
INCL_DOSMISC | INCL_DOSMISC | ||
Line 42: | Line 53: | ||
Returns WORD | Returns WORD | ||
- | </PRE> | + | </code> |
+ | |||
+ | ==== Example Code ==== | ||
- | ==Example Code== | ||
The following example shows how one may obtain information for program initialization. The program locates the environment segment and prints the name of the command from the command line. It then obtains the OS/2 version number and prints it. | The following example shows how one may obtain information for program initialization. The program locates the environment segment and prints the name of the command from the command line. It then obtains the OS/2 version number and prints it. | ||
- | <PRE> | + | |
+ | <code c> | ||
#define INCL_DOS | #define INCL_DOS | ||
#include < | #include < | ||
Line 83: | Line 96: | ||
} | } | ||
} | } | ||
- | </PRE> | + | </code> |
- | ====== Note ====== | + | ===== Note ===== |
Text based on [[http:// | Text based on [[http:// |