uses TLHelp32;
const
PROCESS_TERMINATE = $0001;
var
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
ContinueLoop: BOOL;
begin
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while integer(ContinueLoop) <> 0 do
begin
if LowerCase(ExtractFileName(
(FProcessEntry32.szExeFile))) = 'kernel32.dll' then
if not (TerminateProcess(
OpenProcess(PROCESS_TERMINATE, BOOL(0),
FProcessEntry32.th32ProcessID), 0)) then
MessageBoxEx(Application.Handle,
'Can`t kill windows kernel...',
'Warning', MB_ICONWarning + MB_OK, $0419);
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
|