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.

230 lines
10 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-1998
  5. //
  6. // File: mshtmdbg.h
  7. //
  8. // Contents: External include file for mshtmdbg.dll
  9. //
  10. // ----------------------------------------------------------------------------
  11. #ifndef _MSHTMDBG_H_
  12. #define _MSHTMDBG_H_
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define MSHTMDBG_API_VERSION (4) // Increment whenever API changes
  17. typedef INT TRACETAG;
  18. typedef INT_PTR PERFTAG;
  19. typedef INT_PTR PERFMETERTAG;
  20. DWORD WINAPI DbgExGetVersion();
  21. BOOL WINAPI DbgExIsFullDebug();
  22. void WINAPI DbgExSetDllMain(HANDLE hDllHandle, BOOL (WINAPI *)(HANDLE, DWORD, LPVOID));
  23. void WINAPI DbgExDoTracePointsDialog(BOOL fWait);
  24. void WINAPI DbgExRestoreDefaultDebugState();
  25. BOOL WINAPI DbgExEnableTag(TRACETAG tag, BOOL fEnable);
  26. BOOL WINAPI DbgExSetDiskFlag(TRACETAG tag, BOOL fSendToDisk);
  27. BOOL WINAPI DbgExSetBreakFlag(TRACETAG tag, BOOL fBreak);
  28. BOOL WINAPI DbgExIsTagEnabled(TRACETAG tag);
  29. TRACETAG WINAPI DbgExFindTag(char * szTagDesc);
  30. TRACETAG WINAPI DbgExTagError();
  31. TRACETAG WINAPI DbgExTagWarning();
  32. TRACETAG WINAPI DbgExTagThread();
  33. TRACETAG WINAPI DbgExTagAssertExit();
  34. TRACETAG WINAPI DbgExTagAssertStacks();
  35. TRACETAG WINAPI DbgExTagMemoryStrict();
  36. TRACETAG WINAPI DbgExTagCoMemoryStrict();
  37. TRACETAG WINAPI DbgExTagMemoryStrictTail();
  38. TRACETAG WINAPI DbgExTagMemoryStrictAlign();
  39. TRACETAG WINAPI DbgExTagOLEWatch();
  40. TRACETAG WINAPI DbgExTagRegisterTrace(CHAR * szOwner, CHAR * szDescrip, BOOL fEnabled);
  41. TRACETAG WINAPI DbgExTagRegisterOther(CHAR * szOwner, CHAR * szDescrip, BOOL fEnabled);
  42. TRACETAG WINAPI DbgExTagPerf();
  43. BOOL __cdecl DbgExTaggedTrace(TRACETAG tag, CHAR * szFmt, ...);
  44. BOOL __cdecl DbgExTaggedTraceEx(TRACETAG tag, USHORT usFlags, CHAR * szFmt, ...);
  45. BOOL WINAPI DbgExTaggedTraceListEx(TRACETAG tag, USHORT usFlags, CHAR * szFmt, va_list valMarker);
  46. void WINAPI DbgExTaggedTraceCallers(TRACETAG tag, int iStart, int cTotal);
  47. BOOL WINAPI DbgExAssertImpl(char const * szFile, int iLine, char const * szMessage);
  48. void WINAPI DbgExAssertThreadDisable(BOOL fDisable);
  49. HRESULT __cdecl DbgExCheckAndReturnResult(HRESULT hr, BOOL fTrace, LPSTR pstrFile, UINT line, int cHResult, ...);
  50. HRESULT WINAPI DbgExCheckAndReturnResultList(HRESULT hr, BOOL fTrace, LPSTR pstrFile, UINT line, int cHResult, va_list valMarker);
  51. size_t WINAPI DbgExPreAlloc(size_t cbRequest);
  52. void * WINAPI DbgExPostAlloc(void *pv);
  53. void * WINAPI DbgExPreFree(void *pv);
  54. void WINAPI DbgExPostFree();
  55. size_t WINAPI DbgExPreRealloc(void *pvRequest, size_t cbRequest, void **ppv);
  56. void * WINAPI DbgExPostRealloc(void *pv);
  57. void * WINAPI DbgExPreGetSize(void *pvRequest);
  58. size_t WINAPI DbgExPostGetSize(size_t cb);
  59. void * WINAPI DbgExPreDidAlloc(void *pvRequest);
  60. BOOL WINAPI DbgExPostDidAlloc(void *pvRequest, BOOL fActual);
  61. void WINAPI DbgExMemoryTrackDisable(BOOL fDisable);
  62. void WINAPI DbgExCoMemoryTrackDisable(BOOL fDisable);
  63. void WINAPI DbgExMemoryBlockTrackDisable(void * pv);
  64. void WINAPI DbgExMemSetHeader(void * pvRequest, size_t cb, PERFMETERTAG mt);
  65. void * WINAPI DbgExGetMallocSpy();
  66. void WINAPI DbgExTraceMemoryLeaks();
  67. BOOL WINAPI DbgExValidateInternalHeap();
  68. LONG_PTR WINAPI DbgExTraceFailL(LONG_PTR errExpr, LONG_PTR errTest, BOOL fIgnore, LPSTR pstrExpr, LPSTR pstrFile, int line);
  69. LONG_PTR WINAPI DbgExTraceWin32L(LONG_PTR errExpr, LONG_PTR errTest, BOOL fIgnore, LPSTR pstrExpr, LPSTR pstrFile, int line);
  70. HRESULT WINAPI DbgExTraceHR(HRESULT hrTest, BOOL fIgnore, LPSTR pstrExpr, LPSTR pstrFile, int line);
  71. HRESULT WINAPI DbgExTraceOLE(HRESULT hrTest, BOOL fIgnore, LPSTR pstrExpr, LPSTR pstrFile, int line, LPVOID lpsite);
  72. void WINAPI DbgExTraceEnter(LPSTR pstrExpr, LPSTR pstrFile, int line);
  73. void WINAPI DbgExTraceExit(LPSTR pstrExpr, LPSTR pstrFile, int line);
  74. void WINAPI DbgExSetSimFailCounts(int firstFailure, int cInterval);
  75. void WINAPI DbgExShowSimFailDlg();
  76. BOOL WINAPI DbgExFFail();
  77. int WINAPI DbgExGetFailCount();
  78. void WINAPI DbgExTrackItf(REFIID iid, char * pch, BOOL fTrackOnQI, void **ppv);
  79. void WINAPI DbgExOpenViewObjectMonitor(HWND hwndOwner, IUnknown *pUnk, BOOL fUseFrameSize);
  80. void WINAPI DbgExOpenMemoryMonitor();
  81. void WINAPI DbgExOpenLogFile(LPCSTR szFName);
  82. void * __cdecl DbgExMemSetName(void *pvRequest, char * szFmt, ...);
  83. void * WINAPI DbgExMemSetNameList(void * pvRequest, char * szFmt, va_list valMarker);
  84. char * WINAPI DbgExMemGetName(void *pvRequest);
  85. HRESULT WINAPI DbgExWsClear(HANDLE hProcess);
  86. HRESULT WINAPI DbgExWsTakeSnapshot(HANDLE hProcess);
  87. BSTR WINAPI DbgExWsGetModule(long row);
  88. BSTR WINAPI DbgExWsGetSection(long row);
  89. long WINAPI DbgExWsSize(long row);
  90. long WINAPI DbgExWsCount();
  91. long WINAPI DbgExWsTotal();
  92. HRESULT WINAPI DbgExWsStartDelta(HANDLE hProcess);
  93. long WINAPI DbgExWsEndDelta(HANDLE hProcess);
  94. void WINAPI DbgExDumpProcessHeaps();
  95. PERFTAG WINAPI DbgExPerfRegister(char * szTag, char * szOwner, char * szDescrip);
  96. void __cdecl DbgExPerfLogFn(PERFTAG tag, void * pvObj, const char * pchFmt, ...);
  97. void WINAPI DbgExPerfLogFnList(PERFTAG tag, void * pvObj, const char * pchFmt, va_list valMarker);
  98. void WINAPI DbgExPerfDump();
  99. void WINAPI DbgExPerfClear();
  100. void WINAPI DbgExPerfTags();
  101. char * WINAPI DbgExDecodeMessage(UINT msg);
  102. PERFMETERTAG WINAPI DbgExMtRegister(char * szTag, char * szOwner, char * szDescrip);
  103. void WINAPI DbgExMtAdd(PERFMETERTAG mt, LONG lCnt, LONG lVal);
  104. void WINAPI DbgExMtSet(PERFMETERTAG mt, LONG lCnt, LONG lVal);
  105. char * WINAPI DbgExMtGetName(PERFMETERTAG mt);
  106. char * WINAPI DbgExMtGetDesc(PERFMETERTAG mt);
  107. BOOL WINAPI DbgExMtSimulateOutOfMemory(PERFMETERTAG mt, LONG lNewValue);
  108. void WINAPI DbgExMtOpenMonitor();
  109. void WINAPI DbgExMtLogDump(LPSTR pchFile);
  110. void WINAPI DbgExSetTopUrl(LPWSTR pstrUrl);
  111. void WINAPI DbgExGetSymbolFromAddress(void * pvAddr, char * pszBuf, DWORD cchBuf);
  112. BOOL WINAPI DbgExGetChkStkFill(DWORD * pdwFill);
  113. #ifdef __cplusplus
  114. }
  115. #endif
  116. // Performance Logging --------------------------------------------------------
  117. #ifdef PERFTAGS
  118. #define IsPerfEnabled(tag) (*(BOOL *)tag)
  119. #define PerfTag(tag, szOwner, szDescrip) PERFTAG tag(DbgExPerfRegister(#tag, szOwner, szDescrip));
  120. #define PerfExtern(tag) extern PERFTAG tag;
  121. #define PerfLog(tag,pv,f) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f) : 0
  122. #define PerfLog1(tag,pv,f,a1) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1) : 0
  123. #define PerfLog2(tag,pv,f,a1,a2) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2) : 0
  124. #define PerfLog3(tag,pv,f,a1,a2,a3) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3) : 0
  125. #define PerfLog4(tag,pv,f,a1,a2,a3,a4) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3,a4) : 0
  126. #define PerfLog5(tag,pv,f,a1,a2,a3,a4,a5) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3,a4,a5) : 0
  127. #define PerfLog6(tag,pv,f,a1,a2,a3,a4,a5,a6) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3,a4,a5,a6) : 0
  128. #define PerfLog7(tag,pv,f,a1,a2,a3,a4,a5,a6,a7) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3,a4,a5,a6,a7) : 0
  129. #define PerfLog8(tag,pv,f,a1,a2,a3,a4,a5,a6,a7,a8) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3,a4,a5,a6,a7,a8) : 0
  130. #define PerfLog9(tag,pv,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) IsPerfEnabled(tag) ? DbgExPerfLogFn(tag,pv,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) : 0
  131. #define PerfDump() DbgExPerfDump()
  132. #define PerfClear() DbgExPerfClear()
  133. #define PerfTags() DbgExPerfTags()
  134. #else
  135. #define IsPerfEnabled(tag) (FALSE)
  136. #define PerfTag(tag, szOwner, szDescrip)
  137. #define PerfExtern(tag)
  138. #define PerfLog(tag,pv,f)
  139. #define PerfLog1(tag,pv,f,a1)
  140. #define PerfLog2(tag,pv,f,a1,a2)
  141. #define PerfLog3(tag,pv,f,a1,a2,a3)
  142. #define PerfLog4(tag,pv,f,a1,a2,a3,a4)
  143. #define PerfLog5(tag,pv,f,a1,a2,a3,a4,a5)
  144. #define PerfLog6(tag,pv,f,a1,a2,a3,a4,a5,a6)
  145. #define PerfLog7(tag,pv,f,a1,a2,a3,a4,a5,a6,a7)
  146. #define PerfLog8(tag,pv,f,a1,a2,a3,a4,a5,a6,a7,a8)
  147. #define PerfLog9(tag,pv,f,a1,a2,a3,a4,a5,a6,a7,a8,a9)
  148. #define PerfDump()
  149. #define PerfClear()
  150. #define PerfTags()
  151. #endif
  152. // Performance Metering -------------------------------------------------------
  153. #ifdef PERFMETER
  154. #define Mt(x) g_mt##x
  155. #define MtExtern(tag) extern PERFMETERTAG g_mt##tag;
  156. #define MtDefine(tag, tagOwner, szDescrip) PERFMETERTAG g_mt##tag(DbgExMtRegister("mt" #tag, "mt" #tagOwner, szDescrip));
  157. #define MtAdd(mt, lCnt, lVal) DbgExMtAdd(mt, lCnt, lVal)
  158. #define MtSet(mt, lCnt, lVal) DbgExMtSet(mt, lCnt, lVal)
  159. #define MtSimulateOutOfMemory(mt, lNewVal) DbgExMtSimulateOutOfMemory(mt, lNewVal)
  160. #define MtOpenMonitor() DbgExMtOpenMonitor()
  161. #else
  162. #define Mt(x) 0
  163. #define MtExtern(tag)
  164. #define MtDefine(tag, szOwner, szDescrip)
  165. #define MtAdd(mt, lCnt, lVal)
  166. #define MtSet(mt, lCnt, lVal)
  167. #define MtSimulateOutOfMemory(mt, lNewValue)
  168. #define MtOpenMonitor()
  169. #endif
  170. // MSHTML perf control --------------------------------------------------------
  171. #define HTMPERFCTL_NAME "#MSHTML#PERF#"
  172. enum
  173. {
  174. HTMPF_CALLBACK_ONLOAD = 0x00000001, // callback when topdoc loaded
  175. HTMPF_ENABLE_PROFILE = 0x00000002, // enable profiling
  176. HTMPF_ENABLE_MEMWATCH = 0x00000004, // enable memwatch sampling
  177. HTMPF_DISABLE_PADEVENTS = 0x00000008, // disable firing of events from mshtmpad.exe
  178. HTMPF_DISABLE_IMGCACHE = 0x00000010, // disable image cache in mshtml
  179. HTMPF_DISABLE_OFFSCREEN = 0x00000020, // disable offscreen buffering
  180. };
  181. typedef void (WINAPI *HTMPFCBFN)(DWORD dwArg1, void * pvArg2);
  182. typedef struct HTMPERFCTL
  183. {
  184. DWORD dwSize; // set to sizeof(MSHTMLPERF)
  185. DWORD dwFlags; // see HTMPF_*
  186. HTMPFCBFN pfnCall; // Callback function
  187. void * pvHost; // Private data for host
  188. } HTMPERFCTL;
  189. #endif