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.

232 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1992-2001 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 BOOL g_QuietMode;
  62. extern ULONG g_DefPriority;
  63. typedef BOOL (WINAPI* PFN_FlashWindowEx)(PFLASHWINFO pfwi);
  64. extern PFN_FlashWindowEx g_FlashWindowEx;
  65. //Handle to instance data
  66. extern HINSTANCE g_hInst;
  67. //Main window frame
  68. extern HWND g_hwndFrame;
  69. // Handle to MDI client
  70. extern HWND g_hwndMDIClient;
  71. // Width and height of MDI client.
  72. extern ULONG g_MdiWidth, g_MdiHeight;
  73. //Handle to accelerator table
  74. extern HACCEL g_hMainAccTable;
  75. //Keyboard Hooks functions
  76. extern HHOOK hKeyHook;
  77. // menu that belongs to g_hwndFrame
  78. extern HMENU g_hmenuMain;
  79. extern HMENU g_hmenuMainSave;
  80. //Window submenu
  81. extern HMENU g_hmenuWindowSub;
  82. // WinDBG title text
  83. extern TCHAR g_MainTitleText[MAX_MSG_TXT];
  84. extern TCHAR g_ExeFilePath[];
  85. extern TCHAR g_DumpFilePath[];
  86. extern TCHAR g_SrcFilePath[];
  87. enum
  88. {
  89. COL_PLAIN,
  90. COL_PLAIN_TEXT,
  91. COL_CURRENT_LINE,
  92. COL_CURRENT_LINE_TEXT,
  93. COL_BP_CURRENT_LINE,
  94. COL_BP_CURRENT_LINE_TEXT,
  95. COL_ENABLED_BP,
  96. COL_ENABLED_BP_TEXT,
  97. COL_DISABLED_BP,
  98. COL_DISABLED_BP_TEXT,
  99. COL_COUNT
  100. };
  101. #define OUT_MASK_COL_BASE 0xff00
  102. #define OUT_MASK_COL_COUNT 66
  103. #define USER_OUT_MASK_COL 64
  104. struct INDEXED_COLOR
  105. {
  106. PSTR Name;
  107. COLORREF Color;
  108. COLORREF Default;
  109. HBRUSH Brush;
  110. };
  111. extern INDEXED_COLOR g_Colors[];
  112. extern INDEXED_COLOR g_OutMaskColors[];
  113. #define CUSTCOL_COUNT 16
  114. extern COLORREF g_CustomColors[];
  115. //----------------------------------------------------------------------------
  116. //
  117. // Functions.
  118. //
  119. //----------------------------------------------------------------------------
  120. LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
  121. void UpdateFrameTitle(void);
  122. void SetTitleServerText(PCSTR Format, ...);
  123. void SetTitleSessionText(PCSTR Format, ...);
  124. void SetTitleExplicitText(PCSTR Text);
  125. void UpdateTitleSessionText(void);
  126. BOOL CreateUiInterfaces(BOOL Remote, LPTSTR CreateOptions);
  127. void ReleaseUiInterfaces(void);
  128. BOOL ParseCommandLine(BOOL FirstParse);
  129. #define StartDebugging() \
  130. PostMessage(g_hwndFrame, WU_START_ENGINE, 0, 0)
  131. void StopDebugging(BOOL UserRequest);
  132. void TerminateApplication(BOOL Cancellable);
  133. INDEXED_COLOR* GetIndexedColor(ULONG Index);
  134. BOOL SetColor(ULONG Index, COLORREF Color);
  135. BOOL GetOutMaskColors(ULONG Mask, COLORREF* Fg, COLORREF* Bg);
  136. //----------------------------------------------------------------------------
  137. //
  138. // Macros.
  139. //
  140. //----------------------------------------------------------------------------
  141. // Dbg have to be used for every assertion during Debugging time.
  142. // If false Dbg Opens a fatal error message Box and Stops program
  143. // Standard function to prompt an Assertion False
  144. void ShowAssert(PTSTR condition, UINT line, PTSTR file);
  145. // First, a sanity check
  146. #ifdef Dbg
  147. #undef Dbg
  148. #endif
  149. // Assert are assertions that will stay in final Release.
  150. // If false Assert Opens a fatal error message Box and Stops program
  151. #define RAssert(condition) \
  152. { \
  153. if (!(condition)) \
  154. { \
  155. ShowAssert( _T(#condition), __LINE__, _T(__FILE__) ); \
  156. } \
  157. }
  158. #ifdef DBG
  159. #define Assert RAssert
  160. #define Dbg RAssert
  161. #else // !DBG
  162. //#pragma warning(disable: 4553) // disable warnings for pure expressions
  163. //#pragma warning(disable: 4552) // disable level 4 warnings
  164. #define Assert(x) ((void)0)
  165. #define Dbg(condition) condition
  166. #endif
  167. #endif // _WINDBG_