def send(signal)
case signal
when 0
exit_code == PROCESS_STILL_ALIVE
when WIN_SIGINT
Lib.generate_console_ctrl_event(CTRL_C_EVENT, @pid)
when WIN_SIGBREAK
Lib.generate_console_ctrl_event(CTRL_BREAK_EVENT, @pid)
when WIN_SIGKILL
ok = Lib.terminate_process(@handle, @pid)
ok or raise Error, Lib.last_error_message
else
thread_id = FFI::MemoryPointer.new(:ulong)
module_handle = Lib.get_module_handle("kernel32")
proc_address = Lib.get_proc_address(module_handle, "ExitProcess")
thread = Lib.create_remote_thread(@handle, 0, 0, proc_address, 0, 0, thread_id)
thread or raise Error, Lib.last_error_message
Lib.wait_for_single_object(thread, 5)
true
end
end