Source code of Windows XP (NT5)
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.

157 lines
3.1 KiB

  1. /***************************************************************************
  2. Name : ERRSTAT.C
  3. Comment : Error logging and Status msgs
  4. Revision Log
  5. Date Name Description
  6. -------- ----- ---------------------------------------------------------
  7. ***************************************************************************/
  8. #include "prep.h"
  9. #include "glbproto.h"
  10. #include "t30gl.h"
  11. #define faxTlog(m) DEBUGMSG(ZONE_ERRSTAT, m);
  12. #ifdef FAXWATCH
  13. char szFailureLog[] = "FAXWATCH.LOG";
  14. // sneaky look at BGT30's private data
  15. # ifndef TSK
  16. extern char szPhone[];
  17. # endif //TSK
  18. #endif //FAXWATCH
  19. // Currently in WIN32, logging (IFDbgPrintf) is provided by efaxrun.dll. This
  20. // should later migrate to awkrnl32.dll.
  21. struct {
  22. HFILE hfLog;
  23. BOOL fInited;
  24. CRITICAL_SECTION crit;
  25. } gLog = {HFILE_ERROR, FALSE};
  26. void ICommFailureCode(PThrdGlbl pTG, T30FAILURECODE uT30Fail)
  27. {
  28. SetFailureCode(pTG, uT30Fail);
  29. }
  30. void SetFailureCode(PThrdGlbl pTG, T30FAILURECODE uT30Fail)
  31. {
  32. if(!pTG->Inst.uFirstFailureCode)
  33. pTG->Inst.uFirstFailureCode = (USHORT)uT30Fail;
  34. else
  35. pTG->Inst.uLastFailureCode = (USHORT)uT30Fail;
  36. }
  37. void InitFailureCodes(PThrdGlbl pTG)
  38. {
  39. pTG->Inst.uFirstFailureCode = pTG->Inst.uLastFailureCode = 0;
  40. }
  41. void ICommStatus(PThrdGlbl pTG, T30STATUS uT30Stat, USHORT uN1, USHORT uN2, USHORT uN3)
  42. {
  43. // SetStatus(uT30Stat, uN1, uN2, uN3);
  44. }
  45. void SetStatus(PThrdGlbl pTG, T30STATUS uT30Stat, USHORT uN1, USHORT uN2, USHORT uN3)
  46. {
  47. #if 0 ///RSL was ifdef STATUS
  48. ULONG lParam;
  49. BG_CHK((uT30Stat & 0xFF) == uT30Stat);
  50. BG_CHK((uN1 & 0xFF) == uN1);
  51. // when N2==Kbytes recvd this goes over 256K sometimes & so rolls
  52. // around to 0 again.
  53. // BG_CHK((uN2 & 0xFF) == uN2);
  54. BG_CHK((uN3 & 0xFF) == uN3);
  55. lParam = MAKELONG(MAKEWORD(uT30Stat, uN1), MAKEWORD(uN2, uN3));
  56. if(Inst.fSending || Inst.fInPollReq)
  57. {
  58. BG_CHK(Inst.hwndSend && Inst.aPhone);
  59. PostMessage(Inst.hwndSend, IF_FILET30_STATUS, Inst.aPhone, lParam);
  60. }
  61. else if(Inst.hwndStatus)
  62. {
  63. PostMessage(Inst.hwndStatus, IF_FILET30_STATUS, 0, lParam);
  64. }
  65. #endif //STATUS
  66. }
  67. /*
  68. * MyIFDbgPrintf -- printf to the debugger console
  69. * Takes printf style arguments.
  70. * Expects newline characters at the end of the string.
  71. */
  72. void MyIFDbgPrintf (LPSTR format, ...)
  73. {
  74. va_list marker;
  75. char String[512];
  76. char c;
  77. UINT i;
  78. UINT u;
  79. DWORD dwWritten;
  80. if ( (gT30.DbgLevel < LOG_ALL ) || (! gfFilePrint) ) {
  81. return;
  82. }
  83. u = 0;
  84. va_start(marker, format);
  85. u += wvsprintf(String+u, format, marker);
  86. //
  87. // scramble String
  88. //
  89. for (i=0; i<u; i++) {
  90. c = String[i];
  91. String[i] = ( (c << 4 ) & 0xf0 ) | ( (c >> 4) & 0x0f );
  92. }
  93. WriteFile(ghLogFile, String, u, &dwWritten, NULL);
  94. }