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.

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