What Exactly is an Environment Block?

fernando bonfim 61 Reputation points
2022-07-11T12:05:03.91+00:00

Hi.

On Changing Environment Variables it is said that environment block is a null-terminated block of null-terminated strings.

What is meant by "block"? Also what the "environment" term reffers to?

Windows development Windows API - Win32
Windows for business Windows Client for IT Pros User experience Other
Developer technologies C++
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 90,681 Reputation points
    2022-07-11T12:55:21.967+00:00

    As the doc says, it is just an array of null-terminated Unicode strings, with all Environment Variables
    (Environment Tab in Process Explorer for example)


  2. Limitless Technology 39,916 Reputation points
    2022-07-13T14:20:43.38+00:00

    Hi there,

    An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs.

    Each environment string, being a string, is NULL-terminated, and the entire block of strings is itself NULL-terminated. PATH is one example of a commonly used environment variable.

    To pass the parent's environment to a child process, set lpEnvironment to NULL in the CreateProcess call. Any process, in turn, can interrogate or modify its environment variables or add new environment variables to the block.

    ---------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer–

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.