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.

430 lines
17 KiB

  1. // *********************************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation
  4. //
  5. // Module Name:
  6. //
  7. // SystemInfo.h
  8. //
  9. // Abstract:
  10. //
  11. // macros and function prototypes of SystemInfo.cpp
  12. //
  13. // Author:
  14. //
  15. // Sunil G.V.N. Murali ([email protected]) 22-Dec-2000
  16. //
  17. // Revision History:
  18. //
  19. // Sunil G.V.N. Murali ([email protected]) 22-Dec-2000 : Created It.
  20. //
  21. // *********************************************************************************
  22. #ifndef __SYSTEMINFO_H
  23. #define __SYSTEMINFO_H
  24. // resource header file
  25. #include "resource.h"
  26. //
  27. // NOTE: THIS MODULE WILL WRITTEN IN SUCH A FASHION THAT IT WORKS ONLY
  28. // IN UNICODE BUILD COMPILATION
  29. //
  30. #ifndef UNICODE
  31. #error Must compile only in unicode build environment
  32. #endif
  33. //
  34. // general purpose macros
  35. //
  36. #define EXIT_PROCESS( exitcode ) \
  37. ReleaseGlobals(); \
  38. return exitcode; \
  39. 1
  40. #define RELEASE_MEMORY( block ) \
  41. if ( (block) != NULL ) \
  42. { \
  43. delete (block); \
  44. (block) = NULL; \
  45. } \
  46. 1
  47. #define RELEASE_MEMORY_EX( block ) \
  48. if ( (block) != NULL ) \
  49. { \
  50. delete [] (block); \
  51. (block) = NULL; \
  52. } \
  53. 1
  54. #define DESTROY_ARRAY( array ) \
  55. if ( (array) != NULL ) \
  56. { \
  57. DestroyDynamicArray( &(array) ); \
  58. (array) = NULL; \
  59. } \
  60. 1
  61. //
  62. // constants / defines / enumerations
  63. //
  64. // registry path
  65. #define LOCALE_PATH L"MIME\\Database\\Rfc1766"
  66. // messages
  67. #define ERROR_USERNAME_BUT_NOMACHINE GetResString( IDS_ERROR_USERNAME_BUT_NOMACHINE )
  68. #define ERROR_PASSWORD_BUT_NOUSERNAME GetResString( IDS_ERROR_PASSWORD_BUT_NOUSERNAME )
  69. #define ERROR_USERNAME_EMPTY GetResString( IDS_ERROR_USERNAME_EMPTY )
  70. #define ERROR_NH_NOTSUPPORTED GetResString( IDS_ERROR_NH_NOTSUPPORTED )
  71. #define ERROR_SERVERNAME_EMPTY GetResString( IDS_ERROR_SERVERNAME_EMPTY )
  72. #define ERROR_INVALID_USAGE_REQUEST GetResString( IDS_ERROR_INVALID_USAGE_REQUEST )
  73. // output formats
  74. #define TEXT_FORMAT_LIST GetResString( IDS_TEXT_FORMAT_LIST )
  75. #define TEXT_FORMAT_TABLE GetResString( IDS_TEXT_FORMAT_TABLE )
  76. #define TEXT_FORMAT_CSV GetResString( IDS_TEXT_FORMAT_CSV )
  77. //
  78. // WMI related stuff
  79. // Win32_OperatingSystem class information
  80. #define WIN32_OPERATINGSYSTEM L"Win32_OperatingSystem"
  81. #define WIN32_OPERATINGSYSTEM_P_CAPTION L"Caption"
  82. #define WIN32_OPERATINGSYSTEM_P_CSNAME L"CSName"
  83. #define WIN32_OPERATINGSYSTEM_P_VERSION L"Version"
  84. #define WIN32_OPERATINGSYSTEM_P_CSDVERSION L"CSDVersion"
  85. #define WIN32_OPERATINGSYSTEM_P_BUILDNUMBER L"BuildNumber"
  86. #define WIN32_OPERATINGSYSTEM_P_MANUFACTURER L"Manufacturer"
  87. #define WIN32_OPERATINGSYSTEM_P_BUILDTYPE L"BuildType"
  88. #define WIN32_OPERATINGSYSTEM_P_REGUSER L"RegisteredUser"
  89. #define WIN32_OPERATINGSYSTEM_P_ORGANIZATION L"Organization"
  90. #define WIN32_OPERATINGSYSTEM_P_SERIALNUMBER L"SerialNumber"
  91. #define WIN32_OPERATINGSYSTEM_P_INSTALLDATE L"InstallDate"
  92. #define WIN32_OPERATINGSYSTEM_P_WINDOWSDIR L"WindowsDirectory"
  93. #define WIN32_OPERATINGSYSTEM_P_SYSTEMDIR L"SystemDirectory"
  94. #define WIN32_OPERATINGSYSTEM_P_BOOTDEVICE L"BootDevice"
  95. #define WIN32_OPERATINGSYSTEM_P_LOCALE L"Locale"
  96. #define WIN32_OPERATINGSYSTEM_P_FREEPHYSICALMEMORY L"FreePhysicalMemory"
  97. #define WIN32_OPERATINGSYSTEM_P_TOTALVIRTUALMEMORY L"TotalVirtualMemorySize"
  98. #define WIN32_OPERATINGSYSTEM_P_FREEVIRTUALMEMORY L"FreeVirtualMemory"
  99. // Win32_ComputerSystem class information
  100. #define WIN32_COMPUTERSYSTEM L"Win32_ComputerSystem"
  101. #define WIN32_COMPUTERSYSTEM_P_MODEL L"Model"
  102. #define WIN32_COMPUTERSYSTEM_P_SYSTEMTYPE L"SystemType"
  103. #define WIN32_COMPUTERSYSTEM_P_TOTALPHYSICALMEMORY L"TotalPhysicalMemory"
  104. #define WIN32_COMPUTERSYSTEM_P_MANUFACTURER L"Manufacturer"
  105. #define WIN32_COMPUTERSYSTEM_P_DOMAIN L"Domain"
  106. #define WIN32_COMPUTERSYSTEM_P_DOMAINROLE L"DomainRole"
  107. #define WIN32_COMPUTERSYSTEM_P_USERNAME L"UserName"
  108. // Win32_BIOS
  109. #define WIN32_BIOS L"Win32_BIOS"
  110. #define WIN32_BIOS_P_VERSION L"Version"
  111. // Win32_TimeZone
  112. #define WIN32_TIMEZONE L"Win32_TimeZone"
  113. #define WIN32_TIMEZONE_P_CAPTION L"Caption"
  114. // Win32_PageFile
  115. #define WIN32_PAGEFILE L"Win32_PageFileSetting"
  116. #define WIN32_PAGEFILE_P_NAME L"Name"
  117. // Win32_Processor
  118. #define WIN32_PROCESSOR L"Win32_Processor"
  119. #define WIN32_PROCESSOR_P_CAPTION L"Caption"
  120. #define WIN32_PROCESSOR_P_MANUFACTURER L"Manufacturer"
  121. #define WIN32_PROCESSOR_P_CURRENTCLOCKSPEED L"CurrentClockSpeed"
  122. #define WIN32_PROCESSOR_P_MAXCLOCKSPEED L"MaxClockSpeed"
  123. // Win32_PerfRawData_PerfOS_System
  124. #define WIN32_PERFRAWDATA_PERFOS_SYSTEM L"Win32_PerfRawData_PerfOS_System"
  125. #define WIN32_PERFRAWDATA_PERFOS_SYSTEM_P_SYSUPTIME L"SystemUpTime"
  126. #define WIN32_PERFRAWDATA_PERFOS_SYSTEM_P_TIMESTAMP L"Timestamp_Object"
  127. #define WIN32_PERFRAWDATA_PERFOS_SYSTEM_P_FREQUENCY L"Frequency_Object"
  128. // Win32_Keyboard
  129. #define WIN32_KEYBOARD L"Win32_Keyboard"
  130. #define WIN32_KEYBOARD_P_LAYOUT L"Layout"
  131. // Win32_QuickFixEngineering
  132. #define WIN32_QUICKFIXENGINEERING L"Win32_QuickFixEngineering"
  133. #define WIN32_QUICKFIXENGINEERING_P_HOTFIXID L"HotFixID"
  134. #define WIN32_QUICKFIXENGINEERING_P_FIXCOMMENTS L"FixComments"
  135. // Win32_NetworkAdapter
  136. #define WIN32_NETWORKADAPTER L"Win32_NetworkAdapter"
  137. #define WIN32_NETWORKADAPTER_P_INDEX L"Index"
  138. #define WIN32_NETWORKADAPTER_P_NETCONNECTIONID L"NetConnectionID"
  139. #define WIN32_NETWORKADAPTER_P_DESCRIPTION L"Description"
  140. #define WIN32_NETWORKADAPTER_P_STATUS L"NetConnectionStatus"
  141. // Win32_NetworkAdapterConfiguration
  142. #define WIN32_NETWORKADAPTERCONFIGURATION_GET L"Win32_NetworkAdapterConfiguration.Index=%d"
  143. #define WIN32_NETWORKADAPTERCONFIGURATION_P_IPADDRESS L"IPAddress"
  144. #define WIN32_NETWORKADAPTERCONFIGURATION_P_DHCPENABLED L"DHCPEnabled"
  145. #define WIN32_NETWORKADAPTERCONFIGURATION_P_DHCPSERVER L"DHCPServer"
  146. //
  147. // registry specific
  148. // registry paths
  149. #define SUBKEY_VOLATILE_ENVIRONMENT L"Volatile Environment"
  150. #define KEY_LOGONSERVER L"LOGONSERVER"
  151. //
  152. // column heading names and their indexes in the array ( in fact positions )
  153. #define MAX_COLUMNS 32
  154. // column headings
  155. #define COLHEAD_HOSTNAME GetResString( IDS_COLHEAD_HOSTNAME )
  156. #define COLHEAD_OS_NAME GetResString( IDS_COLHEAD_OS_NAME )
  157. #define COLHEAD_OS_VERSION GetResString( IDS_COLHEAD_OS_VERSION )
  158. #define COLHEAD_OS_MANUFACTURER GetResString( IDS_COLHEAD_OS_MANUFACTURER )
  159. #define COLHEAD_OS_CONFIG GetResString( IDS_COLHEAD_OS_CONFIG )
  160. #define COLHEAD_OS_BUILDTYPE GetResString( IDS_COLHEAD_OS_BUILDTYPE )
  161. #define COLHEAD_REG_OWNER GetResString( IDS_COLHEAD_REG_OWNER )
  162. #define COLHEAD_REG_ORG GetResString( IDS_COLHEAD_REG_ORG )
  163. #define COLHEAD_PRODUCT_ID GetResString( IDS_COLHEAD_PRODUCT_ID )
  164. #define COLHEAD_INSTALL_DATE GetResString( IDS_COLHEAD_INSTALL_DATE )
  165. #define COLHEAD_SYSTEM_UPTIME GetResString( IDS_COLHEAD_SYSTEM_UPTIME )
  166. #define COLHEAD_SYSTEM_MANUFACTURER GetResString( IDS_COLHEAD_SYSTEM_MANUFACTURER )
  167. #define COLHEAD_SYSTEM_MODEL GetResString( IDS_COLHEAD_SYSTEM_MODEL )
  168. #define COLHEAD_SYSTEM_TYPE GetResString( IDS_COLHEAD_SYSTEM_TYPE )
  169. #define COLHEAD_PROCESSOR GetResString( IDS_COLHEAD_PROCESSOR )
  170. #define COLHEAD_BIOS_VERSION GetResString( IDS_COLHEAD_BIOS_VERSION )
  171. #define COLHEAD_WINDOWS_DIRECTORY GetResString( IDS_COLHEAD_WINDOWS_DIRECTORY )
  172. #define COLHEAD_SYSTEM_DIRECTORY GetResString( IDS_COLHEAD_SYSTEM_DIRECTORY )
  173. #define COLHEAD_BOOT_DEVICE GetResString( IDS_COLHEAD_BOOT_DEVICE )
  174. #define COLHEAD_SYSTEM_LOCALE GetResString( IDS_COLHEAD_SYSTEM_LOCALE )
  175. #define COLHEAD_INPUT_LOCALE GetResString( IDS_COLHEAD_INPUT_LOCALE )
  176. #define COLHEAD_TIME_ZONE GetResString( IDS_COLHEAD_TIME_ZONE )
  177. #define COLHEAD_TOTAL_PHYSICAL_MEMORY GetResString( IDS_COLHEAD_TOTAL_PHYSICAL_MEMORY )
  178. #define COLHEAD_AVAILABLE_PHYSICAL_MEMORY GetResString( IDS_COLHEAD_AVAILABLE_PHYSICAL_MEMORY )
  179. #define COLHEAD_VIRTUAL_MEMORY_MAX GetResString( IDS_COLHEAD_VIRTUAL_MEMORY_MAX )
  180. #define COLHEAD_VIRTUAL_MEMORY_AVAILABLE GetResString( IDS_COLHEAD_VIRTUAL_MEMORY_AVAILABLE )
  181. #define COLHEAD_VIRTUAL_MEMORY_INUSE GetResString( IDS_COLHEAD_VIRTUAL_MEMORY_INUSE )
  182. #define COLHEAD_PAGEFILE_LOCATION GetResString( IDS_COLHEAD_PAGEFILE_LOCATION )
  183. #define COLHEAD_DOMAIN GetResString( IDS_COLHEAD_DOMAIN )
  184. #define COLHEAD_LOGON_SERVER GetResString( IDS_COLHEAD_LOGON_SERVER )
  185. #define COLHEAD_HOTFIX GetResString( IDS_COLHEAD_HOTFIX )
  186. #define COLHEAD_NETWORK_CARD GetResString( IDS_COLHEAD_NETWORK_CARD )
  187. // colwidths
  188. #define COLWIDTH_HOSTNAME AsLong( GetResString( IDS_COLWIDTH_HOSTNAME ), 10 )
  189. #define COLWIDTH_OS_NAME AsLong( GetResString( IDS_COLWIDTH_OS_NAME ), 10 )
  190. #define COLWIDTH_OS_VERSION AsLong( GetResString( IDS_COLWIDTH_OS_VERSION ), 10 )
  191. #define COLWIDTH_OS_MANUFACTURER AsLong( GetResString( IDS_COLWIDTH_OS_MANUFACTURER ), 10 )
  192. #define COLWIDTH_OS_CONFIG AsLong( GetResString( IDS_COLWIDTH_OS_CONFIG ), 10 )
  193. #define COLWIDTH_OS_BUILDTYPE AsLong( GetResString( IDS_COLWIDTH_OS_BUILDTYPE ), 10 )
  194. #define COLWIDTH_REG_OWNER AsLong( GetResString( IDS_COLWIDTH_REG_OWNER ), 10 )
  195. #define COLWIDTH_REG_ORG AsLong( GetResString( IDS_COLWIDTH_REG_ORG ), 10 )
  196. #define COLWIDTH_PRODUCT_ID AsLong( GetResString( IDS_COLWIDTH_PRODUCT_ID ), 10 )
  197. #define COLWIDTH_INSTALL_DATE AsLong( GetResString( IDS_COLWIDTH_INSTALL_DATE ), 10 )
  198. #define COLWIDTH_SYSTEM_UPTIME AsLong( GetResString( IDS_COLWIDTH_SYSTEM_UPTIME ), 10 )
  199. #define COLWIDTH_SYSTEM_MANUFACTURER AsLong( GetResString( IDS_COLWIDTH_SYSTEM_MANUFACTURER ), 10 )
  200. #define COLWIDTH_SYSTEM_MODEL AsLong( GetResString( IDS_COLWIDTH_SYSTEM_MODEL ), 10 )
  201. #define COLWIDTH_SYSTEM_TYPE AsLong( GetResString( IDS_COLWIDTH_SYSTEM_TYPE ), 10 )
  202. #define COLWIDTH_PROCESSOR AsLong( GetResString( IDS_COLWIDTH_PROCESSOR ), 10 )
  203. #define COLWIDTH_BIOS_VERSION AsLong( GetResString( IDS_COLWIDTH_BIOS_VERSION ), 10 )
  204. #define COLWIDTH_WINDOWS_DIRECTORY AsLong( GetResString( IDS_COLWIDTH_WINDOWS_DIRECTORY ), 10 )
  205. #define COLWIDTH_SYSTEM_DIRECTORY AsLong( GetResString( IDS_COLWIDTH_SYSTEM_DIRECTORY ), 10 )
  206. #define COLWIDTH_BOOT_DEVICE AsLong( GetResString( IDS_COLWIDTH_BOOT_DEVICE ), 10 )
  207. #define COLWIDTH_SYSTEM_LOCALE AsLong( GetResString( IDS_COLWIDTH_SYSTEM_LOCALE ), 10 )
  208. #define COLWIDTH_INPUT_LOCALE AsLong( GetResString( IDS_COLWIDTH_INPUT_LOCALE ), 10 )
  209. #define COLWIDTH_TIME_ZONE AsLong( GetResString( IDS_COLWIDTH_TIME_ZONE ), 10 )
  210. #define COLWIDTH_TOTAL_PHYSICAL_MEMORY AsLong( GetResString( IDS_COLWIDTH_TOTAL_PHYSICAL_MEMORY ), 10 )
  211. #define COLWIDTH_AVAILABLE_PHYSICAL_MEMORY AsLong( GetResString( IDS_COLWIDTH_AVAILABLE_PHYSICAL_MEMORY ), 10 )
  212. #define COLWIDTH_VIRTUAL_MEMORY_MAX AsLong( GetResString( IDS_COLWIDTH_VIRTUAL_MEMORY_MAX ), 10 )
  213. #define COLWIDTH_VIRTUAL_MEMORY_AVAILABLE AsLong( GetResString( IDS_COLWIDTH_VIRTUAL_MEMORY_AVAILABLE ), 10 )
  214. #define COLWIDTH_VIRTUAL_MEMORY_INUSE AsLong( GetResString( IDS_COLWIDTH_VIRTUAL_MEMORY_INUSE ), 10 )
  215. #define COLWIDTH_PAGEFILE_LOCATION AsLong( GetResString( IDS_COLWIDTH_PAGEFILE_LOCATION ), 10 )
  216. #define COLWIDTH_DOMAIN AsLong( GetResString( IDS_COLWIDTH_DOMAIN ), 10 )
  217. #define COLWIDTH_LOGON_SERVER AsLong( GetResString( IDS_COLWIDTH_LOGON_SERVER ), 10 )
  218. #define COLWIDTH_HOTFIX AsLong( GetResString( IDS_COLWIDTH_HOTFIX ), 10 )
  219. #define COLWIDTH_NETWORK_CARD AsLong( GetResString( IDS_COLWIDTH_NETWORK_CARD ), 10 )
  220. // indexes
  221. #define CI_HOSTNAME 0
  222. #define CI_OS_NAME 1
  223. #define CI_OS_VERSION 2
  224. #define CI_OS_MANUFACTURER 3
  225. #define CI_OS_CONFIG 4
  226. #define CI_OS_BUILDTYPE 5
  227. #define CI_REG_OWNER 6
  228. #define CI_REG_ORG 7
  229. #define CI_PRODUCT_ID 8
  230. #define CI_INSTALL_DATE 9
  231. #define CI_SYSTEM_UPTIME 10
  232. #define CI_SYSTEM_MANUFACTURER 11
  233. #define CI_SYSTEM_MODEL 12
  234. #define CI_SYSTEM_TYPE 13
  235. #define CI_PROCESSOR 14
  236. #define CI_BIOS_VERSION 15
  237. #define CI_WINDOWS_DIRECTORY 16
  238. #define CI_SYSTEM_DIRECTORY 17
  239. #define CI_BOOT_DEVICE 18
  240. #define CI_SYSTEM_LOCALE 19
  241. #define CI_INPUT_LOCALE 20
  242. #define CI_TIME_ZONE 21
  243. #define CI_TOTAL_PHYSICAL_MEMORY 22
  244. #define CI_AVAILABLE_PHYSICAL_MEMORY 23
  245. #define CI_VIRTUAL_MEMORY_MAX 24
  246. #define CI_VIRTUAL_MEMORY_AVAILABLE 25
  247. #define CI_VIRTUAL_MEMORY_INUSE 26
  248. #define CI_PAGEFILE_LOCATION 27
  249. #define CI_DOMAIN 28
  250. #define CI_LOGON_SERVER 29
  251. #define CI_HOTFIX 30
  252. #define CI_NETWORK_CARD 31
  253. // formats
  254. #define FMT_OSVERSION GetResString( IDS_FMT_OSVERSION )
  255. #define FMT_KILOBYTES GetResString( IDS_FMT_KILOBYTES )
  256. #define FMT_MEGABYTES GetResString( IDS_FMT_MEGABYTES )
  257. #define FMT_PROCESSOR_TOTAL GetResString( IDS_FMT_PROCESSOR_TOTAL )
  258. #define FMT_PROCESSOR_INFO GetResString( IDS_FMT_PROCESSOR_INFO )
  259. #define FMT_UPTIME GetResString( IDS_FMT_UPTIME )
  260. #define FMT_HOTFIX_TOTAL GetResString( IDS_FMT_HOTFIX_TOTAL )
  261. #define FMT_HOTFIX_INFO GetResString( IDS_FMT_HOTFIX_INFO )
  262. #define FMT_NIC_TOTAL GetResString( IDS_FMT_NIC_TOTAL )
  263. #define FMT_NIC_INFO GetResString( IDS_FMT_NIC_INFO )
  264. #define FMT_NIC_STATUS GetResString( IDS_FMT_NIC_STATUS )
  265. #define FMT_DHCP_STATUS GetResString( IDS_FMT_DHCP_STATUS )
  266. #define FMT_DHCP_SERVER GetResString( IDS_FMT_DHCP_SERVER )
  267. #define FMT_IPADDRESS_TOTAL GetResString( IDS_FMT_IPADDRESS_TOTAL )
  268. #define FMT_IPADDRESS_INFO GetResString( IDS_FMT_IPADDRESS_INFO )
  269. #define FMT_CONNECTION GetResString( IDS_FMT_CONNECTION )
  270. //
  271. // Mapping information of Win32_ComputerSystem's DomainRole property
  272. // NOTE: Refer to the _DSROLE_MACHINE_ROLE enumeration values in DsRole.h header file
  273. #define VALUE_STANDALONEWORKSTATION GetResString( IDS_VALUE_STANDALONEWORKSTATION )
  274. #define VALUE_MEMBERWORKSTATION GetResString( IDS_VALUE_MEMBERWORKSTATION )
  275. #define VALUE_STANDALONESERVER GetResString( IDS_VALUE_STANDALONESERVER )
  276. #define VALUE_MEMBERSERVER GetResString( IDS_VALUE_MEMBERSERVER )
  277. #define VALUE_BACKUPDOMAINCONTROLLER GetResString( IDS_VALUE_BACKUPDOMAINCONTROLLER )
  278. #define VALUE_PRIMARYDOMAINCONTROLLER GetResString( IDS_VALUE_PRIMARYDOMAINCONTROLLER )
  279. // netcard status mapping
  280. #define VALUE_DISCONNECTED GetResString( IDS_VALUE_DISCONNECTED )
  281. #define VALUE_CONNECTING GetResString( IDS_VALUE_CONNECTING )
  282. #define VALUE_CONNECTED GetResString( IDS_VALUE_CONNECTED )
  283. #define VALUE_DISCONNECTING GetResString( IDS_VALUE_DISCONNECTING )
  284. #define VALUE_HWNOTPRESENT GetResString( IDS_VALUE_HWNOTPRESENT )
  285. #define VALUE_HWDISABLED GetResString( IDS_VALUE_HWDISABLED )
  286. #define VALUE_HWMALFUNCTION GetResString( IDS_VALUE_HWMALFUNCTION )
  287. #define VALUE_MEDIADISCONNECTED GetResString( IDS_VALUE_MEDIADISCONNECTED )
  288. #define VALUE_AUTHENTICATING GetResString( IDS_VALUE_AUTHENTICATING )
  289. #define VALUE_AUTHSUCCEEDED GetResString( IDS_VALUE_AUTHSUCCEEDED )
  290. #define VALUE_AUTHFAILED GetResString( IDS_VALUE_AUTHFAILED )
  291. #define VALUE_YES GetResString( IDS_VALUE_YES )
  292. #define VALUE_NO GetResString( IDS_VALUE_NO )
  293. // status messages
  294. #define MSG_OSINFO GetResString( IDS_MSG_OSINFO )
  295. #define MSG_COMPINFO GetResString( IDS_MSG_COMPINFO )
  296. #define MSG_PERFINFO GetResString( IDS_MSG_PERFINFO )
  297. #define MSG_PROCESSORINFO GetResString( IDS_MSG_PROCESSORINFO )
  298. #define MSG_BIOSINFO GetResString( IDS_MSG_BIOSINFO )
  299. #define MSG_INPUTLOCALEINFO GetResString( IDS_MSG_INPUTLOCALEINFO )
  300. #define MSG_TZINFO GetResString( IDS_MSG_TZINFO )
  301. #define MSG_PAGEFILEINFO GetResString( IDS_MSG_PAGEFILEINFO )
  302. #define MSG_HOTFIXINFO GetResString( IDS_MSG_HOTFIXINFO )
  303. #define MSG_NICINFO GetResString( IDS_MSG_NICINFO )
  304. #define MSG_PROFILEINFO GetResString( IDS_MSG_PROFILEINFO )
  305. //
  306. // command line options
  307. // command line options and their indexes in the array
  308. #define MAX_OPTIONS 6
  309. // options allowed ( no need to localize )
  310. #define OPTION_USAGE _T( "?" )
  311. #define OPTION_SERVER _T( "s" )
  312. #define OPTION_USERNAME _T( "u" )
  313. #define OPTION_PASSWORD _T( "p" )
  314. #define OPTION_FORMAT _T( "fo" )
  315. #define OPTION_NOHEADER _T( "nh" )
  316. // option indexes
  317. #define OI_USAGE 0
  318. #define OI_SERVER 1
  319. #define OI_USERNAME 2
  320. #define OI_PASSWORD 3
  321. #define OI_FORMAT 4
  322. #define OI_NOHEADER 5
  323. // values allowed for format
  324. #define OVALUES_FORMAT GetResString( IDS_OVALUES_FORMAT )
  325. //
  326. // CSystemInfo
  327. //
  328. class CSystemInfo
  329. {
  330. // constructor / destructor
  331. public:
  332. CSystemInfo();
  333. ~CSystemInfo();
  334. // data members
  335. private:
  336. // command line options
  337. CHString m_strServer;
  338. CHString m_strUserName;
  339. CHString m_strPassword;
  340. // WMI interfaces
  341. IWbemLocator* m_pWbemLocator;
  342. IWbemServices* m_pWbemServices;
  343. // progress message related
  344. HANDLE m_hOutput;
  345. CONSOLE_SCREEN_BUFFER_INFO m_csbi;
  346. // other(s)
  347. TARRAY m_arrData; // output data storage
  348. PTCOLUMNS m_pColumns; // output columns information
  349. BOOL m_bNeedPassword; // indicates whether password needs to be accepted or not
  350. BOOL m_bCloseConnection; // indicate whether closeconnection function to be called or not
  351. CHString m_strLogonUser; // used to find the logon server
  352. COAUTHIDENTITY* m_pAuthIdentity; // auth identity
  353. public:
  354. BOOL m_bUsage;
  355. DWORD m_dwFormat;
  356. // methods
  357. private:
  358. BOOL LoadOSInfo();
  359. BOOL LoadBiosInfo();
  360. BOOL LoadHotfixInfo();
  361. BOOL LoadProfileInfo();
  362. BOOL LoadComputerInfo();
  363. BOOL LoadTimeZoneInfo();
  364. BOOL LoadPageFileInfo();
  365. BOOL LoadKeyboardInfo();
  366. BOOL LoadProcessorInfo();
  367. BOOL LoadPerformanceInfo();
  368. BOOL LoadNetworkCardInfo();
  369. // output related ...
  370. BOOL AllocateColumns();
  371. public:
  372. BOOL LoadData();
  373. BOOL Initialize();
  374. BOOL ProcessOptions( DWORD argc, LPCTSTR argv[] );
  375. BOOL Connect();
  376. VOID ShowUsage();
  377. VOID ShowOutput( DWORD dwStart = 0, DWORD dwEnd = MAX_COLUMNS );
  378. };
  379. #endif // __SYSTEMINFO_H