internal static extern bool LogonUser(string lpszUsername, string lpszDomain, string lpszPassword, LogOnType dwLogonType, LogOnProvider dwLogonProvider, out SafeTokenHandle phToken);
/// <summary> /// Releases all resources used by the class and optionally releases the managed resources. /// </summary> /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param> private void Dispose(bool disposing) { Logger.Instance.WriteMethodEntry(EventIdentifier.LogOnUserDispose, "Disposing: {0}.", disposing); try { if (!this.disposed) { if (disposing) { if (this.profileHandle != null) { NativeMethods.UnloadUserProfile(this.Token, this.UserProfileHandle); this.profileHandle.Dispose(); this.profileHandle = null; } if (this.primaryToken != null) { this.primaryToken.Dispose(); this.primaryToken = null; } } } this.disposed = true; } finally { Logger.Instance.WriteMethodExit(EventIdentifier.LogOnUserDispose, "Disposing: {0}.", disposing); } }