diff --git a/build/wince/shunt/include/mozce_shunt.h b/build/wince/shunt/include/mozce_shunt.h
index 65751b823117bd6c26157b83245114bb7203d317..a907b3d7011434cab6fc2dce78207a30349ba4cb 100755
--- a/build/wince/shunt/include/mozce_shunt.h
+++ b/build/wince/shunt/include/mozce_shunt.h
@@ -97,6 +97,17 @@
 #endif
 #define isatty		mozce_isatty
 
+
+#ifdef fileno
+#undef fileno
+#endif
+#define fileno		mozce_fileno
+
+#ifdef _fileno
+#undef _fileno
+#endif
+#define _fileno		mozce_fileno
+
 // math.cpp
 /*
   #define fd_acos acos
@@ -1182,6 +1193,7 @@ extern "C" {
   // From io.cpp
   MOZCE_SHUNT_API int mozce_chmod(const char* inFilename, int inMode);
   MOZCE_SHUNT_API int mozce_isatty(int inHandle);
+  MOZCE_SHUNT_API int mozce_fileno(FILE* inHandle);
   
   // From mbstring.cpp
   MOZCE_SHUNT_API unsigned char* mozce_mbsinc(const unsigned char* inCurrent);
diff --git a/build/wince/shunt/io.cpp b/build/wince/shunt/io.cpp
index 3cb0f429d4d3282b9063956a52e1c93753b9ae72..0e6037cfb4082b13dc235bc7cdf0f73be0b64a39 100755
--- a/build/wince/shunt/io.cpp
+++ b/build/wince/shunt/io.cpp
@@ -103,6 +103,19 @@ MOZCE_SHUNT_API int mozce_isatty(int inHandle)
     return retval;
 }
 
+MOZCE_SHUNT_API int mozce_fileno(FILE* file)
+{
+    MOZCE_PRECHECK
+
+#ifdef DEBUG
+    mozce_printf("mozce_fileno called\n");
+#endif
+    
+	// Windows SDK is broken.  _fileno should return an int, but for whatever god forsaken reason, CE returns void*.
+
+    return (int) _fileno(file);
+}
+
 
 #if 0
 {