You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against 12c3177ed5cae39de8a9f9111a1cb450296cc8e6.
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
From d1dca9874d914f25f3257c850275a14c3835a7e9 Mon Sep 17 00:00:00 2001
|
||||
From 72ace2e57404a068679a703268c505c5f5ac3b12 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 28 Apr 2016 18:14:36 +0800
|
||||
Subject: [PATCH] ntdll: Implement NtSetLdtEntries.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/thread.c | 79 ++++++++++++++++++++++++++++++++++++
|
||||
dlls/ntdll/nt.c | 28 ++++++++++++-
|
||||
2 files changed, 106 insertions(+), 1 deletion(-)
|
||||
1 file changed, 79 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
|
||||
index 180eed82419..5e9d51c24cd 100644
|
||||
index b6a65a4207c..70b22367e18 100644
|
||||
--- a/dlls/kernel32/tests/thread.c
|
||||
+++ b/dlls/kernel32/tests/thread.c
|
||||
@@ -107,6 +107,7 @@ static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP
|
||||
@@ -99,6 +99,7 @@ static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP
|
||||
static NTSTATUS (WINAPI *pNtSetInformationThread)(HANDLE,THREADINFOCLASS,LPCVOID,ULONG);
|
||||
static HRESULT (WINAPI *pSetThreadDescription)(HANDLE,const WCHAR *);
|
||||
static HRESULT (WINAPI *pGetThreadDescription)(HANDLE,WCHAR **);
|
||||
@@ -20,8 +19,8 @@ index 180eed82419..5e9d51c24cd 100644
|
||||
|
||||
static HANDLE create_target_process(const char *arg)
|
||||
{
|
||||
@@ -1223,6 +1224,82 @@ static void test_GetThreadSelectorEntry(void)
|
||||
ok(entry.HighWord.Bits.Granularity == 0, "expected 0, got %u\n", entry.HighWord.Bits.Granularity);
|
||||
@@ -1262,6 +1263,82 @@ static void test_GetThreadSelectorEntry(void)
|
||||
ok(entry.HighWord.Bits.Granularity == 1, "expected 1, got %u\n", entry.HighWord.Bits.Granularity);
|
||||
}
|
||||
|
||||
+static void test_NtSetLdtEntries(void)
|
||||
@@ -103,7 +102,7 @@ index 180eed82419..5e9d51c24cd 100644
|
||||
#endif /* __i386__ */
|
||||
|
||||
static HANDLE finish_event;
|
||||
@@ -2291,6 +2368,7 @@ static void init_funcs(void)
|
||||
@@ -2324,6 +2401,7 @@ static void init_funcs(void)
|
||||
X(NtQueryInformationThread);
|
||||
X(RtlGetThreadErrorMode);
|
||||
X(NtSetInformationThread);
|
||||
@@ -111,7 +110,7 @@ index 180eed82419..5e9d51c24cd 100644
|
||||
}
|
||||
#undef X
|
||||
}
|
||||
@@ -2346,6 +2424,7 @@ START_TEST(thread)
|
||||
@@ -2379,6 +2457,7 @@ START_TEST(thread)
|
||||
#ifdef __i386__
|
||||
test_SetThreadContext();
|
||||
test_GetThreadSelectorEntry();
|
||||
@@ -119,52 +118,6 @@ index 180eed82419..5e9d51c24cd 100644
|
||||
#endif
|
||||
test_QueueUserWorkItem();
|
||||
test_RegisterWaitForSingleObject();
|
||||
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
|
||||
index 85cefa638ab..fd3a7cb7eae 100644
|
||||
--- a/dlls/ntdll/nt.c
|
||||
+++ b/dlls/ntdll/nt.c
|
||||
@@ -75,6 +75,7 @@
|
||||
#include "winternl.h"
|
||||
#include "ntdll_misc.h"
|
||||
#include "wine/server.h"
|
||||
+#include "wine/library.h"
|
||||
#include "ddk/wdm.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -3781,7 +3782,32 @@ NTSTATUS WINAPI NtSystemDebugControl(SYSDBG_COMMAND command, PVOID inbuffer, ULO
|
||||
NTSTATUS WINAPI NtSetLdtEntries(ULONG selector1, ULONG entry1_low, ULONG entry1_high,
|
||||
ULONG selector2, ULONG entry2_low, ULONG entry2_high)
|
||||
{
|
||||
- FIXME("(%u, %u, %u, %u, %u, %u): stub\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high);
|
||||
+#ifdef __i386__
|
||||
+ union
|
||||
+ {
|
||||
+ LDT_ENTRY entry;
|
||||
+ ULONG dw[2];
|
||||
+ } sel;
|
||||
+
|
||||
+ TRACE("(%x,%x,%x,%x,%x,%x)\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high);
|
||||
|
||||
+ if (selector1)
|
||||
+ {
|
||||
+ sel.dw[0] = entry1_low;
|
||||
+ sel.dw[1] = entry1_high;
|
||||
+ if (wine_ldt_set_entry(selector1, &sel.entry) < 0)
|
||||
+ return STATUS_ACCESS_DENIED;
|
||||
+ }
|
||||
+ if (selector2)
|
||||
+ {
|
||||
+ sel.dw[0] = entry2_low;
|
||||
+ sel.dw[1] = entry2_high;
|
||||
+ if (wine_ldt_set_entry(selector2, &sel.entry) < 0)
|
||||
+ return STATUS_ACCESS_DENIED;
|
||||
+ }
|
||||
+ return STATUS_SUCCESS;
|
||||
+#else
|
||||
+ FIXME("(%x,%x,%x,%x,%x,%x): stub\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high);
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
+#endif
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
2.26.0
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
From 36cdcc900c03de3e2e27a16252242a7a5ec55513 Mon Sep 17 00:00:00 2001
|
||||
From 18e7f7c6475673f382a8d3015140383c2dd756b0 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Thu, 28 Apr 2016 17:01:16 +0200
|
||||
Subject: libs/wine: Allow to modify reserved LDT entries.
|
||||
Subject: [PATCH] libs/wine: Allow to modify reserved LDT entries.
|
||||
|
||||
Some implementation notes:
|
||||
|
||||
@@ -17,14 +17,15 @@ entries without that flag set and NtQueryInformationThread(ThreadDescriptorTable
|
||||
fails.
|
||||
---
|
||||
dlls/kernel32/tests/thread.c | 4 ----
|
||||
dlls/ntdll/signal_i386.c | 2 --
|
||||
libs/wine/ldt.c | 4 +---
|
||||
2 files changed, 1 insertion(+), 7 deletions(-)
|
||||
3 files changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
|
||||
index 981e3c4..6efc52a 100644
|
||||
index 70b22367e18..a454bf118cc 100644
|
||||
--- a/dlls/kernel32/tests/thread.c
|
||||
+++ b/dlls/kernel32/tests/thread.c
|
||||
@@ -1163,16 +1163,12 @@ static void test_NtSetLdtEntries(void)
|
||||
@@ -1325,16 +1325,12 @@ static void test_NtSetLdtEntries(void)
|
||||
{
|
||||
memset(&sel.entry, 0x9a, sizeof(sel.entry));
|
||||
ret = GetThreadSelectorEntry(GetCurrentThread(), 0x000f, &sel.entry);
|
||||
@@ -41,11 +42,24 @@ index 981e3c4..6efc52a 100644
|
||||
ok(!memcmp(&ds_entry, &sel.entry, sizeof(ds_entry)), "entries do not match\n");
|
||||
}
|
||||
}
|
||||
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
|
||||
index e812f634ff9..16ee93e001a 100644
|
||||
--- a/dlls/ntdll/signal_i386.c
|
||||
+++ b/dlls/ntdll/signal_i386.c
|
||||
@@ -2558,8 +2558,6 @@ NTSTATUS get_thread_ldt_entry( HANDLE handle, void *data, ULONG len, ULONG *ret_
|
||||
NTSTATUS WINAPI NtSetLdtEntries( ULONG sel1, LDT_ENTRY entry1, ULONG sel2, LDT_ENTRY entry2 )
|
||||
{
|
||||
if (sel1 >> 16 || sel2 >> 16) return STATUS_INVALID_LDT_DESCRIPTOR;
|
||||
- if (sel1 && (sel1 >> 3) < first_ldt_entry) return STATUS_INVALID_LDT_DESCRIPTOR;
|
||||
- if (sel2 && (sel2 >> 3) < first_ldt_entry) return STATUS_INVALID_LDT_DESCRIPTOR;
|
||||
|
||||
ldt_lock();
|
||||
if (sel1) ldt_set_entry( sel1, entry1 );
|
||||
diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c
|
||||
index 0946407..8ac779a 100644
|
||||
index baf12a2e3a7..b9371814ba2 100644
|
||||
--- a/libs/wine/ldt.c
|
||||
+++ b/libs/wine/ldt.c
|
||||
@@ -169,8 +169,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry )
|
||||
@@ -170,8 +170,6 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry )
|
||||
{
|
||||
int ret = 0, index = sel >> 3;
|
||||
|
||||
@@ -54,7 +68,7 @@ index 0946407..8ac779a 100644
|
||||
#ifdef linux
|
||||
{
|
||||
struct modify_ldt_s ldt_info;
|
||||
@@ -222,7 +220,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry )
|
||||
@@ -223,7 +221,7 @@ static int internal_set_entry( unsigned short sel, const LDT_ENTRY *entry )
|
||||
wine_ldt_copy.limit[index] = wine_ldt_get_limit(entry);
|
||||
wine_ldt_copy.flags[index] = (entry->HighWord.Bits.Type |
|
||||
(entry->HighWord.Bits.Default_Big ? WINE_LDT_FLAGS_32BIT : 0) |
|
||||
@@ -64,5 +78,5 @@ index 0946407..8ac779a 100644
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.8.0
|
||||
2.26.0
|
||||
|
||||
|
Reference in New Issue
Block a user