[2/3] msvcrt: Implement _wfreopen_s

André Hentschel nerv at dawncrow.de
Sun Nov 13 11:33:47 CST 2011


---
 dlls/msvcrt/file.c      |   19 +++++++++++++++++++
 dlls/msvcrt/msvcrt.spec |    2 +-
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index a8f8804..aab3fcf 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -3271,6 +3271,25 @@ MSVCRT_FILE* CDECL MSVCRT__wfreopen(const MSVCRT_wchar_t *path, const MSVCRT_wch
 }
 
 /*********************************************************************
+ *      _wfreopen_s (MSVCRT.@)
+ */
+int CDECL MSVCRT__wfreopen_s(MSVCRT_FILE** pFile,
+        const MSVCRT_wchar_t *path, const MSVCRT_wchar_t *mode, MSVCRT_FILE* file)
+{
+    if (!MSVCRT_CHECK_PMT(pFile != NULL) || !MSVCRT_CHECK_PMT(path != NULL) ||
+        !MSVCRT_CHECK_PMT(mode != NULL) || !MSVCRT_CHECK_PMT(file != NULL)) {
+        *MSVCRT__errno() = MSVCRT_EINVAL;
+        return MSVCRT_EINVAL;
+    }
+
+    *pFile = MSVCRT__wfreopen(path, mode, file);
+
+    if(!*pFile)
+        return *MSVCRT__errno();
+    return 0;
+}
+
+/*********************************************************************
  *      freopen (MSVCRT.@)
  *
  */
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index f2b5e33..fac2104 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -1133,7 +1133,7 @@
 @ cdecl _wfopen(wstr wstr) MSVCRT__wfopen
 @ cdecl _wfopen_s(ptr wstr wstr) MSVCRT__wfopen_s
 @ cdecl _wfreopen(wstr wstr ptr) MSVCRT__wfreopen
-# stub _wfreopen_s(ptr wstr wstr ptr)
+@ cdecl _wfreopen_s(ptr wstr wstr ptr) MSVCRT__wfreopen_s
 @ cdecl _wfsopen(wstr wstr long) MSVCRT__wfsopen
 @ cdecl _wfullpath(ptr wstr long)
 # stub _wfullpath_dbg(ptr wstr long long str long)
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list