| 895 | } |
| 896 | |
| 897 | boolean |
| 898 | fakeconsole(void) |
| 899 | { |
| 900 | if (!hStdOut) { |
| 901 | HANDLE fkhStdOut = GetStdHandle(STD_OUTPUT_HANDLE); |
| 902 | HANDLE fkhStdIn = GetStdHandle(STD_INPUT_HANDLE); |
| 903 | |
| 904 | if (!fkhStdOut && !fkhStdIn) { |
| 905 | /* Bool rval; */ |
| 906 | AllocConsole(); |
| 907 | AttachConsole(GetCurrentProcessId()); |
| 908 | /* rval = SetStdHandle(STD_OUTPUT_HANDLE, hWrite); */ |
| 909 | (void) freopen("CON", "w", stdout); |
| 910 | (void) freopen("CON", "r", stdin); |
| 911 | } |
| 912 | has_fakeconsole = TRUE; |
| 913 | } |
| 914 | |
| 915 | /* Obtain handles for the standard Console I/O devices */ |
| 916 | hConIn = GetStdHandle(STD_INPUT_HANDLE); |
| 917 | hConOut = GetStdHandle(STD_OUTPUT_HANDLE); |
| 918 | #if 0 |
| 919 | if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE)) { |
| 920 | /* Unable to set control handler */ |
| 921 | cmode = 0; /* just to have a statement to break on for debugger */ |
| 922 | } |
| 923 | #endif |
| 924 | return has_fakeconsole; |
| 925 | } |
| 926 | void freefakeconsole(void) |
| 927 | { |
| 928 | if (has_fakeconsole) { |
nothing calls this directly
no outgoing calls
no test coverage detected