ReactOS 0.4.15-dev-8241-g63935f8
_reactos_strsafe_wrapper.c File Reference
#include <windef.h>
#include <strsafe.h>
Include dependency graph for _reactos_strsafe_wrapper.c:

Go to the source code of this file.

Functions

int _vsnprintf_s (char *buffer, size_t sizeOfBuffer, size_t count, const char *format, va_list argptr)
 

Function Documentation

◆ _vsnprintf_s()

int _vsnprintf_s ( char buffer,
size_t  sizeOfBuffer,
size_t  count,
const char format,
va_list  argptr 
)

Definition at line 25 of file _reactos_strsafe_wrapper.c.

26{
27 size_t cchRemaining;
28
29 HRESULT ret = StringCchVPrintfEx(buffer, sizeOfBuffer, NULL, &cchRemaining, 0, format, argptr);
30
31 // EXAMPLE //////////////////////////
32 // -------- > Size of provided buffer in chars (8).
33 // ABC0____ > Buffer contents after StringCchVPrintfEx gets called.
34 // --- > What we actually need to return (3).
35 // ----- > Remaining chars in buffer, including post string NULL, returned by StringCchVPrintfEx (5).
36
37 /* _vsnprintf_s returns the number of characters written, not including
38 the terminating null, or a negative value if an output error occurs. */
39
40 switch (ret)
41 {
42 case S_OK:
43 return (sizeOfBuffer - cchRemaining);
44
47 default:
48 return -1;
49 }
50}
#define NULL
Definition: types.h:112
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLuint buffer
Definition: glext.h:5915
#define S_OK
Definition: intsafe.h:52
static size_t sizeOfBuffer
Definition: printf.c:68
#define StringCchVPrintfEx
Definition: strsafe.h:647
#define STRSAFE_E_INVALID_PARAMETER
Definition: strsafe.h:104
#define STRSAFE_E_INSUFFICIENT_BUFFER
Definition: strsafe.h:103
int ret