It certainly is possible, but it just makes no sense. You can crash programs in nearly infinite ways from closing all their handles to triggering interrupts in their context.
You want to use this to kill-off rootkits and malware or even viruses, I know a bit or too about these kinds of programs and here's what inhibits anti-virus/anti-rootkit/anti-malware software from just 'crashing' the party so to speak
First, to use it to kill rootkits you'll have to
find and then target these rootkits. Rootkits are among the hardest pieces of software to remove, this is because a rootkit's purpose is to remain undetected. This is the main problem with rootkits: they just can't be found. If you actually found one the problem of removing it still remains. Rootkits -while there are ring 3 rootkits- usually reside in kernel memory (ring 0) usermode programs can't access kernel memory, so you'd have to write a kernel driver to crash the rootkit. This brings with it the risk of crashing the entire system, because in the kernel there's no goofing around like there is in usermode: faults and exceptions if not caught always result in a BSOD or bugcheck. Next, a rootkit does not play by the rules. It may have hooked kernel-mode functions so that it's handle is never exposed to other programs, and certain kernel functions -like psTerminateProcess- may not work even
if you found the correct handle. You'd have to code these on your own. If you do that however your code will not be portable, and it won't be very safe either unless you have expert knowledge of each and every thing that happens in the windows kernel, which btw differs in each version of windows.
Next malware, malware is very easy to remove if it doesn't have any other -rootkit or viral- components attached. Just boot into livecd -be it windows, osx or linux- and remove it from there.
Next viruses, viruses are again a big problem, like rootkits one of the purposes of a virus is to remain hidden, it does this by hiding and infecting legit programs. This is of itself a reason why you can't just 'crash' a program infected by a virus: it's still the same program with maybe 0.01% of it's code altered (yes viruses can be that small). Crashing or just removing the entire program would be a real waste (even if it's often the only thing that can be done). Another thing that is problematic about a virus infection is that it doesn't stop at just one single infected program. A very aggressive virus can infect
every singe file on your system. Killing and deleting all the programs will leave you with... exactly nothing. So that's no option either. A virus may not even use a stack or buffers that you can use to corrupt, it may work with its own calling scheme as to make it easier to make itself offset independent.
Once you've found a way to find, and deal with a threat like this. You don't crash the program, you just call exit process -your own or the real function- on it's handle and be done.