mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[CRT/MSVCRT]
Follow original design/style of printf module Always use dosmaperr to convert win32 errors to sane crt errors Enable forgotten _get_doserrno, get_errno, set_doserrno and _gmtime32_s Small fixes to pass more wine tests. Patch by Samuel Serapión. svn path=/trunk/; revision=54661
This commit is contained in:
parent
5bf403a592
commit
ce424af08c
30 changed files with 327 additions and 184 deletions
|
@ -428,9 +428,9 @@
|
|||
# @ varargs _fwscanf_s_l(ptr wstr ptr)
|
||||
@ cdecl _gcvt(double long str)
|
||||
# stub _gcvt_s
|
||||
# stub _get_doserrno
|
||||
@ cdecl _get_doserrno(ptr)
|
||||
# stub _get_environ
|
||||
# stub _get_errno
|
||||
@ cdecl _get_errno(ptr)
|
||||
# stub _get_fileinfo
|
||||
# stub _get_fmode
|
||||
# @ cdecl _get_heap_handle()
|
||||
|
@ -466,7 +466,7 @@
|
|||
@ cdecl _getws(ptr)
|
||||
@ cdecl -i386 _global_unwind2(ptr)
|
||||
@ cdecl _gmtime32(ptr)
|
||||
# stub _gmtime32_s
|
||||
@ cdecl _gmtime32_s(ptr ptr)
|
||||
@ cdecl _gmtime64(ptr)
|
||||
@ cdecl _gmtime64_s(ptr ptr)
|
||||
@ cdecl _heapadd(ptr long)
|
||||
|
@ -812,7 +812,7 @@
|
|||
@ stdcall -i386 _seh_longjmp_unwind(ptr)
|
||||
# stub _set_SSE2_enable
|
||||
# stub _set_controlfp
|
||||
# stub _set_doserrno
|
||||
@ cdecl _set_doserrno(long)
|
||||
@ cdecl _set_errno(long)
|
||||
@ cdecl _set_error_mode(long)
|
||||
# stub _set_fileinfo
|
||||
|
|
|
@ -131,25 +131,35 @@ list(APPEND CRT_SOURCE
|
|||
misc/stubs.c
|
||||
misc/tls.c
|
||||
printf/_cprintf.c
|
||||
printf/_cwprintf.c
|
||||
printf/_snprintf.c
|
||||
printf/_snwprintf.c
|
||||
printf/_vcprintf.c
|
||||
printf/_vsprintf_p.c
|
||||
printf/_vcwprintf.c
|
||||
printf/_vsnprintf.c
|
||||
printf/_vsnwprintf.c
|
||||
printf/_vsprintf_p.c
|
||||
printf/fprintf.c
|
||||
printf/fprintf_s.c
|
||||
printf/fwprintf.c
|
||||
printf/fwprintf_s.c
|
||||
printf/printf.c
|
||||
printf/printf_s.c
|
||||
printf/sprintf.c
|
||||
printf/streamout.c
|
||||
printf/swprintf.c
|
||||
printf/vfprintf.c
|
||||
printf/vfprintf_s.c
|
||||
printf/vfwprintf.c
|
||||
printf/vfwprintf_s.c
|
||||
printf/vprintf.c
|
||||
printf/vprintf_s.c
|
||||
printf/vsprintf.c
|
||||
printf/vswprintf.c
|
||||
printf/vwprintf.c
|
||||
printf/vwprintf_s.c
|
||||
printf/wprintf.c
|
||||
printf/wprintf_s.c
|
||||
printf/wstreamout.c
|
||||
process/_cwait.c
|
||||
process/_system.c
|
||||
|
|
|
@ -31,25 +31,35 @@
|
|||
|
||||
<directory name="printf">
|
||||
<file>_cprintf.c</file>
|
||||
<file>_cwprintf.c</file>
|
||||
<file>_snprintf.c</file>
|
||||
<file>_snwprintf.c</file>
|
||||
<file>_vcprintf.c</file>
|
||||
<file>_vsprintf_p.c</file>
|
||||
<file>_vcwprintf.c</file>
|
||||
<file>_vsnprintf.c</file>
|
||||
<file>_vsnwprintf.c</file>
|
||||
<file>_vsprintf_p.c</file>
|
||||
<file>fprintf.c</file>
|
||||
<file>fprintf_s.c</file>
|
||||
<file>fwprintf.c</file>
|
||||
<file>fwprintf_s.c</file>
|
||||
<file>printf.c</file>
|
||||
<file>printf_s.c</file>
|
||||
<file>sprintf.c</file>
|
||||
<file>streamout.c</file>
|
||||
<file>swprintf.c</file>
|
||||
<file>vfprintf.c</file>
|
||||
<file>vfprintf_s.c</file>
|
||||
<file>vfwprintf.c</file>
|
||||
<file>vfwprintf_s.c</file>
|
||||
<file>vprintf.c</file>
|
||||
<file>vprintf_s.c</file>
|
||||
<file>vsprintf.c</file>
|
||||
<file>vswprintf.c</file>
|
||||
<file>vwprintf.c</file>
|
||||
<file>vwprintf_s.c</file>
|
||||
<file>wprintf.c</file>
|
||||
<file>wprintf_s.c</file>
|
||||
<file>wstreamout.c</file>
|
||||
</directory>
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
#include <errno.h>
|
||||
|
||||
extern void * __pInvalidArgHandler;
|
||||
|
||||
void _invalid_parameter(
|
||||
|
@ -10,7 +12,7 @@ void _invalid_parameter(
|
|||
|
||||
#ifndef _LIBCNT_
|
||||
#define MSVCRT_INVALID_PMT(x) _invalid_parameter(NULL, NULL, NULL, 0, 0)
|
||||
#define MSVCRT_CHECK_PMT(x) ((x) || (MSVCRT_INVALID_PMT(0),FALSE))
|
||||
#define MSVCRT_CHECK_PMT(x) ((x) || (MSVCRT_INVALID_PMT(0),0))
|
||||
#else
|
||||
/* disable secure crt parameter checks */
|
||||
#define MSVCRT_CHECK_PMT
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* FILE: lib/sdk/crt/printf/_cprintf.c
|
||||
* PURPOSE: Implementation of _cprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <conio.h>
|
||||
|
@ -22,17 +21,3 @@ _cprintf(const char * format, ...)
|
|||
va_end(argptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_cwprintf(const wchar_t* format, ...)
|
||||
{
|
||||
int retval;
|
||||
va_list valist;
|
||||
|
||||
va_start( valist, format );
|
||||
retval = _vcwprintf(format, valist);
|
||||
va_end(valist);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
24
reactos/lib/sdk/crt/printf/_cwprintf.c
Normal file
24
reactos/lib/sdk/crt/printf/_cwprintf.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/_cwprintf.c
|
||||
* PURPOSE: Implementation of _cwprintf
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <conio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
_cwprintf(const wchar_t* format, ...)
|
||||
{
|
||||
int retval;
|
||||
va_list valist;
|
||||
|
||||
va_start( valist, format );
|
||||
retval = _vcwprintf(format, valist);
|
||||
va_end(valist);
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -15,10 +15,3 @@ _vcprintf(const char* format, va_list va)
|
|||
{
|
||||
return vfprintf(stdout, format, va);
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_vcwprintf(const wchar_t* format, va_list va)
|
||||
{
|
||||
return vfwprintf(stdout, format, va);
|
||||
}
|
||||
|
|
17
reactos/lib/sdk/crt/printf/_vcwprintf.c
Normal file
17
reactos/lib/sdk/crt/printf/_vcwprintf.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/_vcwprintf.c
|
||||
* PURPOSE: Implementation of _vcwprintf
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_vcwprintf(const wchar_t* format, va_list va)
|
||||
{
|
||||
return vfwprintf(stdout, format, va);
|
||||
}
|
|
@ -4,13 +4,13 @@
|
|||
* FILE: lib/sdk/crt/printf/fprintf.c
|
||||
* PURPOSE: Implementation of fprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_cdecl
|
||||
fprintf(FILE *file, const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
@ -21,15 +21,3 @@ fprintf(FILE *file, const char *format, ...)
|
|||
va_end(argptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
fprintf_s(FILE* file, const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
int result;
|
||||
va_start(argptr, format);
|
||||
result = vfprintf_s(file, format, argptr);
|
||||
va_end(argptr);
|
||||
return result;
|
||||
}
|
||||
|
|
24
reactos/lib/sdk/crt/printf/fprintf_s.c
Normal file
24
reactos/lib/sdk/crt/printf/fprintf_s.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/fprintf_s.c
|
||||
* PURPOSE: Implementation of fprintf_s
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
fprintf_s(FILE* file, const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
int result;
|
||||
va_start(argptr, format);
|
||||
result = vfprintf_s(file, format, argptr);
|
||||
va_end(argptr);
|
||||
return result;
|
||||
}
|
|
@ -4,13 +4,13 @@
|
|||
* FILE: lib/sdk/crt/printf/fwprintf.c
|
||||
* PURPOSE: Implementation of fwprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_cdecl
|
||||
fwprintf(FILE* file, const wchar_t *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
@ -22,14 +22,3 @@ fwprintf(FILE* file, const wchar_t *format, ...)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
fwprintf_s(FILE* file, const wchar_t *format, ...)
|
||||
{
|
||||
va_list valist;
|
||||
int res;
|
||||
va_start(valist, format);
|
||||
res = vfwprintf_s(file, format, valist);
|
||||
va_end(valist);
|
||||
return res;
|
||||
}
|
||||
|
|
24
reactos/lib/sdk/crt/printf/fwprintf_s.c
Normal file
24
reactos/lib/sdk/crt/printf/fwprintf_s.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/fwprintf_s.c
|
||||
* PURPOSE: Implementation of fwprintf_s
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
fwprintf_s(FILE* file, const wchar_t *format, ...)
|
||||
{
|
||||
va_list valist;
|
||||
int res;
|
||||
va_start(valist, format);
|
||||
res = vfwprintf_s(file, format, valist);
|
||||
va_end(valist);
|
||||
return res;
|
||||
}
|
|
@ -7,7 +7,8 @@
|
|||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
|
@ -17,22 +18,8 @@ printf(const char *format, ...)
|
|||
int result;
|
||||
|
||||
va_start(argptr, format);
|
||||
result = vprintf(format, argptr);
|
||||
result = vfprintf(stdout, format, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
_cdecl
|
||||
printf_s(const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
int res;
|
||||
|
||||
va_start(argptr, format);
|
||||
res = vprintf_s(format, argptr);
|
||||
va_end(argptr);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
25
reactos/lib/sdk/crt/printf/printf_s.c
Normal file
25
reactos/lib/sdk/crt/printf/printf_s.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/printf_s.c
|
||||
* PURPOSE: Implementation of printf_s
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
printf_s(const char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
int res;
|
||||
|
||||
va_start(argptr, format);
|
||||
res = vfprintf_s(stdout, format, argptr);
|
||||
va_end(argptr);
|
||||
return res;
|
||||
}
|
|
@ -4,17 +4,15 @@
|
|||
* FILE: lib/sdk/crt/printf/vfprintf.c
|
||||
* PURPOSE: Implementation of vfprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void CDECL _lock_file(FILE* file);
|
||||
void CDECL _unlock_file(FILE* file);
|
||||
int CDECL streamout(FILE *stream, const char *format, va_list argptr);
|
||||
int _cdecl streamout(FILE *stream, const char *format, va_list argptr);
|
||||
|
||||
int
|
||||
CDECL
|
||||
_cdecl
|
||||
vfprintf(FILE *file, const char *format, va_list argptr)
|
||||
{
|
||||
int result;
|
||||
|
@ -26,20 +24,3 @@ vfprintf(FILE *file, const char *format, va_list argptr)
|
|||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
CDECL
|
||||
vfprintf_s(FILE* file, const char *format, va_list argptr)
|
||||
{
|
||||
int result;
|
||||
|
||||
if(!MSVCRT_CHECK_PMT(format != NULL)) {
|
||||
*_errno() = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_lock_file(file);
|
||||
result = streamout(file, format, argptr);
|
||||
_unlock_file(file);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
33
reactos/lib/sdk/crt/printf/vfprintf_s.c
Normal file
33
reactos/lib/sdk/crt/printf/vfprintf_s.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/vfprintf_s.c
|
||||
* PURPOSE: Implementation of vfprintf_s
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <internal/safecrt.h>
|
||||
|
||||
int _cdecl streamout(FILE *stream, const char *format, va_list argptr);
|
||||
|
||||
int
|
||||
_cdecl
|
||||
vfprintf_s(FILE* file, const char *format, va_list argptr)
|
||||
{
|
||||
int result;
|
||||
|
||||
if(!MSVCRT_CHECK_PMT(format != NULL)) {
|
||||
_set_errno(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_lock_file(file);
|
||||
result = streamout(file, format, argptr);
|
||||
_unlock_file(file);
|
||||
|
||||
return result;
|
||||
}
|
|
@ -4,18 +4,15 @@
|
|||
* FILE: lib/sdk/crt/printf/vfwprintf.c
|
||||
* PURPOSE: Implementation of vfwprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <wchar.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void CDECL _lock_file(FILE* file);
|
||||
void CDECL _unlock_file(FILE* file);
|
||||
int CDECL wstreamout(FILE *stream, const wchar_t *format, va_list argptr);
|
||||
int _cdecl wstreamout(FILE *stream, const wchar_t *format, va_list argptr);
|
||||
|
||||
int
|
||||
CDECL
|
||||
_cdecl
|
||||
vfwprintf(FILE* file, const wchar_t *format, va_list argptr)
|
||||
{
|
||||
int ret;
|
||||
|
@ -26,21 +23,3 @@ vfwprintf(FILE* file, const wchar_t *format, va_list argptr)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
CDECL
|
||||
vfwprintf_s(FILE* file, const wchar_t *format, va_list argptr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(!MSVCRT_CHECK_PMT( file != NULL)) {
|
||||
*_errno() = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
_lock_file(file);
|
||||
ret = wstreamout(file, format, argptr);
|
||||
_unlock_file(file);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
34
reactos/lib/sdk/crt/printf/vfwprintf_s.c
Normal file
34
reactos/lib/sdk/crt/printf/vfwprintf_s.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/vfwprintf.c
|
||||
* PURPOSE: Implementation of vfwprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <internal/safecrt.h>
|
||||
|
||||
int _cdecl wstreamout(FILE *stream, const wchar_t *format, va_list argptr);
|
||||
|
||||
int
|
||||
_cdecl
|
||||
vfwprintf_s(FILE* file, const wchar_t *format, va_list argptr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(!MSVCRT_CHECK_PMT( file != NULL)) {
|
||||
_set_errno(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_lock_file(file);
|
||||
ret = wstreamout(file, format, argptr);
|
||||
_unlock_file(file);
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -4,21 +4,14 @@
|
|||
* FILE: lib/sdk/crt/printf/vprintf.c
|
||||
* PURPOSE: Implementation of vprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_cdecl
|
||||
vprintf(const char *format, va_list argptr)
|
||||
{
|
||||
return vfprintf(stdout, format, argptr);
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
vprintf_s(const char *format, va_list valist)
|
||||
{
|
||||
return vfprintf_s(stdout,format,valist);
|
||||
}
|
||||
|
|
19
reactos/lib/sdk/crt/printf/vprintf_s.c
Normal file
19
reactos/lib/sdk/crt/printf/vprintf_s.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/vprintf.c
|
||||
* PURPOSE: Implementation of vprintf
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
vprintf_s(const char *format, va_list valist)
|
||||
{
|
||||
return vfprintf_s(stdout,format,valist);
|
||||
}
|
|
@ -4,21 +4,14 @@
|
|||
* FILE: lib/sdk/crt/printf/vwprintf.c
|
||||
* PURPOSE: Implementation of vwprintf
|
||||
* PROGRAMMER: Timo Kreuzer
|
||||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_cdecl
|
||||
vwprintf(const wchar_t *format, va_list valist)
|
||||
{
|
||||
return vfwprintf(stdout,format,valist);
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
vwprintf_s(const wchar_t *format, va_list valist)
|
||||
{
|
||||
return vfwprintf_s(stdout,format,valist);
|
||||
}
|
||||
|
|
19
reactos/lib/sdk/crt/printf/vwprintf_s.c
Normal file
19
reactos/lib/sdk/crt/printf/vwprintf_s.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/vwprintf.c
|
||||
* PURPOSE: Implementation of vwprintf
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
vwprintf_s(const wchar_t *format, va_list valist)
|
||||
{
|
||||
return vfwprintf_s(stdout,format,valist);
|
||||
}
|
|
@ -7,10 +7,11 @@
|
|||
* Samuel Serapión
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
__cdecl
|
||||
_cdecl
|
||||
wprintf(const wchar_t *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
|
@ -21,15 +22,3 @@ wprintf(const wchar_t *format, ...)
|
|||
va_end(argptr);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
__cdecl
|
||||
wprintf_s(const wchar_t *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
int res;
|
||||
va_start(argptr, format);
|
||||
res = vwprintf_s(format, argptr);
|
||||
va_end(argptr);
|
||||
return res;
|
||||
}
|
||||
|
|
24
reactos/lib/sdk/crt/printf/wprintf_s.c
Normal file
24
reactos/lib/sdk/crt/printf/wprintf_s.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: GNU GPL, see COPYING in the top level directory
|
||||
* PROJECT: ReactOS crt library
|
||||
* FILE: lib/sdk/crt/printf/wprintf.c
|
||||
* PURPOSE: Implementation of wprintf
|
||||
* PROGRAMMER: Samuel Serapión
|
||||
*/
|
||||
|
||||
#define MINGW_HAS_SECURE_API 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int
|
||||
_cdecl
|
||||
wprintf_s(const wchar_t *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
int res;
|
||||
va_start(argptr, format);
|
||||
res = vwprintf_s(format, argptr);
|
||||
va_end(argptr);
|
||||
return res;
|
||||
}
|
|
@ -596,7 +596,7 @@ int CDECL _access(const char *filename, int mode)
|
|||
|
||||
if (!filename || attr == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & W_OK))
|
||||
|
@ -633,7 +633,7 @@ int CDECL _waccess(const wchar_t *filename, int mode)
|
|||
|
||||
if (!filename || attr == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & W_OK))
|
||||
|
@ -674,7 +674,7 @@ int CDECL _chmod(const char *path, int flags)
|
|||
if (newFlags == oldFlags || SetFileAttributesA(path, newFlags))
|
||||
return 0;
|
||||
}
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -693,7 +693,7 @@ int CDECL _wchmod(const wchar_t *path, int flags)
|
|||
if (newFlags == oldFlags || SetFileAttributesW(path, newFlags))
|
||||
return 0;
|
||||
}
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@ int CDECL _unlink(const char *path)
|
|||
if(DeleteFileA(path))
|
||||
return 0;
|
||||
TRACE("failed (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ int CDECL _wunlink(const wchar_t *path)
|
|||
if(DeleteFileW(path))
|
||||
return 0;
|
||||
TRACE("failed (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ int CDECL _close(int fd)
|
|||
else if (!CloseHandle(hand))
|
||||
{
|
||||
WARN(":failed-last error (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
ret = -1;
|
||||
}
|
||||
else
|
||||
|
@ -821,7 +821,7 @@ int CDECL _commit(int fd)
|
|||
return 0;
|
||||
}
|
||||
TRACE(":failed-last error (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
TRACE(":ok\n");
|
||||
|
@ -867,7 +867,7 @@ int CDECL _dup2(int od, int nd)
|
|||
else
|
||||
{
|
||||
ret = -1;
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1008,7 +1008,7 @@ __int64 CDECL _lseeki64(int fd, __int64 offset, int whence)
|
|||
return ofs.QuadPart;
|
||||
}
|
||||
TRACE(":error-last error (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ int CDECL _chsize(int fd, long size)
|
|||
if (pos >= 0)
|
||||
{
|
||||
ret = SetEndOfFile(handle);
|
||||
if (!ret) _set_errno(GetLastError());
|
||||
if (!ret) _dosmaperr(GetLastError());
|
||||
}
|
||||
|
||||
/* restore the file pointer */
|
||||
|
@ -1507,7 +1507,7 @@ int CDECL _pipe(int *pfds, unsigned int psize, int textmode)
|
|||
UNLOCK_FILES();
|
||||
}
|
||||
else
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1598,7 +1598,7 @@ int CDECL _sopen_s( int *fd, const char *path, int oflags, int shflags, int pmod
|
|||
hand = CreateFileA(path, access, sharing, &sa, creation, attrib, 0);
|
||||
if (hand == INVALID_HANDLE_VALUE) {
|
||||
WARN(":failed-last error (%d)\n", GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return *_errno();
|
||||
}
|
||||
|
||||
|
@ -1718,7 +1718,7 @@ int CDECL _wsopen_s( int *fd, const wchar_t* path, int oflags, int shflags, int
|
|||
|
||||
if (hand == INVALID_HANDLE_VALUE) {
|
||||
WARN(":failed-last error (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return *_errno();
|
||||
}
|
||||
|
||||
|
@ -2783,7 +2783,7 @@ FILE* CDECL _wfreopen(const wchar_t *path, const wchar_t *mode, FILE* file)
|
|||
{
|
||||
file->_flag = 0;
|
||||
WARN(":failed-last error (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
file = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -3103,7 +3103,7 @@ int CDECL remove(const char *path)
|
|||
if (DeleteFileA(path))
|
||||
return 0;
|
||||
TRACE(":failed (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3116,7 +3116,7 @@ int CDECL _wremove(const wchar_t *path)
|
|||
if (DeleteFileW(path))
|
||||
return 0;
|
||||
TRACE(":failed (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3129,7 +3129,7 @@ int CDECL rename(const char *oldpath,const char *newpath)
|
|||
if (MoveFileExA(oldpath, newpath, MOVEFILE_COPY_ALLOWED))
|
||||
return 0;
|
||||
TRACE(":failed (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3142,7 +3142,7 @@ int CDECL _wrename(const wchar_t *oldpath,const wchar_t *newpath)
|
|||
if (MoveFileExW(oldpath, newpath, MOVEFILE_COPY_ALLOWED))
|
||||
return 0;
|
||||
TRACE(":failed (%d)\n",GetLastError());
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ errno_t CDECL _get_doserrno(unsigned long *pValue)
|
|||
errno_t CDECL _set_doserrno(unsigned long error)
|
||||
{
|
||||
*__doserrno() = error;
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -68,7 +68,7 @@ errno_t CDECL _get_errno(int *pValue)
|
|||
int CDECL _set_errno(int error)
|
||||
{
|
||||
*_errno() = error;
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -71,7 +71,7 @@ int _tsearchenv_s(const _TCHAR* file, const _TCHAR* env, _TCHAR *buf, size_t cou
|
|||
if (GetFileAttributes( file ) != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
GetFullPathName( file, MAX_PATH, buf, NULL );
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ _futime(int fd, struct _utimbuf *filetime)
|
|||
|
||||
if (!SetFileTime(handle, NULL, &at, &wt))
|
||||
{
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
00:00:00, 01/01/1970 UTC to
|
||||
23:59:59. 12/31/3000 UTC */
|
||||
|
||||
|
||||
errno_t
|
||||
localtime_s(struct tm* _tm, const time_t *ptime)
|
||||
{
|
||||
|
@ -28,6 +27,7 @@ localtime_s(struct tm* _tm, const time_t *ptime)
|
|||
_CRT_WIDE(__FILE__),
|
||||
__LINE__,
|
||||
0);
|
||||
_set_errno(EINVAL);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ localtime_s(struct tm* _tm, const time_t *ptime)
|
|||
if (*ptime < 0 || *ptime > _MAX__TIME64_T)
|
||||
{
|
||||
memset(_tm, 0xFF, sizeof(struct tm));
|
||||
_set_errno(EINVAL);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ int CDECL _heapchk(void)
|
|||
{
|
||||
if (!HeapValidate( GetProcessHeap(), 0, NULL))
|
||||
{
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return _HEAPBADNODE;
|
||||
}
|
||||
return _HEAPOK;
|
||||
|
@ -187,7 +187,7 @@ int CDECL _heapmin(void)
|
|||
if (!HeapCompact( GetProcessHeap(), 0 ))
|
||||
{
|
||||
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -209,7 +209,7 @@ int CDECL _heapwalk(_HEAPINFO* next)
|
|||
!HeapValidate( GetProcessHeap(), 0, phe.lpData ))
|
||||
{
|
||||
UNLOCK_HEAP;
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return _HEAPBADNODE;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ int CDECL _heapwalk(_HEAPINFO* next)
|
|||
UNLOCK_HEAP;
|
||||
if (GetLastError() == ERROR_NO_MORE_ITEMS)
|
||||
return _HEAPEND;
|
||||
_set_errno(GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
if (!phe.lpData)
|
||||
return _HEAPBADBEGIN;
|
||||
return _HEAPBADNODE;
|
||||
|
|
Loading…
Reference in a new issue