Ignore:
Timestamp:
Jul 10, 2001, 6:41:10 PM (24 years ago)
Author:
bird
Message:

Use PTDA not PID and allways take loader sem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/k32/k32SetEnvironment.cpp

    r6214 r6296  
    1 /* $Id: k32SetEnvironment.cpp,v 1.1 2001-07-08 02:52:11 bird Exp $
     1/* $Id: k32SetEnvironment.cpp,v 1.2 2001-07-10 16:39:17 bird Exp $
    22 *
    33 * k32SetEnvironment - Sets the Odin32 environment for a process.
     
    1515#define INCL_DOSERRORS
    1616#define INCL_OS2KRNL_TK
     17#define INCL_OS2KRNL_PTDA
    1718#define INCL_OS2KRNL_SEM
    1819#define INCL_OS2KRNL_LDR
     
    2425*******************************************************************************/
    2526#include <os2.h>
     27#include <memory.h>
    2628#include "devSegDf.h"                   /* Win32k segment definitions. */
    2729#include "OS2Krnl.h"
     
    5658    PPTD    pptd;
    5759
    58 
    5960    /*
    6061     * Validate pid a little bit...
     
    6364    {
    6465        kprintf(("k32SetEnvironment: invalid pid=%x\n", pid));
     66        return ERROR_INVALID_PARAMETER;
     67    }
     68
     69    if (pid != 0)
     70    {
     71        kprintf(("k32SetEnvironment: currently only supported for current pid. pid=%x\n", pid));
    6572        return ERROR_INVALID_PARAMETER;
    6673    }
     
    8188     * Get Per Task Data and try set next environment pointer.
    8289     */
    83     pptd = GetTaskData(pid);
     90    pptd = GetTaskData(ptdaGetCur(), TRUE);
    8491    if (pptd)
    8592    {
    86         if (pptd->cUsage != 0 && pptd->pszzOdin32Env)
     93        if (*(PULONG)&pptd->lockOdin32Env)
     94        {
    8795            D32Hlp_VMUnLock(&pptd->lockOdin32Env);
     96            memset(&pptd->lockOdin32Env, 0, sizeof(pptd->lockOdin32Env));
     97        }
    8898        pptd->pszzOdin32Env = NULL;
    8999        if (pptd->cUsage != 0 && pszzEnvironment != NULL && cchEnvironment != 0)
    90100        {
    91             /*
    92              * Currently we're limited to the current process.
    93              */
    94             if (pid != 0 || GetTaskData(0) != pptd)
    95             {
    96                 kprintf(("k32SetEnvironment: not current process (pid=%d)\n", pid));
    97                 LDRClearSem();
    98                 return ERROR_INVALID_PARAMETER;
    99             }
    100 
    101 
    102101            /*
    103102             * Lock the memory (so we don't block or trap during environment searchs).
     
    110109            {
    111110                kprintf(("k32SetEnvironment: VMLock2 failed with rc=%d\n", rc));
     111                memset(&pptd->lockOdin32Env, 0, sizeof(pptd->lockOdin32Env));
    112112            }
    113113        }
Note: See TracChangeset for help on using the changeset viewer.