Re: How to access environment variables from KernelMo- de??- ?

If you know the PID of the process whose environment variables you want to
read, you can call PsLookupProcessByProcessId (undocumented routine exported
by NTOSKRNL.EXE) to get a pointer to that process’s EPROCESS block. Then you
can get a pointer to the PEB and use Charles’s technique.

-----Original Message-----
From: xxxxx@hotmail.com [SMTP:xxxxx@hotmail.com]
Sent: Tuesday, November 20, 2001 8:00 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to access environment variables from
KernelMode??- ?

Thank you for reply. The problem is the driver is a kernel mode DLL called

by other driver. And active process can be arbitrary at the call time. It
looks like I have to manage own environment variables list and just copy
the values from registry at C RTL startup… What do you think? In any
case
nobady except me uses this -)

Anton

On 11/21/01, ““Parton, Charles W.” ” wrote:
> > I take it your trying to get the current directory of the active
> process?
> > Look at the PROCESS_PARAMETERS (usually at 0x20000) if the peb isn’t
> null.
> > This is assuming your in the process’s context.
> >
> > Charles
> >
> >
> > ----- Original Message -----
> > From:
> > To: “NT Developers Interest List”
> > Sent: Sunday, November 18, 2001 12:00 AM
> > Subject: [ntdev] How to access environment variables from KernelMode???
> >
> >
> > > Hi everyone,
> > >
> > > In my current project (ANSI C library port to NT kernel) I need to
> access
> > > the environmnet variables from KernelMode. As I’ve never did it before
> and
> >
> > > I found nothing in DDK documentation about this I’d like to ask how
> can I
> > > do this? Any ZwXxx routines in kernel API like GetCurrentDirectory()
> under
> >
> > > Win32?
> > >
> > > Thanks for help,
> > > Anton
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> > >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@xetron.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@fmr.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@fmr.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com