summaryrefslogtreecommitdiffstats
path: root/win/tclWinChan.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWinChan.c')
-rw-r--r--win/tclWinChan.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index f07c192..6c74b6c 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinChan.c,v 1.48 2006/08/30 19:30:25 hobbs Exp $
+ * RCS: @(#) $Id: tclWinChan.c,v 1.49 2007/04/16 13:36:36 dkf Exp $
*/
#include "tclWinInt.h"
@@ -1460,26 +1460,28 @@ FileThreadActionProc(
*/
DWORD
-FileGetType(handle)
- HANDLE handle; /* Opened file handle */
+FileGetType(
+ HANDLE handle) /* Opened file handle */
{
DWORD type;
type = GetFileType(handle);
/*
- * If the file is a character device, we need to try to figure out
- * whether it is a serial port, a console, or something else. We
- * test for the console case first because this is more common.
+ * If the file is a character device, we need to try to figure out whether
+ * it is a serial port, a console, or something else. We test for the
+ * console case first because this is more common.
*/
if ((type == FILE_TYPE_CHAR)
|| ((type == FILE_TYPE_UNKNOWN) && !GetLastError())) {
DWORD consoleParams;
+
if (GetConsoleMode(handle, &consoleParams)) {
type = FILE_TYPE_CONSOLE;
} else {
DCB dcb;
+
dcb.DCBlength = sizeof(DCB);
if (GetCommState(handle, &dcb)) {
type = FILE_TYPE_SERIAL;