ntdll-NtSetLdtEntries: Fix a random test failure and minor style improvements.

This commit is contained in:
Sebastian Lackner 2016-04-29 17:30:55 +02:00
parent 79eb485272
commit 72a52e44c2
5 changed files with 36 additions and 10 deletions

View File

@ -0,0 +1,24 @@
From 211c1988706a03296da84d5b2607de3ec9e5ca68 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 29 Apr 2016 17:11:26 +0200
Subject: ntdll: Initialize Reserved_0 bit in NtQueryInformationThread.
---
dlls/ntdll/thread.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 40747d7..f6a5fbe 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -1045,6 +1045,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
tdi->Entry.HighWord.Bits.Granularity = 1;
tdi->Entry.HighWord.Bits.Default_Big = 1;
tdi->Entry.HighWord.Bits.Type = 0x12;
+ tdi->Entry.HighWord.Bits.Reserved_0 = 0;
/* it has to be one of the system GDT selectors */
if (sel != (wine_get_ds() & ~3) && sel != (wine_get_ss() & ~3))
{
--
2.8.0

View File

@ -1,4 +1,4 @@
From aadd7b2c0ca9bf60d64c3ed4e0722de3899b8c13 Mon Sep 17 00:00:00 2001
From 41b856b5d47d0d935daf5fdaf3f0fa22c4d1eaba Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Thu, 28 Apr 2016 18:14:36 +0800
Subject: ntdll: Implement NtSetLdtEntries.
@ -9,7 +9,7 @@ Subject: ntdll: Implement NtSetLdtEntries.
2 files changed, 106 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index e0de3f9..981e3c4 100644
index e0de3f9..10a7979 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -102,6 +102,7 @@ static NTSTATUS (WINAPI *pNtQueryInformationThread)(HANDLE,THREADINFOCLASS,PVOID
@ -56,16 +56,16 @@ index e0de3f9..981e3c4 100644
+ ok(ret, "GetThreadContext failed\n");
+
+ tdi.Selector = ctx.SegDs;
+ ret = pNtQueryInformationThread(GetCurrentThread(), 6 /*ThreadDescriptorTableEntry*/, &tdi, sizeof(tdi), &ret);
+ ret = pNtQueryInformationThread(GetCurrentThread(), ThreadDescriptorTableEntry, &tdi, sizeof(tdi), &ret);
+ ok(!ret, "NtQueryInformationThread failed: %08x\n", ret);
+ ds_entry = tdi.Entry;
+
+ tdi.Selector = 0x000f;
+ ret = pNtQueryInformationThread(GetCurrentThread(), 6 /*ThreadDescriptorTableEntry*/, &tdi, sizeof(tdi), &ret);
+ ret = pNtQueryInformationThread(GetCurrentThread(), ThreadDescriptorTableEntry, &tdi, sizeof(tdi), &ret);
+ ok(ret == STATUS_ACCESS_VIOLATION, "got %08x\n", ret);
+
+ tdi.Selector = 0x001f;
+ ret = pNtQueryInformationThread(GetCurrentThread(), 6 /*ThreadDescriptorTableEntry*/, &tdi, sizeof(tdi), &ret);
+ ret = pNtQueryInformationThread(GetCurrentThread(), ThreadDescriptorTableEntry, &tdi, sizeof(tdi), &ret);
+ ok(ret == STATUS_ACCESS_VIOLATION, "NtQueryInformationThread returned %08x\n", ret);
+
+ ret = GetThreadSelectorEntry(GetCurrentThread(), 0x000f, &sel.entry);

View File

@ -4923,16 +4923,18 @@ fi
# | * [#26268] Add stub for NtSetLdtEntries/ZwSetLdtEntries
# |
# | Modified files:
# | * dlls/kernel32/tests/thread.c, dlls/ntdll/nt.c, dlls/ntdll/ntdll.spec, include/ddk/wdm.h, include/winternl.h,
# | libs/wine/ldt.c
# | * dlls/kernel32/tests/thread.c, dlls/ntdll/nt.c, dlls/ntdll/ntdll.spec, dlls/ntdll/thread.c, include/ddk/wdm.h,
# | include/winternl.h, libs/wine/ldt.c
# |
if test "$enable_ntdll_NtSetLdtEntries" -eq 1; then
patch_apply ntdll-NtSetLdtEntries/0001-ntdll-add-NtSetLdtEntries-ZwSetLdtEntries-stub-try-2.patch
patch_apply ntdll-NtSetLdtEntries/0002-ntdll-Implement-NtSetLdtEntries.patch
patch_apply ntdll-NtSetLdtEntries/0003-libs-wine-Allow-to-modify-reserved-LDT-entries.patch
patch_apply ntdll-NtSetLdtEntries/0004-ntdll-Export-NtSetLdtEntries-only-on-i386.patch
patch_apply ntdll-NtSetLdtEntries/0002-ntdll-Initialize-Reserved_0-bit-in-NtQueryInformatio.patch
patch_apply ntdll-NtSetLdtEntries/0003-ntdll-Implement-NtSetLdtEntries.patch
patch_apply ntdll-NtSetLdtEntries/0004-libs-wine-Allow-to-modify-reserved-LDT-entries.patch
patch_apply ntdll-NtSetLdtEntries/0005-ntdll-Export-NtSetLdtEntries-only-on-i386.patch
(
echo '+ { "Austin English", "ntdll: Add NtSetLdtEntries/ZwSetLdtEntries stub.", 2 },';
echo '+ { "Sebastian Lackner", "ntdll: Initialize Reserved_0 bit in NtQueryInformationThread.", 1 },';
echo '+ { "Dmitry Timoshkov", "ntdll: Implement NtSetLdtEntries.", 1 },';
echo '+ { "Dmitry Timoshkov", "libs/wine: Allow to modify reserved LDT entries.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Export NtSetLdtEntries only on i386.", 1 },';