コード例 #1
0
        internal WindowsImpersonationContext(IntPtr token)
        {
            if (token == ZeroHandle)
            {
                m_userToken = ZeroHandle;
            }
            else
            {
                m_userToken = WindowsIdentity._DuplicateHandle(token, false);

                if (m_userToken == ZeroHandle)
                {
                    throw new ArgumentException(Environment.GetResourceString("Argument_InvalidToken"));
                }
            }
        }