reactos/rostests/apitests/kernel32/SetUnhandledExceptionFilter.c
Mike Nordell 2d8ccfc5dc Unbreak MSVC build.
svn path=/trunk/; revision=57272
2012-09-11 05:14:33 +00:00

42 lines
1.2 KiB
C

/*
* 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 <ndk/rtltypes.h>
/*
* Keep these returning different values, to prevent compiler folding
* them into a single function, thereby voiding the test
*/
LONG WINAPI Filter1(LPEXCEPTION_POINTERS p) { return 0; }
LONG WINAPI 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();
}