From fa9ba9ff7454dbe8a76270e8fd0ae3f60004471f Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 25 Jul 2019 20:25:24 -0600 Subject: [PATCH] Changed names of delegates where existing ALLCAP name was a reference to another name. Could be a breaking change. --- PInvoke/Kernel32/FibersApi.cs | 4 +- PInvoke/Kernel32/MemoryApi.cs | 4 +- PInvoke/Kernel32/RtlSupportApi.cs | 2 +- PInvoke/Kernel32/WinBase.TxF.cs | 4 +- PInvoke/Kernel32/WinBase.cs | 117 ------------------------- PInvoke/Kernel32/WinCon.cs | 4 +- PInvoke/Kernel32/WinNT.cs | 4 +- PInvoke/NetApi32/DavClnt.cs | 8 +- PInvoke/Security/AdvApi32/PerfLib.cs | 14 +-- PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs | 2 +- PInvoke/ShlwApi/Shlwapi.cs | 18 +--- PInvoke/User32.Gdi/WinUser.Desktop.cs | 2 +- PInvoke/User32.Gdi/WinUser.Window.cs | 106 +++++++++++----------- PInvoke/User32/WinUser.Hook.cs | 4 +- PInvoke/WinINet/WinINet.cs | 10 +-- PInvoke/Ws2_32/WinSock2.cs | 4 +- 16 files changed, 88 insertions(+), 219 deletions(-) diff --git a/PInvoke/Kernel32/FibersApi.cs b/PInvoke/Kernel32/FibersApi.cs index 7a254cf5..54cba0a5 100644 --- a/PInvoke/Kernel32/FibersApi.cs +++ b/PInvoke/Kernel32/FibersApi.cs @@ -14,7 +14,7 @@ namespace Vanara.PInvoke /// this callback function. FlsCallback is a placeholder for the application-defined function name. /// /// The value stored in the FLS slot for the calling fiber. - public delegate void PFLS_CALLBACK_FUNCTION(IntPtr lpFlsData); + public delegate void FlsCallback(IntPtr lpFlsData); /// /// Allocates a fiber local storage (FLS) index. Any fiber in the process can subsequently use this index to store and retrieve @@ -31,7 +31,7 @@ namespace Vanara.PInvoke // DWORD WINAPI FlsAlloc( _In_ PFLS_CALLBACK_FUNCTION lpCallback); https://msdn.microsoft.com/en-us/library/windows/desktop/ms682664(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("WinBase.h", MSDNShortId = "ms682664")] - public static extern uint FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback); + public static extern uint FlsAlloc(FlsCallback lpCallback); /// Releases a fiber local storage (FLS) index, making it available for reuse. /// The FLS index that was allocated by the FlsAlloc function. diff --git a/PInvoke/Kernel32/MemoryApi.cs b/PInvoke/Kernel32/MemoryApi.cs index 1d2eb824..3cee9eed 100644 --- a/PInvoke/Kernel32/MemoryApi.cs +++ b/PInvoke/Kernel32/MemoryApi.cs @@ -11,7 +11,7 @@ namespace Vanara.PInvoke /// memory pages are detected. /// [UnmanagedFunctionPointer(CallingConvention.StdCall)] - public delegate void PBAD_MEMORY_CALLBACK_ROUTINE(); + public delegate void BadMemoryCallbackRoutine(); /// Flags that indicate which of the file cache limits are enabled. [PInvokeData("MemoryApi.h")] @@ -2296,7 +2296,7 @@ namespace Vanara.PInvoke // PVOID WINAPI RegisterBadMemoryNotification( _In_ PBAD_MEMORY_CALLBACK_ROUTINE Callback); [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("WinBase.h", MSDNShortId = "hh691013")] - public static extern IntPtr RegisterBadMemoryNotification(PBAD_MEMORY_CALLBACK_ROUTINE Callback); + public static extern IntPtr RegisterBadMemoryNotification(BadMemoryCallbackRoutine Callback); /// /// diff --git a/PInvoke/Kernel32/RtlSupportApi.cs b/PInvoke/Kernel32/RtlSupportApi.cs index 04770ade..fc60dda0 100644 --- a/PInvoke/Kernel32/RtlSupportApi.cs +++ b/PInvoke/Kernel32/RtlSupportApi.cs @@ -136,7 +136,7 @@ namespace Vanara.PInvoke [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("rtlsupportapi.h", MSDNShortId = "63b35b17-0b0e-46ed-9dbf-98290ab08bd1")] [return: MarshalAs(UnmanagedType.U1)] - public static extern bool RtlInstallFunctionTableCallback(ulong TableIdentifier, ulong BaseAddress, uint Length, PGET_RUNTIME_FUNCTION_CALLBACK Callback, IntPtr Context = default, [MarshalAs(UnmanagedType.LPWStr)] string OutOfProcessCallbackDll = null); + public static extern bool RtlInstallFunctionTableCallback(ulong TableIdentifier, ulong BaseAddress, uint Length, GetRuntimeFunctionCallback Callback, IntPtr Context = default, [MarshalAs(UnmanagedType.LPWStr)] string OutOfProcessCallbackDll = null); /// Searches the active function tables for an entry that corresponds to the specified PC value. /// The virtual address of an instruction bundle within the function. diff --git a/PInvoke/Kernel32/WinBase.TxF.cs b/PInvoke/Kernel32/WinBase.TxF.cs index 5ac4e353..290b6366 100644 --- a/PInvoke/Kernel32/WinBase.TxF.cs +++ b/PInvoke/Kernel32/WinBase.TxF.cs @@ -278,7 +278,7 @@ namespace Vanara.PInvoke [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winbase.h", MSDNShortId = "118392de-166b-413e-99c9-b3deb756de0e")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool CopyFileTransacted(string lpExistingFileName, string lpNewFileName, LpprogressRoutine lpProgressRoutine, IntPtr lpData, [MarshalAs(UnmanagedType.Bool)] ref bool pbCancel, COPY_FILE dwCopyFlags, IntPtr hTransaction); + public static extern bool CopyFileTransacted(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData, [MarshalAs(UnmanagedType.Bool)] ref bool pbCancel, COPY_FILE dwCopyFlags, IntPtr hTransaction); /// /// @@ -2573,7 +2573,7 @@ namespace Vanara.PInvoke [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winbase.h", MSDNShortId = "466d733b-30d2-4297-a0e6-77038f1a21d5")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool MoveFileTransacted(string lpExistingFileName, string lpNewFileName, LpprogressRoutine lpProgressRoutine, IntPtr lpData, MOVEFILE dwFlags, IntPtr hTransaction); + public static extern bool MoveFileTransacted(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData, MOVEFILE dwFlags, IntPtr hTransaction); /// /// diff --git a/PInvoke/Kernel32/WinBase.cs b/PInvoke/Kernel32/WinBase.cs index 2a422606..e82d55f4 100644 --- a/PInvoke/Kernel32/WinBase.cs +++ b/PInvoke/Kernel32/WinBase.cs @@ -148,95 +148,6 @@ namespace Vanara.PInvoke [UnmanagedFunctionPointer(CallingConvention.Winapi)] public delegate COPYFILE2_MESSAGE_ACTION CopyFile2ProgressRoutine(ref COPYFILE2_MESSAGE pMessage, IntPtr pvCallbackContext); - /// - /// An application-defined callback function used with the CopyFileEx, MoveFileTransacted, and MoveFileWithProgress functions. It is - /// called when a portion of a copy or move operation is completed. The LPPROGRESS_ROUTINE type defines a pointer to this - /// callback function. CopyProgressRoutine is a placeholder for the application-defined function name. - /// - /// - /// The total size of the file, in bytes. - /// - /// - /// The total number of bytes transferred from the source file to the destination file since the copy operation began. - /// - /// - /// The total size of the current file stream, in bytes. - /// - /// - /// - /// The total number of bytes in the current stream that have been transferred from the source file to the destination file since the - /// copy operation began. - /// - /// - /// - /// A handle to the current stream. The first time CopyProgressRoutine is called, the stream number is 1. - /// - /// - /// The reason that CopyProgressRoutine was called. This parameter can be one of the following values. - /// - /// - /// Value - /// Meaning - /// - /// - /// CALLBACK_CHUNK_FINISHED 0x00000000 - /// Another part of the data file was copied. - /// - /// - /// CALLBACK_STREAM_SWITCH 0x00000001 - /// - /// Another stream was created and is about to be copied. This is the callback reason given when the callback routine is first invoked. - /// - /// - /// - /// - /// - /// A handle to the source file. - /// - /// - /// A handle to the destination file - /// - /// - /// Argument passed to CopyProgressRoutine by CopyFileEx, MoveFileTransacted, or MoveFileWithProgress. - /// - /// - /// The CopyProgressRoutine function should return one of the following values. - /// - /// - /// Return code/value - /// Description - /// - /// - /// PROGRESS_CANCEL 1 - /// Cancel the copy operation and delete the destination file. - /// - /// - /// PROGRESS_CONTINUE 0 - /// Continue the copy operation. - /// - /// - /// PROGRESS_QUIET 3 - /// Continue the copy operation, but stop invoking CopyProgressRoutine to report progress. - /// - /// - /// PROGRESS_STOP 2 - /// Stop the copy operation. It can be restarted at a later time. - /// - /// - /// - /// - /// - /// An application can use this information to display a progress bar that shows the total number of bytes copied as a percent of the - /// total file size. - /// - /// - // https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nc-winbase-lpprogress_routine LPPROGRESS_ROUTINE LpprogressRoutine; - // DWORD LpprogressRoutine( LARGE_INTEGER TotalFileSize, LARGE_INTEGER TotalBytesTransferred, LARGE_INTEGER StreamSize, LARGE_INTEGER - // StreamBytesTransferred, DWORD dwStreamNumber, DWORD dwCallbackReason, HANDLE hSourceFile, HANDLE hDestinationFile, LPVOID lpData ) {...} - [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] - [PInvokeData("winbase.h", MSDNShortId = "2c02b212-d4ac-4b01-8955-2561d8c42b1b")] - public delegate COPYFILE_CALLBACK_RESULT LpprogressRoutine(long TotalFileSize, long TotalBytesTransferred, long StreamSize, long StreamBytesTransferred, uint dwStreamNumber, COPYFILE_CALLBACK dwCallbackReason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData); - /// Flags for SetSearchPathMode. [PInvokeData("winbase.h", MSDNShortId = "1874933d-92c3-4945-a3e4-e6dede232d5e")] [Flags] @@ -257,34 +168,6 @@ namespace Vanara.PInvoke BASE_SEARCH_PATH_PERMANENT = 0x00008000, } - /// Used by . - public enum COPYFILE_CALLBACK - { - /// Another part of the data file was copied. - CALLBACK_CHUNK_FINISHED = 0x00000000, - - /// - /// Another stream was created and is about to be copied. This is the callback reason given when the callback routine is first invoked. - /// - CALLBACK_STREAM_SWITCH = 0x00000001, - } - - /// Returned by . - public enum COPYFILE_CALLBACK_RESULT - { - /// Cancel the copy operation and delete the destination file. - PROGRESS_CANCEL = 1, - - /// Continue the copy operation. - PROGRESS_CONTINUE = 0, - - /// Continue the copy operation, but stop invoking CopyProgressRoutine to report progress. - PROGRESS_QUIET = 3, - - /// Stop the copy operation. It can be restarted at a later time. - PROGRESS_STOP = 2, - } - /// /// /// Indicates the phase of a copy at the time of an error. This is used in the Error structure embedded in the diff --git a/PInvoke/Kernel32/WinCon.cs b/PInvoke/Kernel32/WinCon.cs index b94c1f62..c9f88e52 100644 --- a/PInvoke/Kernel32/WinCon.cs +++ b/PInvoke/Kernel32/WinCon.cs @@ -24,7 +24,7 @@ namespace Vanara.PInvoke /// list of handlers for this process is used. /// [return: MarshalAs(UnmanagedType.Bool)] - public delegate bool PHANDLER_ROUTINE(CTRL_EVENT CtrlType); + public delegate bool HandlerRoutine(CTRL_EVENT CtrlType); /// /// Character attributes can be divided into two classes: color and DBCS. The following attributes are defined in the Wincon.h header file. @@ -1851,7 +1851,7 @@ namespace Vanara.PInvoke [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Wincon.h", MSDNShortId = "")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, [MarshalAs(UnmanagedType.Bool)] bool Add); + public static extern bool SetConsoleCtrlHandler(HandlerRoutine HandlerRoutine, [MarshalAs(UnmanagedType.Bool)] bool Add); /// Sets the size and visibility of the cursor for the specified console screen buffer. /// diff --git a/PInvoke/Kernel32/WinNT.cs b/PInvoke/Kernel32/WinNT.cs index f263a7b7..ae95194c 100644 --- a/PInvoke/Kernel32/WinNT.cs +++ b/PInvoke/Kernel32/WinNT.cs @@ -19,11 +19,11 @@ namespace Vanara.PInvoke /// Pointer to a structure. [UnmanagedFunctionPointer(CallingConvention.Winapi)] [PInvokeData("WinNT.h")] - public delegate IntPtr PGET_RUNTIME_FUNCTION_CALLBACK(IntPtr ControlPc, IntPtr Context); + public delegate IntPtr GetRuntimeFunctionCallback(IntPtr ControlPc, IntPtr Context); [UnmanagedFunctionPointer(CallingConvention.Winapi)] [PInvokeData("WinNT.h")] - public delegate uint POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK(HPROCESS Process, IntPtr TableAddress, out uint Entries, [Out] IMAGE_RUNTIME_FUNCTION_ENTRY[] Functions); + public delegate uint OutOfProcessFunctionTableCallback(HPROCESS Process, IntPtr TableAddress, out uint Entries, [Out] IMAGE_RUNTIME_FUNCTION_ENTRY[] Functions); /// /// The application-defined user-mode scheduling (UMS) scheduler entry point function associated with a UMS completion list. diff --git a/PInvoke/NetApi32/DavClnt.cs b/PInvoke/NetApi32/DavClnt.cs index 260d4ddf..f623d15a 100644 --- a/PInvoke/NetApi32/DavClnt.cs +++ b/PInvoke/NetApi32/DavClnt.cs @@ -77,8 +77,8 @@ namespace Vanara.PInvoke // pCallbackCred, AUTHNEXTSTEP *NextStep, PFNDAVAUTHCALLBACK_FREECRED *pFreeCred ) {...} [PInvokeData("davclnt.h", MSDNShortId = "6ac191ac-e63f-431f-893b-92c69320db58")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] - public delegate Win32Error PFNDAVAUTHCALLBACK(string lpwzServerName, string lpwzRemoteName, DAV_AUTHN_SCHEME dwAuthScheme, uint dwFlags, - ref DAV_CALLBACK_CRED pCallbackCred, ref AUTHNEXTSTEP NextStep, out PFNDAVAUTHCALLBACK_FREECRED pFreeCred); + public delegate Win32Error DavAuthCallback(string lpwzServerName, string lpwzRemoteName, DAV_AUTHN_SCHEME dwAuthScheme, uint dwFlags, + ref DAV_CALLBACK_CRED pCallbackCred, ref AUTHNEXTSTEP NextStep, out DavFreeCredCallback pFreeCred); /// /// @@ -108,7 +108,7 @@ namespace Vanara.PInvoke // PfndavauthcallbackFreecred; DWORD PfndavauthcallbackFreecred( PVOID pbuffer ) {...} [PInvokeData("davclnt.h", MSDNShortId = "96bacda5-8f24-4119-b0ae-82ff8aff54b4")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] - public delegate Win32Error PFNDAVAUTHCALLBACK_FREECRED(IntPtr pbuffer); + public delegate Win32Error DavFreeCredCallback(IntPtr pbuffer); /// /// Specifies the next action that the WebDAV client should take after a successful call to the DavAuthCallback callback function. @@ -576,7 +576,7 @@ namespace Vanara.PInvoke // DavRegisterAuthCallback( PFNDAVAUTHCALLBACK CallBack, ULONG Version ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("davclnt.h", MSDNShortId = "7b381929-174f-4b7b-aa22-dc7a2c3e3b4d")] - public static extern uint DavRegisterAuthCallback(PFNDAVAUTHCALLBACK CallBack, uint Version); + public static extern uint DavRegisterAuthCallback(DavAuthCallback CallBack, uint Version); /// Unregisters a registered callback function that the WebDAV client uses to prompt the user for credentials. /// The opaque handle that was returned by the DavRegisterAuthCallback function. diff --git a/PInvoke/Security/AdvApi32/PerfLib.cs b/PInvoke/Security/AdvApi32/PerfLib.cs index 5e81dfab..0303e8d4 100644 --- a/PInvoke/Security/AdvApi32/PerfLib.cs +++ b/PInvoke/Security/AdvApi32/PerfLib.cs @@ -96,7 +96,7 @@ namespace Vanara.PInvoke // Perflibrequest( IN ULONG RequestCode, IN PVOID Buffer, IN ULONG BufferSize ) {...} [PInvokeData("perflib.h", MSDNShortId = "0f771ab7-af42-481b-b2da-20dcdf49b82b")] [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate NTStatus Perflibrequest([In] uint RequestCode, [In] IntPtr Buffer, [In] uint BufferSize); + public delegate NTStatus ControlCallback([In] uint RequestCode, [In] IntPtr Buffer, [In] uint BufferSize); /// /// @@ -122,7 +122,7 @@ namespace Vanara.PInvoke // PerfMemAlloc( IN SIZE_T AllocSize, IN LPVOID pContext ) {...} [PInvokeData("perflib.h", MSDNShortId = "09af7e56-2174-4a82-b45b-59f4180e4aab")] [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate IntPtr PerfMemAlloc([In] SizeT AllocSize, [In] IntPtr pContext); + public delegate IntPtr AllocateMemory([In] SizeT AllocSize, [In] IntPtr pContext); /// /// @@ -147,7 +147,7 @@ namespace Vanara.PInvoke // IN LPVOID pBuffer, IN LPVOID pContext ) {...} [PInvokeData("perflib.h", MSDNShortId = "3b2f9f68-131a-4e17-8b43-6c3a20871dad")] [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate void PerfMemFree([In] IntPtr pBuffer, [In] IntPtr pContext); + public delegate void FreeMemory([In] IntPtr pBuffer, [In] IntPtr pContext); /// /// Indicates the content type of a PERF_COUNTER_HEADER block that the PerfQueryCounterData function includes as part of the @@ -1285,7 +1285,7 @@ namespace Vanara.PInvoke // ProviderGuid, PERFLIBREQUEST ControlCallback, HANDLE *phProvider ); [DllImport(Lib.AdvApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("perflib.h", MSDNShortId = "b417b19b-adbc-40e3-aca1-c2cd94a79232")] - public static extern NTStatus PerfStartProvider(in Guid ProviderGuid, Perflibrequest ControlCallback, out SafeHPERFPROV phProvider); + public static extern NTStatus PerfStartProvider(in Guid ProviderGuid, ControlCallback ControlCallback, out SafeHPERFPROV phProvider); /// Registers the provider. /// @@ -2346,21 +2346,21 @@ namespace Vanara.PInvoke /// used the -NotificationCallback argument when calling CTRPP. Otherwise, NULL. /// [MarshalAs(UnmanagedType.FunctionPtr)] - public Perflibrequest ControlCallback; + public ControlCallback ControlCallback; /// /// The name of the AllocateMemory function that PERFLIB calls to allocate memory. Set this member if you used the /// -MemoryRoutines argument when calling CTRPP. Otherwise, NULL. /// [MarshalAs(UnmanagedType.FunctionPtr)] - public PerfMemAlloc MemAllocRoutine; + public AllocateMemory MemAllocRoutine; /// /// The name of the FreeMemory function that PERFLIB calls to free memory allocated by the AllocateMemory function. Must be /// NULL if MemAllocRoutine is NULL. /// [MarshalAs(UnmanagedType.FunctionPtr)] - public PerfMemFree MemFreeRoutine; + public FreeMemory MemFreeRoutine; /// Context information passed to the memory allocation and free routines. Can be NULL. public IntPtr pMemContext; diff --git a/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs b/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs index 7ae98fac..cce8fae1 100644 --- a/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs +++ b/PInvoke/Shell32/ShObjIdl.IShellPropSheetExt.cs @@ -14,7 +14,7 @@ namespace Vanara.PInvoke /// [PInvokeData("Shobjidl.h")] [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate bool LPFNSVADDPROPSHEETPAGE(IntPtr hPropSheetPage, IntPtr lParam); + public delegate bool LPFNSVADDPROPSHEETPAGE(HPROPSHEETPAGE hPropSheetPage, IntPtr lParam); /// Used by IShellPropSheetExt::ReplacePage. [PInvokeData("Shobjidl.h")] diff --git a/PInvoke/ShlwApi/Shlwapi.cs b/PInvoke/ShlwApi/Shlwapi.cs index b5af4803..0bc27a42 100644 --- a/PInvoke/ShlwApi/Shlwapi.cs +++ b/PInvoke/ShlwApi/Shlwapi.cs @@ -12,20 +12,6 @@ namespace Vanara.PInvoke /// Exposes interfaces, functions and structures defined in shlwapi.dll. public static partial class ShlwApi { - /// - /// Points to a function that notifies the host that a thread has started to execute. - /// - /// - /// - /// The function to which LPTHREAD_START_ROUTINE points is a callback function and must be implemented by the writer of the - /// hosting application. - /// - /// - // https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-3.5/aa964928(v=vs.90) - [PInvokeData("Processthreadsapi.h")] - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate uint LPTHREAD_START_ROUTINE([In] IntPtr lpParameter); - /// /// Used by IQueryAssociations::GetData to define the type of data that is to be returned. /// @@ -2675,7 +2661,7 @@ namespace Vanara.PInvoke [DllImport(Lib.Shlwapi, SetLastError = true, ExactSpelling = true)] [PInvokeData("shlwapi.h", MSDNShortId = "2140e396-29cd-4665-b684-337170570b73")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, IntPtr pData, SHCT_FLAGS flags, LPTHREAD_START_ROUTINE pfnCallback); + public static extern bool SHCreateThread(ThreadProc pfnThreadProc, IntPtr pData, SHCT_FLAGS flags, ThreadProc pfnCallback); /// /// Creates a per-thread reference to a Component Object Model (COM) object. @@ -2770,7 +2756,7 @@ namespace Vanara.PInvoke [DllImport(Lib.Shlwapi, SetLastError = true, ExactSpelling = true)] [PInvokeData("shlwapi.h", MSDNShortId = "22a3a97a-857f-46b8-a2e0-8f3a14f40322")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SHCreateThreadWithHandle(LPTHREAD_START_ROUTINE pfnThreadProc, IntPtr pData, SHCT_FLAGS flags, LPTHREAD_START_ROUTINE pfnCallback, out SafeHFILE pHandle); + public static extern bool SHCreateThreadWithHandle(ThreadProc pfnThreadProc, IntPtr pData, SHCT_FLAGS flags, ThreadProc pfnCallback, out SafeHFILE pHandle); /// /// Deletes an empty key. diff --git a/PInvoke/User32.Gdi/WinUser.Desktop.cs b/PInvoke/User32.Gdi/WinUser.Desktop.cs index ae2d0a77..25f8543b 100644 --- a/PInvoke/User32.Gdi/WinUser.Desktop.cs +++ b/PInvoke/User32.Gdi/WinUser.Desktop.cs @@ -520,7 +520,7 @@ namespace Vanara.PInvoke [DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)] [PInvokeData("winuser.h", MSDNShortId = "b399ff19-e2e5-4509-8bb5-9647734881b3")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumDesktopWindows(HDESK hDesktop, WNDENUMPROC lpfn, IntPtr lParam); + public static extern bool EnumDesktopWindows(HDESK hDesktop, EnumWindowsProc lpfn, IntPtr lParam); /// /// diff --git a/PInvoke/User32.Gdi/WinUser.Window.cs b/PInvoke/User32.Gdi/WinUser.Window.cs index a26cda4f..32008b1b 100644 --- a/PInvoke/User32.Gdi/WinUser.Window.cs +++ b/PInvoke/User32.Gdi/WinUser.Window.cs @@ -10,6 +10,53 @@ namespace Vanara.PInvoke public const int CCHILDREN_SCROLLBAR = 5; public const int CCHILDREN_TITLEBAR = 5; + /// + /// An application-defined callback function used with the EnumChildWindows function. It receives the child window handles. + /// The WNDENUMPROC type defines a pointer to this callback function. EnumChildProc is a placeholder for the + /// application-defined function name. + /// + /// A handle to a child window of the parent window specified in EnumChildWindows. + /// The application-defined value given in EnumChildWindows. + /// To continue enumeration, the callback function must return TRUE; to stop enumeration, it must return FALSE. + // BOOL CALLBACK EnumChildProc( _In_ HWND hwnd, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/ms633493(v=vs.85).aspx + [PInvokeData("Winuser.h", MSDNShortId = "ms633493")] + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [return: MarshalAs(UnmanagedType.Bool)] + public delegate bool EnumWindowsProc([In] HWND hwnd, [In] IntPtr lParam); + + /// + /// + /// An application-defined function that processes messages sent to a window. The WNDPROC type defines a pointer to this + /// callback function. + /// + /// WindowProc is a placeholder for the application-defined function name. + /// + /// + /// Type: HWND + /// A handle to the window. + /// + /// + /// Type: UINT + /// The message. + /// For lists of the system-provided messages, see System-Defined Messages. + /// + /// + /// Type: WPARAM + /// Additional message information. The contents of this parameter depend on the value of the uMsg parameter. + /// + /// + /// Type: LPARAM + /// Additional message information. The contents of this parameter depend on the value of the uMsg parameter. + /// + /// + /// Type: + /// The return value is the result of the message processing and depends on the message sent. + /// + // LRESULT CALLBACK WindowProc( _In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/ms633573(v=vs.85).aspx + [PInvokeData("Winuser.h", MSDNShortId = "ms633573")] + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + public delegate IntPtr WindowProc([In] HWND hwnd, [In] uint uMsg, [In] IntPtr wParam, [In] IntPtr lParam); + /// /// The user-provided entry point for a graphical Windows-based application. /// WinMain is the conventional name used for the application entry point. For more information, see Remarks. @@ -113,53 +160,6 @@ namespace Vanara.PInvoke [PInvokeData("Winbase.h", MSDNShortId = "ms633559")] public delegate int WinMain([In] HINSTANCE hInstance, [In] HINSTANCE hPrevInstance, [In] [MarshalAs(UnmanagedType.LPStr)] string lpCmdLine, [In] ShowWindowCommand nCmdShow); - /// - /// An application-defined callback function used with the EnumChildWindows function. It receives the child window handles. - /// The WNDENUMPROC type defines a pointer to this callback function. EnumChildProc is a placeholder for the - /// application-defined function name. - /// - /// A handle to a child window of the parent window specified in EnumChildWindows. - /// The application-defined value given in EnumChildWindows. - /// To continue enumeration, the callback function must return TRUE; to stop enumeration, it must return FALSE. - // BOOL CALLBACK EnumChildProc( _In_ HWND hwnd, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/ms633493(v=vs.85).aspx - [PInvokeData("Winuser.h", MSDNShortId = "ms633493")] - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - [return: MarshalAs(UnmanagedType.Bool)] - public delegate bool WNDENUMPROC([In] HWND hwnd, [In] IntPtr lParam); - - /// - /// - /// An application-defined function that processes messages sent to a window. The WNDPROC type defines a pointer to this - /// callback function. - /// - /// WindowProc is a placeholder for the application-defined function name. - /// - /// - /// Type: HWND - /// A handle to the window. - /// - /// - /// Type: UINT - /// The message. - /// For lists of the system-provided messages, see System-Defined Messages. - /// - /// - /// Type: WPARAM - /// Additional message information. The contents of this parameter depend on the value of the uMsg parameter. - /// - /// - /// Type: LPARAM - /// Additional message information. The contents of this parameter depend on the value of the uMsg parameter. - /// - /// - /// Type: - /// The return value is the result of the message processing and depends on the message sent. - /// - // LRESULT CALLBACK WindowProc( _In_ HWND hwnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/ms633573(v=vs.85).aspx - [PInvokeData("Winuser.h", MSDNShortId = "ms633573")] - [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate IntPtr WNDPROC([In] HWND hwnd, [In] uint uMsg, [In] IntPtr wParam, [In] IntPtr lParam); - /// /// The type of animation. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, /// use AW_HIDE and a logical OR operator with the appropriate flags. @@ -1589,7 +1589,7 @@ namespace Vanara.PInvoke // lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam ); [DllImport(Lib.User32, SetLastError = false, CharSet = CharSet.Auto)] [PInvokeData("winuser.h", MSDNShortId = "")] - public static extern IntPtr CallWindowProc(WNDPROC lpPrevWndFunc, HWND hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + public static extern IntPtr CallWindowProc(WindowProc lpPrevWndFunc, HWND hWnd, uint Msg, IntPtr wParam, IntPtr lParam); /// /// Cascades the specified child windows of the specified parent window. @@ -2825,7 +2825,7 @@ namespace Vanara.PInvoke [DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)] [PInvokeData("winuser.h", MSDNShortId = "enumchildwindows")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumChildWindows(HWND hWndParent, WNDENUMPROC lpEnumFunc, IntPtr lParam); + public static extern bool EnumChildWindows(HWND hWndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam); /// /// @@ -2859,7 +2859,7 @@ namespace Vanara.PInvoke [DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)] [PInvokeData("winuser.h", MSDNShortId = "enumthreadwindows")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumThreadWindows(uint dwThreadId, WNDENUMPROC lpfn, IntPtr lParam); + public static extern bool EnumThreadWindows(uint dwThreadId, EnumWindowsProc lpfn, IntPtr lParam); /// /// @@ -2900,7 +2900,7 @@ namespace Vanara.PInvoke [DllImport(Lib.User32, SetLastError = true, ExactSpelling = true)] [PInvokeData("winuser.h", MSDNShortId = "enumwindows")] [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumWindows(WNDENUMPROC lpEnumFunc, IntPtr lParam); + public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam); /// /// @@ -8209,7 +8209,7 @@ namespace Vanara.PInvoke /// information, see WindowProc. /// /// - public WNDPROC lpfnWndProc; + public WindowProc lpfnWndProc; /// /// Type: int @@ -8392,7 +8392,7 @@ namespace Vanara.PInvoke /// information, see WindowProc. /// /// - public WNDPROC lpfnWndProc; + public WindowProc lpfnWndProc; /// /// Type: int diff --git a/PInvoke/User32/WinUser.Hook.cs b/PInvoke/User32/WinUser.Hook.cs index 9e5d1371..757b5a8f 100644 --- a/PInvoke/User32/WinUser.Hook.cs +++ b/PInvoke/User32/WinUser.Hook.cs @@ -75,7 +75,7 @@ namespace Vanara.PInvoke // HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD idEventThread, DWORD dwmsEventTime ) {...} [PInvokeData("winuser.h", MSDNShortId = "5fe3cacc-4563-43da-960d-729d3fe4ff70")] [UnmanagedFunctionPointer(CallingConvention.Winapi)] - public delegate void WINEVENTPROC(HWINEVENTHOOK hWinEventHook, uint winEvent, HWND hwnd, int idObject, int idChild, uint idEventThread, uint dwmsEventTime); + public delegate void WinEventProc(HWINEVENTHOOK hWinEventHook, uint winEvent, HWND hwnd, int idObject, int idChild, uint idEventThread, uint dwmsEventTime); /// The type of hook procedure to be installed. [PInvokeData("WinUser.h", MSDNShortId = "ms644990")] @@ -762,7 +762,7 @@ namespace Vanara.PInvoke // eventMin, DWORD eventMax, HMODULE hmodWinEventProc, WINEVENTPROC pfnWinEventProc, DWORD idProcess, DWORD idThread, DWORD dwFlags ); [DllImport(Lib.User32, SetLastError = false, ExactSpelling = true)] [PInvokeData("winuser.h", MSDNShortId = "090bda1b-0635-4aa3-ae33-3987b36e30b8")] - public static extern HWINEVENTHOOK SetWinEventHook(uint eventMin, uint eventMax, HINSTANCE hmodWinEventProc, WINEVENTPROC pfnWinEventProc, uint idProcess, uint idThread, WINEVENT dwFlags); + public static extern HWINEVENTHOOK SetWinEventHook(uint eventMin, uint eventMax, HINSTANCE hmodWinEventProc, WinEventProc pfnWinEventProc, uint idProcess, uint idThread, WINEVENT dwFlags); /// /// Removes a hook procedure installed in a hook chain by the SetWindowsHookEx function. diff --git a/PInvoke/WinINet/WinINet.cs b/PInvoke/WinINet/WinINet.cs index ca12e7b1..331720bb 100644 --- a/PInvoke/WinINet/WinINet.cs +++ b/PInvoke/WinINet/WinINet.cs @@ -35,7 +35,7 @@ namespace Vanara.PInvoke /// DWORD that contains one or more of the flags. /// /// The size, in bytes, of the data pointed to by lpvStatusInformation. - public delegate void INTERNET_STATUS_CALLBACK([In] IntPtr hInternet, [In, Optional] IntPtr dwContext, [In] InternetStatus dwInternetStatus, [In, Optional] IntPtr lpvStatusInformation, [In] uint dwStatusInformationLength); + public delegate void InternetStatusCallback([In] IntPtr hInternet, [In, Optional] IntPtr dwContext, [In] InternetStatus dwInternetStatus, [In, Optional] IntPtr lpvStatusInformation, [In] uint dwStatusInformationLength); /// Flags used by . [Flags] @@ -433,7 +433,7 @@ namespace Vanara.PInvoke /// Sets or retrieves the address of the callback function defined for this handle. This option can be used on all HINTERNET /// handles. Used by InternetQueryOption and InternetSetOption. /// - [CorrespondingType(typeof(INTERNET_STATUS_CALLBACK))] + [CorrespondingType(typeof(InternetStatusCallback))] INTERNET_OPTION_CALLBACK = 1, /// Not implemented. @@ -1258,7 +1258,7 @@ namespace Vanara.PInvoke INTERNET_SERVICE_HTTP = 3 } - /// Values passed using the delegate. + /// Values passed using the delegate. [Flags] public enum InternetState { @@ -1278,7 +1278,7 @@ namespace Vanara.PInvoke INTERNET_STATE_BUSY = 0x200, } - /// Values passed using the delegate. + /// Values passed using the delegate. public enum InternetStatus { /// Closing the connection to the server. The lpvStatusInformation parameter is NULL. @@ -1568,7 +1568,7 @@ namespace Vanara.PInvoke /// function, or INTERNET_INVALID_STATUS_CALLBACK if the callback function is not valid. /// [DllImport(Lib.WinInet, ExactSpelling = true, SetLastError = true)] - public static extern IntPtr InternetSetStatusCallback(SafeInternetHandle hInternet, INTERNET_STATUS_CALLBACK lpfnInternetCallback); + public static extern IntPtr InternetSetStatusCallback(SafeInternetHandle hInternet, InternetStatusCallback lpfnInternetCallback); [DllImport("inetcpl.cpl", SetLastError = true)] private static extern int LaunchInternetControlPanel(HWND hWnd); diff --git a/PInvoke/Ws2_32/WinSock2.cs b/PInvoke/Ws2_32/WinSock2.cs index 1427b9f7..ca29f44f 100644 --- a/PInvoke/Ws2_32/WinSock2.cs +++ b/PInvoke/Ws2_32/WinSock2.cs @@ -78,7 +78,7 @@ namespace Vanara.PInvoke /// [PInvokeData("winsock2.h", MSDNShortId = "f385f63f-49b2-4eb7-8717-ad4cca1a2252")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] - public delegate CF LPCONDITIONPROC(in WSABUF lpCallerId, in WSABUF lpCallerData, IntPtr lpSQOS, IntPtr lpGQOS, in WSABUF lpCalleeId, in WSABUF lpCalleeData, out GROUP g, IntPtr dwCallbackData); + public delegate CF ConditionFunc(in WSABUF lpCallerId, in WSABUF lpCallerData, IntPtr lpSQOS, IntPtr lpGQOS, in WSABUF lpCalleeId, in WSABUF lpCalleeData, out GROUP g, IntPtr dwCallbackData); [PInvokeData("winsock2.h")] public enum ADDRESS_FAMILY : ushort @@ -2607,7 +2607,7 @@ namespace Vanara.PInvoke // *addr, LPINT addrlen, LPCONDITIONPROC lpfnCondition, DWORD_PTR dwCallbackData ); [DllImport(Lib.Ws2_32, SetLastError = true, ExactSpelling = true)] [PInvokeData("winsock2.h", MSDNShortId = "f385f63f-49b2-4eb7-8717-ad4cca1a2252")] - public static extern SOCKET WSAAccept(SOCKET s, SOCKADDR addr, ref int addrlen, [In, Out, Optional] LPCONDITIONPROC lpfnCondition, [In, Out, Optional] IntPtr dwCallbackData); + public static extern SOCKET WSAAccept(SOCKET s, SOCKADDR addr, ref int addrlen, [In, Out, Optional] ConditionFunc lpfnCondition, [In, Out, Optional] IntPtr dwCallbackData); /// ///