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.

82 lines
1.9 KiB

  1. #pragma once
  2. /*
  3. * Ole32 in-memory logging.
  4. *
  5. * Provides a per-process log of events. Only for debugging purposes.
  6. */
  7. #ifdef DBG
  8. /*
  9. * All subject/verb definitions should go here.
  10. *
  11. * The assignment of symbols to verbs/subjects is completely arbitrary, and
  12. * doesn't mean a thing. Except nothing. It has to be NULL.
  13. */
  14. #define SU_NOTHING '\0'
  15. #define SU_GLOBAL 'G'
  16. #define SU_APT 'A'
  17. #define SU_STDID 'S'
  18. #define VB_ADDREF '+'
  19. #define VB_RELEASE '-'
  20. #define VB_QI '?'
  21. #define VB_CREATE 'C'
  22. /*
  23. * Only debuggers need understand this stuff.
  24. *
  25. * Code only has to call the Ole32Log function below.
  26. */
  27. #define STACKTRACE_DEPTH (4)
  28. struct DebugEvent
  29. {
  30. DWORD Time;
  31. DWORD ThreadID;
  32. unsigned char Subject;
  33. unsigned char Verb;
  34. void *SubjectPtr;
  35. void *ObjectPtr;
  36. ULONG_PTR UserData;
  37. void *Stack[STACKTRACE_DEPTH];
  38. };
  39. void __Ole32Log (unsigned char Subject, unsigned char Verb,
  40. void *SubjectPtr, void *ObjectPtr, ULONG_PTR UserData,
  41. BOOL fGrabStack, int FramesToSkip);
  42. inline void Ole32Log (unsigned char Subject,
  43. unsigned char Verb,
  44. void *SubjectPtr,
  45. void *ObjectPtr = NULL,
  46. ULONG_PTR UserData = 0,
  47. BOOL fGrabStack = FALSE,
  48. int FramesToSkip = 0)
  49. {
  50. __Ole32Log(Subject, Verb, SubjectPtr, ObjectPtr, UserData, fGrabStack,
  51. FramesToSkip);
  52. }
  53. #else
  54. inline void Ole32Log (unsigned char Subject,
  55. unsigned char Verb,
  56. void *SubjectPtr,
  57. void *ObjectPtr = NULL,
  58. ULONG_PTR UserData = 0,
  59. BOOL fGrabStack = FALSE,
  60. int FramesToSkip = 0)
  61. {
  62. //Don't do anything!
  63. }
  64. #endif