Re: Environment variables defined using My Computer Properties

Tech-Archive recommends: Fix windows errors by optimizing your registry



From: "David Candy" <.>

| No it's not. It is in memory. You are confusing storage with the environment. And the
| registry is not the only place the the evironment is stored, only part of it is stored
| there.
|
| When you logon your environment is made from the the registry and autoexec.bat (and
| autoexec.nt/config.nt for 16 bit programs). Each program that is started gets it's own
| copy of the environment FROM the program that started it, usually explorer but may not be.
|
| This is what CreateProcess (the thing that executes programs on windows) has to say
|
| lpEnvironment
| [in] Pointer to an environment block for the new process. If this parameter is NULL, the
| new process uses the environment of the calling process. An environment block consists of
| a null-terminated block of null-terminated strings. Each string is in the form:
|
| name=value Because the equal sign is used as a separator, it must not be used in the name
| of an environment variable.
|
| An environment block can contain either Unicode or ANSI characters. If the environment
| block pointed to by lpEnvironment contains Unicode characters, be sure that
| dwCreationFlags includes CREATE_UNICODE_ENVIRONMENT.
|
| Note that an ANSI environment block is terminated by two zero bytes: one for the last
string,
| one more to terminate the block. A Unicode environment block is terminated by four zero
bytes:
| two for the last string, two more to terminate the block.
|
| Here is the environment lifted from a memory block (I got bored reformatting it - but
| here's enough to show that it is NOT in alphabetical order, though it appears to be in
| alpha order by where it came from).
|
| COMSPEC=C:\WINDOWS\SYSTEM32\COMMAND.COM
| ALLUSERSPROFILE=C:\DOCUME~1\ALLUSE~1
| APPDATA=C:\DOCUME~1\DAVIDC~1\APPLIC~1
| COMMONPROGRAMFILES=C:\PROGRA~1\COMMON~1
| COMPUTERNAME=SERENITY
| FP_NO_HOST_CHECK=NO
| HOMEDRIVE=C:
| HOMEPATH=\Documents and Settings\David Candy
| LOGONSERVER=\\SERENITY
| NUMBER_OF_PROCESSORS=1
| OS=Windows_NT
| PATH=C:\PROGRA~1\WINDOW~4\Tools\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C
| :\PROGRA~1\SUPPOR~1\;c:\msbob;C:\MSBOB\;
| PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86
| PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 7, GenuineIntel.PROCESSOR_LEVEL=15
| PROCESSOR_REVISION=0207
| PROGRAMFILES=C:\PROGRA~1
| PROMPT=$P$G
| SESSIONNAME=Console.SYSTEM
| DRIVE=C:
| SYSTEMROOT=C:\windows
| TEMP=C:\windows\T
|
| --
| ------------------------------------------------------------------------------------------
| http://webdiary.smh.com.au/archives/_comment/001075.html
| =================================================
| "David H. Lipman" <DLipman~nospam~@Verizon.Net> wrote in message
news:eQjYTjjrFHA.464@xxxxxxxxxxxxxxxxxxxxxxx
>> From: "David Candy" <.>
>>
|>> I doubt the environment is in the registry (of course some of it is stored there but
|>> each program gets a copy of the environment and it's a memory thing). I suspect it IS
|>> stored alphabetically in memory (I went looking for a debugger to confirm but it's
|>> not installed).
|>>
|>> --


Processing and displaying are two different things.
We haven't even gotten into the Environmental variables that are usable, not in the
Registry, and are not displayed.

--
Dave
http://www.claymania.com/removal-trojan-adware.html
http://www.ik-cs.com/got-a-virus.htm


.



Relevant Pages

  • Re: Environment variables defined using My Computer Properties
    ... | program gets a copy of the environment and it's a memory thing). ... It's in the Registry... ... Prev by Date: ...
    (microsoft.public.windowsxp.general)
  • Re: ENV variable NOT recognized ! Reboot really necessary ????
    ... this will only change the environment block for new processes created *after* the change. ... Existing processes will keep on using their current environment block, which is the same as it was before you made the change. ... But an application needs to be written to explicitly do this; there's no mechanism in the operating system to universally update environment variables on the fly for running processes. ... For example, say you had a command prompt open, and you run a SET command to display the current variables. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: _putenv, getenv and the Registry
    ... > Any idea how to 'refresh' the Environment without a reboot? ... own environment block. ... Luckily Explorer is one of these apps, ...
    (microsoft.public.vc.language)
  • Re: How many copies of an apps environment are there?
    ... environment block of a current process, ... Probably VS2003 CRT caches process environment block and ... can't see the changes that are made via Win32 API or whatever. ...
    (microsoft.public.vc.language)
  • Re: ARG_MAX/E2BIG and environment size
    ... Mohun Biswas wrote: ... > returned if an exec fails because the combined length of the argument ... > list and the environment is greater than ARG_MAX. ... > literally in the environment block and thus need to be counted? ...
    (comp.unix.programmer)