Author: mnordell Date: Tue Sep 11 04:34:03 2012 New Revision: 57270
URL: http://svn.reactos.org/svn/reactos?rev=57270&view=rev Log: Test for SetUnhandledExceptionFilter actually rerturning what it should.
Added: trunk/rostests/apitests/kernel32/SetUnhandledExceptionFilter.c (with props) Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt trunk/rostests/apitests/kernel32/testlist.c
Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CMakeLis... ============================================================================== --- trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] Tue Sep 11 04:34:03 2012 @@ -7,6 +7,7 @@ GetModuleFileName.c lstrcpynW.c SetCurrentDirectory.c + SetUnhandledExceptionFilter.c testlist.c)
add_executable(kernel32_apitest ${SOURCE})
Added: trunk/rostests/apitests/kernel32/SetUnhandledExceptionFilter.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/SetUnhan... ============================================================================== --- trunk/rostests/apitests/kernel32/SetUnhandledExceptionFilter.c (added) +++ trunk/rostests/apitests/kernel32/SetUnhandledExceptionFilter.c [iso-8859-1] Tue Sep 11 04:34:03 2012 @@ -1,0 +1,41 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for SetUnhandledExceptionFilter + * PROGRAMMER: Mike "tamlin" Nordell + */ + +#define WIN32_NO_STATUS +#include <stdio.h> +#include <wine/test.h> +#include <windows.h> + +/* + * Keep these returning different values, to prevent compiler folding + * them into a single function, thereby voiding the test + */ +WINAPI LONG Filter1(LPEXCEPTION_POINTERS p) { return 0; } +WINAPI LONG Filter2(LPEXCEPTION_POINTERS p) { return 1; } + + +/* + * Verify that SetUnhandledExceptionFilter actually returns the + * _previous_ handler. + */ +static +VOID +TestSetUnhandledExceptionFilter(VOID) +{ + LPTOP_LEVEL_EXCEPTION_FILTER p1, p2; + p1 = SetUnhandledExceptionFilter(Filter1); + p2 = SetUnhandledExceptionFilter(Filter2); + ok(p1 != Filter1, "SetUnhandledExceptionFilter returned what was set, not prev\n"); + ok(p2 != Filter2, "SetUnhandledExceptionFilter returned what was set, not prev\n"); + ok(p2 == Filter1, "SetUnhandledExceptionFilter didn't return previous filter\n"); + ok(p1 != p2, "SetUnhandledExceptionFilter seems to return random stuff\n"); +} + +START_TEST(SetUnhandledExceptionFilter) +{ + TestSetUnhandledExceptionFilter(); +}
Propchange: trunk/rostests/apitests/kernel32/SetUnhandledExceptionFilter.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/rostests/apitests/kernel32/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/testlist... ============================================================================== --- trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] Tue Sep 11 04:34:03 2012 @@ -10,14 +10,16 @@ extern void func_GetModuleFileName(void); extern void func_lstrcpynW(void); extern void func_SetCurrentDirectory(void); +extern void func_SetUnhandledExceptionFilter(void);
const struct test winetest_testlist[] = { - { "GetCurrentDirectory", func_GetCurrentDirectory }, - { "GetDriveType", func_GetDriveType }, - { "GetModuleFileName", func_GetModuleFileName }, - { "lstrcpynW", func_lstrcpynW }, - { "SetCurrentDirectory", func_SetCurrentDirectory }, + { "GetCurrentDirectory", func_GetCurrentDirectory }, + { "GetDriveType", func_GetDriveType }, + { "GetModuleFileName", func_GetModuleFileName }, + { "lstrcpynW", func_lstrcpynW }, + { "SetCurrentDirectory", func_SetCurrentDirectory }, + { "SetUnhandledExceptionFilter", func_SetUnhandledExceptionFilter},
{ 0, 0 } };