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.

167 lines
5.1 KiB

  1. /*++
  2. Copyright (c) 1995-2000 Microsoft Corporation
  3. Module Name:
  4. qsys.c
  5. Abstract:
  6. This program simply interfaces with NtQuerySystemInformation()
  7. and dumps the data structures.
  8. Usage:
  9. qsys
  10. Author:
  11. Thierry Fevrier 26-Feb-2000
  12. Revision History:
  13. 02/26/2000 Thierry
  14. Created.
  15. --*/
  16. // If under our build environment'S', we want to get all our
  17. // favorite debug macros defined.
  18. //
  19. #if DBG // NTBE environment
  20. #if NDEBUG
  21. #undef NDEBUG // <assert.h>: assert() is defined
  22. #endif // NDEBUG
  23. #define _DEBUG // <crtdbg.h>: _ASSERT(), _ASSERTE() are defined.
  24. #define DEBUG 1 // our internal file debug flag
  25. #elif _DEBUG // VC++ environment
  26. #ifndef NEBUG
  27. #define NDEBUG
  28. #endif // !NDEBUG
  29. #define DEBUG 1 // our internal file debug flag
  30. #endif
  31. //
  32. // Include System Header files
  33. //
  34. #include <nt.h>
  35. #include <ntrtl.h>
  36. #include <nturtl.h>
  37. #include <windows.h>
  38. #include <assert.h>
  39. #include <stdio.h>
  40. #include <stdlib.h>
  41. #include <string.h>
  42. #include <memory.h>
  43. #include ".\qsys.rc"
  44. #define FPRINTF (void)fprintf
  45. #include ".\basic.c"
  46. #include ".\proc.c"
  47. #include ".\sysperf.c"
  48. #include ".\procperf.c"
  49. #include ".\procidle.c"
  50. #include ".\tod.c"
  51. #include ".\qtimeadj.c"
  52. #include ".\flags.c"
  53. #include ".\filecache.c"
  54. #include ".\dev.c"
  55. #include ".\crashdump.c"
  56. #include ".\except.c"
  57. #include ".\crashstate.c"
  58. #include ".\kdbg.c"
  59. #include ".\ctxswitch.c"
  60. #include ".\regquota.c"
  61. #include ".\dpc.c"
  62. #include ".\verifier.c"
  63. #include ".\legaldrv.c"
  64. #define QUERY_INFO( _Info_Class, _Type ) \
  65. { \
  66. _Type info; \
  67. status = NtQuerySystemInformation( _Info_Class, \
  68. &info, \
  69. sizeof(info), \
  70. NULL \
  71. ); \
  72. if ( !NT_SUCCESS(status) ) { \
  73. printf( "\n%s: %s failed...\n", VER_INTERNALNAME_STR, # _Info_Class ); \
  74. } \
  75. Print##_Type##(&info); \
  76. }
  77. int
  78. __cdecl
  79. main (
  80. int argc,
  81. char *argv[]
  82. )
  83. {
  84. NTSTATUS status;
  85. //
  86. // Print version of the Build environment to identify
  87. // the data structures definitions.
  88. //
  89. printf( "qsys v%s\n", VER_PRODUCTVERSION_STR );
  90. //
  91. // First, dump fixed data structures.
  92. //
  93. QUERY_INFO( SystemBasicInformation, SYSTEM_BASIC_INFORMATION );
  94. QUERY_INFO( SystemProcessorInformation, SYSTEM_PROCESSOR_INFORMATION );
  95. QUERY_INFO( SystemPerformanceInformation, SYSTEM_PERFORMANCE_INFORMATION );
  96. QUERY_INFO( SystemProcessorPerformanceInformation, SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION );
  97. QUERY_INFO( SystemProcessorIdleInformation, SYSTEM_PROCESSOR_IDLE_INFORMATION );
  98. QUERY_INFO( SystemTimeOfDayInformation, SYSTEM_TIMEOFDAY_INFORMATION );
  99. QUERY_INFO( SystemTimeAdjustmentInformation, SYSTEM_QUERY_TIME_ADJUST_INFORMATION );
  100. QUERY_INFO( SystemFlagsInformation, SYSTEM_FLAGS_INFORMATION );
  101. QUERY_INFO( SystemFileCacheInformation, SYSTEM_FILECACHE_INFORMATION );
  102. QUERY_INFO( SystemDeviceInformation, SYSTEM_DEVICE_INFORMATION );
  103. // QUERY_INFO( SystemCrashDumpInformation, SYSTEM_CRASH_DUMP_INFORMATION );
  104. QUERY_INFO( SystemExceptionInformation, SYSTEM_EXCEPTION_INFORMATION );
  105. // QUERY_INFO( SystemCrashDumpStateInformation, SYSTEM_CRASH_STATE_INFORMATION );
  106. QUERY_INFO( SystemKernelDebuggerInformation, SYSTEM_KERNEL_DEBUGGER_INFORMATION );
  107. QUERY_INFO( SystemContextSwitchInformation, SYSTEM_CONTEXT_SWITCH_INFORMATION );
  108. QUERY_INFO( SystemRegistryQuotaInformation, SYSTEM_REGISTRY_QUOTA_INFORMATION );
  109. QUERY_INFO( SystemDpcBehaviorInformation, SYSTEM_DPC_BEHAVIOR_INFORMATION );
  110. // QUERY_INFO( SystemCurrentTimeZoneInformation, RTL_TIME_ZONE_INFORMATION );
  111. QUERY_INFO( SystemLegacyDriverInformation, SYSTEM_LEGACY_DRIVER_INFORMATION );
  112. // SystemRangeStartInformation
  113. //
  114. // Second, dump dynamic data structures.
  115. //
  116. // not done, yet...
  117. // QUERY_INFO( SystemVerifierInformation, SYSTEM_VERIFIER_INFORMATION );
  118. // _SYSTEM_CALL_COUNT_INFORMATION
  119. // _SYSTEM_MODULE_INFORMATION
  120. // _SYSTEM_LOCKS_INFORMATION
  121. // _SYSTEM_PAGED_POOL_INFORMATION
  122. // _SYSTEM_NONPAGED_POOL_INFORMATION
  123. // _SYSTEM_OBJECT_INFORMATION
  124. // _SYSTEM_OBJECTTYPE_INFORMATION
  125. // _SYSTEM_HANDLE_INFORMATION
  126. // _SYSTEM_HANDLE_TABLE_ENTRY_INFO
  127. // _SYSTEM_PAGEFILE_INFORMATION
  128. // _SYSTEM_POOL_INFORMATION
  129. // _SYSTEM_POOLTAG
  130. // _SYSTEM_POOLTAG_INFORMATION
  131. // QUERY_INFO( SystemInterruptInformation, SYSTEM_INTERRUPT_INFORMATION );
  132. // SystemLookasideInformation
  133. // _SYSTEM_SESSION_PROCESS_INFORMATION
  134. // _SYSTEM_THREAD_INFORMATION
  135. // _SYSTEM_PROCESS_INFORMATION
  136. return 0;
  137. } // qsys:main()