Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.35 KB

TPJCustomConsoleApp-ProcessAttrs.md

File metadata and controls

45 lines (32 loc) · 1.35 KB

ProcessAttrs property

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

property ProcessAttrs: PSecurityAttributes;

Description

This property specifies the security and inheritance attributes for a console application process. It determines whether the process handle can be inherited by child processes. Setting ProcessAttrs to nil means the process handle can't be inherited.

Note that the caller is responsible for setting up the structure correctly. The caller need not maintain a copy of the provided structure once the property is set since an internal copy is made.

The property's default value is nil.

Remarks

To make the process handle inheritable set the bInheritHandle field of the TSecurityAttributes record to True. For example:

var
  App: TPJConsoleApp;
  Attrs: TSecurityAttributes;
begin
  Attrs.nLength := SizeOf(Security);
  Attrs.lpSecurityDescriptor := nil;
  Attrs.bInheritHandle := True;
  App := TPJConsoleApp.Create;
  try
    App.ProcessAttrs := @Attrs;
    ...
  finally
    App.Free;
  end;
end;

The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.