ReactOS  0.4.14-dev-317-g96040ec
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  */
40 pVEH = 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");
43 RemoveVectoredExceptionHandler(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  */
49 pVEH = AddVectoredExceptionHandler(1, VEHandler_2);
50  ok(lstrlenA( (LPSTR)0xbaadf00d) == 0, "lstrlenA should have returned 0.\n");
51  ok(lstrlenW((LPWSTR)0xbaadf00d) == 0, "lstrlenW should have returned 0.\n");
52 RemoveVectoredExceptionHandler(pVEH);
53 }
char * LPSTR
Definition: xmlstorage.h:182
#define lstrlenW
Definition: compat.h:407
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI VEHandler_2(PEXCEPTION_POINTERS ExceptionInfo)
Definition: lstrlen.c:20
static const WCHAR L[]
Definition: oid.c:1250
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI VEHandler_1(PEXCEPTION_POINTERS ExceptionInfo)
Definition: lstrlen.c:10
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 EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define ok(value,...)
Definition: atltest.h:57

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
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().