[CRT] Fix _fmode
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 24 Jul 2021 14:27:43 +0000 (16:27 +0200)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 4 Aug 2021 00:03:07 +0000 (02:03 +0200)
Remove mingw-w64 version of _fmode. _fmode should not be linked directly into the executable. Instead, the export from msvcrt should be used. On Windows 10 it's defined to *__p__fmode(), which is exported from ucrtbase.dll
Also _fmode in msvcrt.dll is initialized with 0.

sdk/lib/crt/msvcrtex.cmake
sdk/lib/crt/startup/startup.cmake
sdk/lib/crt/startup/txtmode.c [deleted file]
sdk/lib/crt/stdio/fmode.c

index 32d1afc..5f9cad1 100644 (file)
@@ -15,7 +15,6 @@ list(APPEND MSVCRTEX_SOURCE
     startup/charmax.c
     startup/atonexit.c
     startup/dllmain.c
-    startup/txtmode.c
     startup/pesect.c
     startup/tlsmcrt.c
     startup/tlsthrd.c
index 1574d29..37577e0 100644 (file)
@@ -12,7 +12,6 @@ list(APPEND CRT_STARTUP_SOURCE
     startup/natstart.c
     startup/charmax.c
     startup/atonexit.c
-    #startup/txtmode.c
     startup/pesect.c
     startup/tlsmcrt.c
     startup/tlsthrd.c
diff --git a/sdk/lib/crt/startup/txtmode.c b/sdk/lib/crt/startup/txtmode.c
deleted file mode 100644 (file)
index 1f50d16..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the w64 mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-
-#include <fcntl.h>
-
-/* Set default file mode to text */
-
-/* Is this correct?  Default value of  _fmode in msvcrt.dll is 0. */
-
-int _fmode = _O_TEXT;
index 0469904..220a92d 100644 (file)
@@ -1,7 +1,7 @@
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
 #include <precomp.h>
 
-int _fmode = _O_TEXT;
+int _fmode = 0;
 
 /*
  * @implemented