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.

116 lines
3.4 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Process and thread routines.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997-2000.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef _PROCTHRD_H_
  9. #define _PROCTHRD_H_
  10. #define ANY_PROCESSES() \
  11. (g_ProcessHead != NULL || g_ProcessPending != NULL)
  12. #define SYSTEM_PROCESSES() \
  13. (((g_AllProcessFlags | g_AllPendingFlags) & ENG_PROC_SYSTEM) != 0)
  14. extern ULONG g_NextProcessUserId;
  15. extern ULONG g_AllProcessFlags;
  16. extern ULONG g_NumberProcesses;
  17. extern ULONG g_TotalNumberThreads;
  18. extern ULONG g_MaxThreadsInProcess;
  19. extern PTHREAD_INFO g_RegContextThread;
  20. extern ULONG g_RegContextProcessor;
  21. extern ULONG g_AllPendingFlags;
  22. PPROCESS_INFO FindProcessByUserId(ULONG Id);
  23. PTHREAD_INFO FindThreadByUserId(PPROCESS_INFO Process, ULONG Id);
  24. PPROCESS_INFO FindProcessBySystemId(ULONG Id);
  25. PTHREAD_INFO FindThreadBySystemId(PPROCESS_INFO Process, ULONG Id);
  26. PPROCESS_INFO FindProcessByHandle(ULONG64 Handle);
  27. PTHREAD_INFO FindThreadByHandle(PPROCESS_INFO Process, ULONG64 Handle);
  28. PPROCESS_INFO
  29. AddProcess(
  30. ULONG SystemId,
  31. ULONG64 Handle,
  32. ULONG InitialThreadSystemId,
  33. ULONG64 InitialThreadHandle,
  34. ULONG64 InitialThreadDataOffset,
  35. ULONG64 StartOffset,
  36. ULONG Flags,
  37. ULONG Options,
  38. ULONG InitialThreadFlags
  39. );
  40. PTHREAD_INFO
  41. AddThread(
  42. PPROCESS_INFO Process,
  43. ULONG SystemId,
  44. ULONG64 Handle,
  45. ULONG64 DataOffset,
  46. ULONG64 StartOffset,
  47. ULONG Flags
  48. );
  49. void RemoveAndDeleteProcess(PPROCESS_INFO Process, PPROCESS_INFO Prev);
  50. BOOL DeleteExitedInfos(void);
  51. void OutputProcessInfo(PSTR Title);
  52. void ChangeRegContext(PTHREAD_INFO Thread);
  53. void FlushRegContext(void);
  54. void SetCurrentThread(PTHREAD_INFO Thread, BOOL Hidden);
  55. void SetCurrentProcessorThread(ULONG Processor, BOOL Hidden);
  56. void SaveSetCurrentProcessorThread(ULONG Processor);
  57. void RestoreCurrentProcessorThread(void);
  58. void SuspendAllThreads(void);
  59. BOOL ResumeAllThreads(void);
  60. void SuspendResumeThreads(PPROCESS_INFO Process, BOOL Susp,
  61. PTHREAD_INFO Match);
  62. #define SPT_DEFAULT_OCI_FLAGS \
  63. (OCI_SYMBOL | OCI_DISASM | OCI_FORCE_EA | OCI_ALLOW_SOURCE | \
  64. OCI_ALLOW_REG)
  65. void SetPromptThread(PTHREAD_INFO pThread, ULONG uOciFlags);
  66. void fnOutputProcessInfo(PPROCESS_INFO);
  67. void fnOutputThreadInfo(PTHREAD_INFO);
  68. void parseThreadCmds(DebugClient* Client);
  69. void parseProcessCmds(void);
  70. void AddPendingProcess(PPENDING_PROCESS Pending);
  71. void RemovePendingProcess(PPENDING_PROCESS Pending);
  72. void DiscardPendingProcess(PPENDING_PROCESS Pending);
  73. void DiscardPendingProcesses(void);
  74. PPENDING_PROCESS FindPendingProcessByFlags(ULONG Flags);
  75. PPENDING_PROCESS FindPendingProcessById(ULONG Id);
  76. void VerifyPendingProcesses(void);
  77. void AddExamineToPendingAttach(void);
  78. HRESULT StartAttachProcess(ULONG ProcessId, ULONG AttachFlags,
  79. PPENDING_PROCESS* Pending);
  80. HRESULT StartCreateProcess(PSTR CommandLine, ULONG CreateFlags,
  81. PPENDING_PROCESS* Pending);
  82. HRESULT TerminateProcess(PPROCESS_INFO Process);
  83. HRESULT TerminateProcesses(void);
  84. HRESULT DetachProcess(PPROCESS_INFO Process);
  85. HRESULT DetachProcesses(void);
  86. HRESULT AbandonProcess(PPROCESS_INFO Process);
  87. enum
  88. {
  89. SEP_TERMINATE,
  90. SEP_DETACH,
  91. SEP_ABANDON,
  92. };
  93. HRESULT SeparateCurrentProcess(ULONG Mode, PSTR Description);
  94. #endif // #ifndef _PROCTHRD_H_