ReactOS 0.4.17-dev-218-g5635d24
sprintf.c File Reference
#include <apitest.h>
#include <apitest_guard.h>
#include <stdio.h>
#include <tchar.h>
#include <pseh/pseh2.h>
#include <ndk/mmfuncs.h>
#include <ndk/rtlfuncs.h>
Include dependency graph for sprintf.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define sprintf   p_sprintf
 

Typedefs

typedef int(__cdeclPFN_sprintf) (char *_Dest, const char *_Format,...)
 

Functions

static BOOL Init (void)
 
 if (!Init())
 
 StartSeh () Length
 
 EndSeh ((GetNTVersion() >=_WIN32_WINNT_VISTA) ? 0 :STATUS_ACCESS_VIOLATION)
 
 ok_int (Length,(GetNTVersion() >=_WIN32_WINNT_VISTA) ? -1 :0)
 
 EndSeh (STATUS_SUCCESS)
 
 ok_int (Length,(GetNTVersion() >=_WIN32_WINNT_VISTA) ? -1 :5)
 
 ok_str (Buffer, "abcde")
 
 ok_int (Length, 5)
 
 ok_str (Buffer, "%")
 
 ok_int (Length, 1)
 
 ok_str (Buffer, "")
 
 ok_int (Length, 0)
 
 ok_str (Buffer, "8")
 
 ok_str (Buffer, "hello")
 
 ok_str (Buffer, " hello")
 
 ok_int (Length, 8)
 
 ok_str (Buffer, "hello ")
 
 ok_str (Buffer, "hell")
 
 ok_int (Length, 4)
 
 if (!String)
 
 strcpy (String, "hello")
 
 ok_str (Buffer, "hello!")
 
 ok_int (Length, 6)
 
 ok_str (Buffer, "hello! ")
 
 FreeGuarded (String)
 

Variables

static PFN_sprintf p_sprintf
 
CHAR Buffer [128]
 
PCHAR String = AllocateGuarded(6)
 
 Length = sprintf(Buffer, "abcde")
 

Macro Definition Documentation

◆ sprintf

#define sprintf   p_sprintf

Definition at line 45 of file sprintf.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file sprintf.c.

Typedef Documentation

◆ PFN_sprintf

typedef int(__cdecl * PFN_sprintf) (char *_Dest, const char *_Format,...)

Definition at line 31 of file sprintf.c.

Function Documentation

◆ EndSeh() [1/2]

◆ EndSeh() [2/2]

EndSeh ( STATUS_SUCCESS  )

◆ FreeGuarded()

◆ if() [1/2]

if ( Init())

Definition at line 62 of file sprintf.c.

63 {
64 skip("Skipping tests, because sprintf is not available\n");
65 return;
66 }
#define skip(...)
Definition: atltest.h:64

◆ if() [2/2]

if ( String)

Definition at line 188 of file sprintf.c.

189 {
190 skip("Guarded allocation failure\n");
191 return;
192 }

◆ Init()

static BOOL Init ( void  )
static

Definition at line 34 of file sprintf.c.

35{
37#ifdef TEST_USER32
39#else
41#endif
42 ok(p_sprintf != NULL, "Failed to load sprintf from %s\n", TEST_DLL_NAME);
43 return (p_sprintf != NULL);
44}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
int(__cdecl * PFN_sprintf)(char *_Dest, const char *_Format,...)
Definition: sprintf.c:31
static PFN_sprintf p_sprintf
Definition: sprintf.c:32
#define TEST_DLL_NAME
Definition: wsprintf.c:3
static PVOID hdll
Definition: shimdbg.c:126

◆ ok_int() [1/8]

ok_int ( Length  ,
 
)

◆ ok_int() [2/8]

ok_int ( Length  ,
 
)

◆ ok_int() [3/8]

ok_int ( Length  ,
 
)

◆ ok_int() [4/8]

ok_int ( Length  ,
 
)

◆ ok_int() [5/8]

ok_int ( Length  ,
 
)

◆ ok_int() [6/8]

ok_int ( Length  ,
 
)

◆ ok_int() [7/8]

ok_int ( Length  ,
(GetNTVersion() >=_WIN32_WINNT_VISTA) ? -1 :0   
)

◆ ok_int() [8/8]

ok_int ( Length  ,
(GetNTVersion() >=_WIN32_WINNT_VISTA) ? -1 :5   
)

◆ ok_str() [1/10]

ok_str ( Buffer  ,
" hello"   
)

◆ ok_str() [2/10]

ok_str ( Buffer  ,
""   
)

◆ ok_str() [3/10]

ok_str ( Buffer  ,
"%"   
)

◆ ok_str() [4/10]

ok_str ( Buffer  ,
"8"   
)

◆ ok_str() [5/10]

ok_str ( Buffer  ,
"abcde"   
)

◆ ok_str() [6/10]

ok_str ( Buffer  ,
"hell"   
)

◆ ok_str() [7/10]

ok_str ( Buffer  ,
"hello "   
)

◆ ok_str() [8/10]

ok_str ( Buffer  ,
"hello! "   
)

◆ ok_str() [9/10]

ok_str ( Buffer  ,
"hello!"   
)

◆ ok_str() [10/10]

ok_str ( Buffer  ,
"hello"   
)

◆ StartSeh()

StartSeh ( )

◆ strcpy()

strcpy ( String  ,
"hello"   
)

Variable Documentation

◆ Buffer

CHAR Buffer[128]
Initial value:
{
int Length
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Definition at line 58 of file sprintf.c.

◆ Length

Length = sprintf(Buffer, "abcde")

Definition at line 97 of file sprintf.c.

◆ p_sprintf

PFN_sprintf p_sprintf
static

Definition at line 32 of file sprintf.c.

Referenced by Init(), init(), test__get_output_format(), test_sprintf(), and test_sscanf().

◆ String

Definition at line 59 of file sprintf.c.