64 {
65#if !FIRST_PASS
66
67 if (Environment.OSVersion.Platform == PlatformID.Win32NT)
68 {
69 IntPtr hStdIn = GetStdHandle(STD_INPUT_HANDLE);
70 if (hStdIn.ToInt64() == 0 || hStdIn.ToInt64() == -1)
71 {
72 throw new global::java.io.IOException("The handle is invalid");
73 }
74 int fdwMode;
75 if (GetConsoleMode(hStdIn, out fdwMode) == 0)
76 {
77 throw new global::java.io.IOException("GetConsoleMode failed");
78 }
79 bool old = (fdwMode & ENABLE_ECHO_INPUT) != 0;
80 if (on)
81 {
82 fdwMode |= ENABLE_ECHO_INPUT;
83 }
84 else
85 {
86 fdwMode &= ~ENABLE_ECHO_INPUT;
87 }
88 if (SetConsoleMode(hStdIn, fdwMode) == 0)
89 {
90 throw new global::java.io.IOException("SetConsoleMode failed");
91 }
92 return old;
93 }
94#endif
95 return true;
96 }