Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.1 KiB

  1. /***************************************************************************
  2. Name : fdebug.C
  3. Comment : Factored out debug code
  4. Functions : (see Prototypes just below)
  5. Copyright (c) Microsoft Corp. 1991, 1992, 1993
  6. Revision Log
  7. Num Date Name Description
  8. --- -------- ---------- -----------------------------------------------
  9. ***************************************************************************/
  10. #define USE_DEBUG_CONTEXT DEBUG_CONTEXT_T30_COMM
  11. #include "prep.h"
  12. #include <comdevi.h>
  13. #include "efaxcb.h"
  14. #include "fcomapi.h"
  15. #include "fcomint.h"
  16. #include "fdebug.h"
  17. #include "glbproto.h"
  18. #define FLUSHBUFSIZE 256
  19. #undef USE_DEBUG_CONTEXT
  20. #define USE_DEBUG_CONTEXT DEBUG_CONTEXT_T30_CLASS1
  21. void far D_HexPrint(LPB b1, UWORD incnt)
  22. {
  23. #ifdef DEBUG
  24. BYTE b2[FLUSHBUFSIZE];
  25. UWORD i, j;
  26. DEBUG_FUNCTION_NAME(("D_HexPrint"));
  27. DebugPrintEx( DEBUG_MSG,
  28. "b1=0x%08lx incnt=%d",
  29. (LPSTR)b1,
  30. incnt);
  31. for(i=0; i<incnt;)
  32. {
  33. for(j=0; i<incnt && j<FLUSHBUFSIZE-6;)
  34. {
  35. j += (UWORD)wsprintf(b2+j, "%02x ", (UWORD)(b1[i]));
  36. i++;
  37. }
  38. b2[j] = 0;
  39. DebugPrintEx(DEBUG_MSG,"(%s)",(LPSTR)b2);
  40. }
  41. #endif
  42. }
  43. #undef USE_DEBUG_CONTEXT
  44. #define USE_DEBUG_CONTEXT DEBUG_CONTEXT_T30_COMM
  45. #ifdef DEBUG
  46. void D_PrintCE(int err)
  47. {
  48. DEBUG_FUNCTION_NAME(("D_PrintCE"));
  49. if(err & CE_MODE)
  50. {
  51. DebugPrintEx(DEBUG_ERR,"CE(%02x) CE Mode -- or nCid is illegal", err);
  52. return;
  53. }
  54. if(err & CE_RXOVER)
  55. {
  56. DebugPrintEx(DEBUG_ERR,"CE(%02x) Receive Buffer Overflow", err);
  57. }
  58. if(err & CE_OVERRUN)
  59. {
  60. DebugPrintEx(DEBUG_ERR,"CE(%02x) Receive Overrun (not an error during startup)", err);
  61. }
  62. if(err & CE_RXPARITY)
  63. {
  64. DebugPrintEx(DEBUG_ERR,"CE(%02x) Receive Parity error", err);
  65. }
  66. if(err & CE_FRAME)
  67. {
  68. DebugPrintEx(DEBUG_ERR,"CE(%02x) Framing error (not an error during call startup or shutdown)", err);
  69. }
  70. if(err & CE_BREAK)
  71. {
  72. DebugPrintEx(DEBUG_ERR,"CE(%02x) Break condition (not an error during call startup or shutdown)", err);
  73. }
  74. if(err & CE_TXFULL)
  75. {
  76. DebugPrintEx(DEBUG_ERR,"CE(%02x) Transmit Buffer full", err);
  77. }
  78. if(err & (CE_PTO | CE_IOE | CE_DNS | CE_OOP))
  79. {
  80. DebugPrintEx(DEBUG_ERR,"CE(%02x) Parallel Printer Errors!!!", err);
  81. }
  82. }
  83. void D_PrintCOMSTAT(PThrdGlbl pTG, COMSTAT far* lpcs)
  84. {
  85. DEBUG_FUNCTION_NAME(_T("D_PrintCOMSTAT"));
  86. if( (lpcs->cbInQue != pTG->PrevcbInQue) ||
  87. (lpcs->cbOutQue != pTG->PrevcbOutQue) ||
  88. (lpcs->fXoffHold != (DWORD)pTG->PrevfXoffHold) ||
  89. (lpcs->fXoffSent != (DWORD)pTG->PrevfXoffSent) )
  90. {
  91. DebugPrintEx( DEBUG_MSG,
  92. "STAT::: InQ=%d PutQ=%d XoffHold=%d XoffSent=%d",
  93. lpcs->cbInQue,
  94. lpcs->cbOutQue,
  95. lpcs->fXoffHold,
  96. lpcs->fXoffSent);
  97. }
  98. if( lpcs->fCtsHold ||
  99. lpcs->fDsrHold ||
  100. lpcs->fRlsdHold ||
  101. lpcs->fEof ||
  102. lpcs->fTxim )
  103. {
  104. DebugPrintEx( DEBUG_MSG,
  105. "???::: CTShold=%d DSRhold=%d RLShold=%d FOF=%d TXim=%d",
  106. lpcs->fCtsHold,
  107. lpcs->fDsrHold,
  108. lpcs->fRlsdHold,
  109. lpcs->fEof,
  110. lpcs->fTxim);
  111. }
  112. pTG->PrevfXoffHold = lpcs->fXoffHold;
  113. pTG->PrevfXoffSent = lpcs->fXoffSent;
  114. pTG->PrevcbInQue = (USHORT) lpcs->cbInQue;
  115. pTG->PrevcbOutQue = (USHORT) lpcs->cbOutQue;
  116. }
  117. #undef USE_DEBUG_CONTEXT
  118. #define USE_DEBUG_CONTEXT DEBUG_CONTEXT_T30_CLASS1
  119. #undef USE_DEBUG_CONTEXT
  120. #define USE_DEBUG_CONTEXT DEBUG_CONTEXT_T30_COMM
  121. #endif //DEBUG