Changeset 3412 for trunk/src/win32k/misc/env.c
- Timestamp:
- Apr 17, 2000, 4:26:04 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/misc/env.c
r3411 r3412 1 /* $Id: env.c,v 1. 1 2000-04-17 01:56:50bird Exp $1 /* $Id: env.c,v 1.2 2000-04-17 02:26:04 bird Exp $ 2 2 * 3 * Enviro ment access functions3 * Environment access functions 4 4 * 5 5 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no) … … 9 9 */ 10 10 11 /******************************************************************************* 12 * Defined Constants And Macros * 13 *******************************************************************************/ 14 #define INCL_DOSERRORS /* Error codes */ 15 #define INCL_OS2KRNL_VM /* OS2KRNL: Virtual Memory Management */ 16 11 17 12 18 /******************************************************************************* … … 14 20 *******************************************************************************/ 15 21 #include <os2.h> 22 16 23 #include "dev32.h" 17 24 #include "dev32hlp.h" 25 #include "log.h" 26 #include "ptda.h" 27 #include "OS2Krnl.h" 18 28 #include <string.h> 19 29 20 30 #include "env.h" 21 #include <infoseg.h> /* Infosegments definitions. */22 31 23 32 24 33 /** 25 * Scans the given environment data for a given enviro ment variable and returns34 * Scans the given environment data for a given environment variable and returns 26 35 * its value if found. 27 36 * @returns Pointer to environment variable value for the variable given in … … 74 83 /** 75 84 * Get the linear pointer to the environment data. 85 * 76 86 * @returns Pointer to environment data. 77 87 * NULL on failure. 78 88 */ 79 const char *GetEnv( )89 const char *GetEnv(void) 80 90 { 81 91 /* There is probably two ways of getting the environment data for a the … … 91 101 */ 92 102 93 #if 094 PPTDA pPTDA ; /* CurrentPTDA */95 PPTDA pPTDA ExecChild; /* Current PTDAs pPTDAExecChild*/103 #if 1 104 PPTDA pPTDACur; /* Pointer to the current (system context) PTDA */ 105 PPTDA pPTDA; /* PTDA in question. */ 96 106 USHORT hobEnviron; /* Object handle of the environ block */ 97 107 APIRET rc; /* Return from VMObjHandleInfo. */ … … 103 113 * Get the current PTDA. (Fail if this call failes.) 104 114 * IF pPTDAExecChild isn't NULL THEN try get environment for that first. 105 * IF failed or no pPTDAExecChild THEN try get enviro ment from pPTDA.115 * IF failed or no pPTDAExecChild THEN try get environment from pPTDA. 106 116 */ 107 pPTDA = ptdaGetCur(); 108 if (pPTDA == NULL) 117 pPTDACur = ptdaGetCur(); 118 if (pPTDA != NULL) 119 { 120 pPTDA = ptdaGet_pPTDAExecChild(pPTDA); 121 if (pPTDA != NULL) 122 { 123 hobEnviron = ptdaGet_ptda_environ(pPTDA); 124 if (hobEnviron != 0) 125 { 126 rc = VMObjHandleInfo(hobEnviron, SSToDS(&ulAddr), SSToDS(&ushPTDA)); 127 if (rc == NO_ERROR) 128 return (const char *)ulAddr; 129 kprintf(("GetEnv: VMObjHandleInfo failed with rc=%d for hob=0x%04x\n", rc, hobEnviron)); 130 } 131 } 132 133 hobEnviron = ptdaGet_ptda_environ(pPTDACur); 134 if (hobEnviron != 0) 135 { 136 rc = VMObjHandleInfo(hobEnviron, SSToDS(&ulAddr), SSToDS(&ushPTDA)); 137 if (rc != NO_ERROR) 138 { 139 kprintf(("GetEnv: VMObjHandleInfo failed with rc=%d for hob=0x%04x\n", rc, hobEnviron)); 140 } 141 } 142 } 143 else 109 144 { 110 145 kprintf(("GetEnv: Failed to get current PTDA.\n")); 111 146 } 112 pPTDAExecChild = ptdaGetpPTDAExecChild(pPTDA);113 if (pPTDAExecChild != NULL)114 {115 hobEnviron = ptdaGetptda_environ(pPTDAExecChild);116 if (hobEnviron != 0)117 {118 rc = VMObjHandleInfo(hobEnviron, &ulAddr, &ushPTDA);119 if (rc != NO_ERROR)120 ulAddr = 0;121 }122 }123 124 if (ulAddr == 0) /* failed or non pPTDAExecChild */125 {126 hobEnviron = ptdaGetptda_environ(pPTDA);127 if (hobEnviron != 0)128 {129 rc = VMObjHandleInfo(hobEnviron, &ulAddr, &ushPTDA);130 if (rc != NO_ERROR)131 ulAddr = 0;132 }133 }134 147 135 148 return (const char *)ulAddr; 149 136 150 #else 151 137 152 struct InfoSegLDT * pLIS; /* Pointer to local infosegment. */ 138 153 PVOID pv; /* Address to return. */ … … 147 162 { 148 163 kprintf(("GetEnv: Failed to get local info segment\n")); 149 return NULL 164 return NULL; 150 165 } 151 166 152 167 if (pLIS->LIS_AX <= 3) 153 168 { 154 kprintf(("GetEnv: enviro ment selector is %d, ie. NULL\n", pLIS->LIS_AX));169 kprintf(("GetEnv: environment selector is %d, ie. NULL\n", pLIS->LIS_AX)); 155 170 return NULL; 156 171 }
Note:
See TracChangeset
for help on using the changeset viewer.