windows-kill icon indicating copy to clipboard operation
windows-kill copied to clipboard

windows-kill.exe occasionally fails for Windows after May 2020 Update

Open SigmundVik opened this issue 5 years ago • 2 comments

After updating Windows to version 10.0.19041.388 (May 2020 Update), then windows-kill.exe started to occasionally fail like this:

[BOOTCAMP] [sigmund-MAC2-dev] 00:25 0.634 155649M d:\dev>base-00\exe\windows-kill.exe -SIGINT 496
Windows Kill 1.1.4 | Windows Kill Library 3.1.3
RuntimeError: windows-kill-library: ctrl-routine:findAddress:checkAddressIsNotNull

^C

This is for the pre-built windows-kill.exe for 1.1.4.

SigmundVik avatar Jul 27 '20 12:07 SigmundVik

It seems to work again if I change the CtrlRoutine::findAddressByStackBackTrace() function to this:

	void CtrlRoutine::findAddressByStackBackTrace() {
		HMODULE hModule = GetModuleHandleA("kernel32.dll");
		if (hModule != NULL) {
			this->address = (LPTHREAD_START_ROUTINE)GetProcAddress(hModule, "CtrlRoutine");
		}
	}

Edit: This has been tested and works on both Windows 7 and 10.

SigmundVik avatar Jul 27 '20 15:07 SigmundVik

Also getting this when running 32bit to try to kill 64bit process. SystemError system:5: remote-process:startRemoteThread:CreateRemoteThread: Access is denied.

When using correct exe release however, I am still seeing checkAddressIsnotNull occassionaly. On top of that when running from a bat file it shows "Terminate batch job (y/n)"

In my use-case Bat files call bat files which start bat files and keep process restarting if it closes unexpectedly. I want a clean shutdown with SIGINT which will also close the bat files that keep restarting the process so this works somewhat.

Got around this with the following

REM ===
REM sub runme (A work around to not get "Terminate batch job (Y/N)" when running windows-kill)
REM ===
:runme
%*
goto :EOF


call :runme start /w "Child Process" %comspec% /c "windows-kill -SIGINT %PID% & exit 12345" <NUL >NUL 2>NUL

Also I think that the exit codes returned from int main should be 0 for success something else for errors?

Good also if windows-kill can have a -w wait for clean close option.

LiamKarlMitchell avatar Nov 07 '20 03:11 LiamKarlMitchell