SetConsoleCtrlHandler problem

Michi Henning michi@zeroc.com
Wed Dec 31 06:35:00 GMT 2003


Hi,

it appears that Windows binaries won't run correctly under cygwin/bash
if they use SetConsoleCtrlHandler(). I've attached a trivial program
below. If you run this from a Windows console window, it prints
"handler called" every time you hit Ctrl-C. When run from a cygwin bash
window, the program exits after calling the handler with status 130.

Shouldn't the same binary behave identically, regardless of whether
I run it from cygwin/bash or a console window?

I'd appreciate any help to get the Windows behavior for such binaries
under cygwin.

Thanks,

Michi.

#include <Windows.h>
#include <iostream>

static BOOL handler(DWORD sig)
{
     std::cout << "handler called" << std::endl;
     return 1;
}

int main()
{
     SetConsoleCtrlHandler((PHANDLER_ROUTINE)handler, true);
     for(;;)
	;
     return 0;
}



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list