Location: Symbol Reference > Classes > TJwComProcessSecurity Class > TJwComProcessSecurity Methods > Initialize Method > TJwComProcessSecurity.Initialize Method (PJwSecurityInitializationData, TJwAuthenticationInfoList, TJwComAuthenticationLevel, TJwComImpersonationLevel, TJwComAuthenticationCapabilities, Boolean, Boolean)
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
TJwComProcessSecurity.Initialize Method (PJwSecurityInitializationData, TJwAuthenticationInfoList, TJwComAuthenticationLevel, TJwComImpersonationLevel, TJwComAuthenticationCapabilities, Boolean, Boolean)
Pascal
class procedure Initialize(SecurityData: PJwSecurityInitializationData; var AuthenticationList: TJwAuthenticationInfoList; AuthenticationLevel: TJwComAuthenticationLevel; ImpersonationLevel: TJwComImpersonationLevel; Capabilities: TJwComAuthenticationCapabilities; const AutoDestroy: Boolean; const IgnoreProcess: Boolean = false); virtual; overload;

Initialize is the main class procedure to initialize the process wide security settings for a client and server process using CoInitializeSecurity.

Use this call only for a COM Server that is also a COM client. 

If you intend to use this function (effectively CoInitializeSecurity) in a service provided by VCL (TService) you need to call it in a different way:

  1. Application.DelayInitialize := true;
or
  1. Use the demonstration code in your application as demonstrated at the end of this file:
 

 

  var
    SaveInitProc: Pointer = nil;
      
  procedure InitComServer;
  begin
    //In a service, add code to CoInitializeSecurity here
      
    if SaveInitProc <> nil then TProcedure(SaveInitProc);
  end;
      
  initialization
    SaveInitProc := InitProc;
    InitProc := @InitComServer;

 

In this way the call to CoInitializeSecurity is made before VCL inits COM. 

For more information see http://blog.delphi-jedi.net/2009/12/16/windows-2003-server-requires-startservicectrldispatcher/

Exceptions 
Description 
This exception will be raised if :
  1. a member of AuthenticationList has the asWinNT or asGSSKerberos
flag set and AuthorizationService is azsDefault.
  1. AuthenticationLevel is calNone but SecurityData contains none nil security information.
  2. Capabilities contains acAccessControl and acAppId
 
This exception will be raised if a security descriptor is supplied which does not allow SYSTEM full access. COM cannot work then. 
This exception will be raised if IgnoreProcess is true and the current process' name can be found in global variable JwKnownComHostProcesses
CoInitialize was not called or CoInitializeSecurity was already called. You need to call CoInitialize first or call CoUnitialize, CoInitialize and then again this method. 
Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!