// This Source Code is partially based on reverse engineering of the Windows Operating System, // and is intended for use on Windows systems only. // This Source Code is partially based on the source code provided by the .NET Foundation. // // NOTE: // I split unmanaged code stuff into the NativeMethods library. // If you have suggestions for the code below, please submit your changes there. // https://github.com/lepoco/nativemethods // ReSharper disable IdentifierTypo // ReSharper disable InconsistentNaming using System.Runtime.InteropServices; #pragma warning disable CA1060 // Move pinvokes to native methods class namespace WPFluent.Interop; /// /// Used by multiple technologies. /// internal class Kernel32 { /// /// Retrieves the calling thread's last-error code value. The last-error code is maintained on a per-thread basis. /// Multiple threads do not overwrite each other's last-error code. /// /// The return value is the calling thread's last-error code. [DllImport(Libraries.Kernel32)] public static extern int GetLastError(); /// /// Determines whether the calling process is being debugged by a user-mode debugger. /// /// If the current process is running in the context of a debugger, the return value is nonzero. [DllImport(Libraries.Kernel32, ExactSpelling = true, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsDebuggerPresent(); /// /// Sets the last-error code for the calling thread. /// /// The last-error code for the thread. [DllImport(Libraries.Kernel32, ExactSpelling = true, CharSet = CharSet.Auto)] public static extern void SetLastError([In] int dwErrorCode); } #pragma warning restore CA1060 // Move pinvokes to native methods class