Commit 6ecabf7c authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Added _set_printf_count_output and _get_printf_count_output implementation.

parent 16890928
......@@ -20,7 +20,7 @@
#include <stdarg.h>
#include "stdlib.h"
#include "stdio.h"
#include "windef.h"
#include "winbase.h"
......@@ -37,6 +37,7 @@ BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hdll);
_set_printf_count_output(0);
}
return TRUE;
}
......@@ -686,7 +686,7 @@
@ cdecl _get_osfhandle(long) msvcrt._get_osfhandle
@ cdecl _get_output_format() msvcrt._get_output_format
@ stub _get_pgmptr
@ stub _get_printf_count_output
@ cdecl _get_printf_count_output() msvcrt._get_printf_count_output
@ stub _get_purecall_handler
@ cdecl _get_terminate() msvcrt._get_terminate
@ stub _get_timezone
......@@ -1077,7 +1077,7 @@
@ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler
@ stub _set_malloc_crt_max_wait
@ stub _set_output_format
@ stub _set_printf_count_output
@ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output
@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler
@ cdecl _seterrormode(long) msvcrt._seterrormode
@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp
......
MODULE = msvcr80.dll
IMPORTS = msvcrt
MODCFLAGS = @BUILTINFLAG@
EXTRAINCL = -I$(top_srcdir)/include/msvcrt
C_SRCS = \
msvcr80.c
......
......@@ -20,6 +20,7 @@
#include <stdarg.h>
#include "stdio.h"
#include "windef.h"
#include "winbase.h"
......@@ -32,6 +33,7 @@ BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hdll);
_set_printf_count_output(0);
}
return TRUE;
}
......@@ -530,7 +530,7 @@
@ stub _get_osver
@ cdecl _get_output_format() msvcrt._get_output_format
@ stub _get_pgmptr
@ stub _get_printf_count_output
@ cdecl _get_printf_count_output() msvcrt._get_printf_count_output
@ stub _get_purecall_handler
@ cdecl _get_sbh_threshold() msvcrt._get_sbh_threshold
@ cdecl _get_terminate() msvcrt._get_terminate
......@@ -930,7 +930,7 @@
@ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler
@ stub _set_malloc_crt_max_wait
@ stub _set_output_format
@ stub _set_printf_count_output
@ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output
@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler
@ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold
@ cdecl _seterrormode(long) msvcrt._seterrormode
......
......@@ -22,6 +22,7 @@
#include <stdarg.h>
#include "stdlib.h"
#include "stdio.h"
#include "errno.h"
#include "malloc.h"
#include "windef.h"
......@@ -101,6 +102,7 @@ BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hdll);
_set_printf_count_output(0);
}
return TRUE;
}
......
......@@ -520,7 +520,7 @@
@ cdecl _get_osfhandle(long) msvcrt._get_osfhandle
@ cdecl _get_output_format() msvcrt._get_output_format
@ stub _get_pgmptr
@ stub _get_printf_count_output
@ cdecl _get_printf_count_output() msvcrt._get_printf_count_output
@ stub _get_purecall_handler
@ cdecl _get_sbh_threshold() msvcrt._get_sbh_threshold
@ cdecl _get_terminate() msvcrt._get_terminate
......@@ -916,7 +916,7 @@
@ cdecl _set_invalid_parameter_handler(ptr) msvcrt._set_invalid_parameter_handler
@ stub _set_malloc_crt_max_wait
@ stub _set_output_format
@ stub _set_printf_count_output
@ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output
@ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler
@ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold
@ cdecl _seterrormode(long) msvcrt._seterrormode
......
......@@ -1491,3 +1491,5 @@
@ cdecl -arch=i386 _statusfp2(ptr ptr)
@ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l
@ cdecl _wdupenv_s(ptr ptr str)
@ cdecl _get_printf_count_output()
@ cdecl _set_printf_count_output(long)
......@@ -491,7 +491,15 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
i = FUNC_NAME(pf_output_format_str)(pf_puts, puts_ctx, buf, -1, &flags, locale);
#endif
} else if(flags.Format == 'n') {
int *used = pf_args(args_ctx, pos, VT_PTR, &valist).get_ptr;
int *used;
if(!n_format_enabled) {
MSVCRT_INVALID_PMT("\'n\' format specifier disabled");
*MSVCRT__errno() = MSVCRT_EINVAL;
return -1;
}
used = pf_args(args_ctx, pos, VT_PTR, &valist).get_ptr;
*used = written;
i = 0;
} else if(flags.Format && strchr("diouxX", flags.Format)) {
......
......@@ -33,11 +33,27 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
static BOOL n_format_enabled = TRUE;
#include "printf.h"
#define PRINTF_WIDE
#include "printf.h"
#undef PRINTF_WIDE
/* _get_printf_count_output - not exported in native msvcrt */
int CDECL _get_printf_count_output( void )
{
return n_format_enabled ? 1 : 0;
}
/* _set_printf_count_output - not exported in native msvcrt */
int CDECL _set_printf_count_output( int enable )
{
BOOL old = n_format_enabled;
n_format_enabled = (enable ? TRUE : FALSE);
return old ? 1 : 0;
}
/*********************************************************************
* _wcsdup (MSVCRT.@)
*/
......
......@@ -108,12 +108,14 @@ int __cdecl _flsbuf(int,FILE*);
int __cdecl _flushall(void);
int __cdecl _fputchar(int);
FILE* __cdecl _fsopen(const char*,const char*,int);
int __cdecl _get_printf_count_output(void);
int __cdecl _getmaxstdio(void);
int __cdecl _getw(FILE*);
int __cdecl _pclose(FILE*);
FILE* __cdecl _popen(const char*,const char*);
int __cdecl _putw(int,FILE*);
int __cdecl _rmtmp(void);
int __cdecl _set_printf_count_output(int);
int __cdecl _setmaxstdio(int);
int __cdecl _snprintf(char*,size_t,const char*,...);
int __cdecl _snprintf_s(char*,size_t,size_t,const char*,...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment