Changeset 1070


Ignore:
Timestamp:
5/20/2009 2:02:54 AM (5 years ago)
Author:
lowjoel
Message:

Sorry, compilo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Eraser.Util/AdvApi.cs

    r1069 r1070  
    5959 
    6060            //Get the process token. 
    61             IntPtr hToken = IntPtr.Zero; 
     61            SafeTokenHandle hToken = new SafeTokenHandle(); 
    6262            bool result = NativeMethods.OpenProcessToken(KernelApi.NativeMethods.GetCurrentProcess(), 
    6363                NativeMethods.TOKEN_QUERY, out hToken); 
    64             if (!result || hToken == IntPtr.Zero) 
     64            if (!result || hToken.IsInvalid) 
    6565                throw KernelApi.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 
    6666 
     
    8787            finally 
    8888            { 
    89                 KernelApi.NativeMethods.CloseHandle(hToken); 
    9089                Marshal.FreeHGlobal(pElevationType); 
    9190            } 
     
    263262            [DllImport("Advapi32.dll", SetLastError = true)] 
    264263            [return: MarshalAs(UnmanagedType.Bool)] 
    265             public static extern bool GetTokenInformation(IntPtr TokenHandle, 
     264            public static extern bool GetTokenInformation(SafeTokenHandle TokenHandle, 
    266265                TOKEN_INFORMATION_CLASS TokenInformationClass, IntPtr TokenInformation, 
    267266                uint TokenInformationLength, out uint ReturnLength); 
Note: See TracChangeset for help on using the changeset viewer.