en:docs:fapi:dosgetenv

Differences

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

Link to this comparison view

Next revision
Previous revision
en:docs:fapi:dosgetenv [2018/08/31 08:20] – created prokusheven:docs:fapi:dosgetenv [2021/12/05 09:57] (current) prokushev
Line 1: Line 1:
 +{{page>en:templates:fapiint}}
 +
 +====== 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 =====
- DosGetEnv (EnvSegment, CmdOffset)+
  
-==Parameters== +<code c> 
-;EnvSegment (PSEL- output : Address of the selector for the environment segment. +DosGetEnv (EnvSegment, CmdOffset
-;CmdOffset (PUSHORT) - output : Address of the offset to the command line within the environment segment.+</code>
  
-==Return Code== +===== Parameters ===== 
-;rc (USHORT) - return:Return code descriptions are: + 
-* 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:Return code descriptions are: 
 + 
 +  * 0  NO_ERROR 
 +  * 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  rc;            /* return code */ USHORT  rc;            /* return code */
-</PRE>+</code>
  
-===MASM=== +==== MASM ==== 
-<PRE>+<code asm>
 EXTRN  DosGetEnv:FAR EXTRN  DosGetEnv:FAR
 INCL_DOSMISC      EQU 1 INCL_DOSMISC      EQU 1
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 <os2.h> #include <os2.h>
Line 83: Line 96:
   }   }
 } }
-</PRE>+</code>
  
  
  
-====== Note ======+===== Note =====
  
 Text based on [[http://www.edm2.com/index.php/DosGetEnv]] Text based on [[http://www.edm2.com/index.php/DosGetEnv]]