sforce5
Олл фо ЛулзЪ
- Сообщения
- 160
- Репутация
- 41
Версия AutoIt: 3.2.8.1 и выше
Описание: Необходимо преобразовать Delphi код в AutoIt скрипт:
Программа посредством DbgUiConnectToDbg и DbgUiDebugActiveProcess подключается к процессу и вырубает его
или хотя бы дайте пример вызова API из ntdll.dll DbgUiConnectToDbg и DbgUiDebugActiveProcess
Описание: Необходимо преобразовать Delphi код в AutoIt скрипт:
Программа посредством DbgUiConnectToDbg и DbgUiDebugActiveProcess подключается к процессу и вырубает его
Код:
Function DebugKillProcess(ProcessId: dword): boolean;
var
pHandle: dword;
myPID: dword;
HandlesInfo: PSYSTEM_HANDLE_INFORMATION_EX;
r: dword;
begin
Result := false;
myPID := GetCurrentProcessId();
if not EnableDebugPrivilege() then Exit;
//подключаемся к системе отладки и получаем DebugObject
if DbgUiConnectToDbg() <> STATUS_SUCCESS then Exit;
pHandle := OpenProcessEx(ProcessId);
//включаем отладку процесса
if DbgUiDebugActiveProcess(pHandle) <> STATUS_SUCCESS then Exit;
//надо найти полученный DebugObject
HandlesInfo := GetInfoTable(SystemHandleInformation);
if HandlesInfo = nil then Exit;
for r := 0 to HandlesInfo^.NumberOfHandles do
if (HandlesInfo^.Information[r].ProcessId = myPID) and
(HandlesInfo^.Information[r].ObjectTypeNumber = $8) //DebugObject
then begin
//закрываем DebugObject, что приводит к уничтожению отлаживаемого процесса
CloseHandle(HandlesInfo^.Information[r].Handle);
Result := true;
break;
end;
VirtualFree(HandlesInfo, 0, MEM_RELEASE);
end;
или хотя бы дайте пример вызова API из ntdll.dll DbgUiConnectToDbg и DbgUiDebugActiveProcess