2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Tests for lstrlenA/W
5 * PROGRAMMER: Hermes Belusca-Maito
10 #define WIN32_NO_STATUS
13 LONG WINAPI
VEHandler_1(PEXCEPTION_POINTERS ExceptionInfo
)
16 * Vectored Exception Handler possibly called for lstrlen(NULL).
17 * Expected not to be called!
19 ok(FALSE
, "VEHandler_1 called!\n");
20 return EXCEPTION_CONTINUE_SEARCH
;
23 LONG WINAPI
VEHandler_2(PEXCEPTION_POINTERS ExceptionInfo
)
25 /* Vectored Exception Handler that should be called for lstrlen(<invalid_ptr>) */
26 ok(TRUE
, "VEHandler_2 not called?\n");
27 return EXCEPTION_CONTINUE_SEARCH
;
34 /* Test basic functionality */
35 ok(lstrlenA( "Hello World!") == 12, "lstrlenA failed!\n");
36 ok(lstrlenW(L
"Hello World!") == 12, "lstrlenW failed!\n");
39 * NULL buffer is special and is considered separately;
40 * no internal exception is generated.
41 * Use Vectored Exception Handling to monitor for first-chance exceptions.
43 pVEH
= AddVectoredExceptionHandler(1, VEHandler_1
);
44 ok(lstrlenA(NULL
) == 0, "lstrlenA should have returned 0.\n");
45 ok(lstrlenW(NULL
) == 0, "lstrlenW should have returned 0.\n");
46 RemoveVectoredExceptionHandler(pVEH
);
49 * Test some invalid buffers. Internal exceptions should be generated.
50 * Use Vectored Exception Handling to monitor for first-chance exceptions.
52 pVEH
= AddVectoredExceptionHandler(1, VEHandler_2
);
53 ok(lstrlenA( (LPSTR
)0xbaadf00d) == 0, "lstrlenA should have returned 0.\n");
54 ok(lstrlenW((LPWSTR
)0xbaadf00d) == 0, "lstrlenW should have returned 0.\n");
55 RemoveVectoredExceptionHandler(pVEH
);