diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 306b36d5bb7..1d56da8525a 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -156,6 +156,9 @@ extern int ntdll_umbstowcs(DWORD flags, const char* src, int srclen, WCHAR* dst, extern int ntdll_wcstoumbs(DWORD flags, const WCHAR* src, int srclen, char* dst, int dstlen, const char* defchar, int *used ); +extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ); +extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ); + /* load order */ enum loadorder diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index f84c7c4fb2c..602bfadbb76 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -303,11 +303,11 @@ void WINAPI RtlDumpResource(LPRTL_RWLOCK rwl) NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...) { char buf[512]; - va_list args; + __ms_va_list args; - va_start(args, fmt); - vsprintf(buf,fmt, args); - va_end(args); + __ms_va_start(args, fmt); + NTDLL__vsnprintf(buf, sizeof(buf), fmt, args); + __ms_va_end(args); MESSAGE("DbgPrint says: %s",buf); /* hmm, raise exception? */ @@ -321,18 +321,18 @@ NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...) NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...) { NTSTATUS ret; - va_list args; + __ms_va_list args; - va_start(args, fmt); + __ms_va_start(args, fmt); ret = vDbgPrintEx(iComponentId, Level, fmt, args); - va_end(args); + __ms_va_end(args); return ret; } /****************************************************************************** * vDbgPrintEx [NTDLL.@] */ -NTSTATUS WINAPI vDbgPrintEx( ULONG id, ULONG level, LPCSTR fmt, va_list args ) +NTSTATUS WINAPI vDbgPrintEx( ULONG id, ULONG level, LPCSTR fmt, __ms_va_list args ) { return vDbgPrintExWithPrefix( "", id, level, fmt, args ); } @@ -340,11 +340,11 @@ NTSTATUS WINAPI vDbgPrintEx( ULONG id, ULONG level, LPCSTR fmt, va_list args ) /****************************************************************************** * vDbgPrintExWithPrefix [NTDLL.@] */ -NTSTATUS WINAPI vDbgPrintExWithPrefix( LPCSTR prefix, ULONG id, ULONG level, LPCSTR fmt, va_list args ) +NTSTATUS WINAPI vDbgPrintExWithPrefix( LPCSTR prefix, ULONG id, ULONG level, LPCSTR fmt, __ms_va_list args ) { char buf[1024]; - vsprintf(buf, fmt, args); + NTDLL__vsnprintf(buf, sizeof(buf), fmt, args); switch (level & DPFLTR_MASK) { diff --git a/include/winternl.h b/include/winternl.h index 1a11469bccc..1af1370aed2 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2508,8 +2508,8 @@ NTSYSAPI NTSTATUS WINAPI RtlpNtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRI NTSYSAPI NTSTATUS WINAPI RtlpNtEnumerateSubKey(HANDLE,UNICODE_STRING *, ULONG); NTSYSAPI NTSTATUS WINAPI RtlpWaitForCriticalSection(RTL_CRITICAL_SECTION *); NTSYSAPI NTSTATUS WINAPI RtlpUnWaitCriticalSection(RTL_CRITICAL_SECTION *); -NTSYSAPI NTSTATUS WINAPI vDbgPrintEx(ULONG,ULONG,LPCSTR,va_list); -NTSYSAPI NTSTATUS WINAPI vDbgPrintExWithPrefix(LPCSTR,ULONG,ULONG,LPCSTR,va_list); +NTSYSAPI NTSTATUS WINAPI vDbgPrintEx(ULONG,ULONG,LPCSTR,__ms_va_list); +NTSYSAPI NTSTATUS WINAPI vDbgPrintExWithPrefix(LPCSTR,ULONG,ULONG,LPCSTR,__ms_va_list); /* Wine internal functions */