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.

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