MCPcopy Create free account
hub / github.com/NetHack/NetHack / fakeconsole

Function fakeconsole

sys/windows/windmain.c:897–925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897boolean
898fakeconsole(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}
926void freefakeconsole(void)
927{
928 if (has_fakeconsole) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected