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.

139 lines
4.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: dbgprt.hxx
  7. //
  8. // Contents: Routines to make printing trace info for debugging easier
  9. //
  10. // History: 31-Jan-95 Ricksa Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include "act.hxx"
  14. // This file only produces code for the debug version of the SCM
  15. #if DBG == 1
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Function: FormatGuid
  19. //
  20. // Synopsis: Format a binary guid for display on debugger
  21. //
  22. // Arguments: [rguid] - guid to display
  23. // [pwszGuid] - where to put displayable form
  24. //
  25. // Returns: pointer to guid string
  26. //
  27. // History: 01-May-93 Ricksa Created
  28. //
  29. //--------------------------------------------------------------------------
  30. WCHAR *FormatGuid(const GUID& rguid, WCHAR *pwszGuid)
  31. {
  32. wsprintf(pwszGuid, L"%08lX-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X",
  33. rguid.Data1, rguid.Data2, rguid.Data3, (int) rguid.Data4[0],
  34. (int) rguid.Data4[1], (int) rguid.Data4[2], (int) rguid.Data4[3],
  35. (int) rguid.Data4[4], (int) rguid.Data4[5],
  36. (int) rguid.Data4[6], (int) rguid.Data4[7]);
  37. return pwszGuid;
  38. }
  39. void DbgPrintFileTime(char *pszDesc, FILETIME *pfiletime)
  40. {
  41. CairoleDebugOut((DEB_SCM, "%s Low: %04X High: %04X\n",
  42. pszDesc, pfiletime->dwLowDateTime, pfiletime->dwHighDateTime));
  43. }
  44. void DbgPrintGuid(char *pszDesc, const GUID *pguid)
  45. {
  46. WCHAR aszGuidStr[48];
  47. CairoleDebugOut((DEB_SCM, "%s %ws\n", pszDesc,
  48. FormatGuid(*pguid, &aszGuidStr[0])));
  49. }
  50. void DbgPrintIFD(char *pszDesc, InterfaceData *pifd)
  51. {
  52. if (pifd != NULL)
  53. {
  54. BYTE *pb = &pifd->abData[0];
  55. CairoleDebugOut((DEB_SCM,
  56. "%s Addr %04X Len: %04X Data: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n",
  57. pszDesc, pifd, pifd->ulCntData, pb[0], pb[1], pb[2], pb[3],
  58. pb[4], pb[5], pb[6], pb[7], pb[8], pb[9], pb[10], pb[11]));
  59. }
  60. else
  61. {
  62. CairoleDebugOut((DEB_SCM, "%s Addr %04X", pszDesc, pifd));
  63. }
  64. }
  65. void DbgPrintMkIfList(char *pszDesc, MkInterfaceList **ppMkIFList)
  66. {
  67. CairoleDebugOut((DEB_SCM, "%s Addr: %l04X Count: %04X\n",
  68. pszDesc, *ppMkIFList, (*ppMkIFList)->dwSize));
  69. }
  70. void DbgPrintMnkEqBuf(char *pszDesc, MNKEQBUF *pmkeqbuf)
  71. {
  72. GUID *pguid = (GUID *) &pmkeqbuf->abEqData[0];
  73. WCHAR aszGuidStr[48];
  74. CairoleDebugOut((DEB_SCM, "%s Addr %04X Len: %04X Clsid: %ws\n",
  75. pszDesc, pmkeqbuf, pmkeqbuf->cdwSize,
  76. FormatGuid(*pguid, &aszGuidStr[0])));
  77. }
  78. void DbgPrintRegIn(char *pszDesc, RegInput *pregin)
  79. {
  80. CairoleDebugOut((DEB_SCM, "%s Count: %04X\n", pszDesc, pregin->dwSize));
  81. // Loop printing the registrations
  82. for (DWORD i = 0; i < pregin->dwSize; i++)
  83. {
  84. DbgPrintGuid("CLSID: ", &pregin->rginent[i].clsid);
  85. #ifdef DCOM
  86. ULARGE_INTEGER *puint = (ULARGE_INTEGER *)&pregin->rginent[i].oxid;
  87. CairoleDebugOut((DEB_SCM, "OXID: %08x %08x\n",
  88. puint->HighPart, puint->LowPart));
  89. DbgPrintGuid("IPID: ", &pregin->rginent[i].ipid);
  90. #else
  91. CairoleDebugOut((DEB_SCM, "EndPoint: %ws\n",
  92. pregin->rginent[i].pwszEndPoint));
  93. #endif
  94. CairoleDebugOut((DEB_SCM, "Flags: %04X\n",
  95. pregin->rginent[i].dwFlags));
  96. }
  97. }
  98. void DbgPrintRevokeClasses(char *pszDesc, RevokeClasses *prevcls)
  99. {
  100. CairoleDebugOut((DEB_SCM, "%s Count: %04X\n", pszDesc, prevcls->dwSize));
  101. // Loop printing the registrations
  102. for (DWORD i = 0; i < prevcls->dwSize; i++)
  103. {
  104. DbgPrintGuid("CLSID: ", &prevcls->revent[i].clsid);
  105. CairoleDebugOut((DEB_SCM, "Reg: %04X\n",
  106. prevcls->revent[i].dwReg));
  107. }
  108. }
  109. void DbgPrintScmRegKey(char *pszDesc, SCMREGKEY *psrkRegister)
  110. {
  111. CairoleDebugOut((DEB_SCM, "%s EntryLoc: %04X ScmId: %04X\n", pszDesc,
  112. psrkRegister->dwEntryLoc, psrkRegister->dwScmId));
  113. }
  114. #endif // DBG == 1
  115.