What does SIGINT translate into in the NT native API?

167 views Asked by At

Windows has support for SIGINT in console applications in response to Ctrl-C. This implies Windows has functionality to interrupt a running thread from a remote thread (process even!) and invoke a signal handler.

Exactly how does this work at the NT Native API level? Can this thread-interruption API be used for other purposes in userspace?

2

There are 2 answers

0
Kristopher Johnson On BEST ANSWER

According to http://msdn.microsoft.com/en-us/library/xdkz3x12(v=vs.71).aspx, a SIGINT causes a new thread to be created to handle the interrupt.

So it looks like it doesn't really "interrupt" any running threads. You can achieve the same effect by simply spawning your own thread.

There is more commentary here:

0
Chris Smith On

You could always suspend the target thread, fix up the context to execute your procedure and then resume it. It's ugly but it would work if you wanted to interrupt a thread to execute a procedure.

The console and the CTRL+C handler are Win32 constructs and do't really exist at the native API level.