[1/3] msvcrt: Implement freopen_s
André Hentschel
nerv at dawncrow.de
Sun Nov 13 11:33:00 CST 2011
http://bugs.winehq.org/show_bug.cgi?id=28701
---
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 90e0d80..a8f8804 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -3294,6 +3294,25 @@ MSVCRT_FILE* CDECL MSVCRT_freopen(const char *path, const char *mode, MSVCRT_FIL
}
/*********************************************************************
+ * freopen_s (MSVCRT.@)
+ */
+int CDECL MSVCRT_freopen_s(MSVCRT_FILE** pFile,
+ const char *path, const char *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_freopen(path, mode, file);
+
+ if(!*pFile)
+ return *MSVCRT__errno();
+ return 0;
+}
+
+/*********************************************************************
* fsetpos (MSVCRT.@)
*/
int CDECL MSVCRT_fsetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index c8c710d..f2b5e33 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -1269,7 +1269,7 @@
@ cdecl fread(ptr long long ptr) MSVCRT_fread
@ cdecl free(ptr) MSVCRT_free
@ cdecl freopen(str str ptr) MSVCRT_freopen
-# stub freopen_s(ptr str str ptr)
+@ cdecl freopen_s(ptr str str ptr) MSVCRT_freopen_s
@ cdecl frexp(double ptr) MSVCRT_frexp
@ cdecl -arch=x86_64 frexpf(float ptr) MSVCRT_frexpf
@ varargs fscanf(ptr str) MSVCRT_fscanf
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list