MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / AttachWindowsConsole

Function AttachWindowsConsole

launcher/WindowsConsole.cpp:102–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102bool AttachWindowsConsole()
103{
104 auto stdinType = GetFileType(GetStdHandle(STD_INPUT_HANDLE));
105 auto stdoutType = GetFileType(GetStdHandle(STD_OUTPUT_HANDLE));
106 auto stderrType = GetFileType(GetStdHandle(STD_ERROR_HANDLE));
107
108 bool bindStdIn = false;
109 bool bindStdOut = false;
110 bool bindStdErr = false;
111
112 if (stdinType == FILE_TYPE_CHAR || stdinType == FILE_TYPE_UNKNOWN) {
113 bindStdIn = true;
114 }
115 if (stdoutType == FILE_TYPE_CHAR || stdoutType == FILE_TYPE_UNKNOWN) {
116 bindStdOut = true;
117 }
118 if (stderrType == FILE_TYPE_CHAR || stderrType == FILE_TYPE_UNKNOWN) {
119 bindStdErr = true;
120 }
121
122 if (AttachConsole(ATTACH_PARENT_PROCESS)) {
123 BindCrtHandlesToStdHandles(bindStdIn, bindStdOut, bindStdErr);
124 return true;
125 }
126
127 return false;
128}

Callers 2

ApplicationMethod · 0.85
FileLinkAppMethod · 0.85

Calls 1

Tested by

no test coverage detected