C# Class Opc.Ua.Configuration.LocalSecurityPolicy

Allows to add privileges to Local Security Policy. You can use this class to add the LogOn as service privilege to an account.
Inheritance: IDisposable
ファイルを表示 Open project: OPCFoundation/UA-.NET Class Usage Examples

Public Methods

Method Description
AddLogonAsServicePrivilege ( string account ) : void

Add the privilege for the given account to logon as service.

AddPrivilege ( string account, string privilege ) : void

Add privileges for the given account

Dispose ( ) : void

Release all unmanaged resources.

LocalSecurityPolicy ( ) : System

Constructor for LocalSecurityPolicy

LocalSecurityPolicy ( string systemName ) : System

Constructor for LocalSecurityPolicy

Private Methods

Method Description
FreeSid ( IntPtr pSid ) : void
GetLastError ( ) : int
GetSIDInformation ( string account ) : IntPtr
InitLsaString ( string s ) : LSA_UNICODE_STRING
IsValidSid ( IntPtr pSid ) : bool
LookupAccountName ( string lpSystemName, string lpAccountName, IntPtr psid, int &cbsid, StringBuilder domainName, int &cbdomainLength, int &use ) : bool
LsaAddAccountRights ( IntPtr PolicyHandle, IntPtr AccountSid, LSA_UNICODE_STRING UserRights, long CountOfRights ) : long
LsaClose ( IntPtr ObjectHandle ) : long
LsaNtStatusToWinError ( long status ) : long
LsaOpenPolicy ( LSA_UNICODE_STRING &SystemName, LSA_OBJECT_ATTRIBUTES &ObjectAttributes, Int32 DesiredAccess, IntPtr &PolicyHandle ) : UInt32

Method Details

AddLogonAsServicePrivilege() public method

Add the privilege for the given account to logon as service.
public AddLogonAsServicePrivilege ( string account ) : void
account string The account name (domain\userName)
return void

AddPrivilege() public method

Add privileges for the given account
public AddPrivilege ( string account, string privilege ) : void
account string The account name (domain\userName)
privilege string The name of the privilege to add
return void

Dispose() public method

Release all unmanaged resources.
public Dispose ( ) : void
return void

LocalSecurityPolicy() public method

Constructor for LocalSecurityPolicy
public LocalSecurityPolicy ( ) : System
return System

LocalSecurityPolicy() public method

Constructor for LocalSecurityPolicy
public LocalSecurityPolicy ( string systemName ) : System
systemName string local system if systemName is null
return System