diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 76618ea3690..87cae041a42 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1469,7 +1469,7 @@ @ stub fread_s @ cdecl free(ptr) msvcrt.free @ cdecl freopen(str str ptr) msvcrt.freopen -@ stub freopen_s +@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s @ cdecl frexp(double ptr) msvcrt.frexp @ varargs fscanf(ptr str) msvcrt.fscanf @ varargs fscanf_s(ptr str) msvcrt.fscanf_s diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index f3c0a946b65..06751ef5fa7 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1325,7 +1325,7 @@ @ stub fread_s @ cdecl free(ptr) msvcrt.free @ cdecl freopen(str str ptr) msvcrt.freopen -@ stub freopen_s +@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s @ cdecl frexp(double ptr) msvcrt.frexp @ varargs fscanf(ptr str) msvcrt.fscanf @ varargs fscanf_s(ptr str) msvcrt.fscanf_s diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index e40d2e9024a..688bdc628cc 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1326,7 +1326,7 @@ @ stub fread_s @ cdecl free(ptr) msvcrt.free @ cdecl freopen(str str ptr) msvcrt.freopen -@ stub freopen_s +@ cdecl freopen_s(ptr str str ptr) msvcrt.freopen_s @ cdecl frexp(double ptr) msvcrt.frexp @ varargs fscanf(ptr str) msvcrt.fscanf @ varargs fscanf_s(ptr str) msvcrt.fscanf_s diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index b6af98fb335..f3200eba194 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3299,6 +3299,25 @@ MSVCRT_FILE* CDECL MSVCRT_freopen(const char *path, const char *mode, MSVCRT_FIL return ret; } +/********************************************************************* + * 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.@) */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index c8c710deb48..f2b5e330b47 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