网站首页  词典首页

请输入您要查询的函数:

 

术语 debugactiveprocess
释义 DebugActiveProcess
语法:
C++
BOOL WINAPI DebugActiveProcess(
__in DWORD dwProcessId
);
DebugActiveProcess功能
实现了调试器附加到一个积极的进程,并对其进行调试。
参数
dwProcessId [in]
在这一进程标识符进行调试。调试器调试授予访问过程,如果它创建与DEBUG_ONLY_THIS_PROCESS旗进程。有关更多信息,请参阅本主题的备注部分。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值为0(零)。为了获得更多错误信息,调用GetLastError。
备注
要停止调试过程中,您必须退出的过程,或调用DebugActiveProcessStop功能。退出调试器也退出过程,除非您使用DebugSetProcessKillOnExit功能。
调试器必须具有适当的访问到目标进程,它必须能够以打开PROCESS_ALL_ACCESS进程。 DebugActiveProcess可能会失败,如果目标进程的安全描述符,以授予调试器以外的任何充分利用较少创建。如果调试过程具有SE_DEBUG_NAME权限批准和启用时,它可以调试任何进程。
系统检查后的进程标识符,并确定一个有效的调试正在取得的附件,该函数返回TRUE。然后调试,预计等待调试使用WaitForDebugEvent函数的事件。该系统中止对这一进程的所有线程,并移送调试的事件,表示该进程的当前状态。
该系统发送一个CREATE_PROCESS_DEBUG_EVENT调试器调试的事件,表示了dwProcessId参数指定的过程。该CREATE_PROCESS_DEBUG_INFO结构lpStartAddress成员是NULL。
对于每个线程是目前进程的一部分,该系统发送CREATE_THREAD_DEBUG_EVENT调试事件。该CREATE_THREAD_DEBUG_INFO结构lpStartAddress成员是NULL。
对于每个动态链接库(DLL)是当前到目标进程的地址空间中加载,系统发送LOAD_DLL_DEBUG_EVENT调试事件。该系统安排来执行断点指令后,将恢复在这个过程中第一个线程。继续线程导致它返回到以前一样做调试器附加同样的事情。
之后,所有这一切的完成,系统恢复进程中的所有线程。当在恢复进程的第一线,它执行一个断点指令所导致的EXCEPTION_DEBUG_EVENT调试事件被发送到调试程序。所有未来的调试事件发送到调试器使用正常的机制和规则。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
CreateProcess的
CREATE_PROCESS_DEBUG_INFO
CREATE_THREAD_DEBUG_INFO
DebugActiveProcessStop
调试正在运行的进程
调试功能
WaitForDebugEvent
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==DebugActiveProcess Function
Enables a debugger to attach to an active process and debug it.
Syntax
C++
BOOL WINAPI DebugActiveProcess(
__in DWORD dwProcessId
);
Parameters
dwProcessId [in]
The identifier for the process to be debugged. The debugger is granted debugging access to the process as if it created the process with the DEBUG_ONLY_THIS_PROCESS flag. For more information, see the Remarks section of this topic.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError .
Remarks
To stop debugging the process, you must exit the process or call the DebugActiveProcessStop function. Exiting the debugger also exits the process unless you use the DebugSetProcessKillOnExit function.
The debugger must have appropriate access to the target process, and it must be able to open the process for PROCESS_ALL_ACCESS. DebugActiveProcess can fail if the target process is created with a security descriptor that grants the debugger anything less than full access. If the debugging process has the SE_DEBUG_NAME privilege granted and enabled, it can debug any process.
After the system checks the process identifier and determines that a valid debugging attachment is being made, the function returns TRUE. Then the debugger is expected to wait for debugging events by using the WaitForDebugEvent function. The system suspends all threads in the process, and sends the debugger events that represents the current state of the process.
The system sends the debugger a single CREATE_PROCESS_DEBUG_EVENT debugging event that represents the process specified by the dwProcessId parameter. The lpStartAddress member of the CREATE_PROCESS_DEBUG_INFO structure is NULL.
For each thread that is currently part of the process, the system sends a CREATE_THREAD_DEBUG_EVENT debugging event. The lpStartAddress member of the CREATE_THREAD_DEBUG_INFO structure is NULL.
For each dynamic-link library (DLL) that is currently loaded into the address space of the target process, the system sends a LOAD_DLL_DEBUG_EVENT debugging event. The system arranges for the first thread in the process to execute a breakpoint instruction after it resumes. Continuing this thread causes it to return to doing the same thing as before the debugger is attached.
After all of this is done, the system resumes all threads in the process. When the first thread in the process resumes, it executes a breakpoint instruction that causes an EXCEPTION_DEBUG_EVENT debugging event to be sent to the debugger. All future debugging events are sent to the debugger by using the normal mechanism and rules.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
CreateProcess
CREATE_PROCESS_DEBUG_INFO
CREATE_THREAD_DEBUG_INFO
DebugActiveProcessStop
Debugging a Running Process
Debugging Functions
WaitForDebugEvent
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/ms679295(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:18:36