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.

244 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 1992-2002 Microsoft Corporation
  3. Module Name:
  4. Windbg.h
  5. Abstract:
  6. Main header file for the Windbg debugger.
  7. --*/
  8. #if ! defined( _WINDBG_ )
  9. #define _WINDBG_
  10. //----------------------------------------------------------------------------
  11. //
  12. // Global limit constants.
  13. //
  14. //----------------------------------------------------------------------------
  15. #define MAX_MSG_TXT 4096 //Max text width in message boxes
  16. #define TMP_STRING_SIZE 8192 //All purpose strings
  17. #define MAX_CMDLINE_TXT 8192 //Max size for command line
  18. #define MAX_VAR_MSG_TXT 8192 //Max size of a message built at run-time
  19. #define MAX_LINE_SIZE 512 //Max inside length of editor line
  20. #define MAX_USER_LINE MAX_LINE_SIZE //Max length of user line
  21. //----------------------------------------------------------------------------
  22. //
  23. // UI constants.
  24. //
  25. //----------------------------------------------------------------------------
  26. //
  27. // Private window messages
  28. //
  29. #define WU_UPDATE (WM_USER + 0)
  30. #define WU_INVALIDATE (WM_USER + 1)
  31. #define WU_START_ENGINE (WM_USER + 2)
  32. #define WU_ENGINE_STARTED (WM_USER + 3)
  33. #define WU_SWITCH_WORKSPACE (WM_USER + 4)
  34. #define WU_ENGINE_IDLE (WM_USER + 5)
  35. #define WU_RECONFIGURE (WM_USER + 6)
  36. // Position of window menu.
  37. #define WINDOWMENU 4
  38. // Position of file menu.
  39. #define FILEMENU 0
  40. // Toolbar control identifier.
  41. #define ID_TOOLBAR 100
  42. // Generic customize button ID.
  43. #define ID_CUSTOMIZE 29876
  44. // Generic show/hide toolbar button ID.
  45. #define ID_SHOW_TOOLBAR 29877
  46. // For MDI default menu handling.
  47. #define IDM_FIRSTCHILD 30000
  48. /*
  49. ** Include the defines which are used have numbers for string
  50. ** resources.
  51. */
  52. #include "res_str.h"
  53. //----------------------------------------------------------------------------
  54. //
  55. // Variables.
  56. //
  57. //----------------------------------------------------------------------------
  58. // Set when the debugger is exiting.
  59. extern BOOL g_Exit;
  60. extern ULONG g_CommandLineStart;
  61. extern ULONG g_DefPriority;
  62. enum QUIET_MODES
  63. {
  64. QMODE_DISABLED,
  65. QMODE_ALWAYS_NO,
  66. QMODE_ALWAYS_YES,
  67. };
  68. extern QUIET_MODES g_QuietMode;
  69. extern QUIET_MODES g_QuietSourceMode;
  70. typedef BOOL (WINAPI* PFN_FlashWindowEx)(PFLASHWINFO pfwi);
  71. extern PFN_FlashWindowEx g_FlashWindowEx;
  72. //Handle to instance data
  73. extern HINSTANCE g_hInst;
  74. //Main window frame
  75. extern HWND g_hwndFrame;
  76. // Handle to MDI client
  77. extern HWND g_hwndMDIClient;
  78. // Width and height of MDI client.
  79. extern ULONG g_MdiWidth, g_MdiHeight;
  80. //Handle to accelerator table
  81. extern HACCEL g_hMainAccTable;
  82. //Keyboard Hooks functions
  83. extern HHOOK hKeyHook;
  84. // menu that belongs to g_hwndFrame
  85. extern HMENU g_hmenuMain;
  86. extern HMENU g_hmenuMainSave;
  87. //Window submenu
  88. extern HMENU g_hmenuWindowSub;
  89. // WinDBG title text
  90. extern TCHAR g_MainTitleText[MAX_MSG_TXT];
  91. extern TCHAR g_ExeFilePath[MAX_PATH];
  92. extern TCHAR g_DumpFilePath[MAX_PATH];
  93. extern TCHAR g_SrcFilePath[MAX_PATH];
  94. enum
  95. {
  96. COL_PLAIN,
  97. COL_PLAIN_TEXT,
  98. COL_CURRENT_LINE,
  99. COL_CURRENT_LINE_TEXT,
  100. COL_BP_CURRENT_LINE,
  101. COL_BP_CURRENT_LINE_TEXT,
  102. COL_ENABLED_BP,
  103. COL_ENABLED_BP_TEXT,
  104. COL_DISABLED_BP,
  105. COL_DISABLED_BP_TEXT,
  106. COL_CHANGED_DATA_TEXT,
  107. COL_DISABLED_WINDOW,
  108. COL_COUNT
  109. };
  110. #define OUT_MASK_COL_BASE 0xff00
  111. #define OUT_MASK_COL_COUNT 66
  112. #define USER_OUT_MASK_COL 64
  113. struct INDEXED_COLOR
  114. {
  115. PSTR Name;
  116. COLORREF Color;
  117. COLORREF Default;
  118. HBRUSH Brush;
  119. };
  120. extern INDEXED_COLOR g_Colors[];
  121. extern INDEXED_COLOR g_OutMaskColors[];
  122. #define CUSTCOL_COUNT 16
  123. extern COLORREF g_CustomColors[];
  124. //----------------------------------------------------------------------------
  125. //
  126. // Functions.
  127. //
  128. //----------------------------------------------------------------------------
  129. LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
  130. void UpdateFrameTitle(void);
  131. void SetTitleServerText(PCSTR Format, ...);
  132. void SetTitleSessionText(PCSTR Format, ...);
  133. void SetTitleExplicitText(PCSTR Text);
  134. void UpdateTitleSessionText(void);
  135. BOOL CreateUiInterfaces(BOOL Remote, LPTSTR CreateOptions);
  136. void ReleaseUiInterfaces(void);
  137. BOOL ParseCommandLine(BOOL FirstParse);
  138. #define StartDebugging() \
  139. PostMessage(g_hwndFrame, WU_START_ENGINE, 0, 0)
  140. void StopDebugging(BOOL UserRequest);
  141. void ClearDebuggingParams(void);
  142. void TerminateApplication(BOOL Cancellable);
  143. INDEXED_COLOR* GetIndexedColor(ULONG Index);
  144. BOOL SetColor(ULONG Index, COLORREF Color);
  145. BOOL GetOutMaskColors(ULONG Mask, COLORREF* Fg, COLORREF* Bg);
  146. //----------------------------------------------------------------------------
  147. //
  148. // Macros.
  149. //
  150. //----------------------------------------------------------------------------
  151. // Dbg have to be used for every assertion during Debugging time.
  152. // If false Dbg Opens a fatal error message Box and Stops program
  153. // Standard function to prompt an Assertion False
  154. void ShowAssert(PTSTR condition, UINT line, PTSTR file);
  155. // First, a sanity check
  156. #ifdef Dbg
  157. #undef Dbg
  158. #endif
  159. // Assert are assertions that will stay in final Release.
  160. // If false Assert Opens a fatal error message Box and Stops program
  161. #define RAssert(condition) \
  162. { \
  163. if (!(condition)) \
  164. { \
  165. ShowAssert( _T(#condition), __LINE__, _T(__FILE__) ); \
  166. } \
  167. }
  168. #ifdef DBG
  169. #define Assert RAssert
  170. #define Dbg RAssert
  171. #else // !DBG
  172. //#pragma warning(disable: 4553) // disable warnings for pure expressions
  173. //#pragma warning(disable: 4552) // disable level 4 warnings
  174. #define Assert(x) ((void)0)
  175. #define Dbg(condition) condition
  176. #endif
  177. #endif // _WINDBG_