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.

241 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. ntsdexts.c
  5. Abstract:
  6. This function contains the default ntsd debugger extensions
  7. Author:
  8. Mark Lucovsky (markl) 09-Apr-1991
  9. Revision History:
  10. --*/
  11. #include "ntsdextp.h"
  12. extern WINDBG_EXTENSION_APIS ExtensionApis;
  13. extern HANDLE ExtensionCurrentProcess;
  14. VOID
  15. PrintFlagValue(
  16. LPCTSTR lpString
  17. )
  18. {
  19. BOOL retval= FALSE;
  20. PVOID p;
  21. TCHAR Argument[100];
  22. sprintf( Argument, "winnt32u!%s", lpString );
  23. p = (PVOID) GetExpression( Argument );
  24. if (!p) {
  25. sprintf( Argument, "winnt32a!%s", lpString );
  26. p = (PVOID) GetExpression( Argument );
  27. }
  28. if (p) {
  29. move( retval, p );
  30. dprintf( "%s : %s (at address 0x%08x)\n", lpString, retval ? "TRUE" : "FALSE", p );
  31. } else {
  32. dprintf( "Couldn't find global flag %s\n" , lpString );
  33. }
  34. }
  35. #define ANSIFORMAT "%s : %s (at address 0x%08x)\n"
  36. #define UNICODEFORMAT "%s : %ws (at address 0x%08x)\n"
  37. #define ANSIARRAYFORMAT "%s[%i] : %s (at address 0x%08x)\n"
  38. #define UNICODEARRAYFORMAT "%s[%i] : %ws (at address 0x%08x)\n"
  39. #define MAX_OPTIONALDIRS 20
  40. #define MAX_SOURCE_COUNT 8
  41. VOID
  42. PrintStringBufferValue(
  43. LPCTSTR lpString
  44. )
  45. {
  46. WCHAR Data[MAX_PATH];
  47. PVOID p;
  48. TCHAR Argument[100];
  49. BOOL fUnicode = TRUE;
  50. sprintf( Argument, "winnt32u!%s", lpString );
  51. p = (PVOID) GetExpression( Argument );
  52. if (!p) {
  53. sprintf( Argument, "winnt32a!%s", lpString );
  54. p = (PVOID) GetExpression( Argument );
  55. fUnicode = FALSE;
  56. }
  57. if (p) {
  58. move( Data, p );
  59. dprintf( fUnicode ? UNICODEFORMAT : ANSIFORMAT, lpString, Data, p );
  60. } else {
  61. dprintf( "Couldn't find global string buffer %s\n" , lpString );
  62. }
  63. }
  64. VOID
  65. PrintStringBufferArrayValue(
  66. LPCTSTR lpString,
  67. DWORD ElementSize,
  68. DWORD ArraySize
  69. )
  70. {
  71. WCHAR Data[MAX_PATH];
  72. PVOID p;
  73. TCHAR Argument[100];
  74. TCHAR Format[100];
  75. BOOL fUnicode = TRUE;
  76. DWORD i;
  77. sprintf( Argument, "winnt32u!%s", lpString );
  78. p = (PVOID) GetExpression( Argument );
  79. if (!p) {
  80. sprintf( Argument, "winnt32a!%s", lpString );
  81. p = (PVOID) GetExpression( Argument );
  82. fUnicode = FALSE;
  83. }
  84. if (p) {
  85. for (i = 0; i< ArraySize; i++) {
  86. move( Data, ((LPBYTE)p+(i*ElementSize* (fUnicode) ? sizeof(WCHAR) : sizeof(CHAR))) );
  87. dprintf( fUnicode ? UNICODEARRAYFORMAT : ANSIARRAYFORMAT ,
  88. lpString, i, Data, p );
  89. }
  90. } else {
  91. dprintf( "Couldn't find global string buffer %s\n" , lpString );
  92. }
  93. }
  94. DECLARE_API( winntflags )
  95. /*++
  96. Routine Description:
  97. This debugger extension dumps winnt32 flags
  98. Arguments:
  99. Return Value:
  100. --*/
  101. {
  102. DWORD ReturnLength;
  103. PVOID pst;
  104. DWORD i, offset;
  105. PVOID stdata,pextradata;
  106. //BOOL val;
  107. INIT_API();
  108. dprintf("\t\t****winnt32 global flags****\n");
  109. PrintFlagValue( "Server" );
  110. PrintFlagValue( "Upgrade" );
  111. PrintFlagValue( "UnattendedOperation" );
  112. dprintf("\n");
  113. PrintFlagValue( "CheckUpgradeOnly" );
  114. PrintFlagValue( "Aborted" );
  115. PrintFlagValue( "Cancelled" );
  116. PrintFlagValue( "CancelPending" );
  117. dprintf("\n");
  118. PrintFlagValue( "ChoosePartition" );
  119. PrintFlagValue( "Floppyless" );
  120. PrintFlagValue( "ForceNTFSConversion" );
  121. PrintFlagValue( "NTFSConversionChanged" );
  122. PrintFlagValue( "HideWinDir" );
  123. PrintFlagValue( "MakeBootMedia" );
  124. PrintFlagValue( "MakeLocalSource" );
  125. PrintFlagValue( "OemPreinstall" );
  126. PrintFlagValue( "RunFromCD" );
  127. dprintf("\n");
  128. PrintFlagValue( "BlockOnNotEnoughSpace" );
  129. PrintFlagValue( "SkipLocaleCheck" );
  130. PrintFlagValue( "AccessibleKeyboard" );
  131. PrintFlagValue( "AccessibleMagnifier" );
  132. PrintFlagValue( "AccessibleReader" );
  133. PrintFlagValue( "AccessibleSetup" );
  134. PrintFlagValue( "AccessibleVoice" );
  135. PrintFlagValue( "AutomaticallyShutDown" );
  136. PrintFlagValue( "AutoSkipMissingFiles" );
  137. dprintf("\n");
  138. PrintFlagValue( "GlobalResult" );
  139. dprintf("\n");
  140. }
  141. DECLARE_API( winntstr )
  142. /*++
  143. Routine Description:
  144. This debugger extension dumps winnt32 string global info
  145. Arguments:
  146. Return Value:
  147. --*/
  148. {
  149. DWORD ReturnLength;
  150. PVOID pst;
  151. DWORD i, offset;
  152. PVOID stdata,pextradata;
  153. //BOOL val;
  154. INIT_API();
  155. dprintf("\t\t****winnt32 global strings****\n");
  156. PrintStringBufferValue( "AccessibleScriptFile" );
  157. PrintStringBufferValue( "AlternateSourcePath" );
  158. PrintStringBufferValue( "FirstFloppyDriveLetter" );
  159. PrintStringBufferValue( "ForcedSystemPartition" );
  160. PrintStringBufferValue( "InfName" );
  161. PrintStringBufferValue( "InstallDir" );
  162. PrintStringBufferValue( "LocalBackupDirectory" );
  163. PrintStringBufferValue( "LocalBootDirectory" );
  164. PrintStringBufferValue( "LocalSourceDirectory" );
  165. PrintStringBufferValue( "LocalSourceDrive" );
  166. PrintStringBufferValue( "LocalSourceWithPlatform" );
  167. PrintStringBufferValue( "ProductId" );
  168. PrintStringBufferValue( "SystemPartitionDriveLetter" );
  169. PrintStringBufferValue( "SystemPartitionDriveLetters" );
  170. PrintStringBufferValue( "UserSpecifiedLocalSourceDrive" );
  171. PrintStringBufferArrayValue( "OptionalDirectories", MAX_PATH, MAX_OPTIONALDIRS );
  172. PrintStringBufferArrayValue( "SourcePaths", MAX_PATH, MAX_SOURCE_COUNT );
  173. dprintf("\n");
  174. }