You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Rebase against 205228eb80089c38b25e7249073021e7806d2bfa.
[dinput-DIPROP_USERNAME] Removed patch to implement dinput device property DIPROP_USERNAME (accepted upstream). [kernel32-GetFinalPathNameByHandle] Removed patch to add support for GetFinalPathNameByHandle (accepted upstream). [ntoskrnl-Stubs] Removed patches for KeDelayExecutionThread and PsRemoveLoadImageNotifyRoutine stubs (accepted upstream). [server-Parent_Process] Removed patch to avoid holding reference on parent process in wineserver (accepted upstream). [wined3d-Geforce_425M] Removed patch to add wined3d detection for GeForce GT 425M (accepted upstream). [winscard-SCardListReaders] Removed patch to add stub for winscard.SCardListReadersA/W (accepted upstream).
This commit is contained in:
@@ -1,236 +0,0 @@
|
||||
From c1fbb588bfe27085e0751c561c76339938575d56 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sat, 12 Dec 2015 15:08:40 +0100
|
||||
Subject: kernel32/tests: Add test for process object destruction.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/process.c | 159 ++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 159 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
|
||||
index 5e7fecb..d7518f7 100644
|
||||
--- a/dlls/kernel32/tests/process.c
|
||||
+++ b/dlls/kernel32/tests/process.c
|
||||
@@ -33,11 +33,14 @@
|
||||
#include "wincon.h"
|
||||
#include "winnls.h"
|
||||
#include "winternl.h"
|
||||
+#include "tlhelp32.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
/* PROCESS_ALL_ACCESS in Vista+ PSDKs is incompatible with older Windows versions */
|
||||
#define PROCESS_ALL_ACCESS_NT4 (PROCESS_ALL_ACCESS & ~0xf000)
|
||||
+/* THREAD_ALL_ACCESS in Vista+ PSDKs is incompatible with older Windows versions */
|
||||
+#define THREAD_ALL_ACCESS_NT4 (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3ff)
|
||||
|
||||
#define expect_eq_d(expected, actual) \
|
||||
do { \
|
||||
@@ -80,6 +83,11 @@ static NTSTATUS (WINAPI *pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, P
|
||||
static BOOL (WINAPI *pProcessIdToSessionId)(DWORD,DWORD*);
|
||||
static DWORD (WINAPI *pWTSGetActiveConsoleSessionId)(void);
|
||||
static BOOL (WINAPI *pGetLogicalProcessorInformationEx)(LOGICAL_PROCESSOR_RELATIONSHIP,SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*,DWORD*);
|
||||
+static HANDLE (WINAPI *pCreateToolhelp32Snapshot)(DWORD, DWORD);
|
||||
+static BOOL (WINAPI *pProcess32First)(HANDLE, PROCESSENTRY32*);
|
||||
+static BOOL (WINAPI *pProcess32Next)(HANDLE, PROCESSENTRY32*);
|
||||
+static BOOL (WINAPI *pThread32First)(HANDLE, THREADENTRY32*);
|
||||
+static BOOL (WINAPI *pThread32Next)(HANDLE, THREADENTRY32*);
|
||||
|
||||
/* ############################### */
|
||||
static char base[MAX_PATH];
|
||||
@@ -239,6 +247,11 @@ static BOOL init(void)
|
||||
pProcessIdToSessionId = (void *)GetProcAddress(hkernel32, "ProcessIdToSessionId");
|
||||
pWTSGetActiveConsoleSessionId = (void *)GetProcAddress(hkernel32, "WTSGetActiveConsoleSessionId");
|
||||
pGetLogicalProcessorInformationEx = (void *)GetProcAddress(hkernel32, "GetLogicalProcessorInformationEx");
|
||||
+ pCreateToolhelp32Snapshot = (void *)GetProcAddress(hkernel32, "CreateToolhelp32Snapshot");
|
||||
+ pProcess32First = (void *)GetProcAddress(hkernel32, "Process32First");
|
||||
+ pProcess32Next = (void *)GetProcAddress(hkernel32, "Process32Next");
|
||||
+ pThread32First = (void *)GetProcAddress(hkernel32, "Thread32First");
|
||||
+ pThread32Next = (void *)GetProcAddress(hkernel32, "Thread32Next");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -290,6 +303,8 @@ static void doChild(const char* file, const char* option)
|
||||
char bufA[MAX_PATH];
|
||||
WCHAR bufW[MAX_PATH];
|
||||
HANDLE hFile = CreateFileA(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
|
||||
+ HANDLE snapshot;
|
||||
+ PROCESSENTRY32 pe;
|
||||
BOOL ret;
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE) return;
|
||||
@@ -344,6 +359,26 @@ static void doChild(const char* file, const char* option)
|
||||
childPrintf(hFile, "CommandLineA=%s\n", encodeA(GetCommandLineA()));
|
||||
childPrintf(hFile, "CommandLineW=%s\n\n", encodeW(GetCommandLineW()));
|
||||
|
||||
+ /* output toolhelp information */
|
||||
+ snapshot = pCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
+ ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
|
||||
+ memset(&pe, 0, sizeof(pe));
|
||||
+ pe.dwSize = sizeof(pe);
|
||||
+ if (pProcess32First(snapshot, &pe))
|
||||
+ {
|
||||
+ while (pe.th32ProcessID != GetCurrentProcessId())
|
||||
+ if (!pProcess32Next(snapshot, &pe)) break;
|
||||
+ }
|
||||
+ CloseHandle(snapshot);
|
||||
+ ok(pe.th32ProcessID == GetCurrentProcessId(), "failed to find current process in snapshot\n");
|
||||
+ childPrintf(hFile,
|
||||
+ "[Toolhelp]\ncntUsage=%u\nth32DefaultHeapID=%lu\n"
|
||||
+ "th32ModuleID=%u\ncntThreads=%u\nth32ParentProcessID=%u\n"
|
||||
+ "pcPriClassBase=%u\ndwFlags=%u\nszExeFile=%s\n\n",
|
||||
+ pe.cntUsage, pe.th32DefaultHeapID, pe.th32ModuleID,
|
||||
+ pe.cntThreads, pe.th32ParentProcessID, pe.pcPriClassBase,
|
||||
+ pe.dwFlags, encodeA(pe.szExeFile));
|
||||
+
|
||||
/* output of environment (Ansi) */
|
||||
ptrA_save = ptrA = GetEnvironmentStringsA();
|
||||
if (ptrA)
|
||||
@@ -1068,6 +1103,112 @@ static void test_Directory(void)
|
||||
ok(!TerminateProcess(info.hProcess, 0), "Child process should not exist\n");
|
||||
}
|
||||
|
||||
+static void test_Toolhelp(void)
|
||||
+{
|
||||
+ char buffer[MAX_PATH];
|
||||
+ STARTUPINFOA startup;
|
||||
+ PROCESS_INFORMATION info;
|
||||
+ HANDLE process, thread, snapshot;
|
||||
+ PROCESSENTRY32 pe;
|
||||
+ THREADENTRY32 te;
|
||||
+ DWORD ret;
|
||||
+ int i;
|
||||
+
|
||||
+ memset(&startup, 0, sizeof(startup));
|
||||
+ startup.cb = sizeof(startup);
|
||||
+ startup.dwFlags = STARTF_USESHOWWINDOW;
|
||||
+ startup.wShowWindow = SW_SHOWNORMAL;
|
||||
+
|
||||
+ get_file_name(resfile);
|
||||
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, resfile);
|
||||
+ ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess failed\n");
|
||||
+ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
||||
+ CloseHandle(info.hProcess);
|
||||
+ CloseHandle(info.hThread);
|
||||
+
|
||||
+ WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
||||
+ okChildInt("Toolhelp", "cntUsage", 0);
|
||||
+ okChildInt("Toolhelp", "th32DefaultHeapID", 0);
|
||||
+ okChildInt("Toolhelp", "th32ModuleID", 0);
|
||||
+ okChildInt("Toolhelp", "th32ParentProcessID", GetCurrentProcessId());
|
||||
+ todo_wine okChildInt("Toolhelp", "pcPriClassBase", 8);
|
||||
+ okChildInt("Toolhelp", "dwFlags", 0);
|
||||
+
|
||||
+ release_memory();
|
||||
+ DeleteFileA(resfile);
|
||||
+
|
||||
+ get_file_name(resfile);
|
||||
+ sprintf(buffer, "\"%s\" tests/process.c nested \"%s\"", selfname, resfile);
|
||||
+ ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess failed\n");
|
||||
+ ok(WaitForSingleObject(info.hProcess, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
||||
+
|
||||
+ process = OpenProcess(PROCESS_ALL_ACCESS_NT4, FALSE, info.dwProcessId);
|
||||
+ ok(process != NULL, "OpenProcess failed %u\n", GetLastError());
|
||||
+ CloseHandle(process);
|
||||
+
|
||||
+ CloseHandle(info.hProcess);
|
||||
+ CloseHandle(info.hThread);
|
||||
+
|
||||
+ for (i = 0; i < 20; i++)
|
||||
+ {
|
||||
+ SetLastError(0xdeadbeef);
|
||||
+ process = OpenProcess(PROCESS_ALL_ACCESS_NT4, FALSE, info.dwProcessId);
|
||||
+ ok(process || GetLastError() == ERROR_INVALID_PARAMETER, "OpenProcess failed %u\n", GetLastError());
|
||||
+ if (!process) break;
|
||||
+ CloseHandle(process);
|
||||
+ Sleep(100);
|
||||
+ }
|
||||
+ /* The following test fails randomly on some Windows versions */
|
||||
+ todo_wine ok(i < 20 || broken(i == 20), "process object not released\n");
|
||||
+
|
||||
+ snapshot = pCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
+ ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
|
||||
+ memset(&pe, 0, sizeof(pe));
|
||||
+ pe.dwSize = sizeof(pe);
|
||||
+ if (pProcess32First(snapshot, &pe))
|
||||
+ {
|
||||
+ while (pe.th32ParentProcessID != info.dwProcessId)
|
||||
+ if (!pProcess32Next(snapshot, &pe)) break;
|
||||
+ }
|
||||
+ CloseHandle(snapshot);
|
||||
+ ok(pe.th32ParentProcessID == info.dwProcessId, "failed to find nested child process\n");
|
||||
+
|
||||
+ process = OpenProcess(PROCESS_ALL_ACCESS_NT4, FALSE, pe.th32ProcessID);
|
||||
+ ok(process != NULL, "OpenProcess failed %u\n", GetLastError());
|
||||
+
|
||||
+ snapshot = pCreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
|
||||
+ ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
|
||||
+ memset(&te, 0, sizeof(te));
|
||||
+ te.dwSize = sizeof(te);
|
||||
+ if (pThread32First(snapshot, &te))
|
||||
+ {
|
||||
+ while (te.th32OwnerProcessID != pe.th32ProcessID)
|
||||
+ if (!pThread32Next(snapshot, &te)) break;
|
||||
+ }
|
||||
+ CloseHandle(snapshot);
|
||||
+ ok(te.th32OwnerProcessID == pe.th32ProcessID, "failed to find suspended thread\n");
|
||||
+
|
||||
+ thread = OpenThread(THREAD_ALL_ACCESS_NT4, FALSE, te.th32ThreadID);
|
||||
+ ok(thread != NULL, "OpenThread failed %u\n", GetLastError());
|
||||
+ ret = ResumeThread(thread);
|
||||
+ ok(ret == 1, "expected 1, got %u\n", ret);
|
||||
+ CloseHandle(thread);
|
||||
+
|
||||
+ ok(WaitForSingleObject(process, 30000) == WAIT_OBJECT_0, "Child process termination\n");
|
||||
+ CloseHandle(process);
|
||||
+
|
||||
+ WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
|
||||
+ okChildInt("Toolhelp", "cntUsage", 0);
|
||||
+ okChildInt("Toolhelp", "th32DefaultHeapID", 0);
|
||||
+ okChildInt("Toolhelp", "th32ModuleID", 0);
|
||||
+ okChildInt("Toolhelp", "th32ParentProcessID", info.dwProcessId);
|
||||
+ todo_wine okChildInt("Toolhelp", "pcPriClassBase", 8);
|
||||
+ okChildInt("Toolhelp", "dwFlags", 0);
|
||||
+
|
||||
+ release_memory();
|
||||
+ DeleteFileA(resfile);
|
||||
+}
|
||||
+
|
||||
static BOOL is_str_env_drive_dir(const char* str)
|
||||
{
|
||||
return str[0] == '=' && str[1] >= 'A' && str[1] <= 'Z' && str[2] == ':' &&
|
||||
@@ -3024,6 +3165,23 @@ START_TEST(process)
|
||||
Sleep(100);
|
||||
return;
|
||||
}
|
||||
+ else if (!strcmp(myARGV[2], "nested") && myARGC >= 4)
|
||||
+ {
|
||||
+ char buffer[MAX_PATH];
|
||||
+ STARTUPINFOA startup;
|
||||
+ PROCESS_INFORMATION info;
|
||||
+
|
||||
+ memset(&startup, 0, sizeof(startup));
|
||||
+ startup.cb = sizeof(startup);
|
||||
+ startup.dwFlags = STARTF_USESHOWWINDOW;
|
||||
+ startup.wShowWindow = SW_SHOWNORMAL;
|
||||
+
|
||||
+ sprintf(buffer, "\"%s\" tests/process.c dump \"%s\"", selfname, myARGV[3]);
|
||||
+ ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &startup, &info), "CreateProcess\n");
|
||||
+ CloseHandle(info.hProcess);
|
||||
+ CloseHandle(info.hThread);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
ok(0, "Unexpected command %s\n", myARGV[2]);
|
||||
return;
|
||||
@@ -3034,6 +3192,7 @@ START_TEST(process)
|
||||
test_Startup();
|
||||
test_CommandLine();
|
||||
test_Directory();
|
||||
+ test_Toolhelp();
|
||||
test_Environment();
|
||||
test_SuspendFlag();
|
||||
test_DebuggingFlag();
|
||||
--
|
||||
2.7.1
|
||||
|
@@ -1,127 +0,0 @@
|
||||
From 8d0b9020200ee933ed02fae3235fee2ade651394 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Thu, 10 Dec 2015 05:55:41 +0100
|
||||
Subject: server: Do not hold reference on parent process.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/process.c | 2 +-
|
||||
server/console.c | 3 +--
|
||||
server/process.c | 7 +++----
|
||||
server/process.h | 2 +-
|
||||
server/snapshot.c | 2 +-
|
||||
server/thread.c | 2 +-
|
||||
6 files changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
|
||||
index 8e0f0c2..9c07d09 100644
|
||||
--- a/dlls/kernel32/tests/process.c
|
||||
+++ b/dlls/kernel32/tests/process.c
|
||||
@@ -1158,7 +1158,7 @@ static void test_Toolhelp(void)
|
||||
Sleep(100);
|
||||
}
|
||||
/* The following test fails randomly on some Windows versions */
|
||||
- todo_wine ok(i < 20 || broken(i == 20), "process object not released\n");
|
||||
+ ok(i < 20 || broken(i == 20), "process object not released\n");
|
||||
|
||||
snapshot = pCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
ok(snapshot != INVALID_HANDLE_VALUE, "CreateToolhelp32Snapshot failed %u\n", GetLastError());
|
||||
diff --git a/server/console.c b/server/console.c
|
||||
index a57b2fe..3d0e0e0 100644
|
||||
--- a/server/console.c
|
||||
+++ b/server/console.c
|
||||
@@ -1425,13 +1425,12 @@ DECL_HANDLER(alloc_console)
|
||||
case 0:
|
||||
/* renderer is current, console to be attached to parent process */
|
||||
renderer = current;
|
||||
- if (!(process = current->process->parent))
|
||||
+ if (!(process = get_process_from_id( current->process->parent_id )))
|
||||
{
|
||||
if (fd != -1) close( fd );
|
||||
set_error( STATUS_ACCESS_DENIED );
|
||||
return;
|
||||
}
|
||||
- grab_object( process );
|
||||
attach = 1;
|
||||
break;
|
||||
case 0xffffffff:
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index 1b41037..8ecc32e 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -504,7 +504,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
||||
close( fd );
|
||||
goto error;
|
||||
}
|
||||
- process->parent = NULL;
|
||||
+ process->parent_id = 0;
|
||||
process->debugger = NULL;
|
||||
process->handles = NULL;
|
||||
process->msg_fd = NULL;
|
||||
@@ -556,7 +556,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
||||
else
|
||||
{
|
||||
struct process *parent = parent_thread->process;
|
||||
- process->parent = (struct process *)grab_object( parent );
|
||||
+ process->parent_id = parent->id;
|
||||
process->handles = inherit_all ? copy_handle_table( process, parent )
|
||||
: alloc_handle_table( process, 0 );
|
||||
/* Note: for security reasons, starting a new process does not attempt
|
||||
@@ -623,7 +623,6 @@ static void process_destroy( struct object *obj )
|
||||
release_object( process->job );
|
||||
}
|
||||
if (process->console) release_object( process->console );
|
||||
- if (process->parent) release_object( process->parent );
|
||||
if (process->msg_fd) release_object( process->msg_fd );
|
||||
list_remove( &process->entry );
|
||||
if (process->idle_event) release_object( process->idle_event );
|
||||
@@ -1352,7 +1351,7 @@ DECL_HANDLER(get_process_info)
|
||||
if ((process = get_process_from_handle( req->handle, PROCESS_QUERY_LIMITED_INFORMATION )))
|
||||
{
|
||||
reply->pid = get_process_id( process );
|
||||
- reply->ppid = process->parent ? get_process_id( process->parent ) : 0;
|
||||
+ reply->ppid = process->parent_id;
|
||||
reply->exit_code = process->exit_code;
|
||||
reply->priority = process->priority;
|
||||
reply->affinity = process->affinity;
|
||||
diff --git a/server/process.h b/server/process.h
|
||||
index fa7f60d..34b6ea6 100644
|
||||
--- a/server/process.h
|
||||
+++ b/server/process.h
|
||||
@@ -56,7 +56,7 @@ struct process
|
||||
{
|
||||
struct object obj; /* object header */
|
||||
struct list entry; /* entry in system-wide process list */
|
||||
- struct process *parent; /* parent process */
|
||||
+ process_id_t parent_id; /* parent process id (at the time of creation) */
|
||||
struct list thread_list; /* thread list */
|
||||
struct thread *debugger; /* thread debugging this process */
|
||||
struct handle_table *handles; /* handle entries */
|
||||
diff --git a/server/snapshot.c b/server/snapshot.c
|
||||
index dd00bd1..bec281d 100644
|
||||
--- a/server/snapshot.c
|
||||
+++ b/server/snapshot.c
|
||||
@@ -113,7 +113,7 @@ static int snapshot_next_process( struct snapshot *snapshot, struct next_process
|
||||
ptr = &snapshot->processes[snapshot->process_pos++];
|
||||
reply->count = ptr->count;
|
||||
reply->pid = get_process_id( ptr->process );
|
||||
- reply->ppid = ptr->process->parent ? get_process_id( ptr->process->parent ) : 0;
|
||||
+ reply->ppid = ptr->process->parent_id;
|
||||
reply->threads = ptr->threads;
|
||||
reply->priority = ptr->priority;
|
||||
reply->handles = ptr->handles;
|
||||
diff --git a/server/thread.c b/server/thread.c
|
||||
index bad2231..176cf44 100644
|
||||
--- a/server/thread.c
|
||||
+++ b/server/thread.c
|
||||
@@ -1300,7 +1300,7 @@ DECL_HANDLER(init_thread)
|
||||
process->peb = req->entry;
|
||||
process->cpu = req->cpu;
|
||||
reply->info_size = init_process( current );
|
||||
- if (!process->parent)
|
||||
+ if (!process->parent_id)
|
||||
process->affinity = current->affinity = get_thread_affinity( current );
|
||||
else
|
||||
set_thread_affinity( current, current->affinity );
|
||||
--
|
||||
2.6.2
|
||||
|
@@ -1 +0,0 @@
|
||||
Fixes: [37087] Do not hold reference on parent process in wineserver
|
Reference in New Issue
Block a user