• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            小明思考

            高性能服務器端計算
            posts - 70, comments - 428, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            When program crashed (windows)

            Posted on 2008-11-17 13:54 小明 閱讀(3293) 評論(0)  編輯 收藏 引用 所屬分類: Win32Debug
            天下沒有不crash的程序。

            Crash作為一個客觀存在的現實,每個程序員都應該意識到這個問題,才能最大限度的降低crash所帶來的危害。

            讓我們先來看看幾種死亡對話框


            Figure-1 Crash MessageBox in Windows 2000


            Figure-2 Crash MessageBox in Windows XP

            讓我們看看哪些因素影響程序Crash的時候的行為

            1 . Error Mode

            --cut from microsoft--
            Each process has an associated error mode that indicates to the system how the application is going to respond to serious errors. Serious errors include disk failure, drive-not-ready errors, data misalignment, and unhandled exceptions. An application can let the system display a message box informing the user that an error has occurred, or it can handle the errors. To handle these errors without user intervention, use the SetErrorMode function. After calling SetErrorMode and specifying appropriate flags, the system will not display the corresponding error message boxes.
            --cut from microsoft--

            也就是說我們可以調用來SetErrorMode(SEM_NOGPFAULTERRORBOX)來屏蔽掉"Death MessageBox"的出現。

            具體的API使用參考http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx

            另外值得一提的一點是,父子進程默認使用相同的ErrorMode,但是你可以在CreateProcess通過指定CREATE_DEFAULT_ERROR_MODE來disable.

            2.注冊表中的HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug

            有兩個key,第一個是auto,指定程序crash的時候要不要自動的load debugger
            如果為1,就不會顯示"Death MessageBox"而直接調用debugger了

            另外一個是debugger,指定默認的debugger.


            最后上傳一個測試程序來體會一下

            Click here to download TestCrash
            久久精品国产精品亚洲人人| 国产午夜精品久久久久九九| 久久久久久久97| 中文字幕久久久久人妻| 久久男人Av资源网站无码软件| 久久精品亚洲中文字幕无码麻豆 | 久久久久成人精品无码| 手机看片久久高清国产日韩| 乱亲女H秽乱长久久久| 久久露脸国产精品| 少妇高潮惨叫久久久久久| 精品久久综合1区2区3区激情| 一本一道久久综合狠狠老| 国产精品欧美亚洲韩国日本久久 | 91亚洲国产成人久久精品网址| 久久精品国产精品亚洲| 777米奇久久最新地址| 国产成人无码精品久久久免费| 深夜久久AAAAA级毛片免费看| 国内精品久久久久| 亚洲va中文字幕无码久久不卡| 国产三级精品久久| 久久精品国产99国产精品澳门 | 精品综合久久久久久97超人 | 四虎亚洲国产成人久久精品| 久久久综合九色合综国产| 久久久久人妻一区二区三区vr | 97久久国产亚洲精品超碰热 | 免费一级欧美大片久久网| 久久精品国产只有精品2020| 久久久久成人精品无码中文字幕| 久久亚洲AV无码西西人体| 久久最近最新中文字幕大全| 国产精品久久亚洲不卡动漫| 国产高潮国产高潮久久久| 日韩精品无码久久久久久| 新狼窝色AV性久久久久久| 漂亮人妻被中出中文字幕久久| 国产成人精品久久| 久久夜色撩人精品国产| 亚洲国产精品综合久久网络 |