• <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 小明 閱讀(3285) 評論(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
            久久久久噜噜噜亚洲熟女综合| 女同久久| 国内精品久久久久久99| 99精品久久精品一区二区| 久久久精品一区二区三区| 久久国产免费| 久久久久久久久无码精品亚洲日韩 | 大伊人青草狠狠久久| 国产精品99久久久久久www| 性高湖久久久久久久久AAAAA| 久久精品国产亚洲AV影院| 99久久国语露脸精品国产| 久久国产精品免费一区二区三区| 一级做a爰片久久毛片看看| 99久久精品日本一区二区免费| 久久精品成人免费观看97| 久久亚洲精品中文字幕| 国产精品热久久毛片| 日韩久久久久久中文人妻| 性做久久久久久久久久久| 99久久婷婷国产综合精品草原| 精品国产乱码久久久久久呢| 99久久久久| 一本一道久久精品综合 | 精品久久久久久无码专区不卡| 激情久久久久久久久久| 97久久超碰成人精品网站| 无码任你躁久久久久久老妇App| 国产免费福利体检区久久| 97久久香蕉国产线看观看| 色偷偷偷久久伊人大杳蕉| 色青青草原桃花久久综合| 久久久久亚洲AV综合波多野结衣 | 久久97精品久久久久久久不卡| 思思久久精品在热线热| 无夜精品久久久久久| 久久香蕉国产线看观看猫咪?v| 91精品国产91热久久久久福利| 91精品国产91久久综合| 99国产精品久久| 国产福利电影一区二区三区久久老子无码午夜伦不 |