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.

139 lines
2.7 KiB

  1. #pragma once
  2. #if defined(__cplusplus)
  3. extern "C" {
  4. #endif
  5. #define MAX_TASKS 1024
  6. #define TITLE_SIZE 128
  7. #define PROCESS_SIZE 64
  8. #define SERVICENAMES_SIZE 1024
  9. #define MTS_PACKAGE_NAMES_SIZE 1024
  10. #define TL_CMD_LINE_SIZE 512
  11. typedef struct _THREAD_INFO {
  12. ULONG ThreadState;
  13. HANDLE UniqueThread;
  14. } THREAD_INFO, *PTHREAD_INFO;
  15. typedef struct _FIND_MODULE_INFO {
  16. LPSTR szModuleToFind;
  17. LPSTR szMatchingModuleName;
  18. BOOL fFound;
  19. } FIND_MODULE_INFO, *PFIND_MODULE_INFO;
  20. //
  21. // task list structure
  22. //
  23. typedef struct _TASK_LIST {
  24. DWORD dwProcessId;
  25. DWORD dwInheritedFromProcessId;
  26. ULARGE_INTEGER CreateTime;
  27. BOOL flags;
  28. HANDLE hwnd;
  29. LPSTR lpWinsta;
  30. LPSTR lpDesk;
  31. CHAR ProcessName[PROCESS_SIZE];
  32. CHAR WindowTitle[TITLE_SIZE];
  33. SIZE_T PeakVirtualSize;
  34. SIZE_T VirtualSize;
  35. ULONG PageFaultCount;
  36. SIZE_T PeakWorkingSetSize;
  37. SIZE_T WorkingSetSize;
  38. ULONG NumberOfThreads;
  39. PTHREAD_INFO pThreadInfo;
  40. CHAR ServiceNames[SERVICENAMES_SIZE];
  41. CHAR MtsPackageNames[MTS_PACKAGE_NAMES_SIZE];
  42. ULONG SessionId;
  43. CHAR CommandLine[TL_CMD_LINE_SIZE];
  44. } TASK_LIST, *PTASK_LIST;
  45. typedef struct _TASK_LIST_ENUM {
  46. PTASK_LIST tlist;
  47. DWORD numtasks;
  48. LPSTR lpWinsta;
  49. LPSTR lpDesk;
  50. BOOL bFirstLoop;
  51. } TASK_LIST_ENUM, *PTASK_LIST_ENUM;
  52. DWORD
  53. GetServiceProcessInfo(
  54. LPENUM_SERVICE_STATUS_PROCESS* ppSvcInfo
  55. );
  56. DWORD
  57. GetTaskList(
  58. PTASK_LIST pTask,
  59. DWORD dwNumTasks
  60. );
  61. DWORD
  62. GetTaskListEx(
  63. PTASK_LIST pTask,
  64. DWORD dwNumTasks,
  65. BOOL fThreadInfo,
  66. DWORD dwNumServices,
  67. const ENUM_SERVICE_STATUS_PROCESS* pServiceInfo
  68. );
  69. void
  70. AddMtsPackageNames(
  71. PTASK_LIST Tasks,
  72. DWORD NumTasks
  73. );
  74. void
  75. AddCommandLines(
  76. PTASK_LIST Tasks,
  77. DWORD NumTasks
  78. );
  79. void
  80. PrintTasksUsingModule(
  81. LPTSTR szModuleName
  82. );
  83. BOOL
  84. DetectOrphans(
  85. PTASK_LIST pTask,
  86. DWORD dwNumTasks
  87. );
  88. BOOL
  89. EnableDebugPriv(
  90. VOID
  91. );
  92. BOOL
  93. KillProcess(
  94. PTASK_LIST tlist,
  95. BOOL fForce
  96. );
  97. VOID
  98. GetWindowTitles(
  99. PTASK_LIST_ENUM te
  100. );
  101. BOOL
  102. MatchPattern(
  103. PUCHAR String,
  104. PUCHAR Pattern
  105. );
  106. BOOL
  107. EmptyProcessWorkingSet(
  108. DWORD pid
  109. );
  110. BOOL
  111. EmptySystemWorkingSet(
  112. VOID
  113. );
  114. #if defined(__cplusplus)
  115. }
  116. #endif