diff options
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/WinProcess.hs | 17 | ||||
-rw-r--r-- | Utility/winprocess.c | 10 |
2 files changed, 12 insertions, 15 deletions
diff --git a/Utility/WinProcess.hs b/Utility/WinProcess.hs index 31f6cfc69..36f079d04 100644 --- a/Utility/WinProcess.hs +++ b/Utility/WinProcess.hs @@ -11,18 +11,5 @@ module Utility.WinProcess where import Utility.PID -import System.Win32.Process -import Control.Exception (bracket) -import Control.Monad - -terminatePID :: PID -> IO () -terminatePID p = bracket - (openProcess pROCESS_TERMINATE False p) - (void . c_closeProcess) - (\h -> void $ c_TerminateProcess h 1) - -foreign import ccall unsafe "windows.h TerminateProcess" - c_TerminateProcess :: ProcessHandle -> Int -> IO Int - -foreign import ccall unsafe "windows.h CloseHandle" - c_closeProcess :: ProcessHandle -> IO Bool +foreign import ccall unsafe "terminatepid" + terminatePID :: PID -> IO () diff --git a/Utility/winprocess.c b/Utility/winprocess.c new file mode 100644 index 000000000..b6e315573 --- /dev/null +++ b/Utility/winprocess.c @@ -0,0 +1,10 @@ +#include <windows.h> + +void terminatepid (DWORD pid) { + HANDLE h; + h = OpenProcess(PROCESS_TERMINATE, 0, pid); + if (h != NULL) { + TerminateProcess(h, 1); + } + CloseHandle(h); +} |