На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

DebugActiveProcess



The DebugActiveProcess function allows a debugger to attach to an active process and then debug it.

BOOL DebugActiveProcess(

DWORD dwProcessId // process to be debugged
);


Parameters

dwProcessId

Specifies the identifier for the process to be debugged. The debugger gets debugging access to the process as if it created the process with the DEBUG_ONLY_THIS_PROCESS flag.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The debugger must have appropriate access to the target process; it must be able to open the process for PROCESS_ALL_ACCESS access. In the Win32 application programming interface (API) for Windows 95, this is always true if the process identifier is valid. However, in the Win32 API for Windows NT, DebugActiveProcess can fail if the target process was created with a security descriptor that denies the debugger appropriate access.
After the system checks the process identifier and determines that a valid debugging attachment is being made, the function returns TRUE. The debugger is then expected to wait for debugging events by using the WaitForDebugEvent function. The system suspends all threads in the process and sends the debugger events representing the current state of the process.

The system sends the debugger a single CREATE_PROCESS_DEBUG_EVENT debugging event representing the process specified by the dwProcessId parameter. The lpStartAddress member of the CREATE_PROCESS_DEBUG_INFO structure is NULL.
For each thread 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) 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 whatever it was doing before the debugger was attached.

After all of this has been 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.

See Also

CreateProcess, CREATE_PROCESS_DEBUG_INFO, CREATE_THREAD_DEBUG_INFO, WaitForDebugEvent


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

DebugActiveProcess



Функция DebugActiveProcess позволяет отладчика, чтобы подключать к активному процессу затем отлаживать это.

BOOL DebugActiveProcess(

ПРОЦЕСС DWORD dwProcessId //, чтобы быть отлаженн
);


Параметры

dwProcessId

Определяет идентификатор для процесса, который нужно отлаживаться. Отладчик получает отладку доступа к процессу как будто он создал процесс с флагом DEBUG_ONLY_THIS_PROCESS.



Обратные Величины

Если функция добивается успеха, обратная величина ненулевая.
Если функция терпит неудачу, обратная величина нулевая. Для того, чтобы расширять информацию ошибки, назовите GetLastError.

Замечания

Отладчик должен иметь подходящий доступ к целевому процессу; это по-видимому способным открыть процесс для доступа PROCESS_ALL_ACCESS. В приложении Win32, программирующем интерфейс (API) для Windows 95, это - всегда истина если идентификатор процесса в силе. Тем не менее, в Win32 API для Windows NT, DebugActiveProcess может потерпеть неудачу если целевой процесс был создан дескриптором безопасности, который запрещит подходящий доступ отладчика.
После того, как система проверит идентификатор процесса и определит, что правильная отладка присоединения сделана, функция возвращает ИСТИНУ. Отладчик - затем ожиданное, чтобы ждать отладку событий используя функцию WaitForDebugEvent. Система задерживает всю резьбу в процессе и посылает события отладчика представляя текущее состояние процесса.

Система посылает отладчику единственный CREATE_PROCESS_DEBUG_EVENT, отлаживающее представлять события процесс определялся параметром dwProcessId. Элемент lpStartAddress структуры CREATE_PROCESS_DEBUG_INFO НЕДЕЙСТВИТЕЛЕН.
Для каждой к настоящему времени части резьбы процесса, система посылает CREATE_THREAD_DEBUG_EVENT, отлаживающее событие. Элемент lpStartAddress структуры CREATE_THREAD_DEBUG_INFO НЕДЕЙСТВИТЕЛЕН.
Для каждой динамической связи библиотеки (DLL) к настоящему времени загружался в пространство адреса целевого процесса, система посылает LOAD_DLL_DEBUG_EVENT, отлаживающее событие. Система устраивает для первой резьбы в процессе, чтобы выполнять инструкцию точечного разрыва после того, как она продолжится. Продолжая эти причины резьбы это, чтобы возвращаться ему это делало прежде, чем отладчик был приложен.

В конце концов этого, сделан, система продолжает всю резьбу в процесс. Когда первая резьба в итогах процесса, это выполняет инструкцию точечного разрыва, которая вызывает EXCEPTION_DEBUG_EVENT, отлаживающее событие, которое нужно посылаться отладчику. Все будущее, отлаживающее события послано отладчику используя нормальный механизм и правила.

Смотри Также

CreateProcess, CREATE_PROCESS_DEBUG_INFO, CREATE_THREAD_DEBUG_INFO, WaitForDebugEvent


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz