Changeset 1070
- Timestamp:
- 5/20/2009 2:02:54 AM (4 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Eraser.Util/AdvApi.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Eraser.Util/AdvApi.cs
r1069 r1070 59 59 60 60 //Get the process token. 61 IntPtr hToken = IntPtr.Zero;61 SafeTokenHandle hToken = new SafeTokenHandle(); 62 62 bool result = NativeMethods.OpenProcessToken(KernelApi.NativeMethods.GetCurrentProcess(), 63 63 NativeMethods.TOKEN_QUERY, out hToken); 64 if (!result || hToken == IntPtr.Zero)64 if (!result || hToken.IsInvalid) 65 65 throw KernelApi.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 66 66 … … 87 87 finally 88 88 { 89 KernelApi.NativeMethods.CloseHandle(hToken);90 89 Marshal.FreeHGlobal(pElevationType); 91 90 } … … 263 262 [DllImport("Advapi32.dll", SetLastError = true)] 264 263 [return: MarshalAs(UnmanagedType.Bool)] 265 public static extern bool GetTokenInformation( IntPtrTokenHandle,264 public static extern bool GetTokenInformation(SafeTokenHandle TokenHandle, 266 265 TOKEN_INFORMATION_CLASS TokenInformationClass, IntPtr TokenInformation, 267 266 uint TokenInformationLength, out uint ReturnLength);
Note: See TracChangeset
for help on using the changeset viewer.
