Bug 456449: pass INVALID_HANDLE_VALUE instead of 0, 1, and 2 to the
authorwtc%google.com
Wed, 04 Feb 2009 23:47:33 +0000
changeset 4033 271db86d9e6518efa31f3f131b83d873aac74ca3
parent 4032 2117b2359c33a6473065aa261ce44038d959a5dc
child 4034 356a5eaf87238301b01aeea6372aaed8601b1e33
push idunknown
push userunknown
push dateunknown
bugs456449
Bug 456449: pass INVALID_HANDLE_VALUE instead of 0, 1, and 2 to the PR_AllocFileDesc calls for _pr_stdin, _pr_stdout, and _pr_stderr on WinCE. r=blassey.
pr/src/io/prio.c
--- a/pr/src/io/prio.c
+++ b/pr/src/io/prio.c
@@ -40,26 +40,38 @@
 #include <string.h> /* for memset() */
 
 
 /************************************************************************/
 
 PRLock *_pr_flock_lock;
 PRCondVar *_pr_flock_cv;
 
+#ifdef WINCE
+/*
+ * There are no stdin, stdout, stderr in Windows CE.  INVALID_HANDLE_VALUE
+ * should cause all I/O functions on the handle to fail.
+ */
+static HANDLE GetStdHandle(DWORD nStdHandle)
+{
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return INVALID_HANDLE_VALUE;
+}
+#endif
+
 void _PR_InitIO(void)
 {
     const PRIOMethods *methods = PR_GetFileMethods();
 
     _PR_InitFdCache();
 
     _pr_flock_lock = PR_NewLock();
     _pr_flock_cv = PR_NewCondVar(_pr_flock_lock);
 
-#if defined(WIN32) && !defined(WINCE)
+#ifdef WIN32
     _pr_stdin = PR_AllocFileDesc((PROsfd)GetStdHandle(STD_INPUT_HANDLE),
             methods);
     _pr_stdout = PR_AllocFileDesc((PROsfd)GetStdHandle(STD_OUTPUT_HANDLE),
             methods);
     _pr_stderr = PR_AllocFileDesc((PROsfd)GetStdHandle(STD_ERROR_HANDLE),
             methods);
 #ifdef WINNT
     _pr_stdin->secret->md.sync_file_io = PR_TRUE;