3

I was working for an exercise in c, with codeblocks. When i was done, i compiled & ran it.

Instead of running properly, the cmd window was blank, it couldn't take any input nor show any output. I googled a bit and found guys having a similar problem, with processes stuck in their task manager.

I terminated the processes (cmd exercise1) from there initially, but codeblocks kept behaving the same as before.

I googled a bit further and found out about process explorer and process hacker. I tried both of them, but with no luck. I'm stuck with 2 processes in the process explorer, unable to terminate, suspend OR restart them with what i've tried so far.

Furthermore, as of codeblocks, when i'm trying to do anything with exercise1.c (the file that's stuck) it compiles with the error "Permission Denied" and never runs properly, please help :)

nic3ts
  • 216
  • 1
  • 11

1 Answers1

2

It remind me when I was programming Windows Services and they were also impossible to stop using the windows Task Manager.

For resolving this we had to find a code called EnableDebugPrivAndRun.cpp, compile it to an executable and then launching the Task Manager with:

C:\>EnableDebugPrivAndRun.exe TaskMgr.exe

With that, the Task Manager was able to kill any process. Beware: even the Windows core processes can be killed (like lsass.exe in Windows 2000) and you just get a frozen machine).

You can still find the code and full article in that Microsoft article. The code is available when you click the link called Figure 3.

I used that long time ago, on Windows NT4 and Windows 2000 machines, I am not sure that will still works for the latest version of Windows and perhaps now such a tool would be provided by Microsoft's latest development environment.

UPDATE: Apparently some other users found a solution in this SuperUser question and I also found a Windows Debugging Tools which contains a kill command which should do the job as well.

Extract of the MSDN site:

Debugging Tools for Windows (WinDbg, KD, CDB, NTSD)

3 ways to get Debugging Tools for Windows:

  • As part of the WDK Install Microsoft Visual Studio and then install the Windows Driver Kit (WDK). Debugging Tools for Windows is included in the WDK.

  • As part of the Windows SDK Install the Windows Software Development Kit > (SDK). Debugging Tools for Windows is included in the Windows SDK.

  • As a standalone tool set If you want to download only Debugging Tools for Windows, install the Windows SDK, and, during the installation, select the Debugging Tools for Windows box and clear all the other boxes.

The Debugging toolkit is available here.

рüффп
  • 744
  • 6
  • 13
  • 26
  • hey, i got the code from figure 3 and compiled it to an executable. – nic3ts Nov 27 '15 at 10:11
  • Fired up cmd: >cd desktop (where i placed the .exe) >EnableDebugPrivAndRun.exe (with TaskMgr.exe and then procexp.exe) but none of those worked so i guess EnableDebugPrivAndRun is obsolete for windows 10 like you said :-/ It's a shame, the article was pretty good and was pretty much after my problem. Any clues where i can find something similar for an up-to-date version of windows? – nic3ts Nov 27 '15 at 10:18
  • I found different alternative for Windows (since version Win7). The fastest is probably to download the Windows SDK and install only the Debugging tools (latest option described in my update). Then you should have the kill.exe program to be able to kill your application. – рüффп Nov 27 '15 at 13:51
  • Ok, sounds like a plan! Pretty much everything newer than win7 is compatible! I'll also check with my teacher (i'm headed for the lab in which my c course takes place) for a possible alternative solution, has he seen something similiar in his years of service. Otherwise i'll go for the SDK when i'm back home. Thanks for your time mate :) – nic3ts Nov 27 '15 at 16:07
  • Also, i've stumbled upon the [Super User question](http://superuser.com/questions/109010/kill-a-process-which-says-access-denied) you indicated beforehand. Main answer suggests giving process hacker a go ... Didn't work out. I wouldn't be bothering you without some research of my own! – nic3ts Nov 27 '15 at 16:11
  • This is awesome, thank you. Here's the SDK link for Windows 10: https://developer.microsoft.com/windows/downloads/windows-10-sdk – Martin Hansen Jun 15 '18 at 18:35
  • I also uploaded kill.exe as a standalone file so you don't need to download the 500MB SDK. You can check the file integrity with VirusTotal. https://drive.google.com/open?id=1nwZjRHG4vSrLGGpVATg7c_M_M7XyBoiD – Martin Hansen Jun 15 '18 at 18:53