コード例 #1
0
        public static void Initialize()
        {
            var baseHandler = Kernel32.AddVectoredExceptionHandler(IntPtr.Zero, BaseHandler);

            if (baseHandler == IntPtr.Zero)
            {
                throw new Win32Exception("AddVectoredExceptionHandler failed");
            }

            var size = 32768;

            if (!Kernel32.SetThreadStackGuarantee(&size))
            {
                throw new InsufficientExecutionStackException("SetThreadStackGuarantee failed", new Win32Exception());
            }

            if (Msvcrt._resetstkoflw() == 0)
            {
                throw new InvalidOperationException("_resetstkoflw failed");
            }
        }