ReactOS  0.4.14-dev-57-g333b8f1
_sntprintf.h File Reference
#include <wine/test.h>
#include <stdio.h>
#include <tchar.h>
#include <pseh/pseh2.h>
#include <ndk/mmfuncs.h>
#include <ndk/rtlfuncs.h>
Include dependency graph for _sntprintf.h:
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 StartSeh()   ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {
 
#define EndSeh(ExpectedStatus)   } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus == ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus, ExpectedStatus)
 
#define broken(x)   0
 

Functions

 START_TEST (_sntprintf)
 

Macro Definition Documentation

◆ broken

#define broken (   x)    0

Definition at line 21 of file _sntprintf.h.

◆ EndSeh

#define EndSeh (   ExpectedStatus)    } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus == ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus, ExpectedStatus)

Definition at line 17 of file _sntprintf.h.

◆ StartSeh

#define StartSeh ( )    ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY {

Definition at line 16 of file _sntprintf.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file _sntprintf.h.

Function Documentation

◆ START_TEST()

START_TEST ( _sntprintf  )

Definition at line 23 of file _sntprintf.h.

24 {
25  NTSTATUS ExceptionStatus;
26  _TCHAR Buffer[128];
27  size_t BufferSize = sizeof(Buffer) / sizeof(Buffer[0]);
28  int Result;
29 
30  StartSeh()
31  Result = _sntprintf(NULL, 0, _T("Hello"));
32 #ifdef TEST_CRTDLL
33  ok_int(Result, -1);
34 #else
35  ok_int(Result, 5);
36 #endif
38 
39  StartSeh()
40  Result = _sntprintf(NULL, 1, _T("Hello"));
41  ok(Result == 5 ||
42  broken(Result == -1) /* Win7 */, "Result = %d\n", Result);
43 #if defined(_UNICODE) || defined(TEST_CRTDLL)
45 #else
47 #endif
48 
49  StartSeh()
50  FillMemory(Buffer, sizeof(Buffer), 0x55);
51  Result = _sntprintf(Buffer, BufferSize, _T("Hello"));
52  ok_int(Result, 5);
53  ok(Buffer[0] == _T('H'), "\n");
54  ok(Buffer[1] == _T('e'), "\n");
55  ok(Buffer[2] == _T('l'), "\n");
56  ok(Buffer[3] == _T('l'), "\n");
57  ok(Buffer[4] == _T('o'), "\n");
58  ok(Buffer[5] == _T('\0'), "\n");
59  ok(Buffer[6] == (_TCHAR)0x5555, "\n");
61 
62  StartSeh()
63  FillMemory(Buffer, sizeof(Buffer), 0x55);
64  Result = _sntprintf(Buffer, 5, _T("Hello"));
65  ok_int(Result, 5);
66  ok(Buffer[0] == _T('H'), "\n");
67  ok(Buffer[1] == _T('e'), "\n");
68  ok(Buffer[2] == _T('l'), "\n");
69  ok(Buffer[3] == _T('l'), "\n");
70  ok(Buffer[4] == _T('o'), "\n");
71  ok(Buffer[5] == (_TCHAR)0x5555, "\n");
73 
74  StartSeh()
75  FillMemory(Buffer, sizeof(Buffer), 0x55);
76  Result = _sntprintf(Buffer, 1, _T("Hello"));
77  ok_int(Result, -1);
78  ok(Buffer[0] == _T('H'), "\n");
79  ok(Buffer[1] == (_TCHAR)0x5555, "\n");
81 
82  StartSeh()
83  FillMemory(Buffer, sizeof(Buffer), 0x55);
84  Result = _sntprintf(Buffer, 0, _T("Hello"));
85  ok_int(Result, -1);
86  ok(Buffer[0] == (_TCHAR)0x5555, "\n");
88 }
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
LONG NTSTATUS
Definition: precomp.h:26
GLdouble n
Definition: glext.h:7729
#define StartSeh()
Definition: _sntprintf.h:16
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
#define ok_int(expression, result)
Definition: atltest.h:134
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
char _TCHAR
Definition: tchar.h:1392
r l[0]
Definition: byte_order.h:167
#define _T(x)
Definition: vfdio.h:22
#define d
Definition: ke_i.h:81
#define BufferSize
Definition: classpnp.h:419
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
#define _sntprintf
Definition: xmlstorage.h:201
#define broken(x)
Definition: _sntprintf.h:21
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ok(value,...)
Definition: atltest.h:57
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define H
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17