コード例 #1
0
        /// <summary>
        /// Diposes the Impersonator's resources and also calls Undo()
        /// </summary>
        public void Dispose()
        {
            // Revert back to the previous user context
            this.Undo();

            if (this.m_ExpireTimer != null) // check for null
            {
                // Dipose of the Timer
                this.m_ExpireTimer.Dispose();
            }

            // close the open handle to the authenticated account
            Shell32.CloseHandle(tokenHandle);
        }