kernel32/tests: Add tests for GetThreadSelectorEntry.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d039d188f4
commit
6870f3c049
|
@ -1100,6 +1100,46 @@ static void test_SetThreadContext(void)
|
||||||
CloseHandle( thread );
|
CloseHandle( thread );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_GetThreadSelectorEntry(void)
|
||||||
|
{
|
||||||
|
LDT_ENTRY entry;
|
||||||
|
CONTEXT ctx;
|
||||||
|
DWORD limit;
|
||||||
|
void *base;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
memset(&ctx, 0x11, sizeof(ctx));
|
||||||
|
ctx.ContextFlags = CONTEXT_SEGMENTS | CONTEXT_CONTROL;
|
||||||
|
ret = GetThreadContext(GetCurrentThread(), &ctx);
|
||||||
|
ok(ret, "GetThreadContext error %u\n", GetLastError());
|
||||||
|
ok(!HIWORD(ctx.SegCs), "expected HIWORD(SegCs) == 0, got %u\n", ctx.SegCs);
|
||||||
|
ok(!HIWORD(ctx.SegDs), "expected HIWORD(SegDs) == 0, got %u\n", ctx.SegDs);
|
||||||
|
ok(!HIWORD(ctx.SegFs), "expected HIWORD(SegFs) == 0, got %u\n", ctx.SegFs);
|
||||||
|
|
||||||
|
ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegCs, &entry);
|
||||||
|
ok(ret, "GetThreadSelectorEntry(SegCs) error %u\n", GetLastError());
|
||||||
|
ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegDs, &entry);
|
||||||
|
ok(ret, "GetThreadSelectorEntry(SegDs) error %u\n", GetLastError());
|
||||||
|
|
||||||
|
memset(&entry, 0x11, sizeof(entry));
|
||||||
|
ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegFs, &entry);
|
||||||
|
ok(ret, "GetThreadSelectorEntry(SegFs) error %u\n", GetLastError());
|
||||||
|
entry.HighWord.Bits.Type &= ~1; /* ignore accessed bit */
|
||||||
|
|
||||||
|
base = (void *)((entry.HighWord.Bits.BaseHi << 24) | (entry.HighWord.Bits.BaseMid << 16) | entry.BaseLow);
|
||||||
|
limit = (entry.HighWord.Bits.LimitHi << 16) | entry.LimitLow;
|
||||||
|
|
||||||
|
ok(base == NtCurrentTeb(), "expected %p, got %p\n", NtCurrentTeb(), base);
|
||||||
|
ok(limit == 0x0fff || limit == 0x4000, "expected 0x0fff or 0x4000, got %#x\n", limit);
|
||||||
|
ok(entry.HighWord.Bits.Type == 0x12, "expected 0x12, got %#x\n", entry.HighWord.Bits.Type);
|
||||||
|
ok(entry.HighWord.Bits.Dpl == 3, "expected 3, got %u\n", entry.HighWord.Bits.Dpl);
|
||||||
|
ok(entry.HighWord.Bits.Pres == 1, "expected 1, got %u\n", entry.HighWord.Bits.Pres);
|
||||||
|
ok(entry.HighWord.Bits.Sys == 0, "expected 0, got %u\n", entry.HighWord.Bits.Sys);
|
||||||
|
ok(entry.HighWord.Bits.Reserved_0 == 0, "expected 0, got %u\n", entry.HighWord.Bits.Reserved_0);
|
||||||
|
ok(entry.HighWord.Bits.Default_Big == 1, "expected 1, got %u\n", entry.HighWord.Bits.Default_Big);
|
||||||
|
ok(entry.HighWord.Bits.Granularity == 0, "expected 0, got %u\n", entry.HighWord.Bits.Granularity);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __i386__ */
|
#endif /* __i386__ */
|
||||||
|
|
||||||
static HANDLE finish_event;
|
static HANDLE finish_event;
|
||||||
|
@ -1965,6 +2005,7 @@ START_TEST(thread)
|
||||||
test_GetThreadExitCode();
|
test_GetThreadExitCode();
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
test_SetThreadContext();
|
test_SetThreadContext();
|
||||||
|
test_GetThreadSelectorEntry();
|
||||||
#endif
|
#endif
|
||||||
test_QueueUserWorkItem();
|
test_QueueUserWorkItem();
|
||||||
test_RegisterWaitForSingleObject();
|
test_RegisterWaitForSingleObject();
|
||||||
|
|
Loading…
Reference in New Issue