ReactOS 0.4.15-dev-8100-g1887773
lstrlen.c File Reference
#include "precomp.h"
Include dependency graph for lstrlen.c:

Go to the source code of this file.

Functions

LONG WINAPI VEHandler_1 (PEXCEPTION_POINTERS ExceptionInfo)
 
LONG WINAPI VEHandler_2 (PEXCEPTION_POINTERS ExceptionInfo)
 
 START_TEST (lstrlen)
 

Function Documentation

◆ START_TEST()

START_TEST ( lstrlen  )

Definition at line 27 of file lstrlen.c.

28{
29 PVOID pVEH;
30
31 /* Test basic functionality */
32 ok(lstrlenA( "Hello World!") == 12, "lstrlenA failed!\n");
33 ok(lstrlenW(L"Hello World!") == 12, "lstrlenW failed!\n");
34
35 /*
36 * NULL buffer is special and is considered separately;
37 * no internal exception is generated.
38 * Use Vectored Exception Handling to monitor for first-chance exceptions.
39 */
40pVEH = AddVectoredExceptionHandler(1, VEHandler_1);
41 ok(lstrlenA(NULL) == 0, "lstrlenA should have returned 0.\n");
42 ok(lstrlenW(NULL) == 0, "lstrlenW should have returned 0.\n");
43RemoveVectoredExceptionHandler(pVEH);
44
45 /*
46 * Test some invalid buffers. Internal exceptions should be generated.
47 * Use Vectored Exception Handling to monitor for first-chance exceptions.
48 */
49pVEH = AddVectoredExceptionHandler(1, VEHandler_2);
50 ok(lstrlenA( (LPSTR)(LONG_PTR)0xbaadf00d) == 0, "lstrlenA should have returned 0.\n");
51 ok(lstrlenW((LPWSTR)(LONG_PTR)0xbaadf00d) == 0, "lstrlenW should have returned 0.\n");
52RemoveVectoredExceptionHandler(pVEH);
53}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
LONG WINAPI VEHandler_2(PEXCEPTION_POINTERS ExceptionInfo)
Definition: lstrlen.c:20
LONG WINAPI VEHandler_1(PEXCEPTION_POINTERS ExceptionInfo)
Definition: lstrlen.c:10
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define L(x)
Definition: ntvdm.h:50
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ VEHandler_1()

LONG WINAPI VEHandler_1 ( PEXCEPTION_POINTERS  ExceptionInfo)

Definition at line 10 of file lstrlen.c.

11{
12 /*
13 * Vectored Exception Handler possibly called for lstrlen(NULL).
14 * Expected not to be called!
15 */
16 ok(FALSE, "VEHandler_1 called!\n");
18}
#define FALSE
Definition: types.h:117
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86

Referenced by START_TEST().

◆ VEHandler_2()

LONG WINAPI VEHandler_2 ( PEXCEPTION_POINTERS  ExceptionInfo)

Definition at line 20 of file lstrlen.c.

21{
22 /* Vectored Exception Handler that should be called for lstrlen(<invalid_ptr>) */
23 ok(TRUE, "VEHandler_2 not called?\n");
25}
#define TRUE
Definition: types.h:120

Referenced by START_TEST().