kernel32/tests: Don't crash the test if GetThreadContext fails.
This commit is contained in:
parent
1f8ba96128
commit
58b85bba3e
|
@ -795,6 +795,7 @@ static void test_SetThreadContext(void)
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
DWORD threadid;
|
DWORD threadid;
|
||||||
DWORD prevcount;
|
DWORD prevcount;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
event = CreateEvent( NULL, TRUE, FALSE, NULL );
|
event = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||||
|
@ -811,16 +812,20 @@ static void test_SetThreadContext(void)
|
||||||
|
|
||||||
ctx.ContextFlags = CONTEXT_FULL;
|
ctx.ContextFlags = CONTEXT_FULL;
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ok( GetThreadContext( thread, &ctx ), "GetThreadContext failed : (%d)\n", GetLastError() );
|
ret = GetThreadContext( thread, &ctx );
|
||||||
|
ok( ret, "GetThreadContext failed : (%u)\n", GetLastError() );
|
||||||
|
|
||||||
/* simulate a call to set_test_val(10) */
|
if (ret)
|
||||||
stack = (int *)ctx.Esp;
|
{
|
||||||
stack[-1] = 10;
|
/* simulate a call to set_test_val(10) */
|
||||||
stack[-2] = ctx.Eip;
|
stack = (int *)ctx.Esp;
|
||||||
ctx.Esp -= 2 * sizeof(int *);
|
stack[-1] = 10;
|
||||||
ctx.Eip = (DWORD)set_test_val;
|
stack[-2] = ctx.Eip;
|
||||||
SetLastError(0xdeadbeef);
|
ctx.Esp -= 2 * sizeof(int *);
|
||||||
ok( SetThreadContext( thread, &ctx ), "SetThreadContext failed : (%d)\n", GetLastError() );
|
ctx.Eip = (DWORD)set_test_val;
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ok( SetThreadContext( thread, &ctx ), "SetThreadContext failed : (%d)\n", GetLastError() );
|
||||||
|
}
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
prevcount = ResumeThread( thread );
|
prevcount = ResumeThread( thread );
|
||||||
|
|
Loading…
Reference in New Issue