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.

531 lines
17 KiB

  1. // *********************************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation
  4. //
  5. // Module Name:
  6. //
  7. // TaskList.h
  8. //
  9. // Abstract:
  10. //
  11. // macros and function prototypes of TList.cpp
  12. //
  13. // Author:
  14. //
  15. // Sunil G.V.N. Murali ([email protected]) 24-Sep-2000
  16. //
  17. // Revision History:
  18. //
  19. // Sunil G.V.N. Murali ([email protected]) 24-Sep-2000 : Created It.
  20. //
  21. // *********************************************************************************
  22. #ifndef _TASKLIST_H
  23. #define _TASKLIST_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 HEAP_FREE( pointer ) \
  41. if ( (pointer) != NULL ) \
  42. { \
  43. HeapFree( GetProcessHeap(), 0, (pointer) ); \
  44. (pointer) = NULL; \
  45. } \
  46. 1
  47. #define SHOW_MESSAGE_EX( tag, message ) \
  48. { \
  49. CHString strBuffer; \
  50. strBuffer.Format( L"%s %s", tag, message ); \
  51. ShowMessage( stderr, strBuffer ); \
  52. } \
  53. 1
  54. //
  55. // winstation related structures ( extract from winsta.h - internal file )
  56. //
  57. //
  58. // structures
  59. typedef struct _CITRIX_PROCESS_INFORMATION {
  60. ULONG MagicNumber;
  61. ULONG LogonId;
  62. PVOID ProcessSid;
  63. ULONG Pad;
  64. } CITRIX_PROCESS_INFORMATION, * PCITRIX_PROCESS_INFORMATION;
  65. // ...
  66. typedef struct _TS_UNICODE_STRING {
  67. USHORT Length;
  68. USHORT MaximumLength;
  69. PWSTR Buffer;
  70. } TS_UNICODE_STRING;
  71. // CAUTION:
  72. // TS_SYSTEM_PROCESS_INFORMATION is duplicated from ntexapi.h, and slightly modified.
  73. // (not nice, but necessary because the Midl compiler doesn't like PVOID !)
  74. typedef struct _TS_SYSTEM_PROCESS_INFORMATION {
  75. ULONG NextEntryOffset;
  76. ULONG NumberOfThreads;
  77. LARGE_INTEGER SpareLi1;
  78. LARGE_INTEGER SpareLi2;
  79. LARGE_INTEGER SpareLi3;
  80. LARGE_INTEGER CreateTime;
  81. LARGE_INTEGER UserTime;
  82. LARGE_INTEGER KernelTime;
  83. TS_UNICODE_STRING ImageName;
  84. LONG BasePriority; // KPRIORITY in ntexapi.h
  85. DWORD UniqueProcessId; // HANDLE in ntexapi.h
  86. DWORD InheritedFromUniqueProcessId; // HANDLE in ntexapi.h
  87. ULONG HandleCount;
  88. ULONG SessionId;
  89. ULONG SpareUl3;
  90. SIZE_T PeakVirtualSize;
  91. SIZE_T VirtualSize;
  92. ULONG PageFaultCount;
  93. ULONG PeakWorkingSetSize;
  94. ULONG WorkingSetSize;
  95. SIZE_T QuotaPeakPagedPoolUsage;
  96. SIZE_T QuotaPagedPoolUsage;
  97. SIZE_T QuotaPeakNonPagedPoolUsage;
  98. SIZE_T QuotaNonPagedPoolUsage;
  99. SIZE_T PagefileUsage;
  100. SIZE_T PeakPagefileUsage;
  101. SIZE_T PrivatePageCount;
  102. } TS_SYSTEM_PROCESS_INFORMATION, *PTS_SYSTEM_PROCESS_INFORMATION;
  103. // ...
  104. typedef struct _TS_ALL_PROCESSES_INFO {
  105. PTS_SYSTEM_PROCESS_INFORMATION pspiProcessInfo;
  106. DWORD SizeOfSid;
  107. PBYTE pSid;
  108. } TS_ALL_PROCESSES_INFO, *PTS_ALL_PROCESSES_INFO;
  109. // defines
  110. #define SERVERNAME_CURRENT ((HANDLE)NULL)
  111. #define GAP_LEVEL_BASIC 0
  112. #define CITRIX_PROCESS_INFO_MAGIC 0x23495452
  113. #define WINSTATIONNAME_LENGTH 64
  114. #define WINSTA_DLLNAME L"Winsta.dll"
  115. #define FUNCNAME_WinStationFreeMemory "WinStationFreeMemory"
  116. #define FUNCNAME_WinStationCloseServer "WinStationCloseServer"
  117. #define FUNCNAME_WinStationOpenServerW "WinStationOpenServerW"
  118. #define FUNCNAME_WinStationEnumerateProcesses "WinStationEnumerateProcesses"
  119. #define FUNCNAME_WinStationFreeGAPMemory "WinStationFreeGAPMemory"
  120. #define FUNCNAME_WinStationGetAllProcesses "WinStationGetAllProcesses"
  121. #define FUNCNAME_WinStationNameFromLogonIdW "WinStationNameFromLogonIdW"
  122. #define SIZEOF_SYSTEM_THREAD_INFORMATION sizeof( struct SYSTEM_THREAD_INFORMATION )
  123. #define SIZEOF_SYSTEM_PROCESS_INFORMATION sizeof( struct SYSTEM_PROCESS_INFORMATION )
  124. //
  125. // function prototypes
  126. typedef BOOLEAN (WINAPI * FUNC_WinStationFreeMemory)( PVOID pBuffer );
  127. typedef BOOLEAN (WINAPI * FUNC_WinStationCloseServer)( HANDLE hServer );
  128. typedef HANDLE (WINAPI * FUNC_WinStationOpenServerW)( LPWSTR pwszServerName );
  129. typedef BOOLEAN (WINAPI * FUNC_WinStationNameFromLogonIdW)( HANDLE hServer,
  130. ULONG LogonId, LPWSTR pwszWinStationName );
  131. typedef BOOLEAN (WINAPI * FUNC_WinStationEnumerateProcesses)( HANDLE hServer, PVOID *ppProcessBuffer );
  132. typedef BOOLEAN (WINAPI * FUNC_WinStationFreeGAPMemory)( ULONG Level,
  133. PVOID ProcessArray, ULONG ulCount );
  134. typedef BOOLEAN (WINAPI * FUNC_WinStationGetAllProcesses)( HANDLE hServer,
  135. ULONG Level, ULONG *pNumberOfProcesses,
  136. PVOID *ppProcessArray );
  137. //
  138. // constants / defines / enumerations
  139. //
  140. //
  141. // WMI related stuff
  142. // class name
  143. #define CLASS_PROCESS L"Win32_Process"
  144. // wmi query
  145. #define WMI_QUERY_TYPE L"WQL"
  146. #define WMI_SERVICE_QUERY L"SELECT Name FROM Win32_Service WHERE ProcessId = %d and State=\"Running\""
  147. #define WMI_MODULES_QUERY L"ASSOCIATORS OF {%s} WHERE ResultClass = CIM_DataFile"
  148. #define WMI_PROCESS_QUERY \
  149. L"SELECT " \
  150. L"__PATH, ProcessId, CSName, Caption, SessionId, ThreadCount, " \
  151. L"WorkingSetSize, KernelModeTime, UserModeTime " \
  152. L" FROM Win32_Process"
  153. // wmi query operators etc
  154. #define WMI_QUERY_FIRST_CLAUSE L"WHERE"
  155. #define WMI_QUERY_SECOND_CLAUSE L"AND"
  156. // Win32_Process class properties
  157. #define WIN32_PROCESS_SYSPROPERTY_PATH L"__PATH"
  158. #define WIN32_PROCESS_PROPERTY_HANDLE L"Handle"
  159. #define WIN32_PROCESS_PROPERTY_COMPUTER L"CSName"
  160. #define WIN32_PROCESS_PROPERTY_IMAGENAME L"Caption"
  161. #define WIN32_PROCESS_PROPERTY_PROCESSID L"ProcessId"
  162. #define WIN32_PROCESS_PROPERTY_SESSION L"SessionId"
  163. #define WIN32_PROCESS_PROPERTY_THREADS L"ThreadCount"
  164. #define WIN32_PROCESS_PROPERTY_USERMODETIME L"UserModeTime"
  165. #define WIN32_PROCESS_PROPERTY_MEMUSAGE L"WorkingSetSize"
  166. #define WIN32_PROCESS_PROPERTY_KERNELMODETIME L"KernelModeTime"
  167. // Win32_Process class method(s)
  168. #define WIN32_PROCESS_METHOD_GETOWNER L"GetOwner"
  169. // GetOwner method's return values
  170. #define GETOWNER_RETURNVALUE_USER L"User"
  171. #define GETOWNER_RETURNVALUE_DOMAIN L"Domain"
  172. // function default return value
  173. #define WMI_RETURNVALUE L"ReturnValue"
  174. // Win32_Service related stuff
  175. #define WIN32_SERVICE_PROPERTY_NAME L"Name"
  176. // CIM_DataFile related stuff
  177. #define CIM_DATAFILE_PROPERTY_FILENAME L"FileName"
  178. #define CIM_DATAFILE_PROPERTY_EXTENSION L"Extension"
  179. //
  180. // other stuff
  181. // generals
  182. #define VALUE_RUNNING GetResString( IDS_VALUE_RUNNING )
  183. #define VALUE_NOTRESPONDING GetResString( IDS_VALUE_NOTRESPONDING )
  184. #define PID_0_DOMAIN GetResString( IDS_PID_0_DOMAIN )
  185. #define PID_0_USERNAME GetResString( IDS_PID_0_USERNAME )
  186. #define FMT_MODULES_FILTER GetResString( IDS_FMT_MODULES_FILTER )
  187. // error messages
  188. #define ERROR_USERNAME_BUT_NOMACHINE GetResString( IDS_ERROR_USERNAME_BUT_NOMACHINE )
  189. #define ERROR_PASSWORD_BUT_NOUSERNAME GetResString( IDS_ERROR_PASSWORD_BUT_NOUSERNAME )
  190. #define ERROR_NODATA_AVAILABLE GetResString( IDS_ERROR_NODATA_AVAILABLE )
  191. #define ERROR_USERNAME_EMPTY GetResString( IDS_ERROR_USERNAME_EMPTY )
  192. #define ERROR_NH_NOTSUPPORTED GetResString( IDS_ERROR_NH_NOTSUPPORTED )
  193. #define ERROR_M_SVC_V_CANNOTBECOUPLED GetResString( IDS_ERROR_M_SVC_V_CANNOTBECOUPLED )
  194. #define ERROR_SERVERNAME_EMPTY GetResString( IDS_ERROR_SERVERNAME_EMPTY )
  195. #define ERROR_INVALID_USAGE_REQUEST GetResString( IDS_ERROR_INVALID_USAGE_REQUEST )
  196. #define ERROR_M_CHAR_AFTER_WILDCARD GetResString( IDS_ERROR_M_CHAR_AFTER_WILDCARD )
  197. #define ERROR_PLATFORM_SHOULD_BE_X86 GetResString( IDS_ERROR_PLATFORM_SHOULD_BE_X86 )
  198. // progress messages
  199. #define MSG_MODULESINFO GetResString( IDS_MSG_MODULESINFO )
  200. #define MSG_MODULESINFO_EX GetResString( IDS_MSG_MODULESINFO_EX )
  201. #define MSG_SERVICESINFO GetResString( IDS_MSG_SERVICESINFO )
  202. #define MSG_TASKSINFO GetResString( IDS_MSG_TASKSINFO )
  203. // output formats
  204. #define TEXT_FORMAT_LIST GetResString( IDS_TEXT_FORMAT_LIST )
  205. #define TEXT_FORMAT_TABLE GetResString( IDS_TEXT_FORMAT_TABLE )
  206. #define TEXT_FORMAT_CSV GetResString( IDS_TEXT_FORMAT_CSV )
  207. //
  208. // column heading names and their indexes in the array ( in fact positions )
  209. #define MAX_COLUMNS 12
  210. // column headings
  211. #define COLHEAD_HOSTNAME GetResString( IDS_COLHEAD_HOSTNAME )
  212. #define COLHEAD_STATUS GetResString( IDS_COLHEAD_STATUS )
  213. #define COLHEAD_IMAGENAME GetResString( IDS_COLHEAD_IMAGENAME )
  214. #define COLHEAD_PID GetResString( IDS_COLHEAD_PID )
  215. #define COLHEAD_SESSION GetResString( IDS_COLHEAD_SESSION )
  216. #define COLHEAD_USERNAME GetResString( IDS_COLHEAD_USERNAME )
  217. #define COLHEAD_WINDOWTITLE GetResString( IDS_COLHEAD_WINDOWTITLE )
  218. #define COLHEAD_CPUTIME GetResString( IDS_COLHEAD_CPUTIME )
  219. #define COLHEAD_MEMUSAGE GetResString( IDS_COLHEAD_MEMUSAGE )
  220. #define COLHEAD_SERVICES GetResString( IDS_COLHEAD_SERVICES )
  221. #define COLHEAD_SESSIONNAME GetResString( IDS_COLHEAD_SESSIONNAME )
  222. #define COLHEAD_MODULES GetResString( IDS_COLHEAD_MODULES )
  223. // indexes
  224. #define CI_HOSTNAME TASK_HOSTNAME
  225. #define CI_STATUS TASK_STATUS
  226. #define CI_IMAGENAME TASK_IMAGENAME
  227. #define CI_PID TASK_PID
  228. #define CI_SESSION TASK_SESSION
  229. #define CI_USERNAME TASK_USERNAME
  230. #define CI_WINDOWTITLE TASK_WINDOWTITLE
  231. #define CI_CPUTIME TASK_CPUTIME
  232. #define CI_MEMUSAGE TASK_MEMUSAGE
  233. #define CI_SERVICES TASK_SERVICES
  234. #define CI_SESSIONNAME TASK_SESSIONNAME
  235. #define CI_MODULES TASK_MODULES
  236. // column widths
  237. #define COLWIDTH_HOSTNAME AsLong( GetResString( IDS_COLWIDTH_HOSTNAME ), 10 )
  238. #define COLWIDTH_STATUS AsLong( GetResString( IDS_COLWIDTH_STATUS ), 10 )
  239. #define COLWIDTH_IMAGENAME AsLong( GetResString( IDS_COLWIDTH_IMAGENAME ), 10 )
  240. #define COLWIDTH_PID AsLong( GetResString( IDS_COLWIDTH_PID ), 10 )
  241. #define COLWIDTH_SESSION AsLong( GetResString( IDS_COLWIDTH_SESSION ), 10 )
  242. #define COLWIDTH_USERNAME AsLong( GetResString( IDS_COLWIDTH_USERNAME ), 10 )
  243. #define COLWIDTH_WINDOWTITLE AsLong( GetResString( IDS_COLWIDTH_WINDOWTITLE ), 10 )
  244. #define COLWIDTH_CPUTIME AsLong( GetResString( IDS_COLWIDTH_CPUTIME ), 10 )
  245. #define COLWIDTH_MEMUSAGE AsLong( GetResString( IDS_COLWIDTH_MEMUSAGE ), 10 )
  246. #define COLWIDTH_SERVICES AsLong( GetResString( IDS_COLWIDTH_SERVICES ), 10 )
  247. #define COLWIDTH_SERVICES_WRAP AsLong( GetResString( IDS_COLWIDTH_SERVICES_WRAP ), 10 )
  248. #define COLWIDTH_SESSIONNAME AsLong( GetResString( IDS_COLWIDTH_SESSIONNAME ), 10 )
  249. #define COLWIDTH_MODULES AsLong( GetResString( IDS_COLWIDTH_MODULES ), 10 )
  250. #define COLWIDTH_MODULES_WRAP AsLong( GetResString( IDS_COLWIDTH_MODULES_WRAP ), 10 )
  251. //
  252. // command line options
  253. // command line options and their indexes in the array
  254. #define MAX_OPTIONS 10
  255. // options allowed ( no need to localize )
  256. #define OPTION_USAGE L"?"
  257. #define OPTION_SERVER L"s"
  258. #define OPTION_USERNAME L"u"
  259. #define OPTION_PASSWORD L"p"
  260. #define OPTION_FILTER L"fi"
  261. #define OPTION_FORMAT L"fo"
  262. #define OPTION_NOHEADER L"nh"
  263. #define OPTION_VERBOSE L"v"
  264. #define OPTION_SVC L"svc"
  265. #define OPTION_MODULES L"m"
  266. // option indexes
  267. #define OI_USAGE 0
  268. #define OI_SERVER 1
  269. #define OI_USERNAME 2
  270. #define OI_PASSWORD 3
  271. #define OI_FILTER 4
  272. #define OI_FORMAT 5
  273. #define OI_NOHEADER 6
  274. #define OI_VERBOSE 7
  275. #define OI_SVC 8
  276. #define OI_MODULES 9
  277. // values allowed for format
  278. #define OVALUES_FORMAT GetResString( IDS_OVALUES_FORMAT )
  279. //
  280. // filter details
  281. #define MAX_FILTERS 11
  282. // filter allowed
  283. #define FILTER_SESSIONNAME GetResString( IDS_FILTER_SESSIONNAME )
  284. #define FILTER_STATUS GetResString( IDS_FILTER_STATUS )
  285. #define FILTER_IMAGENAME GetResString( IDS_FILTER_IMAGENAME )
  286. #define FILTER_PID GetResString( IDS_FILTER_PID )
  287. #define FILTER_SESSION GetResString( IDS_FILTER_SESSION )
  288. #define FILTER_CPUTIME GetResString( IDS_FILTER_CPUTIME )
  289. #define FILTER_MEMUSAGE GetResString( IDS_FILTER_MEMUSAGE )
  290. #define FILTER_USERNAME GetResString( IDS_FILTER_USERNAME )
  291. #define FILTER_SERVICES GetResString( IDS_FILTER_SERVICES )
  292. #define FILTER_WINDOWTITLE GetResString( IDS_FILTER_WINDOWTITLE )
  293. #define FILTER_MODULES GetResString( IDS_FILTER_MODULES )
  294. // indexes
  295. #define FI_SESSIONNAME 0
  296. #define FI_STATUS 1
  297. #define FI_IMAGENAME 2
  298. #define FI_PID 3
  299. #define FI_SESSION 4
  300. #define FI_CPUTIME 5
  301. #define FI_MEMUSAGE 6
  302. #define FI_USERNAME 7
  303. #define FI_SERVICES 8
  304. #define FI_WINDOWTITLE 9
  305. #define FI_MODULES 10
  306. // values allowed for status
  307. #define FVALUES_STATUS GetResString( IDS_FVALUES_STATUS )
  308. // operators
  309. #define OPERATORS_STRING GetResString( IDS_OPERATORS_STRING )
  310. #define OPERATORS_NUMERIC GetResString( IDS_OPERATORS_NUMERIC )
  311. // max. columns ( information ) to be stored for one task
  312. #define MAX_TASKSINFO 17
  313. // task info indexes
  314. #define TASK_HOSTNAME 0
  315. #define TASK_IMAGENAME 1
  316. #define TASK_PID 2
  317. #define TASK_SESSIONNAME 3
  318. #define TASK_SESSION 4
  319. #define TASK_MEMUSAGE 5
  320. #define TASK_STATUS 6
  321. #define TASK_USERNAME 7
  322. #define TASK_CPUTIME 8
  323. #define TASK_WINDOWTITLE 9
  324. #define TASK_SERVICES 10
  325. #define TASK_MODULES 11
  326. // always hidden
  327. #define TASK_HWND 12
  328. #define TASK_WINSTA 13
  329. #define TASK_DESK 14
  330. #define TASK_CREATINGPROCESSID 15
  331. #define TASK_OBJPATH 16
  332. //
  333. // CTaskList
  334. //
  335. class CTaskList
  336. {
  337. public:
  338. // enumerators
  339. enum
  340. {
  341. twiProcessId = 0,
  342. twiWinSta = 1,
  343. twiDesktop = 2,
  344. twiHandle = 3,
  345. twiTitle = 4,
  346. twiCOUNT,
  347. };
  348. // constructor / destructor
  349. public:
  350. CTaskList();
  351. ~CTaskList();
  352. // data memebers
  353. private:
  354. // WMI / COM interfaces
  355. IWbemLocator* m_pWbemLocator;
  356. IWbemServices* m_pWbemServices;
  357. IEnumWbemClassObject* m_pEnumObjects;
  358. // WMI connectivity
  359. COAUTHIDENTITY* m_pAuthIdentity;
  360. // command-line argument values
  361. BOOL m_bVerbose;
  362. BOOL m_bAllServices;
  363. BOOL m_bAllModules;
  364. DWORD m_dwFormat;
  365. TARRAY m_arrFilters;
  366. CHString m_strServer;
  367. CHString m_strUserName;
  368. CHString m_strPassword;
  369. CHString m_strModules;
  370. // others
  371. BOOL m_bNeedPassword; // infoms whether password has to read or not
  372. BOOL m_bNeedModulesInfo;
  373. BOOL m_bNeedServicesInfo; // determines whether services info has to gathered or not
  374. BOOL m_bNeedUserContextInfo; // determines whether userinfo has to gathered or not
  375. BOOL m_bNeedWindowTitles; // determines whether window titles has to be gathered or not
  376. PTCOLUMNS m_pColumns; // columns config information
  377. TARRAY m_arrFiltersEx; // parsed filters info
  378. TARRAY m_arrWindowTitles; // window titles
  379. PTFILTERCONFIG m_pfilterConfigs; // filters config information
  380. CHString m_strQuery; // optimized WMI Query for filters
  381. DWORD m_dwGroupSep; // number group seperation in number formatting
  382. CHString m_strTimeSep; // time seperator
  383. CHString m_strGroupThousSep; // thousand sepeartion character in number formatting
  384. // output data
  385. TARRAY m_arrTasks;
  386. DWORD m_dwProcessId;
  387. CHString m_strImageName;
  388. // helpers .. in getting info using API
  389. CHString m_strUNCServer; // server name
  390. BOOL m_bCloseConnection;
  391. // winstation related stuff
  392. BOOL m_bIsHydra;
  393. HANDLE m_hServer;
  394. HMODULE m_hWinstaLib;
  395. PBYTE m_pProcessInfo;
  396. ULONG m_ulNumberOfProcesses;
  397. // services related stuff
  398. DWORD m_dwServicesCount;
  399. LPENUM_SERVICE_STATUS_PROCESS m_pServicesInfo;
  400. // modules related stuff ( remote only )
  401. BOOL m_bUseRemote;
  402. PPERF_DATA_BLOCK m_pdb;
  403. // progress message related
  404. HANDLE m_hOutput;
  405. CONSOLE_SCREEN_BUFFER_INFO m_csbi;
  406. //
  407. // functions
  408. FUNC_WinStationFreeMemory m_pfnWinStationFreeMemory;
  409. FUNC_WinStationOpenServerW m_pfnWinStationOpenServerW;
  410. FUNC_WinStationCloseServer m_pfnWinStationCloseServer;
  411. FUNC_WinStationFreeGAPMemory m_pfnWinStationFreeGAPMemory;
  412. FUNC_WinStationGetAllProcesses m_pfnWinStationGetAllProcesses;
  413. FUNC_WinStationNameFromLogonIdW m_pfnWinStationNameFromLogonIdW;
  414. FUNC_WinStationEnumerateProcesses m_pfnWinStationEnumerateProcesses;
  415. public:
  416. // command-line argument values
  417. BOOL m_bUsage;
  418. BOOL m_bLocalSystem;
  419. // functions
  420. private:
  421. // helpers
  422. VOID SetStatus( LONG lIndex, IWbemClassObject* pWmiObject );
  423. VOID SetCPUTime( LONG lIndex, IWbemClassObject* pWmiObject );
  424. VOID SetSession( LONG lIndex, IWbemClassObject* pWmiObject );
  425. VOID SetMemUsage( LONG lIndex, IWbemClassObject* pWmiObject );
  426. VOID SetUserContext( LONG lIndex, IWbemClassObject* pWmiObject );
  427. VOID SetWindowTitle( LONG lIndex, IWbemClassObject* pWmiObject );
  428. VOID SetServicesInfo( LONG lIndex, IWbemClassObject* pWmiObject );
  429. BOOL SetModulesInfo( LONG lIndex, IWbemClassObject* pWmiObject );
  430. BOOL SaveInformation( LONG lIndex, IWbemClassObject* pWmiObject );
  431. // ...
  432. BOOL LoadTasksEx();
  433. BOOL LoadModulesInfo();
  434. BOOL LoadServicesInfo();
  435. BOOL EnableDebugPriv();
  436. BOOL GetModulesOnRemote( LONG lIndex, TARRAY arrModules );
  437. BOOL GetModulesOnRemoteEx( LONG lIndex, TARRAY arrModules );
  438. BOOL LoadModulesOnLocal( LONG lIndex, TARRAY arrModules );
  439. BOOL LoadUserNameFromWinsta( CHString& strDomain, CHString& strUserName );
  440. // winsta functions
  441. BOOLEAN WinStationFreeMemory( PVOID pBuffer );
  442. BOOLEAN WinStationCloseServer( HANDLE hServer );
  443. HANDLE WinStationOpenServerW( LPWSTR pwszServerName );
  444. BOOLEAN WinStationEnumerateProcesses( HANDLE hServer, PVOID *ppProcessBuffer );
  445. BOOLEAN WinStationFreeGAPMemory( ULONG Level, PVOID ProcessArray, ULONG ulCount );
  446. BOOLEAN WinStationNameFromLogonIdW( HANDLE hServer, ULONG ulLogonId, LPWSTR pwszWinStationName );
  447. BOOLEAN WinStationGetAllProcesses( HANDLE hServer, ULONG Level,
  448. ULONG *pNumberOfProcesses, PVOID *ppProcessArray );
  449. public:
  450. VOID Usage();
  451. BOOL Initialize();
  452. VOID PrepareColumns();
  453. BOOL ValidateFilters();
  454. BOOL ProcessOptions( DWORD argc, LPCWSTR argv[] );
  455. // functionality related
  456. DWORD Show();
  457. BOOL Connect();
  458. BOOL LoadTasks();
  459. };
  460. //
  461. // public functions
  462. //
  463. VOID PrintProgressMsg( HANDLE hOutput, LPCWSTR pwszMsg, const CONSOLE_SCREEN_BUFFER_INFO& csbi );
  464. #endif // _TASKLIST_H