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.

100 lines
2.9 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: trace.cxx
  3. *
  4. * Copyright (c) 2000 Microsoft Corporation
  5. *
  6. \**************************************************************************/
  7. #include "precomp.hxx"
  8. DECLARE_API( trace )
  9. {
  10. OutputControl OutCtl(Client);
  11. OutCtl.Output("trace is not fully supported yet.\n");
  12. HRESULT hr = E_INVALIDARG;
  13. PDEBUG_SYMBOLS Symbols;
  14. ULONG64 Module;
  15. ULONG TypeId;
  16. // Interpret command line
  17. while (isspace(*args)) args++;
  18. if (*args != '\0')
  19. {
  20. OutCtl.Output("trace [-cdels] [Name]\n");
  21. return S_OK;
  22. }
  23. if (Client == NULL ||
  24. (hr = Client->QueryInterface(__uuidof(IDebugSymbols),
  25. (void **)&Symbols)) != S_OK)
  26. {
  27. return hr;
  28. }
  29. BEGIN_API( trace );
  30. if (GDIKM_Module.Base == 0)
  31. {
  32. OutCtl.OutErr("Error: win32k.sys module isn't available.\n");
  33. }
  34. Module = GDIKM_Module.Base;
  35. if (Module != 0)
  36. {
  37. // Make sure tracing is enabled in GDI
  38. hr = Symbols->GetTypeId(Module, "GDITraceEntryType", &TypeId);
  39. if (hr != S_OK)
  40. {
  41. OutCtl.OutErr("Error: GDI Tracing is not enabled.\n"
  42. " Rebuild " GDIModule() " with DBG_TRACE enabled.\n");
  43. }
  44. else
  45. {
  46. OutCtl.OutWarn("no implementation yet.\n");
  47. CHAR TypeName[200];
  48. ULONG NameSize;
  49. for (TypeId = 0;
  50. Symbols->GetTypeName(Module, TypeId, NULL, 0, NULL) == E_FAIL;
  51. TypeId++)
  52. {
  53. if (TypeId > 255) break;
  54. }
  55. for (;//TypeId = 0;
  56. (hr = Symbols->GetTypeName(Module, TypeId,
  57. TypeName, sizeof(TypeName),
  58. &NameSize)) != E_FAIL;
  59. TypeId++)
  60. {
  61. if ((NameSize > 11 && strncmp(TypeName, "enum_GDITE_", 11) == 0) ||
  62. (NameSize > 6 && strncmp(TypeName, "GDITE_", 6) == 0))
  63. {
  64. OutCtl.Output(" %lx ", TypeId);
  65. hr = Symbols->OutputTypedDataVirtual(DEBUG_OUTCTL_AMBIENT,
  66. 0, Module, TypeId,
  67. DEBUG_OUTTYPE_COMPACT_OUTPUT);
  68. if (hr != S_OK)
  69. {
  70. OutCtl.Output("%s = Unknown Value (HRESULT %s)\n", TypeName, pszHRESULT(hr));
  71. }
  72. }
  73. }
  74. OutCtl.Output("GetTypeName(,%lx,) returned %s.\n", TypeId, pszHRESULT(hr));
  75. }
  76. }
  77. Symbols->Release();
  78. return hr;
  79. }