diff --git a/trunk/ProcessHacker.Native/Api/Functions.cs b/trunk/ProcessHacker.Native/Api/Functions.cs index 243890a21..563e6f7b9 100644 --- a/trunk/ProcessHacker.Native/Api/Functions.cs +++ b/trunk/ProcessHacker.Native/Api/Functions.cs @@ -40,7 +40,6 @@ using ProcessHacker.Native.Security; namespace ProcessHacker.Native.Api { - [System.Security.SuppressUnmanagedCodeSecurity] public static partial class Win32 { #region Cryptography @@ -632,13 +631,9 @@ namespace ProcessHacker.Native.Api [Out] out long PerformanceFrequency ); - [Obsolete("Superseded - use GetTickCount64 instead")] [DllImport("kernel32.dll")] public static extern int GetTickCount(); - [DllImport("kernel32.dll")] - public static extern Int64 GetTickCount64(); - #endregion #region Named Pipes @@ -758,7 +753,7 @@ namespace ProcessHacker.Native.Api ); [DllImport("kernel32.dll", SetLastError = true)] - public static extern ProcessPriority GetPriorityClass( + public static extern int GetPriorityClass( [In] IntPtr ProcessHandle ); @@ -874,7 +869,7 @@ namespace ProcessHacker.Native.Api ); [DllImport("kernel32.dll", SetLastError = true)] - public static extern IntPtr GetCurrentProcess(); + public static extern int GetCurrentProcess(); [DllImport("kernel32.dll", SetLastError = true)] public static extern int GetCurrentProcessId(); @@ -1662,7 +1657,6 @@ namespace ProcessHacker.Native.Api [In] bool InvadeProcess ); - [Obsolete("Superseded by the SymLoadModuleEx function")] [DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Ansi)] public static extern long SymLoadModule64( [In] IntPtr ProcessHandle, @@ -1673,18 +1667,6 @@ namespace ProcessHacker.Native.Api [In] int SizeOfDll ); - [DllImport("dbghelp.dll", SetLastError = true, CharSet = CharSet.Ansi)] - public static extern long SymLoadModuleEx( - [In] IntPtr ProcessHandle, - [In] [Optional] IntPtr FileHandle, - [In] [Optional] string ImageName, - [In] [Optional] string ModuleName, - [In] ulong BaseOfDll, - [In] int SizeOfDll, - [In] MODLOAD_DATA data, - [In] int flags - ); - [DllImport("dbghelp.dll", SetLastError = true)] public static extern SymbolOptions SymSetOptions( [In] SymbolOptions SymOptions @@ -1748,7 +1730,6 @@ namespace ProcessHacker.Native.Api ref int pdwSize, [In] bool bOrder); - [Obsolete("Not supported on Windows Vista and later")] [DllImport("iphlpapi.dll", SetLastError = true)] public extern static int AllocateAndGetTcpExTableFromStack( [Out] out IntPtr pTable, @@ -1944,10 +1925,10 @@ namespace ProcessHacker.Native.Api ); [DllImport("kernel32.dll", SetLastError = true)] - public static extern ThreadPriority GetThreadPriority([In] IntPtr ThreadHandle); + public static extern int GetThreadPriority([In] IntPtr ThreadHandle); [DllImport("kernel32.dll", SetLastError = true)] - public static extern IntPtr CreateThread( + public static extern int CreateThread( [In] [Optional] IntPtr ThreadAttributes, [In] int StackSize, [In] [MarshalAs(UnmanagedType.FunctionPtr)] ThreadStart StartAddress, @@ -2114,7 +2095,6 @@ namespace ProcessHacker.Native.Api [In] bool bOrder ); - [Obsolete("Not supported on Windows Vista and later")] [DllImport("iphlpapi.dll", SetLastError = true)] public extern static int AllocateAndGetUdpExTableFromStack( [Out] out IntPtr pTable, @@ -2333,7 +2313,7 @@ namespace ProcessHacker.Native.Api ); [DllImport("uxtheme.dll", CharSet = CharSet.Unicode)] - public static extern Win32Error SetWindowTheme( + public static extern int SetWindowTheme( [In] IntPtr hWnd, [In] string appName, [In] string idList diff --git a/trunk/ProcessHacker.Native/Api/LsaFunctions.cs b/trunk/ProcessHacker.Native/Api/LsaFunctions.cs index 19d4561ba..d982add5a 100644 --- a/trunk/ProcessHacker.Native/Api/LsaFunctions.cs +++ b/trunk/ProcessHacker.Native/Api/LsaFunctions.cs @@ -28,7 +28,6 @@ using ProcessHacker.Native.Security; namespace ProcessHacker.Native.Api { - [System.Security.SuppressUnmanagedCodeSecurity] public static partial class Win32 { /* Note: Be very careful about where these functions are diff --git a/trunk/ProcessHacker.Native/Api/NativeEnums.cs b/trunk/ProcessHacker.Native/Api/NativeEnums.cs index d88eca8c6..b4012eaa3 100644 --- a/trunk/ProcessHacker.Native/Api/NativeEnums.cs +++ b/trunk/ProcessHacker.Native/Api/NativeEnums.cs @@ -1044,17 +1044,6 @@ namespace ProcessHacker.Native.Api MaxProcessInfoClass } - [Flags] - public enum ProcessPriority : int - { - ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000, - BELOW_NORMAL_PRIORITY_CLASS = 0x00004000, - HIGH_PRIORITY_CLASS = 0x00000080, - IDLE_PRIORITY_CLASS = 0x00000040, - NORMAL_PRIORITY_CLASS = 0x00000020, - REALTIME_PRIORITY_CLASS = 0x00000100, - } - [Flags] public enum RegHiveFormat : int { @@ -1447,20 +1436,6 @@ namespace ProcessHacker.Native.Api MaxThreadInfoClass } - [Flags] - public enum ThreadPriority - { - THREAD_MODE_BACKGROUND_BEGIN = 0x00010000, - THREAD_MODE_BACKGROUND_END = 0x00020000, - THREAD_PRIORITY_ABOVE_NORMAL = 1, - THREAD_PRIORITY_BELOW_NORMAL = -1, - THREAD_PRIORITY_HIGHEST = 2, - THREAD_PRIORITY_IDLE = -15, - THREAD_PRIORITY_LOWEST = -2, - THREAD_PRIORITY_NORMAL = 0, - THREAD_PRIORITY_TIME_CRITICAL = 15 - } - public enum TimerInformationClass : int { TimerBasicInformation diff --git a/trunk/ProcessHacker.Native/Api/NativeFunctions.cs b/trunk/ProcessHacker.Native/Api/NativeFunctions.cs index ce08c1181..ac0582a97 100644 --- a/trunk/ProcessHacker.Native/Api/NativeFunctions.cs +++ b/trunk/ProcessHacker.Native/Api/NativeFunctions.cs @@ -36,7 +36,6 @@ using ProcessHacker.Native.Security; namespace ProcessHacker.Native.Api { - [System.Security.SuppressUnmanagedCodeSecurity] public static partial class Win32 { // IMPORTANT: All timeouts, etc. are in 100ns units except when stated otherwise. diff --git a/trunk/ProcessHacker.Native/Api/NativeStructs.cs b/trunk/ProcessHacker.Native/Api/NativeStructs.cs index 21b548178..b8f98974a 100644 --- a/trunk/ProcessHacker.Native/Api/NativeStructs.cs +++ b/trunk/ProcessHacker.Native/Api/NativeStructs.cs @@ -1225,16 +1225,6 @@ namespace ProcessHacker.Native.Api // ANSI/Unicode string follows. } - [StructLayout(LayoutKind.Sequential)] - public struct MODLOAD_DATA - { - public int ssize; - public int ssig; - public IntPtr data; - public int size; - public int flags; - } - [StructLayout(LayoutKind.Sequential)] public struct MutantBasicInformation { diff --git a/trunk/ProcessHacker.Native/Api/Win32Error.cs b/trunk/ProcessHacker.Native/Api/Win32Error.cs index a59a0889d..19f75536d 100644 --- a/trunk/ProcessHacker.Native/Api/Win32Error.cs +++ b/trunk/ProcessHacker.Native/Api/Win32Error.cs @@ -32,7 +32,7 @@ namespace ProcessHacker.Native.Api public enum Win32Error : uint { Success = 0x0, - Failure = 0x1, + InvalidFunction = 0x1, FileNotFound = 0x2, PathNotFound = 0x3, TooManyOpenFiles = 0x4, @@ -89,17 +89,7 @@ namespace ProcessHacker.Native.Api TooManySemRequests = 0x67, InvalidAtInterruptTime = 0x68, SemOwnerDied = 0x69, - SemUserLimit = 0x6a, - - E_INVALIDARG = 0x80070057, - E_OUTOFMEMORY = 0x8007000E, - E_NOINTERFACE = 0x80004002, - E_FAIL = 0x80004005, - E_ELEMENTNOTFOUND = 0x80070490, - TYPE_E_ELEMENTNOTFOUND = 0x8002802B, - NO_OBJECT = 0x800401E5, - ERROR_CANCELLED = 1223, - RESOURCE_IN_USE = 0x800700AA, + SemUserLimit = 0x6a } public static class Win32ErrorExtensions diff --git a/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs b/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs index 1c64a2e89..d5fdec7ac 100644 --- a/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs +++ b/trunk/ProcessHacker.Native/Objects/ProcessHandle.cs @@ -1703,7 +1703,7 @@ namespace ProcessHacker.Native.Objects /// A ProcessPriorityClass enum. public ProcessPriorityClass GetPriorityClass() { - ProcessPriority priority = Win32.GetPriorityClass(this); + int priority = Win32.GetPriorityClass(this); if (priority == 0) Win32.ThrowLastError(); diff --git a/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs b/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs index 3109572f9..f4bd280fd 100644 --- a/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs +++ b/trunk/ProcessHacker.Native/Objects/ThreadHandle.cs @@ -676,9 +676,9 @@ namespace ProcessHacker.Native.Objects /// A ThreadPriorityLevel enum. public ThreadPriorityLevel GetPriorityLevel() { - ThreadPriority priority = Win32.GetThreadPriority(this); + int priority = Win32.GetThreadPriority(this); - if ((int)priority == 0x7fffffff) + if (priority == 0x7fffffff) Win32.ThrowLastError(); return (ThreadPriorityLevel)priority; diff --git a/trunk/ProcessHacker/Components/TaskbarLib/TaskbarClass.cs b/trunk/ProcessHacker/Components/TaskbarLib/TaskbarClass.cs index a84b132de..3900b6e31 100644 --- a/trunk/ProcessHacker/Components/TaskbarLib/TaskbarClass.cs +++ b/trunk/ProcessHacker/Components/TaskbarLib/TaskbarClass.cs @@ -47,8 +47,7 @@ namespace TaskbarLib if (_taskbar == null) { _taskbar = (TaskbarNative.ITaskbarList)new TaskbarNative.TaskbarList(); - - Win32Error result = _taskbar.HrInit(); + TaskbarNative.HRESULT result = _taskbar.HrInit(); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -60,7 +59,7 @@ namespace TaskbarLib public static void ActivateTab(IntPtr hwnd) { - Win32Error result = Taskbar.ActivateTab(hwnd); + TaskbarNative.HRESULT result = Taskbar.ActivateTab(hwnd); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -68,7 +67,7 @@ namespace TaskbarLib public static void AddTab(IntPtr hwnd) { - Win32Error result = Taskbar.AddTab(hwnd); + TaskbarNative.HRESULT result = Taskbar.AddTab(hwnd); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -76,7 +75,7 @@ namespace TaskbarLib public static void DeleteTab(IntPtr hwnd) { - Win32Error result = Taskbar.DeleteTab(hwnd); + TaskbarNative.HRESULT result = Taskbar.DeleteTab(hwnd); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -84,7 +83,7 @@ namespace TaskbarLib public static void SetActivateAlt(IntPtr hwnd) { - Win32Error result = Taskbar.SetActiveAlt(hwnd); + TaskbarNative.HRESULT result = Taskbar.SetActiveAlt(hwnd); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -92,7 +91,7 @@ namespace TaskbarLib public static void MarkFullscreenWindow(IntPtr hwnd, bool fullscreen) { - Win32Error result = Taskbar.MarkFullscreenWindow(hwnd, fullscreen); + TaskbarNative.HRESULT result = Taskbar.MarkFullscreenWindow(hwnd, fullscreen); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -102,7 +101,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetProgressValue(Program.HackerWindowHandle, completed, total); + TaskbarNative.HRESULT result = Taskbar.SetProgressValue(Program.HackerWindowHandle, completed, total); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -113,7 +112,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetProgressState(Program.HackerWindowHandle, flags); + TaskbarNative.HRESULT result = Taskbar.SetProgressState(Program.HackerWindowHandle, flags); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -124,7 +123,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.RegisterTab(hwndTab, hwndMDI); + TaskbarNative.HRESULT result = Taskbar.RegisterTab(hwndTab, hwndMDI); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -135,7 +134,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.UnregisterTab(hwndTab); + TaskbarNative.HRESULT result = Taskbar.UnregisterTab(hwndTab); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -146,7 +145,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetTabOrder(hwndTab, hwndInsertBefore); + TaskbarNative.HRESULT result = Taskbar.SetTabOrder(hwndTab, hwndInsertBefore); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -157,7 +156,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetTabActive(hwndTab, hwndInsertBefore, tbatFlags); + TaskbarNative.HRESULT result = Taskbar.SetTabActive(hwndTab, hwndInsertBefore, tbatFlags); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -168,7 +167,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.ThumbBarAddButtons(hwnd, cButtons, pButton); + TaskbarNative.HRESULT result = Taskbar.ThumbBarAddButtons(hwnd, cButtons, pButton); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -179,7 +178,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.ThumbBarUpdateButtons(hwnd, cButtons, pButton); + TaskbarNative.HRESULT result = Taskbar.ThumbBarUpdateButtons(hwnd, cButtons, pButton); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -190,7 +189,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.ThumbBarSetImageList(hwnd, himl); + TaskbarNative.HRESULT result = Taskbar.ThumbBarSetImageList(hwnd, himl); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -201,7 +200,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetOverlayIcon(Program.HackerWindowHandle, icon != null ? icon.Handle : IntPtr.Zero, pszDescription); + TaskbarNative.HRESULT result = Taskbar.SetOverlayIcon(Program.HackerWindowHandle, icon != null ? icon.Handle : IntPtr.Zero, pszDescription); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -212,7 +211,7 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetThumbnailTooltip(hwnd, pszTip); + TaskbarNative.HRESULT result = Taskbar.SetThumbnailTooltip(hwnd, pszTip); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); @@ -223,19 +222,21 @@ namespace TaskbarLib { if (OSVersion.HasExtendedTaskbar) { - Win32Error result = Taskbar.SetThumbnailClip(hwnd, ref prcClip); + TaskbarNative.HRESULT result = Taskbar.SetThumbnailClip(hwnd, ref prcClip); if (Failed(result)) throw Marshal.GetExceptionForHR((int)result); } } - public static bool Failed(Win32Error hResult) + /// + /// HRESULT - Failed + /// + /// The error code. + /// True if the error code indicates failure. + public static bool Failed(TaskbarNative.HRESULT hResult) { - if (hResult != Win32Error.Success) - return true; - else - return false; + return (hResult != TaskbarNative.HRESULT.S_OK); } } } diff --git a/trunk/ProcessHacker/Components/TaskbarLib/TaskbarNative.cs b/trunk/ProcessHacker/Components/TaskbarLib/TaskbarNative.cs index c238d0e29..82441db30 100644 --- a/trunk/ProcessHacker/Components/TaskbarLib/TaskbarNative.cs +++ b/trunk/ProcessHacker/Components/TaskbarLib/TaskbarNative.cs @@ -1,6 +1,5 @@ using System.Runtime.InteropServices; using System; -using ProcessHacker.Native.Api; namespace TaskbarLib { @@ -26,7 +25,7 @@ namespace TaskbarLib /// /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error HrInit(); + HRESULT HrInit(); /// /// Adds an item to the taskbar. @@ -34,7 +33,7 @@ namespace TaskbarLib /// A handle to the window to be added to the taskbar. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error AddTab(IntPtr hwnd); + HRESULT AddTab(IntPtr hwnd); /// /// Deletes an item from the taskbar. @@ -42,7 +41,7 @@ namespace TaskbarLib /// A handle to the window to be deleted from the taskbar. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error DeleteTab(IntPtr hwnd); + HRESULT DeleteTab(IntPtr hwnd); /// /// Activates an item on the taskbar. The window is not actually activated; @@ -51,7 +50,7 @@ namespace TaskbarLib /// A handle to the window on the taskbar to be displayed as active. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error ActivateTab(IntPtr hwnd); + HRESULT ActivateTab(IntPtr hwnd); /// /// Marks a taskbar item as active but does not visually activate it. @@ -69,7 +68,7 @@ namespace TaskbarLib /// A handle to the window to be marked as active. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetActiveAlt(IntPtr hwnd); + HRESULT SetActiveAlt(IntPtr hwnd); #endregion @@ -90,7 +89,7 @@ namespace TaskbarLib /// A Boolean value marking the desired full-screen status of the window. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + HRESULT MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); #endregion @@ -104,7 +103,7 @@ namespace TaskbarLib /// An application-defined value that specifies the value ullCompleted will have when the operation is complete /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetProgressValue(IntPtr hwnd, UInt64 completed, UInt64 total); + HRESULT SetProgressValue(IntPtr hwnd, UInt64 completed, UInt64 total); /// /// Sets the type and state of the progress indicator displayed on a taskbar button. @@ -114,7 +113,7 @@ namespace TaskbarLib /// Flags that control the current state of the progress button. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetProgressState(IntPtr hwnd, TBPFlag tbpFlags); + HRESULT SetProgressState(IntPtr hwnd, TBPFlag tbpFlags); /// /// Informs the taskbar that a new tab or document thumbnail has been provided for display in an application's taskbar group flyout. @@ -123,7 +122,7 @@ namespace TaskbarLib /// Handle of the application's main window. This value tells the taskbar which application's preview group to attach the new thumbnail to. This value is required and cannot be NULL. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); + HRESULT RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); /// /// Removes a thumbnail from an application's preview group when that tab or document is closed in the application. @@ -133,7 +132,7 @@ namespace TaskbarLib /// This value is required and cannot be NULL. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error UnregisterTab(IntPtr hwndTab); + HRESULT UnregisterTab(IntPtr hwndTab); /// /// Inserts a new thumbnail into a tabbed-document interface (TDI) or multiple-document interface (MDI) application's group flyout or moves an existing thumbnail to a new position in the application's group. @@ -142,7 +141,7 @@ namespace TaskbarLib /// The handle of the tab window whose thumbnail that hwndTab is inserted to the left of. This handle must already be registered through ITaskbarList3::RegisterTab. If this value is NULL, the new thumbnail is added to the end of the list. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); + HRESULT SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); /// /// Informs the taskbar that a tab or document window has been made the active window. @@ -152,7 +151,7 @@ namespace TaskbarLib /// Reserved /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetTabActive(IntPtr hwndTab, IntPtr hwndInsertBefore, TBATFlag dwReserved); + HRESULT SetTabActive(IntPtr hwndTab, IntPtr hwndInsertBefore, TBATFlag dwReserved); /// /// Adds a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window in a taskbar button flyout. @@ -163,7 +162,7 @@ namespace TaskbarLib /// Returns S_OK if successful, or an error value otherwise, including the following: /// E_INVALIDARG - The hwnd parameter does not specify a handle that belongs to the process or does not specify a window that is associated with a taskbar button. This value is also returned if pButton is less than 1 or greater than 7. [PreserveSig] - Win32Error ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons); + HRESULT ThumbBarAddButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons); /// /// Shows, enables, disables, or hides buttons in a thumbnail toolbar as required by the window's current state. A thumbnail toolbar is a toolbar embedded in a thumbnail image of a window in a taskbar button flyout. @@ -181,7 +180,7 @@ namespace TaskbarLib /// A pointer to an array of THUMBBUTTON structures. Each THUMBBUTTON defines an individual button. If the button already exists (the iId value is already defined), then that existing button is updated with the information provided in the structure. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons); + HRESULT ThumbBarUpdateButtons(IntPtr hwnd, uint cButtons, [MarshalAs(UnmanagedType.LPArray)] THUMBBUTTON[] pButtons); /// /// Specifies an image list that contains button images for a toolbar embedded in a thumbnail image of a window in a taskbar button flyout. @@ -190,7 +189,7 @@ namespace TaskbarLib /// The handle of the image list that contains all button images to be used in the toolbar. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error ThumbBarSetImageList(IntPtr hwnd, IntPtr himl); + HRESULT ThumbBarSetImageList(IntPtr hwnd, IntPtr himl); /// /// Applies an overlay to a taskbar button to indicate application status or a notification to the user. @@ -204,7 +203,7 @@ namespace TaskbarLib /// A pointer to a string that provides an alt text version of the information conveyed by the overlay, for accessibility purposes. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string description); + HRESULT SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, [MarshalAs(UnmanagedType.LPWStr)] string description); /// /// Specifies or updates the text of the tooltip that is displayed when the mouse pointer rests on an individual preview thumbnail in a taskbar button flyout. @@ -213,7 +212,7 @@ namespace TaskbarLib /// The pointer to the text to be displayed in the tooltip. This value can be NULL, in which case the title of the window specified by hwnd is used as the tooltip. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string tip); + HRESULT SetThumbnailTooltip(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string tip); /// /// Selects a portion of a window's client area to display as that window's thumbnail in the taskbar. @@ -222,7 +221,7 @@ namespace TaskbarLib /// A pointer to a RECT structure that specifies a selection within the window's client area, relative to the upper-left corner of that client area. To clear a clip that is already in place and return to the default display of the thumbnail, set this parameter to NULL. /// Returns S_OK if successful, or an error value otherwise. [PreserveSig] - Win32Error SetThumbnailClip(IntPtr hwnd, ref ProcessHacker.Native.Api.Rect prcClip); + HRESULT SetThumbnailClip(IntPtr hwnd, ref ProcessHacker.Native.Api.Rect prcClip); #endregion @@ -234,7 +233,7 @@ namespace TaskbarLib /// The handle of the tab window that is to have properties set. This handle must already be registered through ITaskbarList3::RegisterTab. /// One or more members of the STPFLAG enumeration that specify the displayed thumbnail and peek image source of the tab thumbnail. /// Returns S_OK if successful, or an error value otherwise. - Win32Error SetTabProperties(IntPtr hwndTab, STPFlag stpFlags); + HRESULT SetTabProperties(IntPtr hwndTab, STPFlag stpFlags); #endregion } @@ -299,5 +298,24 @@ namespace TaskbarLib internal THBFlags dwFlags; } + /// + /// Native HResult Wrapper + /// + public enum HRESULT : uint + { + S_FALSE = 0x0001, + S_OK = 0x0000, + + E_INVALIDARG = 0x80070057, + E_OUTOFMEMORY = 0x8007000E, + E_NOINTERFACE = 0x80004002, + E_FAIL = 0x80004005, + E_ELEMENTNOTFOUND = 0x80070490, + + TYPE_E_ELEMENTNOTFOUND = 0x8002802B, + NO_OBJECT = 0x800401E5, + ERROR_CANCELLED = 1223, + RESOURCE_IN_USE = 0x800700AA, + } } } \ No newline at end of file diff --git a/trunk/ProcessHacker/Forms/ResultsWindow.cs b/trunk/ProcessHacker/Forms/ResultsWindow.cs index b984e7b3f..206e34f2e 100644 --- a/trunk/ProcessHacker/Forms/ResultsWindow.cs +++ b/trunk/ProcessHacker/Forms/ResultsWindow.cs @@ -55,7 +55,7 @@ namespace ProcessHacker listResults.SetDoubleBuffered(true); listResults.SetTheme("explorer"); - Thread.CurrentThread.Priority = System.Threading.ThreadPriority.Highest; + Thread.CurrentThread.Priority = ThreadPriority.Highest; _pid = PID; diff --git a/trunk/ProcessHacker/Program/Program.cs b/trunk/ProcessHacker/Program/Program.cs index b69ba3f6b..c43855576 100644 --- a/trunk/ProcessHacker/Program/Program.cs +++ b/trunk/ProcessHacker/Program/Program.cs @@ -260,7 +260,7 @@ namespace ProcessHacker { CurrentProcessId = Win32.GetCurrentProcessId(); CurrentSessionId = Win32.GetProcessSessionId(Win32.GetCurrentProcessId()); - System.Threading.Thread.CurrentThread.Priority = System.Threading.ThreadPriority.Highest; + System.Threading.Thread.CurrentThread.Priority = ThreadPriority.Highest; } catch (Exception ex) {