internal static extern NtStatus LsaCreateSecret( SafeLsaHandle PolicyHandle, [In] UnicodeString SecretName, LsaSecretAccessRights DesiredAccess, out SafeLsaHandle SecretHandle );
/// <summary> /// Create an LSA secret object. /// </summary> /// <param name="name">The name of the secret.</param> /// <param name="desired_access">The desired access for the secret.</param> /// <returns>The created secret.</returns> public LsaSecret CreateSecret(string name, LsaSecretAccessRights desired_access) { return(CreateSecret(name, desired_access, true).Result); }
internal LsaSecret(SafeLsaHandle handle, LsaSecretAccessRights granted_access, string name, string system_name) : base(handle, granted_access, LsaPolicyUtils.LSA_SECRET_NT_TYPE_NAME, $"LSA Secret ({name})", system_name) { }
/// <summary> /// Create an LSA secret object. /// </summary> /// <param name="name">The name of the secret.</param> /// <param name="desired_access">The desired access for the secret.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The created secret.</returns> public NtResult <LsaSecret> CreateSecret(string name, LsaSecretAccessRights desired_access, bool throw_on_error) { return(SecurityNativeMethods.LsaCreateSecret(Handle, new UnicodeString(name), desired_access, out SafeLsaHandle handle).CreateResult(throw_on_error, () => new LsaSecret(handle, desired_access, name))); }