Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

BlockSize class method

Project: Environment Variables Unit

Unit: PJEnvVars

Class: TPJEnvironmentVars

Applies to: ~>3.0

class function BlockSize: Integer;


Calculates and returns the size, in characters, of the environment block in the current process.

The block size is sufficient to store a concatentation of all environment variables where each one is represented in Name=Value format, separated by a zero character (i.e. #0 or Char(0)) with the whole block terminated by a pair of zero characters. An example block with three variables is Foo=Lorem#0Bar=Ipsum#0Raboof=Dolore#0#0

Important. Because the size of the environment block is returned in characters, not bytes, you must multiply the returned value by SizeOf(Char) to get the size in bytes.