spdebug.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:24k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /*******************************************************************************
  2. * SPDebug.h *
  3. *-----------*
  4. *   Description:
  5. *       This header file contains debug output services for SAPI5
  6. *-------------------------------------------------------------------------------
  7. *   Copyright (c) Microsoft Corporation. All rights reserved.
  8. *******************************************************************************/
  9. #pragma once
  10. #include <TCHAR.h>
  11. #include <crtdbg.h>
  12. #ifdef ASSERT_WITH_STACK
  13. #include "AssertWithStack.h"
  14. #endif
  15. const TCHAR g_szSpDebugKey[] = _T("SPDebug");
  16. const TCHAR g_szSpDebugFuncTraceReportMode[] = _T("FuncTraceMode");
  17. const TCHAR g_szSpDebugFuncTraceReportFile[] = _T("FuncTraceFile");
  18. const TCHAR g_szSpDebugParamInfoReportMode[] = _T("ParamInfoMode");
  19. const TCHAR g_szSpDebugParamInfoReportFile[] = _T("ParamInfoFile");
  20. const TCHAR g_szSpDebugDumpInfoReportMode[] = _T("DumpInfoMode");
  21. const TCHAR g_szSpDebugDumpInfoReportFile[] = _T("DumpInfoFile");
  22. const TCHAR g_szSpDebugAssertReportMode[] = _T("AssertMode");
  23. const TCHAR g_szSpDebugAssertReportFile[] = _T("AssertFile");
  24. const TCHAR g_szSpDebugHRFailReportMode[] = _T("HRFailMode");
  25. const TCHAR g_szSpDebugHRFailReportFile[] = _T("HRFailFile");
  26. const TCHAR g_szSpDebugAssertSettingsReReadEachTime[] = _T("AssertSettingsReReadEachTime");
  27. const TCHAR g_szSpDebugServerOnStart[] = _T("DebugServerOnStart");
  28. const TCHAR g_szSpDebugClientOnStart[] = _T("DebugClientOnStart");
  29. const TCHAR g_szSpDebugLog[] = _T("c:\spdebug.log");
  30. #ifdef _DEBUG
  31. class CSpDebug
  32. {
  33. public:
  34.     
  35.     CSpDebug()
  36.     {
  37.         m_mutex = NULL;
  38.         m_reportModePrev = -1;
  39.         m_hfilePrev = NULL;
  40.         Read();
  41.     }
  42.     ~CSpDebug()
  43.     {
  44.         if (m_mutex != NULL)
  45.         {
  46.             CloseHandle(m_mutex);
  47.         }
  48.     }
  49.  
  50.     BOOL FuncTrace(BOOL fEnter = TRUE)
  51.     {
  52.         return fEnter
  53.             ? Enter(_CRT_WARN, m_FuncTraceMode, m_szFuncTraceFile)
  54.             : Leave();
  55.     }
  56.     
  57.     BOOL ParamInfo(BOOL fEnter = TRUE)
  58.     {
  59.         return fEnter
  60.             ? Enter(_CRT_WARN, m_ParamInfoMode, m_szParamInfoFile)
  61.             : Leave();
  62.     }
  63.     
  64.     BOOL DumpInfo(BOOL fEnter = TRUE)
  65.     {
  66.         return fEnter
  67.             ? Enter(_CRT_WARN, m_DumpInfoMode, m_szDumpInfoFile)
  68.             : Leave();
  69.     }
  70.     
  71.     BOOL Assert(BOOL fEnter = TRUE)
  72.     {
  73.         if (m_fAssertSettingsReReadEachTime)
  74.             Read();
  75.         return fEnter
  76.             ? Enter(_CRT_ASSERT, m_AssertMode, m_szAssertFile)
  77.             : Leave();
  78.     }
  79.     
  80.     BOOL HRFail(BOOL fEnter = TRUE)
  81.     {
  82.         return fEnter
  83.             ? Enter(_CRT_WARN, m_HRFailMode, m_szHRFailFile)
  84.             : Leave();
  85.     }
  86.     
  87.     BOOL DebugServerOnStart()
  88.     {
  89.         return m_fDebugServerOnStart;
  90.     }
  91.     
  92.     BOOL DebugClientOnStart()
  93.     {
  94.         return m_fDebugClientOnStart;
  95.     }
  96.     
  97. private:
  98.     void Read()
  99.     {
  100.         HKEY hkeyDebug;
  101.         RegCreateKeyEx(
  102.             HKEY_CLASSES_ROOT, 
  103.             g_szSpDebugKey, 
  104.             0, 
  105.             NULL, 
  106.             0,
  107.             KEY_READ | KEY_WRITE, 
  108.             NULL, 
  109.             &hkeyDebug, 
  110.             NULL);
  111.         if (hkeyDebug == NULL)
  112.         {
  113.             RegCreateKeyEx(
  114.                 HKEY_CLASSES_ROOT, 
  115.                 g_szSpDebugKey, 
  116.                 0, 
  117.                 NULL, 
  118.                 0,
  119.                 KEY_READ,
  120.                 NULL, 
  121.                 &hkeyDebug, 
  122.                 NULL);
  123.         }
  124.         
  125.         DWORD dw = sizeof(m_fAssertSettingsReReadEachTime);
  126.         if (RegQueryValueEx(
  127.                 hkeyDebug,
  128.                 g_szSpDebugAssertSettingsReReadEachTime,
  129.                 NULL,
  130.                 NULL,
  131.                 LPBYTE(&m_fAssertSettingsReReadEachTime),
  132.                 &dw) != ERROR_SUCCESS)
  133.         {
  134.             m_fAssertSettingsReReadEachTime = FALSE;
  135.             RegSetValueEx(
  136.                 hkeyDebug,
  137.                 g_szSpDebugAssertSettingsReReadEachTime,
  138.                 NULL,
  139.                 REG_DWORD,
  140.                 LPBYTE(&m_fAssertSettingsReReadEachTime),
  141.                 sizeof(m_fAssertSettingsReReadEachTime));
  142.         }
  143.             
  144.         ReadFor(
  145.             hkeyDebug, 
  146.             g_szSpDebugFuncTraceReportMode,
  147.             g_szSpDebugFuncTraceReportFile, 
  148.             &m_FuncTraceMode, 
  149.             m_szFuncTraceFile, 
  150.             0, 
  151.             g_szSpDebugLog);
  152.         ReadFor(
  153.             hkeyDebug, 
  154.             g_szSpDebugParamInfoReportMode, 
  155.             g_szSpDebugParamInfoReportFile, 
  156.             &m_ParamInfoMode, 
  157.             m_szParamInfoFile, 
  158.             0, 
  159.             g_szSpDebugLog);
  160.         ReadFor(
  161.             hkeyDebug, 
  162.             g_szSpDebugDumpInfoReportMode, 
  163.             g_szSpDebugDumpInfoReportFile, 
  164.             &m_DumpInfoMode, 
  165.             m_szDumpInfoFile, 
  166.             _CRTDBG_MODE_DEBUG, 
  167.             g_szSpDebugLog);
  168.         ReadFor(
  169.             hkeyDebug, 
  170.             g_szSpDebugAssertReportMode, 
  171.             g_szSpDebugAssertReportFile, 
  172.             &m_AssertMode, 
  173.             m_szAssertFile, 
  174.             _CRTDBG_MODE_WNDW,
  175.             g_szSpDebugLog);
  176.         ReadFor(
  177.             hkeyDebug, 
  178.             g_szSpDebugHRFailReportMode,
  179.             g_szSpDebugHRFailReportFile, 
  180.             &m_HRFailMode, 
  181.             m_szHRFailFile, 
  182.             _CRTDBG_MODE_DEBUG,
  183.             g_szSpDebugLog);
  184.         
  185.         dw = sizeof(m_fDebugServerOnStart);
  186.         if (RegQueryValueEx(
  187.                 hkeyDebug,
  188.                 g_szSpDebugServerOnStart,
  189.                 NULL,
  190.                 NULL,
  191.                 LPBYTE(&m_fDebugServerOnStart),
  192.                 &dw) != ERROR_SUCCESS)
  193.         {
  194.             m_fDebugServerOnStart = FALSE;
  195.             RegSetValueEx(
  196.                 hkeyDebug,
  197.                 g_szSpDebugServerOnStart,
  198.                 NULL,
  199.                 REG_DWORD,
  200.                 LPBYTE(&m_fDebugServerOnStart),
  201.                 sizeof(m_fDebugServerOnStart));
  202.         }
  203.             
  204.         dw = sizeof(m_fDebugClientOnStart);
  205.         if (RegQueryValueEx(
  206.                 hkeyDebug,
  207.                 g_szSpDebugClientOnStart,
  208.                 NULL,
  209.                 NULL,
  210.                 LPBYTE(&m_fDebugClientOnStart),
  211.                 &dw) != ERROR_SUCCESS)
  212.         {
  213.             m_fDebugClientOnStart = FALSE;
  214.             RegSetValueEx(
  215.                 hkeyDebug,
  216.                 g_szSpDebugClientOnStart,
  217.                 NULL,
  218.                 REG_DWORD,
  219.                 LPBYTE(&m_fDebugClientOnStart),
  220.                 sizeof(m_fDebugClientOnStart));
  221.         }
  222.         
  223.         RegCloseKey(hkeyDebug);
  224.     }
  225.     void ReadFor(
  226.             HKEY hkey, 
  227.             const TCHAR * pszModeValueName, 
  228.             const TCHAR * pszFileValueName, 
  229.             DWORD * pdwModeValue,
  230.             TCHAR * pszFileValue,
  231.             DWORD dwDefaultModeValue,
  232.             const TCHAR * pszDefaultFileValue)
  233.     {
  234.         DWORD dw = sizeof(*pdwModeValue);
  235.         if (RegQueryValueEx(
  236.                 hkey,
  237.                 pszModeValueName,
  238.                 NULL,
  239.                 NULL,
  240.                 LPBYTE(pdwModeValue),
  241.                 &dw) != ERROR_SUCCESS)
  242.         {
  243.             *pdwModeValue = dwDefaultModeValue;
  244.             RegSetValueEx(
  245.                 hkey,
  246.                 pszModeValueName,
  247.                 NULL,
  248.                 REG_DWORD,
  249.                 LPBYTE(pdwModeValue),
  250.                 sizeof(*pdwModeValue));
  251.         }
  252.         
  253.         dw = MAX_PATH;
  254.         if (RegQueryValueEx(
  255.                 hkey,
  256.                 pszFileValueName,
  257.                 NULL,
  258.                 NULL,
  259.                 LPBYTE(pszFileValue),
  260.                 &dw) != ERROR_SUCCESS)
  261.         {
  262.             _tcscpy(pszFileValue, pszDefaultFileValue);
  263.             RegSetValueEx(
  264.                 hkey,
  265.                 pszFileValueName,
  266.                 NULL,
  267.                 REG_SZ,
  268.                 LPBYTE(pszFileValue),
  269.                 MAX_PATH);
  270.         }
  271.     }
  272.     BOOL Enter(int reportType, DWORD &reportMode, TCHAR * pszFile)
  273.     {
  274.         if (reportMode != 0)
  275.         {
  276.             // We'll hold the mutex, until the caller also calls Leave
  277.             if (m_mutex == NULL)
  278.             {
  279.                 m_mutex = CreateMutex(NULL, FALSE, _T("SpDebug"));
  280.             }
  281.             WaitForSingleObject(m_mutex, INFINITE);
  282.             
  283.             m_reportType = reportType;
  284.             m_reportModePrev = _CrtSetReportMode(reportType, reportMode);
  285.             if (reportMode & _CRTDBG_MODE_FILE)
  286.             {
  287.                 HANDLE hfile = CreateFile(
  288.                     pszFile, 
  289.                     GENERIC_READ | GENERIC_WRITE,
  290.                     FILE_SHARE_READ,
  291.                     NULL,
  292.                     OPEN_ALWAYS,
  293.                     0,
  294.                     NULL);
  295.                 SetFilePointer(hfile, 0, NULL, FILE_END);
  296.                 m_hfilePrev = (_HFILE)_CrtSetReportFile(reportType, (_HFILE)hfile);
  297.             }
  298.             
  299.             return TRUE;
  300.         }
  301.         return FALSE;
  302.     }
  303.     BOOL Leave()
  304.     {
  305.         int reportMode = _CrtSetReportMode(m_reportType, m_reportModePrev);
  306.         if (reportMode & _CRTDBG_MODE_FILE)
  307.         {
  308.             CloseHandle((_HFILE)_CrtSetReportFile(m_reportType, (_HFILE)m_hfilePrev));
  309.         }
  310.         
  311.         ReleaseMutex(m_mutex);
  312.         return TRUE;
  313.     }
  314.     
  315. private:
  316.     HANDLE m_mutex;
  317.     
  318.     int    m_reportType;
  319.     int    m_reportModePrev;
  320.     _HFILE m_hfilePrev;
  321.     
  322.     BOOL  m_fAssertSettingsReReadEachTime;
  323.     
  324.     DWORD m_FuncTraceMode;
  325.     TCHAR  m_szFuncTraceFile[MAX_PATH + 1];
  326.     DWORD m_ParamInfoMode;
  327.     TCHAR  m_szParamInfoFile[MAX_PATH + 1];
  328.     DWORD m_DumpInfoMode;
  329.     TCHAR  m_szDumpInfoFile[MAX_PATH + 1];
  330.     DWORD m_AssertMode;
  331.     TCHAR  m_szAssertFile[MAX_PATH + 1];
  332.     DWORD m_HRFailMode;
  333.     TCHAR  m_szHRFailFile[MAX_PATH + 1];
  334.     
  335.     BOOL m_fDebugServerOnStart;
  336.     BOOL m_fDebugClientOnStart;
  337. };
  338. inline CSpDebug *PSpDebug()
  339. {
  340.     static CSpDebug debug;
  341.     return &debug;
  342. }
  343. class CSpFuncTrace
  344. {
  345. public:
  346.   
  347.     CSpFuncTrace(PCHAR pFuncName)
  348.     {
  349.         m_pFuncName = pFuncName;
  350.         if (PSpDebug()->FuncTrace())
  351.         {
  352.             _RPT1( _CRT_WARN, "nEntering Function: %sn", m_pFuncName );
  353.             PSpDebug()->FuncTrace(FALSE);
  354.         }
  355.     }
  356.     
  357.     ~CSpFuncTrace()
  358.     {
  359.         if (PSpDebug()->FuncTrace())
  360.         {
  361.             _RPT1( _CRT_WARN, "Leaving Function: %sn", m_pFuncName );
  362.             PSpDebug()->FuncTrace(FALSE);
  363.         }
  364.     }
  365.     
  366. private:
  367.     PCHAR m_pFuncName;
  368. };
  369. #endif // _DEBUG
  370. //=== User macros ==============================================================
  371. #ifdef _DEBUG
  372. #define SPDBG_FUNC(name)            
  373.     CSpFuncTrace functrace(name)
  374. #if defined(ASSERT_WITH_STACK) && !defined(_WIN64)
  375. #define SPDBG_REPORT_ON_FAIL(hr)                                                      
  376.     do                                                                                
  377.     {                                                                                 
  378.         HRESULT _hr = (hr);                                                           
  379.         if (FAILED(_hr) && PSpDebug()->HRFail())                                      
  380.         {                                                                             
  381.             SYSTEMTIME sysTime;                                                       
  382.             GetLocalTime(&sysTime);                                                   
  383.             CHAR pszHrWithTime[100];                                                  
  384.             sprintf(pszHrWithTime, "%lXnn%d.%d.%d %02d:%02d:%02d",            
  385.                 _hr,                                                                  
  386.                 sysTime.wMonth,sysTime.wDay,sysTime.wYear,                            
  387.                 sysTime.wHour,sysTime.wMinute,sysTime.wSecond);                       
  388.             PCHAR pszStack =                                                          
  389.                 (PCHAR)_alloca(                                                       
  390.                     cchMaxAssertStackLevelStringLen *                                 
  391.                          cfrMaxAssertStackLevels + 1);                                
  392.             GetStringFromStackLevels(0, 10, pszStack);                                
  393.             _RPT4(_CRT_WARN,                                                          
  394.                 "%s(%d): Failed HR = %snn%sn",                                     
  395.                 __FILE__,                                                             
  396.                 __LINE__,                                                             
  397.                 pszHrWithTime,                                                        
  398.                 pszStack);                                                            
  399.             PSpDebug()->HRFail(FALSE);                                                
  400.         }                                                                             
  401.     } while (0)
  402. #else // ASSERT_WITH_STACK & !_WIN64
  403. #define SPDBG_REPORT_ON_FAIL(hr)                                                      
  404.     do                                                                                
  405.     {                                                                                 
  406.         HRESULT _hr = (hr);                                                           
  407.         if (FAILED(_hr) && PSpDebug()->HRFail())                                      
  408.         {                                                                             
  409.             _RPT3(_CRT_WARN, "%s(%d): Failed HR = %lXn", __FILE__, __LINE__, (_hr) );
  410.             PSpDebug()->HRFail(FALSE);                                                
  411.         }                                                                             
  412.     } while (0)
  413. #endif // ASSERT_WITH_STACK
  414. #define SPDBG_ASSERT(expr)                  
  415.     do                                      
  416.     {                                       
  417.         if (!(expr))                        
  418.         {                                   
  419.             if (PSpDebug()->Assert())       
  420.             {                               
  421.                 _ASSERTE( expr );           
  422.                 PSpDebug()->Assert(FALSE);  
  423.             }                               
  424.         }                                   
  425.     }                                       
  426.     while (0)
  427. #define SPDBG_VERIFY(expr)  
  428.     SPDBG_ASSERT(expr)
  429. #define SPDBG_PMSG0(format)                                    
  430.     do                                                         
  431.     {                                                          
  432.         if (PSpDebug()->ParamInfo())                           
  433.         {                                                      
  434.             _RPT0(_CRT_WARN, format);                          
  435.             PSpDebug()->ParamInfo(FALSE);                      
  436.         }                                                      
  437.     } while (0)
  438. #define SPDBG_PMSG1(format, arg1)                              
  439.     do                                                         
  440.     {                                                          
  441.         if (PSpDebug()->ParamInfo())                           
  442.         {                                                      
  443.             _RPT1(_CRT_WARN, format, arg1);                    
  444.             PSpDebug()->ParamInfo(FALSE);                      
  445.         }                                                      
  446.     } while (0)
  447. #define SPDBG_PMSG2(format, arg1, arg2)                        
  448.     do                                                         
  449.     {                                                          
  450.         if (PSpDebug()->ParamInfo())                           
  451.         {                                                      
  452.             _RPT2(_CRT_WARN, format, arg1, arg2);              
  453.             PSpDebug()->ParamInfo(FALSE);                      
  454.         }                                                      
  455.     } while (0)
  456. #define SPDBG_PMSG3(format, arg1, arg2, arg3)                  
  457.     do                                                         
  458.     {                                                          
  459.         if (PSpDebug()->ParamInfo())                           
  460.         {                                                      
  461.             _RPT3(_CRT_WARN, format, arg1, arg2, arg3);        
  462.             PSpDebug()->ParamInfo(FALSE);                      
  463.         }                                                      
  464.     } while (0)
  465. #define SPDBG_PMSG4(format, arg1, arg2, arg3, arg4)            
  466.     do                                                         
  467.     {                                                          
  468.         if (PSpDebug()->ParamInfo())                           
  469.         {                                                      
  470.             _RPT4(_CRT_WARN, format, arg1, arg2, arg3, arg4);  
  471.             PSpDebug()->ParamInfo(FALSE);                      
  472.         }                                                      
  473.     } while (0)
  474.     
  475. #define SPDBG_DMSG0(format)                                    
  476.     do                                                         
  477.     {                                                          
  478.         if (PSpDebug()->DumpInfo())                            
  479.         {                                                      
  480.             _RPT0(_CRT_WARN, format);                          
  481.             PSpDebug()->DumpInfo(FALSE);                       
  482.         }                                                      
  483.     } while (0)
  484. #define SPDBG_DMSG1(format, arg1)                              
  485.     do                                                         
  486.     {                                                          
  487.         if (PSpDebug()->DumpInfo())                            
  488.         {                                                      
  489.             _RPT1(_CRT_WARN, format, arg1);                    
  490.             PSpDebug()->DumpInfo(FALSE);                       
  491.         }                                                      
  492.     } while (0)
  493. #define SPDBG_DMSG2(format, arg1, arg2)                        
  494.     do                                                         
  495.     {                                                          
  496.         if (PSpDebug()->DumpInfo())                            
  497.         {                                                      
  498.             _RPT2(_CRT_WARN, format, arg1, arg2);              
  499.             PSpDebug()->DumpInfo(FALSE);                       
  500.         }                                                      
  501.     } while (0)
  502. #define SPDBG_DMSG3(format, arg1, arg2, arg3)                  
  503.     do                                                         
  504.     {                                                          
  505.         if (PSpDebug()->DumpInfo())                            
  506.         {                                                      
  507.             _RPT3(_CRT_WARN, format, arg1, arg2, arg3);        
  508.             PSpDebug()->DumpInfo(FALSE);                       
  509.         }                                                      
  510.     } while (0)
  511. #define SPDBG_DMSG4(format, arg1, arg2, arg3, arg4)            
  512.     do                                                         
  513.     {                                                          
  514.         if (PSpDebug()->DumpInfo())                            
  515.         {                                                      
  516.             _RPT4(_CRT_WARN, format, arg1, arg2, arg3, arg4);  
  517.             PSpDebug()->DumpInfo(FALSE);                       
  518.         }                                                      
  519.     } while (0)
  520. #define SPDBG_RETURN(hr)                
  521.     {                                   
  522.         HRESULT __hr = (hr);            
  523.         if (FAILED(__hr))               
  524.         {                               
  525.             SPDBG_REPORT_ON_FAIL(__hr); 
  526.         }                               
  527.         return __hr;                    
  528.     }                                                    
  529. #define SPDBG_DEBUG_SERVER_ON_START()           
  530.     {                                           
  531.         if (PSpDebug()->DebugServerOnStart())   
  532.         {                                       
  533.             if (MessageBox(                     
  534.                     GetDesktopWindow(),         
  535.                     _T("Attach Debugger to the SAPI Server process?"),   
  536.                     _T("SAPI"),                 
  537.                     MB_YESNO) == IDYES)         
  538.             {                                   
  539.                 USES_CONVERSION;                
  540.                 TCHAR szCommand[MAX_PATH + 1];  
  541.                 wsprintf(                       
  542.                     szCommand,                  
  543.                     _T("msdev -p %d"),          
  544.                     GetCurrentProcessId());     
  545.                 system(T2A(szCommand));         
  546.             }                                   
  547.         }                                       
  548.     }
  549. #define SPDBG_DEBUG_CLIENT_ON_START()           
  550.     {                                           
  551.         if (PSpDebug()->DebugClientOnStart())   
  552.         {                                       
  553.             TCHAR szModule[MAX_PATH + 1];       
  554.             szModule[0] = '';                 
  555.             TCHAR * pszSapiServer =             
  556.                 _T("sapisvr.exe");              
  557.             GetModuleFileName(                  
  558.                 NULL,                           
  559.                 szModule,                       
  560.                 MAX_PATH);                      
  561.             if ((_tcslen(szModule) <=           
  562.                     _tcslen(pszSapiServer) ||   
  563.                  _tcsicmp(                      
  564.                     szModule +                  
  565.                         _tcslen(szModule) -     
  566.                         _tcslen(pszSapiServer), 
  567.                     pszSapiServer) != 0) &&     
  568.                 MessageBox(                     
  569.                     GetDesktopWindow(),         
  570.                     _T("Attach Debugger to the SAPI Client process?"),   
  571.                     _T("SAPI"),                 
  572.                     MB_YESNO) == IDYES)         
  573.             {                                   
  574.                 USES_CONVERSION;                
  575.                 TCHAR szCommand[MAX_PATH + 1];  
  576.                 wsprintf(                       
  577.                     szCommand,                  
  578.                     _T("msdev -p %d"),          
  579.                     GetCurrentProcessId());     
  580.                 system(T2A(szCommand));         
  581.             }                                   
  582.         }                                       
  583.     }
  584.         
  585. #else // _DEBUG
  586. #define SPDBG_FUNC(name)
  587. #define SPDBG_REPORT_ON_FAIL(hr)
  588. #define SPDBG_ASSERT(expr)
  589. #define SPDBG_VERIFY(expr) (expr)
  590. #define SPDBG_PMSG0(format)
  591. #define SPDBG_PMSG1(format, arg1)
  592. #define SPDBG_PMSG2(format, arg1, arg2)
  593. #define SPDBG_PMSG3(format, arg1, arg2, arg3)
  594. #define SPDBG_PMSG4(format, arg1, arg2, arg3, arg4)
  595. #define SPDBG_DMSG0(format)
  596. #define SPDBG_DMSG1(format, arg1)
  597. #define SPDBG_DMSG2(format, arg1, arg2)
  598. #define SPDBG_DMSG3(format, arg1, arg2, arg3)
  599. #define SPDBG_DMSG4(format, arg1, arg2, arg3, arg4)
  600. #define SPDBG_RETURN(hr) return (hr)
  601. #define SPDBG_DEBUG_SERVER_ON_START()
  602. #define SPDBG_DEBUG_CLIENT_ON_START()
  603. #endif // _DEBUG