Rebase against e0e3b6bc91f7db956e3a66f2938eea45d4055a39.

This commit is contained in:
Zebediah Figura 2020-07-07 17:59:50 -05:00
parent 21a97e1f88
commit b1765ff74e
28 changed files with 205 additions and 1491 deletions

View File

@ -1,4 +1,4 @@
From 1f2b1bafabfd457836f18741f178b3745e129c36 Mon Sep 17 00:00:00 2001
From b7e3ca4678d073c92f950708c1be35f37fda86d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 03:39:55 +0200
Subject: [PATCH] ntdll: Implement process token elevation through manifests.
@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Implement process token elevation through manifests.
5 files changed, 67 insertions(+)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 0c8f05285c4..92ae87c6e6d 100644
index 3513102b6f0..3b68f6685d0 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3898,6 +3898,32 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow
@@ -3489,6 +3489,32 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow
}
@ -48,7 +48,7 @@ index 0c8f05285c4..92ae87c6e6d 100644
/***********************************************************************
* load_global_options
*/
@@ -4359,6 +4385,7 @@ void __wine_process_init(void)
@@ -3922,6 +3948,7 @@ void __wine_process_init(void)
'k','e','r','n','e','l','3','2','.','d','l','l',0};
void (WINAPI *kernel32_start_process)(LPTHREAD_START_ROUTINE,void*) = NULL;
RTL_USER_PROCESS_PARAMETERS *params;
@ -56,7 +56,7 @@ index 0c8f05285c4..92ae87c6e6d 100644
WINE_MODREF *wm;
NTSTATUS status;
ANSI_STRING func_name;
@@ -4453,6 +4480,16 @@ void __wine_process_init(void)
@@ -4032,6 +4059,16 @@ void __wine_process_init(void)
unix_funcs->virtual_set_large_address_space();
@ -74,11 +74,11 @@ index 0c8f05285c4..92ae87c6e6d 100644
RemoveEntryList( &wm->ldr.InLoadOrderLinks );
InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks );
diff --git a/server/process.c b/server/process.c
index ac85cace95d..52604ec4d61 100644
index c414717a8d7..100cb424623 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1115,6 +1115,14 @@ struct process_snapshot *process_snap( int *count )
return snapshot;
@@ -1086,6 +1086,14 @@ int set_process_debug_flag( struct process *process, int flag )
return write_process_memory( process, process->peb + 2, 1, &data );
}
+/* replace the token of a process */
@ -93,22 +93,22 @@ index ac85cace95d..52604ec4d61 100644
DECL_HANDLER(new_process)
{
diff --git a/server/process.h b/server/process.h
index 5b83e111a6f..dfe5c4e52d8 100644
index fb29f21cb12..d0b7ec4987b 100644
--- a/server/process.h
+++ b/server/process.h
@@ -139,6 +139,7 @@ extern void kill_debugged_processes( struct thread *debugger, int exit_code );
@@ -129,6 +129,7 @@ extern void kill_console_processes( struct thread *renderer, int exit_code );
extern void kill_debugged_processes( struct thread *debugger, int exit_code );
extern void detach_debugged_processes( struct thread *debugger );
extern struct process_snapshot *process_snap( int *count );
extern void enum_processes( int (*cb)(struct process*, void*), void *user);
+extern void replace_process_token( struct process *process, struct token *token );
/* console functions */
extern void inherit_console( struct thread *parent_thread, struct process *parent,
diff --git a/server/protocol.def b/server/protocol.def
index 7315f8ac4ea..901c380b721 100644
index bc0d0723eb3..ec67ce7ab87 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3763,6 +3763,13 @@ struct handle_info
@@ -3737,6 +3737,13 @@ struct handle_info
@END
@ -145,5 +145,5 @@ index 970ed1838da..1c1d49989b3 100644
+ }
+}
--
2.26.2
2.27.0

View File

@ -1,4 +1,4 @@
From 223addb60e053484eaa77df434898419683e926b Mon Sep 17 00:00:00 2001
From 659da72b956f4c59bc940736609fe8d52ec2d909 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 19 Feb 2017 05:38:40 +0100
Subject: [PATCH] kernel32: Make K32GetPerformanceInfo faster.
@ -10,7 +10,7 @@ Subject: [PATCH] kernel32: Make K32GetPerformanceInfo faster.
3 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c
index 6acdf0f1ea95..8f021ebb0d21 100644
index 6acdf0f1ea9..8f021ebb0d2 100644
--- a/dlls/kernelbase/debug.c
+++ b/dlls/kernelbase/debug.c
@@ -1449,7 +1449,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH K32GetPerformanceInfo( PPERFORMANCE_INFORMATION in
@ -85,14 +85,13 @@ index 6acdf0f1ea95..8f021ebb0d21 100644
diff --git a/server/process.c b/server/process.c
index 3156e1bc82a5..da5c55e5368a 100644
index 9482da98be5..9b7f10fffe5 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1830,3 +1830,21 @@ DECL_HANDLER(resume_process)
release_object( process );
@@ -1791,6 +1791,24 @@ DECL_HANDLER(resume_process)
}
}
+
+/* Retrieve process, thread and handle count */
+DECL_HANDLER(get_system_info)
+{
@ -110,11 +109,15 @@ index 3156e1bc82a5..da5c55e5368a 100644
+ reply->handles += get_handle_table_count( process );
+ }
+}
+
/* Get a list of processes and threads currently running */
DECL_HANDLER(list_processes)
{
diff --git a/server/protocol.def b/server/protocol.def
index ef10b5e1438c..ca34c9dc1b4b 100644
index bad8fef7903..cee75eff66d 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3992,3 +3992,11 @@ struct handle_info
@@ -3945,3 +3945,11 @@ struct handle_info
@REQ(resume_process)
obj_handle_t handle; /* process handle */
@END
@ -127,5 +130,5 @@ index ef10b5e1438c..ca34c9dc1b4b 100644
+ unsigned int handles; /* number of handles */
+@END
--
2.26.2
2.27.0

View File

@ -1,3 +1,2 @@
Fixes: [38656] Add support for hiding wine version information from applications
Depends: ntdll-ThreadTime
Depends: advapi32-Token_Integrity_Level

View File

@ -1,4 +1,4 @@
From f886d8af24ba52e791535c7a606c4ca97cc5ed8e Mon Sep 17 00:00:00 2001
From e043e7d570fcdc0f7bc662d794d111baaa15b015 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 20:56:49 -0700
Subject: [PATCH] ntdll: Add support for junction point creation.
@ -18,10 +18,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
create mode 100644 libs/port/renameat2.c
diff --git a/configure.ac b/configure.ac
index 9c5f76669df..201ae3c2d98 100644
index a403c9436ca..dbd07791de7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2203,6 +2203,8 @@ AC_CHECK_FUNCS(\
@@ -2218,6 +2218,8 @@ AC_CHECK_FUNCS(\
pwrite \
readdir \
readlink \
@ -31,7 +31,7 @@ index 9c5f76669df..201ae3c2d98 100644
select \
setproctitle \
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 184b7cdad59..8b5ddbb0da1 100644
index a502a8eec75..bce34f03920 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -38,6 +38,7 @@
@ -155,7 +155,7 @@ index 184b7cdad59..8b5ddbb0da1 100644
+ test_reparse_points();
}
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index ca6899b50f5..44cb12f90ee 100644
index b76d07a8175..271151ed1be 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -32,6 +32,7 @@
@ -174,7 +174,7 @@ index ca6899b50f5..44cb12f90ee 100644
#include "wine/server.h"
#include "wine/list.h"
#include "wine/debug.h"
@@ -5607,6 +5609,104 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -5661,6 +5663,104 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
}
@ -204,7 +204,7 @@ index ca6899b50f5..44cb12f90ee 100644
+ src_allocated = TRUE;
+ nt_dest.Buffer = dest;
+ nt_dest.Length = dest_len;
+ status = nt_to_unix_file_name( &nt_dest, &unix_dest, 0, FALSE );
+ status = nt_to_unix_file_name( &nt_dest, &unix_dest, 0 );
+ if (status != STATUS_SUCCESS && status != STATUS_NO_SUCH_FILE)
+ goto cleanup;
+ dest_allocated = TRUE;
@ -279,7 +279,7 @@ index ca6899b50f5..44cb12f90ee 100644
/******************************************************************************
* NtFsControlFile (NTDLL.@)
*/
@@ -5671,6 +5771,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
@@ -5748,6 +5848,23 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
io->Information = 0;
status = STATUS_SUCCESS;
break;
@ -304,10 +304,10 @@ index ca6899b50f5..44cb12f90ee 100644
return server_ioctl_file( handle, event, apc, apc_context, io, code,
in_buffer, in_size, out_buffer, out_size );
diff --git a/include/Makefile.in b/include/Makefile.in
index 9f70e72b4c7..1c5c456aa39 100644
index 216adf0d7ae..7dc16c230b6 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -518,6 +518,7 @@ SOURCES = \
@@ -520,6 +520,7 @@ SOURCES = \
ntddvdeo.h \
ntdef.h \
ntdsapi.h \
@ -364,7 +364,7 @@ index 00000000000..21d42e17325
+
+#endif /* __WINE_NTIFS_H */
diff --git a/include/wine/port.h b/include/wine/port.h
index 928730a41d7..e8434c73cca 100644
index 930efeeea1f..7d2c7388707 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -334,6 +334,15 @@ double rint(double x);
@ -384,7 +384,7 @@ index 928730a41d7..e8434c73cca 100644
int statvfs( const char *path, struct statvfs *buf );
#endif
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 7bc67fa3fee..1963afe2423 100644
index d1de285d527..4b1ecab7516 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -14,6 +14,7 @@ C_SRCS = \

View File

@ -1,4 +1,4 @@
From b53336eeca65aa2dbf11c2d80a731ca904fe81de Mon Sep 17 00:00:00 2001
From 67cacb66b16c354aa30f4c94bba9da44f7e45619 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 21:02:11 -0700
Subject: [PATCH] kernel32,ntdll: Add support for deleting junction points with
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index b580e367561..9fa7d4c9f27 100644
index db2c1fb0240..6b7912359cf 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1058,6 +1058,7 @@ BOOL WINAPI CreateDirectoryExA( LPCSTR template, LPCSTR path, LPSECURITY_ATTRIBU
@@ -233,6 +233,7 @@ BOOL WINAPI CreateDirectoryExA( LPCSTR template, LPCSTR path, LPSECURITY_ATTRIBU
*/
BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
{
@ -22,10 +22,10 @@ index b580e367561..9fa7d4c9f27 100644
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nt_name;
ANSI_STRING unix_name;
@@ -1089,15 +1090,21 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
@@ -264,15 +265,21 @@ BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
}
status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN, FALSE );
status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN );
- RtlFreeUnicodeString( &nt_name );
- if (!set_ntstatus( status ))
+ if (status == STATUS_SUCCESS)
@ -51,10 +51,10 @@ index b580e367561..9fa7d4c9f27 100644
return ret;
}
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index d7b2f9aa0d9..e8cdb661772 100644
index c7107500939..5b71f6f658b 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4938,7 +4938,7 @@ static void test_reparse_points(void)
@@ -5009,7 +5009,7 @@ static void test_reparse_points(void)
REPARSE_GUID_DATA_BUFFER guid_buffer;
static const WCHAR dotW[] = {'.',0};
REPARSE_DATA_BUFFER *buffer = NULL;
@ -63,7 +63,7 @@ index d7b2f9aa0d9..e8cdb661772 100644
INT buffer_len, string_len;
IO_STATUS_BLOCK iosb;
UNICODE_STRING nameW;
@@ -5027,6 +5027,38 @@ static void test_reparse_points(void)
@@ -5098,6 +5098,38 @@ static void test_reparse_points(void)
"Junction point folder's access time does not match.\n");
CloseHandle(handle);
@ -103,5 +103,5 @@ index d7b2f9aa0d9..e8cdb661772 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
--
2.23.0
2.27.0

View File

@ -1,4 +1,4 @@
From 6a13b364b9b8a92d706b8ee2f4e69743ab3bee5a Mon Sep 17 00:00:00 2001
From 2fe2cb6a67925f22e9b3fbffefd20c2fe0040775 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 11 Apr 2019 12:16:49 -0600
Subject: [PATCH] ntdll: Add support for relative symlink creation.
@ -11,7 +11,7 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
3 files changed, 77 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index df912e18496..515a84da4d6 100644
index b93ba0e87ed..975a72e7103 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4972,7 +4972,8 @@ static void test_file_readonly_access(void)
@ -101,10 +101,10 @@ index df912e18496..515a84da4d6 100644
/* Cleanup */
pRtlFreeUnicodeString(&nameW);
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index e35ea49d17f..eb39dc0873b 100644
index fe945cef477..a1d1863133a 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -5615,16 +5615,19 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
@@ -5669,16 +5669,19 @@ static void ignore_server_ioctl_struct_holes( ULONG code, const void *in_buffer,
*/
NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
{
@ -126,7 +126,7 @@ index e35ea49d17f..eb39dc0873b 100644
int i;
switch(buffer->ReparseTag)
@@ -5633,11 +5636,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5687,11 +5690,13 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
dest_len = buffer->MountPointReparseBuffer.SubstituteNameLength;
offset = buffer->MountPointReparseBuffer.SubstituteNameOffset;
dest = &buffer->MountPointReparseBuffer.PathBuffer[offset];
@ -140,7 +140,7 @@ index e35ea49d17f..eb39dc0873b 100644
break;
default:
return STATUS_NOT_IMPLEMENTED;
@@ -5649,17 +5654,54 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5703,17 +5708,54 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
if ((status = server_get_unix_name( handle, &unix_src )))
goto cleanup;
src_allocated = TRUE;
@ -173,7 +173,7 @@ index e35ea49d17f..eb39dc0873b 100644
+ nt_dest.Length = dest_len;
+ }
+ nt_dest_allocated = TRUE;
status = nt_to_unix_file_name( &nt_dest, &unix_dest, 0, FALSE );
status = nt_to_unix_file_name( &nt_dest, &unix_dest, 0 );
if (status != STATUS_SUCCESS && status != STATUS_NO_SUCH_FILE)
goto cleanup;
dest_allocated = TRUE;
@ -199,7 +199,7 @@ index e35ea49d17f..eb39dc0873b 100644
for (i = 0; i < sizeof(ULONG)*8; i++)
{
if ((buffer->ReparseTag >> i) & 1)
@@ -5678,7 +5720,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5732,7 +5774,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
strcat( magic_dest, "." );
strcat( magic_dest, "/" );
}
@ -208,7 +208,7 @@ index e35ea49d17f..eb39dc0873b 100644
/* Produce the link in a temporary location in the same folder */
strcpy( tmpdir, unix_src.Buffer );
@@ -5728,7 +5770,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5782,7 +5824,9 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
cleanup:
if (tempdir_created) rmdir( tmpdir );

View File

@ -1,4 +1,4 @@
From 1f399151685c3d7827d39b7039abe7b3b941a3bc Mon Sep 17 00:00:00 2001
From c1f3ec8ecefd4488bd8f49da22deb2f4f56d489c Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 30 Apr 2019 16:24:54 -0600
Subject: [PATCH] ntdll: Allow creation of dangling reparse points to
@ -11,10 +11,10 @@ Signed-off-by: Erich E. Hoover <erich.e.hoover@gmail.com>
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index fb1e6bd3c1c..c47aea62a38 100644
index 3cfd633df86..fc79a2fa735 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3218,6 +3218,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
@@ -3273,6 +3273,19 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
status = STATUS_OBJECT_NAME_COLLISION;
}
}
@ -34,20 +34,20 @@ index fb1e6bd3c1c..c47aea62a38 100644
if (status != STATUS_SUCCESS) break;
@@ -5682,7 +5695,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
@@ -5736,7 +5749,7 @@ NTSTATUS FILE_CreateSymlink(HANDLE handle, REPARSE_DATA_BUFFER *buffer)
nt_dest.Length = dest_len;
}
nt_dest_allocated = TRUE;
- status = nt_to_unix_file_name( &nt_dest, &unix_dest, 0, FALSE );
+ status = nt_to_unix_file_name( &nt_dest, &unix_dest, FILE_WINE_PATH, FALSE );
- status = nt_to_unix_file_name( &nt_dest, &unix_dest, 0 );
+ status = nt_to_unix_file_name( &nt_dest, &unix_dest, FILE_WINE_PATH );
if (status != STATUS_SUCCESS && status != STATUS_NO_SUCH_FILE)
goto cleanup;
dest_allocated = TRUE;
diff --git a/include/winternl.h b/include/winternl.h
index 0957561063a..0af566f518d 100644
index 4ee32d3c9e9..3d444e7485e 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1839,6 +1839,7 @@ typedef struct _RTL_HANDLE_TABLE
@@ -1869,6 +1869,7 @@ typedef struct _RTL_HANDLE_TABLE
#define FILE_OVERWRITE 4
#define FILE_OVERWRITE_IF 5
#define FILE_MAXIMUM_DISPOSITION 5

View File

@ -1,4 +1,4 @@
From 351c405a950985a6d5a2262ce88b46ecf83b03ff Mon Sep 17 00:00:00 2001
From 38833e0b211516ba54a68cb7e6f560c8caf952ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 26 May 2017 05:17:17 +0200
Subject: [PATCH] ntdll: Implement opening files through nt device paths.
@ -9,7 +9,7 @@ Subject: [PATCH] ntdll: Implement opening files through nt device paths.
2 files changed, 147 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index e7918140323..7247f792941 100644
index 9e65a1f6ddd..7b65152f7cf 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -135,18 +135,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
@ -63,10 +63,10 @@ index e7918140323..7247f792941 100644
static void open_file_test(void)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 22f34a1f008..72fea5b8aab 100644
index a7f22e83e12..b93c169f856 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3360,16 +3360,10 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
@@ -3307,16 +3307,10 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
/******************************************************************************
@ -80,13 +80,13 @@ index 22f34a1f008..72fea5b8aab 100644
+ * nt_to_unix_file_name_internal
*/
-NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
- UINT disposition, BOOLEAN check_case )
- UINT disposition )
+static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
+ UINT disposition, BOOLEAN check_case )
+ UINT disposition )
{
static const WCHAR unixW[] = {'u','n','i','x'};
static const WCHAR pipeW[] = {'p','i','p','e'};
@@ -3482,6 +3476,126 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
@@ -3430,6 +3424,126 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
return status;
}
@ -166,7 +166,7 @@ index 22f34a1f008..72fea5b8aab 100644
+ * returned, but the unix name is still filled in properly.
+ */
+NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret,
+ UINT disposition, BOOLEAN check_case )
+ UINT disposition )
+{
+ static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0};
+ static const WCHAR dosprefixW[] = {'\\','?','?','\\'};
@ -189,7 +189,7 @@ index 22f34a1f008..72fea5b8aab 100644
+ prefix = user_shared_data->NtSystemRoot;
+ }
+ else
+ return nt_to_unix_file_name_internal( nameW, unix_name_ret, disposition, check_case );
+ return nt_to_unix_file_name_internal( nameW, unix_name_ret, disposition );
+
+ name_len = sizeof(dosprefixW) + wcslen(prefix) * sizeof(WCHAR) +
+ nameW->Length - offset * sizeof(WCHAR) + sizeof(WCHAR);
@ -205,7 +205,7 @@ index 22f34a1f008..72fea5b8aab 100644
+ ptr[ nameW->Length / sizeof(WCHAR) - offset ] = 0;
+
+ RtlInitUnicodeString( &dospathW, name );
+ status = nt_to_unix_file_name_internal( &dospathW, unix_name_ret, disposition, check_case );
+ status = nt_to_unix_file_name_internal( &dospathW, unix_name_ret, disposition );
+
+ RtlFreeHeap( GetProcessHeap(), 0, name );
+ return status;

View File

@ -1,4 +1,4 @@
From d4166e5e9761c9a3d896486b1eb2582ca6f20482 Mon Sep 17 00:00:00 2001
From addb612dfe7429c29adeb31144976713cb0756b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 27 Jul 2014 03:35:42 +0200
Subject: [PATCH] ntdll: Allow special characters in pipe names.
@ -38,26 +38,26 @@ index 3c7ca06a045..453dcc80b7b 100644
}
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 13096e085e8..31a6c761c7c 100644
index 61340a0e010..a7f22e83e12 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -2830,6 +2830,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
UINT disposition, BOOLEAN check_case )
@@ -3319,6 +3319,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
UINT disposition )
{
static const WCHAR unixW[] = {'u','n','i','x'};
+ static const WCHAR pipeW[] = {'p','i','p','e'};
static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 };
NTSTATUS status = STATUS_SUCCESS;
@@ -2839,6 +2840,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
int pos, ret, name_len, unix_len, prefix_len;
@@ -3329,6 +3330,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
WCHAR prefix[MAX_DIR_ENTRY_LEN + 1];
BOOLEAN check_case = FALSE;
BOOLEAN is_unix = FALSE;
+ BOOLEAN is_pipe = FALSE;
name = nameW->Buffer;
name_len = nameW->Length / sizeof(WCHAR);
@@ -2872,13 +2874,17 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
@@ -3362,13 +3364,17 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u
name += prefix_len;
name_len -= prefix_len;

View File

@ -2,3 +2,4 @@ Fixes: Return correct thread creation time in SystemProcessInformation
Fixes: Fill process virtual memory counters in NtQuerySystemInformation
# Patch 6 is broken. We should really be returning this information from the
# server, but that needs a bit more work.
Disabled: true

View File

@ -1,16 +1,16 @@
From 7ed5f1e7150ea0d397633ff1b44518567eddcf5d Mon Sep 17 00:00:00 2001
From 73f255bdc5edef27f9a03b7e8917686490d3bf7a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 7 Mar 2015 06:20:55 +0100
Subject: nvcuda: Implement cuModuleLoad wrapper function.
Subject: [PATCH] nvcuda: Implement cuModuleLoad wrapper function.
---
dlls/nvcuda/nvcuda.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/nvcuda/nvcuda.c | 46 +++++++++++++++++++++++++++++++++++++++++
dlls/nvcuda/nvcuda.spec | 2 +-
include/cuda.h | 1 +
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/dlls/nvcuda/nvcuda.c b/dlls/nvcuda/nvcuda.c
index 3262afd..ec32da2 100644
index e11a1d51a9d..14b695f3371 100644
--- a/dlls/nvcuda/nvcuda.c
+++ b/dlls/nvcuda/nvcuda.c
@@ -29,6 +29,7 @@
@ -59,7 +59,7 @@ index 3262afd..ec32da2 100644
+ return FALSE;
+ }
+
+ status = wine_nt_to_unix_file_name(&ntpathW, unix_name, FILE_OPEN, FALSE);
+ status = wine_nt_to_unix_file_name(&ntpathW, unix_name, FILE_OPEN);
+
+ RtlFreeUnicodeString(&ntpathW);
+ RtlFreeUnicodeString(&dospathW);
@ -88,7 +88,7 @@ index 3262afd..ec32da2 100644
{
TRACE("(%p, %p)\n", module, image);
diff --git a/dlls/nvcuda/nvcuda.spec b/dlls/nvcuda/nvcuda.spec
index 84b5fcd..492d6c1 100644
index 84b5fcd8f4d..492d6c129c1 100644
--- a/dlls/nvcuda/nvcuda.spec
+++ b/dlls/nvcuda/nvcuda.spec
@@ -240,7 +240,7 @@
@ -101,7 +101,7 @@ index 84b5fcd..492d6c1 100644
@ stdcall cuModuleLoadDataEx(ptr ptr long ptr ptr) wine_cuModuleLoadDataEx
@ stdcall cuModuleLoadFatBinary(ptr ptr) wine_cuModuleLoadFatBinary
diff --git a/include/cuda.h b/include/cuda.h
index 327fe4d..2bf20f9 100644
index 327fe4d8ef3..2bf20f9533e 100644
--- a/include/cuda.h
+++ b/include/cuda.h
@@ -23,6 +23,7 @@
@ -113,5 +113,5 @@ index 327fe4d..2bf20f9 100644
#define CUDA_ERROR_NOT_SUPPORTED 801
#define CUDA_ERROR_UNKNOWN 999
--
2.3.0
2.27.0

View File

@ -1,7 +1,7 @@
From 0e8472f74df21fed8e0b86ba1e2ae2e34b4082d2 Mon Sep 17 00:00:00 2001
From ecde4f4f994831bbeb1029d93e0b06f815c503b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 6 Jan 2015 05:16:36 +0100
Subject: [PATCH] nvcuvid: First implementation. (rev 2)
Subject: nvcuvid: First implementation. (rev 2)
Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Convert structures properly where the Windows and Linux definition differs.
@ -21,10 +21,10 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
create mode 100644 include/nvcuvid.h
diff --git a/configure.ac b/configure.ac
index 90d5ed7df..326d03975 100644
index e0d4af5b9d8..14bd257d826 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3554,6 +3554,7 @@ WINE_CONFIG_MAKEFILE(dlls/nvapi/tests)
@@ -3589,6 +3589,7 @@ WINE_CONFIG_MAKEFILE(dlls/nvapi/tests)
WINE_CONFIG_MAKEFILE(dlls/nvapi64,enable_win64)
WINE_CONFIG_MAKEFILE(dlls/nvcuda)
WINE_CONFIG_MAKEFILE(dlls/nvcuda/tests)
@ -34,7 +34,7 @@ index 90d5ed7df..326d03975 100644
WINE_CONFIG_MAKEFILE(dlls/odbcbcp)
diff --git a/dlls/nvcuvid/Makefile.in b/dlls/nvcuvid/Makefile.in
new file mode 100644
index 000000000..2c2dc8ccf
index 00000000000..2c2dc8ccf67
--- /dev/null
+++ b/dlls/nvcuvid/Makefile.in
@@ -0,0 +1,4 @@
@ -44,7 +44,7 @@ index 000000000..2c2dc8ccf
+ nvcuvid.c
diff --git a/dlls/nvcuvid/nvcuvid.c b/dlls/nvcuvid/nvcuvid.c
new file mode 100644
index 000000000..05fec0fff
index 00000000000..2704bfa9a63
--- /dev/null
+++ b/dlls/nvcuvid/nvcuvid.c
@@ -0,0 +1,537 @@
@ -338,7 +338,7 @@ index 000000000..05fec0fff
+ return FALSE;
+ }
+
+ status = wine_nt_to_unix_file_name(&ntpathW, unix_name, FILE_OPEN, FALSE);
+ status = wine_nt_to_unix_file_name(&ntpathW, unix_name, FILE_OPEN);
+
+ RtlFreeUnicodeString(&ntpathW);
+ RtlFreeUnicodeString(&dospathW);
@ -587,7 +587,7 @@ index 000000000..05fec0fff
+}
diff --git a/dlls/nvcuvid/nvcuvid.spec b/dlls/nvcuvid/nvcuvid.spec
new file mode 100644
index 000000000..433e7db3b
index 00000000000..433e7db3b7e
--- /dev/null
+++ b/dlls/nvcuvid/nvcuvid.spec
@@ -0,0 +1,24 @@
@ -616,10 +616,10 @@ index 000000000..433e7db3b
+@ stdcall cuvidSetVideoSourceState(ptr long) wine_cuvidSetVideoSourceState
+@ stdcall cuvidUnmapVideoFrame(ptr long) wine_cuvidUnmapVideoFrame
diff --git a/include/Makefile.in b/include/Makefile.in
index c28834897..c38dd2ad1 100644
index 3bb3f938747..3db2e16be76 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -81,6 +81,7 @@ SOURCES = \
@@ -87,6 +87,7 @@ SOURCES = \
ctxtcall.idl \
cuda.h \
custcntl.h \
@ -627,7 +627,7 @@ index c28834897..c38dd2ad1 100644
cvconst.h \
d2d1.idl \
d2d1_1.idl \
@@ -498,6 +499,7 @@ SOURCES = \
@@ -527,6 +528,7 @@ SOURCES = \
ntsecpkg.h \
ntstatus.h \
nvapi.h \
@ -637,7 +637,7 @@ index c28834897..c38dd2ad1 100644
objectarray.idl \
diff --git a/include/cuviddec.h b/include/cuviddec.h
new file mode 100644
index 000000000..e45032190
index 00000000000..e4503219097
--- /dev/null
+++ b/include/cuviddec.h
@@ -0,0 +1,99 @@
@ -742,7 +742,7 @@ index 000000000..e45032190
+#endif /* __WINE_CUVIDDEC_H */
diff --git a/include/nvcuvid.h b/include/nvcuvid.h
new file mode 100644
index 000000000..a192ef64c
index 00000000000..a192ef64c2e
--- /dev/null
+++ b/include/nvcuvid.h
@@ -0,0 +1,79 @@
@ -826,5 +826,5 @@ index 000000000..a192ef64c
+
+#endif /* __WINE_NVCUVID_H */
--
2.24.0
2.27.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "6e2a54ec76d225d76506fe909a9c300702636d5b"
echo "e0e3b6bc91f7db956e3a66f2938eea45d4055a39"
}
# Show version information
@ -196,7 +196,6 @@ patch_enable_all ()
enable_ntdll_SystemInterruptInformation="$1"
enable_ntdll_SystemModuleInformation="$1"
enable_ntdll_SystemRoot_Symlink="$1"
enable_ntdll_ThreadTime="$1"
enable_ntdll_WRITECOPY="$1"
enable_ntdll_Zero_mod_name="$1"
enable_ntdll_aarch_TEB="$1"
@ -680,9 +679,6 @@ patch_enable ()
ntdll-SystemRoot_Symlink)
enable_ntdll_SystemRoot_Symlink="$2"
;;
ntdll-ThreadTime)
enable_ntdll_ThreadTime="$2"
;;
ntdll-WRITECOPY)
enable_ntdll_WRITECOPY="$2"
;;
@ -1558,13 +1554,6 @@ if test "$enable_shell32_Progress_Dialog" -eq 1; then
enable_shell32_SHFileOperation_Move=1
fi
if test "$enable_server_Realtime_Priority" -eq 1; then
if test "$enable_ntdll_ThreadTime" -gt 1; then
abort "Patchset ntdll-ThreadTime disabled, but server-Realtime_Priority depends on that."
fi
enable_ntdll_ThreadTime=1
fi
if test "$enable_server_Object_Types" -eq 1; then
if test "$enable_ntdll_SystemModuleInformation" -gt 1; then
abort "Patchset ntdll-SystemModuleInformation disabled, but server-Object_Types depends on that."
@ -1661,11 +1650,7 @@ if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then
if test "$enable_advapi32_Token_Integrity_Level" -gt 1; then
abort "Patchset advapi32-Token_Integrity_Level disabled, but ntdll-Hide_Wine_Exports depends on that."
fi
if test "$enable_ntdll_ThreadTime" -gt 1; then
abort "Patchset ntdll-ThreadTime disabled, but ntdll-Hide_Wine_Exports depends on that."
fi
enable_advapi32_Token_Integrity_Level=1
enable_ntdll_ThreadTime=1
fi
if test "$enable_ntdll_Builtin_Prot" -eq 1; then
@ -3655,24 +3640,10 @@ if test "$enable_ntdll_Heap_Improvements" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-ThreadTime
# |
# | Modified files:
# | * dlls/ntdll/unix/system.c, server/protocol.def, server/snapshot.c, server/thread.h
# |
if test "$enable_ntdll_ThreadTime" -eq 1; then
patch_apply ntdll-ThreadTime/0002-ntdll-Set-correct-thread-creation-time-for-SystemPro.patch
patch_apply ntdll-ThreadTime/0004-ntdll-Set-process-start-time.patch
(
printf '%s\n' '+ { "Michael Müller", "ntdll: Set correct thread creation time for SystemProcessInformation in NtQuerySystemInformation.", 1 },';
printf '%s\n' '+ { "Michael Müller", "ntdll: Set process start time.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-Hide_Wine_Exports
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level, ntdll-ThreadTime
# | * Staging, advapi32-CreateRestrictedToken, advapi32-Token_Integrity_Level
# |
# | This patchset fixes the following Wine bugs:
# | * [#38656] Add support for hiding wine version information from applications
@ -4383,8 +4354,8 @@ fi
# | server/console.c, server/debugger.c, server/device.c, server/directory.c, server/event.c, server/fd.c, server/file.c,
# | server/handle.c, server/handle.h, server/hook.c, server/mailslot.c, server/mapping.c, server/mutex.c,
# | server/named_pipe.c, server/object.c, server/object.h, server/process.c, server/queue.c, server/registry.c,
# | server/request.c, server/semaphore.c, server/serial.c, server/signal.c, server/snapshot.c, server/sock.c,
# | server/symlink.c, server/thread.c, server/timer.c, server/token.c, server/winstation.c
# | server/request.c, server/semaphore.c, server/serial.c, server/signal.c, server/sock.c, server/symlink.c,
# | server/thread.c, server/timer.c, server/token.c, server/winstation.c
# |
if test "$enable_server_Desktop_Refcount" -eq 1; then
patch_apply server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch
@ -4557,9 +4528,6 @@ fi
# Patchset server-Realtime_Priority
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-ThreadTime
# |
# | Modified files:
# | * server/Makefile.in, server/main.c, server/scheduler.c, server/thread.c, server/thread.h
# |

View File

@ -1,4 +1,4 @@
From 07f5dd1db6399c54be793ca496546bb28947aaae Mon Sep 17 00:00:00 2001
From 057f64581fd7acc3834bae2c6ebccd812f26b722 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 4 Dec 2015 10:36:47 +0100
Subject: [PATCH] server: Introduce a new alloc_handle object callback. (v2)
@ -32,14 +32,13 @@ Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
server/semaphore.c | 1 +
server/serial.c | 1 +
server/signal.c | 1 +
server/snapshot.c | 1 +
server/sock.c | 2 ++
server/symlink.c | 1 +
server/thread.c | 3 +++
server/timer.c | 1 +
server/token.c | 1 +
server/winstation.c | 2 ++
34 files changed, 79 insertions(+), 4 deletions(-)
33 files changed, 78 insertions(+), 4 deletions(-)
diff --git a/server/async.c b/server/async.c
index 03994e8fac2..9feafd01847 100644
@ -110,10 +109,10 @@ index db04727b93b..e72a155eeeb 100644
completion_destroy /* destroy */
};
diff --git a/server/console.c b/server/console.c
index 729cfa40612..a0d9bd87ab4 100644
index d6673dca1bd..8ed0c1f2d81 100644
--- a/server/console.c
+++ b/server/console.c
@@ -97,6 +97,7 @@ static const struct object_ops console_input_ops =
@@ -99,6 +99,7 @@ static const struct object_ops console_input_ops =
NULL, /* unlink_name */
console_input_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
@ -121,7 +120,7 @@ index 729cfa40612..a0d9bd87ab4 100644
no_close_handle, /* close_handle */
console_input_destroy /* destroy */
};
@@ -132,6 +133,7 @@ static const struct object_ops console_input_events_ops =
@@ -134,6 +135,7 @@ static const struct object_ops console_input_events_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
@ -129,7 +128,7 @@ index 729cfa40612..a0d9bd87ab4 100644
no_close_handle, /* close_handle */
console_input_events_destroy /* destroy */
};
@@ -195,6 +197,7 @@ static const struct object_ops screen_buffer_ops =
@@ -197,6 +199,7 @@ static const struct object_ops screen_buffer_ops =
NULL, /* unlink_name */
screen_buffer_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
@ -137,7 +136,7 @@ index 729cfa40612..a0d9bd87ab4 100644
no_close_handle, /* close_handle */
screen_buffer_destroy /* destroy */
};
@@ -241,6 +244,7 @@ static const struct object_ops console_device_ops =
@@ -244,6 +247,7 @@ static const struct object_ops console_device_ops =
default_unlink_name, /* unlink_name */
console_device_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
@ -375,7 +374,7 @@ index 781e6f3141a..6f0321393e2 100644
mailslot_device_destroy /* destroy */
};
diff --git a/server/mapping.c b/server/mapping.c
index 0941dd87c05..42c207b3367 100644
index 07c51c246d6..796855ac8e5 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -79,6 +79,7 @@ static const struct object_ops ranges_ops =
@ -500,10 +499,10 @@ index f0b889d5899..13c59694c46 100644
extern void no_destroy( struct object *obj );
#ifdef DEBUG_OBJECTS
diff --git a/server/process.c b/server/process.c
index 283edc09c5e..3134bf415a0 100644
index 9482da98be5..4166f1ce8df 100644
--- a/server/process.c
+++ b/server/process.c
@@ -88,6 +88,7 @@ static const struct object_ops process_ops =
@@ -89,6 +89,7 @@ static const struct object_ops process_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
process_get_kernel_obj_list, /* get_kernel_obj_list */
@ -511,7 +510,7 @@ index 283edc09c5e..3134bf415a0 100644
no_close_handle, /* close_handle */
process_destroy /* destroy */
};
@@ -138,6 +139,7 @@ static const struct object_ops startup_info_ops =
@@ -139,6 +140,7 @@ static const struct object_ops startup_info_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
@ -519,7 +518,7 @@ index 283edc09c5e..3134bf415a0 100644
no_close_handle, /* close_handle */
startup_info_destroy /* destroy */
};
@@ -183,6 +185,7 @@ static const struct object_ops job_ops =
@@ -184,6 +186,7 @@ static const struct object_ops job_ops =
default_unlink_name, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
@ -528,7 +527,7 @@ index 283edc09c5e..3134bf415a0 100644
job_destroy /* destroy */
};
diff --git a/server/queue.c b/server/queue.c
index c3925dd6646..e30cc0c13ad 100644
index a65eab38bdc..d658c48323f 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -182,6 +182,7 @@ static const struct object_ops msg_queue_ops =
@ -607,18 +606,6 @@ index c81f6b8e989..b8dd87d86f1 100644
no_close_handle, /* close_handle */
handler_destroy /* destroy */
};
diff --git a/server/snapshot.c b/server/snapshot.c
index a0f2ea17a3e..d5ba720980a 100644
--- a/server/snapshot.c
+++ b/server/snapshot.c
@@ -72,6 +72,7 @@ static const struct object_ops snapshot_ops =
NULL, /* unlink_name */
no_open_file, /* open_file */
no_kernel_obj_list, /* get_kernel_obj_list */
+ no_alloc_handle, /* alloc_handle */
no_close_handle, /* close_handle */
snapshot_destroy /* destroy */
};
diff --git a/server/sock.c b/server/sock.c
index 5095a6ef9f0..7b10b74cc4e 100644
--- a/server/sock.c
@ -652,7 +639,7 @@ index 7a2f8642d5f..7bb28c8d7ce 100644
symlink_destroy /* destroy */
};
diff --git a/server/thread.c b/server/thread.c
index e2bfa50c7ba..9faef2dcd34 100644
index 9b14174578e..e3783351eb1 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -121,6 +121,7 @@ static const struct object_ops thread_apc_ops =

View File

@ -1,4 +1,4 @@
From 0fefda7a02d52d1c8813d7caaf2ca3cc6e352a29 Mon Sep 17 00:00:00 2001
From f20e406fad78eeebea4e07407e6b05e069c8475f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 12 Mar 2015 00:44:25 +0100
Subject: [PATCH] server: Introduce a helper function to update the
@ -9,7 +9,7 @@ Subject: [PATCH] server: Introduce a helper function to update the
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/server/queue.c b/server/queue.c
index 432885f9e4c..0a20bd3639d 100644
index a65eab38bdc..b8943bc4b61 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1295,9 +1295,9 @@ static void set_input_key_state( unsigned char *keystate, unsigned char key, int
@ -61,16 +61,16 @@ index 432885f9e4c..0a20bd3639d 100644
}
/* release the hardware message currently being processed by the given thread */
@@ -1413,7 +1419,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
}
if (clr_bit) clear_queue_bits( queue, clr_bit );
- update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam );
+ update_input_key_state( input, msg->msg, msg->wparam );
list_remove( &msg->entry );
free_message( msg );
@@ -1408,7 +1414,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
}
@@ -1532,7 +1538,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
if (clr_bit) clear_queue_bits( queue, clr_bit );
- update_input_key_state( input->desktop, input->keystate, msg->msg, msg->wparam );
+ update_input_key_state( input, msg->msg, msg->wparam );
list_remove( &msg->entry );
free_message( msg );
}
@@ -1526,7 +1532,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
struct thread_input *input;
unsigned int msg_code;
@ -79,7 +79,7 @@ index 432885f9e4c..0a20bd3639d 100644
last_input_time = get_tick_count();
if (msg->msg != WM_MOUSEMOVE) always_queue = 1;
@@ -1567,7 +1573,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
@@ -1561,7 +1567,7 @@ static void queue_hardware_message( struct desktop *desktop, struct message *msg
win = find_hardware_message_window( desktop, input, msg, &msg_code, &thread );
if (!win || !thread)
{
@ -88,7 +88,7 @@ index 432885f9e4c..0a20bd3639d 100644
free_message( msg );
return;
}
@@ -1905,7 +1911,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
@@ -1899,7 +1905,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
if ((device = current->process->rawinput_kbd) && (device->flags & RIDEV_NOLEGACY))
{
@ -97,7 +97,7 @@ index 432885f9e4c..0a20bd3639d 100644
return 0;
}
@@ -2034,7 +2040,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
@@ -2028,7 +2034,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
if (!win || !win_thread)
{
/* no window at all, remove it */
@ -106,7 +106,7 @@ index 432885f9e4c..0a20bd3639d 100644
list_remove( &msg->entry );
free_message( msg );
continue;
@@ -2050,7 +2056,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
@@ -2044,7 +2050,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
else
{
/* for another thread input, drop it */

View File

@ -1,8 +1,8 @@
From 52837e975cb343d78e626bd8a9464db59d27565b Mon Sep 17 00:00:00 2001
From c527f32596831ae31b055cd77cb3bc848f83a8a8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 15 Mar 2015 01:05:48 +0100
Subject: server: Fix handling of GetMessage after previous PeekMessage call.
(v3)
Subject: [PATCH] server: Fix handling of GetMessage after previous PeekMessage
call. (v3)
Changes in v2:
* accept_hardware_message should also reset ignore_post_msg.
@ -10,15 +10,15 @@ Changes in v2:
Changes in v3:
* Fix remaining todo_wine.
---
dlls/user32/tests/msg.c | 29 +++++++++++++++++++---------
server/queue.c | 50 +++++++++++++++++++++++++++++++++++++++++--------
dlls/user32/tests/msg.c | 29 ++++++++++++++++--------
server/queue.c | 50 ++++++++++++++++++++++++++++++++++-------
2 files changed, 62 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 45b5222deba..e36d0f8af49 100644
index f84525a0bf9..80cc0daa6c6 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -11037,13 +11037,10 @@ static void test_PeekMessage3(void)
@@ -12429,13 +12429,10 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE);
@ -32,7 +32,7 @@ index 45b5222deba..e36d0f8af49 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, NULL, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -11053,10 +11050,8 @@ static void test_PeekMessage3(void)
@@ -12445,10 +12442,8 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE);
@ -43,7 +43,7 @@ index 45b5222deba..e36d0f8af49 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, NULL, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -11068,10 +11063,8 @@ static void test_PeekMessage3(void)
@@ -12460,10 +12455,8 @@ static void test_PeekMessage3(void)
ok(msg.message == WM_TIMER, "msg.message = %u instead of WM_TIMER\n", msg.message);
PostMessageA(hwnd, WM_USER, 0, 0);
ret = GetMessageA(&msg, NULL, 0, 0);
@ -54,7 +54,7 @@ index 45b5222deba..e36d0f8af49 100644
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = PeekMessageA(&msg, NULL, 0, 0, 0);
ok(!ret, "expected PeekMessage to return FALSE, got %u\n", ret);
@@ -11099,14 +11092,32 @@ static void test_PeekMessage3(void)
@@ -12491,14 +12484,32 @@ static void test_PeekMessage3(void)
ret = GetMessageA(&msg, NULL, 0, 0);
ok(ret && msg.message == WM_USER, "msg.message = %u instead of WM_USER\n", msg.message);
ret = GetMessageA(&msg, NULL, 0, 0);
@ -90,7 +90,7 @@ index 45b5222deba..e36d0f8af49 100644
* because both messages are in the same queue. */
diff --git a/server/queue.c b/server/queue.c
index c479b388bd6..fdb09d93238 100644
index a65eab38bdc..bf315f5008c 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -140,6 +140,7 @@ struct msg_queue
@ -101,7 +101,7 @@ index c479b388bd6..fdb09d93238 100644
};
struct hotkey
@@ -298,6 +299,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -300,6 +301,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->input = (struct thread_input *)grab_object( input );
queue->hooks = NULL;
queue->last_get_msg = current_time;
@ -109,7 +109,7 @@ index c479b388bd6..fdb09d93238 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -495,13 +497,21 @@ static inline struct msg_queue *get_current_queue(void)
@@ -529,13 +531,21 @@ static inline struct msg_queue *get_current_queue(void)
}
/* get a (pseudo-)unique id to tag hardware messages */
@ -132,7 +132,7 @@ index c479b388bd6..fdb09d93238 100644
/* try to merge a message with the last in the list; return 1 if successful */
static int merge_message( struct thread_input *input, const struct message *msg )
{
@@ -779,7 +789,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
@@ -813,7 +823,7 @@ static int match_window( user_handle_t win, user_handle_t msg_win )
}
/* retrieve a posted message */
@ -141,7 +141,7 @@ index c479b388bd6..fdb09d93238 100644
unsigned int first, unsigned int last, unsigned int flags,
struct get_message_reply *reply )
{
@@ -790,6 +800,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
@@ -824,6 +834,7 @@ static int get_posted_message( struct msg_queue *queue, user_handle_t win,
{
if (!match_window( win, msg->win )) continue;
if (!check_msg_filter( msg->msg, first, last )) continue;
@ -149,7 +149,7 @@ index c479b388bd6..fdb09d93238 100644
goto found; /* found one */
}
return 0;
@@ -1387,6 +1398,7 @@ found:
@@ -1439,6 +1450,7 @@ found:
msg->msg = WM_HOTKEY;
msg->wparam = hotkey->id;
msg->lparam = ((hotkey->vkey & 0xffff) << 16) | modifiers;
@ -157,7 +157,7 @@ index c479b388bd6..fdb09d93238 100644
free( msg->data );
msg->data = NULL;
@@ -1992,7 +2004,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
@@ -2061,7 +2073,7 @@ static int get_hardware_message( struct thread *thread, unsigned int hw_id, user
continue;
}
/* now we can return it */
@ -166,7 +166,7 @@ index c479b388bd6..fdb09d93238 100644
reply->type = MSG_HARDWARE;
reply->win = win;
reply->msg = msg_code;
@@ -2098,6 +2110,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
@@ -2167,6 +2179,7 @@ void post_message( user_handle_t win, unsigned int message, lparam_t wparam, lpa
msg->result = NULL;
msg->data = NULL;
msg->data_size = 0;
@ -174,7 +174,7 @@ index c479b388bd6..fdb09d93238 100644
get_message_defaults( thread->queue, &msg->x, &msg->y, &msg->time );
@@ -2342,6 +2355,7 @@ DECL_HANDLER(send_message)
@@ -2411,6 +2424,7 @@ DECL_HANDLER(send_message)
set_queue_bits( recv_queue, QS_SENDMESSAGE );
break;
case MSG_POSTED:
@ -182,7 +182,7 @@ index c479b388bd6..fdb09d93238 100644
list_add_tail( &recv_queue->msg_list[POST_MESSAGE], &msg->entry );
set_queue_bits( recv_queue, QS_POSTMESSAGE|QS_ALLPOSTMESSAGE );
if (msg->msg == WM_HOTKEY)
@@ -2455,12 +2469,12 @@ DECL_HANDLER(get_message)
@@ -2531,12 +2545,12 @@ DECL_HANDLER(get_message)
/* then check for posted messages */
if ((filter & QS_POSTMESSAGE) &&
@ -197,7 +197,7 @@ index c479b388bd6..fdb09d93238 100644
return;
/* only check for quit messages if not posted messages pending */
@@ -2471,7 +2485,7 @@ DECL_HANDLER(get_message)
@@ -2547,7 +2561,7 @@ DECL_HANDLER(get_message)
if ((filter & QS_INPUT) &&
filter_contains_hw_range( req->get_first, req->get_last ) &&
get_hardware_message( current, req->hw_id, get_win, req->get_first, req->get_last, req->flags, reply ))
@ -206,7 +206,7 @@ index c479b388bd6..fdb09d93238 100644
/* now check for WM_PAINT */
if ((filter & QS_PAINT) &&
@@ -2484,7 +2498,7 @@ DECL_HANDLER(get_message)
@@ -2560,7 +2574,7 @@ DECL_HANDLER(get_message)
reply->wparam = 0;
reply->lparam = 0;
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
@ -215,7 +215,7 @@ index c479b388bd6..fdb09d93238 100644
}
/* now check for timer */
@@ -2500,13 +2514,30 @@ DECL_HANDLER(get_message)
@@ -2576,13 +2590,30 @@ DECL_HANDLER(get_message)
get_message_defaults( queue, &reply->x, &reply->y, &reply->time );
if (!(req->flags & PM_NOYIELD) && current->process->idle_event)
set_event( current->process->idle_event );
@ -247,17 +247,17 @@ index c479b388bd6..fdb09d93238 100644
}
@@ -2524,7 +2555,10 @@ DECL_HANDLER(reply_message)
@@ -2600,7 +2631,10 @@ DECL_HANDLER(reply_message)
DECL_HANDLER(accept_hardware_message)
{
if (current->queue)
+ {
release_hardware_message( current->queue, req->hw_id, req->remove );
+ if (req->remove) current->queue->ignore_post_msg = 0;
release_hardware_message( current->queue, req->hw_id );
+ current->queue->ignore_post_msg = 0;
+ }
else
set_error( STATUS_ACCESS_DENIED );
}
--
2.11.0
2.27.0

View File

@ -1,4 +1,4 @@
From 98bc215910ff978093b666607f2cff3f1c93b7d3 Mon Sep 17 00:00:00 2001
From 13a0529750a14a032bb9ef5af97a48bc4f1aff14 Mon Sep 17 00:00:00 2001
From: Joakim Hernberg <jhernberg@alchemy.lu>
Date: Tue, 31 Mar 2015 20:58:20 +0200
Subject: [PATCH] wineserver: Draft to implement priority levels through POSIX
@ -19,7 +19,7 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
create mode 100644 server/scheduler.c
diff --git a/server/Makefile.in b/server/Makefile.in
index 3f3761faab6..89c1d8a4cdb 100644
index e90c5d1336c..9a695cefc30 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -30,6 +30,7 @@ C_SRCS = \
@ -215,10 +215,10 @@ index 00000000000..4a5d82b208d
+
+#endif
diff --git a/server/thread.c b/server/thread.c
index 23c0538150f..7feda374487 100644
index 9b14174578e..7280f87012d 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -607,7 +607,10 @@ static void set_thread_info( struct thread *thread,
@@ -608,7 +608,10 @@ static void set_thread_info( struct thread *thread,
if ((req->priority >= min && req->priority <= max) ||
req->priority == THREAD_PRIORITY_IDLE ||
req->priority == THREAD_PRIORITY_TIME_CRITICAL)
@ -230,12 +230,12 @@ index 23c0538150f..7feda374487 100644
set_error( STATUS_INVALID_PARAMETER );
}
diff --git a/server/thread.h b/server/thread.h
index 43b17534693..924f28a8697 100644
index 650bc44628d..2599f7629c3 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -152,4 +152,9 @@ static inline void set_win32_error( unsigned int err ) { set_error( 0xc0010000 |
@@ -144,4 +144,9 @@ static inline void set_win32_error( unsigned int err ) { set_error( 0xc0010000 |
static inline thread_id_t get_thread_id( struct thread *thread ) { return thread->id; }
static inline timeout_t get_thread_creation_time( struct thread *thread ) { return thread->creation_time; }
+/* scheduler functions */
+

View File

@ -1,2 +1 @@
Fixes: Support for linux priority levels for faster performance
Depends: ntdll-ThreadTime

View File

@ -1,4 +1,4 @@
From a2401a21b78201f2310d571f8d66ac574dd0d830 Mon Sep 17 00:00:00 2001
From d05ac476a0ca682ecb7ae13aa9e578c94b71e3f8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 12 Nov 2018 18:10:32 +0200
Subject: [PATCH] server: Do not signal violently terminated threads until they
@ -27,10 +27,10 @@ Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/server/thread.c b/server/thread.c
index 1c0fbd4179b..f8962221d9a 100644
index 9b14174578e..2f32cb4b62e 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -203,6 +203,7 @@ static inline void init_thread_structure( struct thread *thread )
@@ -239,6 +239,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->token = NULL;
thread->desc = NULL;
thread->desc_len = 0;
@ -38,7 +38,7 @@ index 1c0fbd4179b..f8962221d9a 100644
thread->creation_time = current_time;
thread->exit_time = 0;
@@ -361,6 +362,7 @@ static void destroy_thread( struct object *obj )
@@ -430,6 +431,7 @@ static void destroy_thread( struct object *obj )
list_remove( &thread->entry );
cleanup_thread( thread );
release_object( thread->process );
@ -46,7 +46,7 @@ index 1c0fbd4179b..f8962221d9a 100644
if (thread->id) free_ptid( thread->id );
if (thread->token) release_object( thread->token );
}
@@ -385,7 +387,7 @@ static struct object_type *thread_get_type( struct object *obj )
@@ -454,7 +456,7 @@ static struct object_type *thread_get_type( struct object *obj )
static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
{
struct thread *mythread = (struct thread *)obj;
@ -55,7 +55,7 @@ index 1c0fbd4179b..f8962221d9a 100644
}
static unsigned int thread_map_access( struct object *obj, unsigned int access )
@@ -1171,6 +1173,26 @@ int thread_get_inflight_fd( struct thread *thread, int client )
@@ -1245,6 +1247,26 @@ int thread_get_inflight_fd( struct thread *thread, int client )
return -1;
}
@ -82,7 +82,7 @@ index 1c0fbd4179b..f8962221d9a 100644
/* kill a thread on the spot */
void kill_thread( struct thread *thread, int violent_death )
{
@@ -1191,8 +1213,12 @@ void kill_thread( struct thread *thread, int violent_death )
@@ -1265,8 +1287,12 @@ void kill_thread( struct thread *thread, int violent_death )
kill_console_processes( thread, 0 );
debug_exit_thread( thread );
abandon_mutexes( thread );
@ -98,17 +98,17 @@ index 1c0fbd4179b..f8962221d9a 100644
remove_process_thread( thread->process, thread );
release_object( thread );
diff --git a/server/thread.h b/server/thread.h
index 7957557b6cc..880419c5924 100644
index 650bc44628d..668cc4ebd79 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -90,6 +90,7 @@ struct thread
@@ -91,6 +91,7 @@ struct thread
struct list kernel_object; /* list of kernel object pointers */
data_size_t desc_len; /* thread description length in bytes */
WCHAR *desc; /* thread description string */
+ struct timeout_user *exit_poll; /* poll if the thread/process has exited already */
};
struct thread_snapshot
extern struct thread *current;
--
2.24.0
2.27.0

View File

@ -1,4 +1,4 @@
From 2c92d595325accce44db85552efda8070f526569 Mon Sep 17 00:00:00 2001
From f836f939423f02291ba1ee175542f195ec6eb182 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Mon, 11 Nov 2019 18:35:18 +0100
Subject: [PATCH] server: Add HID input message type to send_hardware_message
@ -14,7 +14,7 @@ Subject: [PATCH] server: Add HID input message type to send_hardware_message
6 files changed, 143 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index c5c7db667cf..bb7c79b9b2c 100644
index aadec28b559..a6e0b3cf94d 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3244,10 +3244,10 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, UINT flags )
@ -46,7 +46,7 @@ index c5c7db667cf..bb7c79b9b2c 100644
req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH );
break;
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 43da5248faf..90dc911397d 100644
index bcdb70bdb81..4914c67c98b 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -47,6 +47,7 @@ struct device
@ -110,7 +110,7 @@ index 43da5248faf..90dc911397d 100644
static void find_devices(void)
{
static ULONGLONG last_check;
@@ -325,6 +361,22 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
@@ -327,6 +363,22 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message;
rawinput->data.keyboard.ExtraInformation = msg_data->info;
}
@ -133,16 +133,16 @@ index 43da5248faf..90dc911397d 100644
else
{
FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type);
@@ -514,7 +566,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
{
@@ -525,7 +577,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
struct hardware_msg_data *msg_data;
struct rawinput_thread_data *thread_data;
RAWINPUT *rawinput;
- UINT count = 0, rawinput_size, next_size, overhead;
+ UINT count = 0, rawinput_size, msg_size, next_size, overhead;
BOOL is_wow64;
int i;
@@ -572,7 +624,10 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
@@ -585,7 +637,10 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
data->header.dwSize - sizeof(RAWINPUTHEADER));
data->header.dwSize += overhead;
data = NEXTRAWINPUTBLOCK(data);
@ -154,7 +154,7 @@ index 43da5248faf..90dc911397d 100644
}
if (count == 0 && next_size == 0) *data_size = 0;
@@ -647,6 +702,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
@@ -660,6 +715,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
handle, command, data, data_size);
if (!data_size) return ~0U;
@ -163,10 +163,10 @@ index 43da5248faf..90dc911397d 100644
/* each case below must set:
* *data_size: length (meaning defined by command) of data we want to copy
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index eb828203597..6592927cfae 100644
index 8fa54b9229a..460f3aa1c3e 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -380,4 +380,6 @@ static inline WCHAR *heap_strdupW(const WCHAR *src)
@@ -386,4 +386,6 @@ static inline WCHAR *heap_strdupW(const WCHAR *src)
return dst;
}
@ -174,7 +174,7 @@ index eb828203597..6592927cfae 100644
+
#endif /* __WINE_USER_PRIVATE_H */
diff --git a/server/protocol.def b/server/protocol.def
index 21de849e5d8..d49c33f63f9 100644
index 521e2a78fa9..651e6423e82 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -312,6 +312,13 @@ struct hardware_msg_data
@ -234,7 +234,7 @@ index 21de849e5d8..d49c33f63f9 100644
typedef union
{
@@ -2330,6 +2349,7 @@ enum message_type
@@ -2301,6 +2320,7 @@ enum message_type
user_handle_t win; /* window handle */
hw_input_t input; /* input data */
unsigned int flags; /* flags (see below) */
@ -243,10 +243,10 @@ index 21de849e5d8..d49c33f63f9 100644
int wait; /* do we need to wait for a reply? */
int prev_x; /* previous cursor position */
diff --git a/server/queue.c b/server/queue.c
index 59c6cbb6921..fbed47d6951 100644
index 3ad376b776b..baf19fa17a6 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1594,7 +1594,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
@@ -1588,7 +1588,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
struct msg_queue *queue;
struct message *msg;
timeout_t timeout = 2000 * -10000; /* FIXME: load from registry */
@ -255,7 +255,7 @@ index 59c6cbb6921..fbed47d6951 100644
if (!(hook_thread = get_first_global_hook( id ))) return 0;
if (!(queue = hook_thread->queue)) return 0;
@@ -1612,7 +1612,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
@@ -1606,7 +1606,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
msg->data_size = hardware_msg->data_size;
msg->result = NULL;
@ -264,7 +264,7 @@ index 59c6cbb6921..fbed47d6951 100644
{
unsigned short vkey = input->kbd.vkey;
if (input->kbd.flags & KEYEVENTF_UNICODE) vkey = VK_PACKET;
@@ -1648,6 +1648,8 @@ struct rawinput_message
@@ -1642,6 +1642,8 @@ struct rawinput_message
struct desktop *desktop;
struct hw_msg_source source;
unsigned int time;
@ -273,7 +273,7 @@ index 59c6cbb6921..fbed47d6951 100644
struct hardware_msg_data data;
const void *extra;
data_size_t extra_len;
@@ -1657,6 +1659,7 @@ struct rawinput_message
@@ -1651,6 +1653,7 @@ struct rawinput_message
static int queue_rawinput_message( struct process* process, void *arg )
{
const struct rawinput_message* raw_msg = arg;
@ -281,7 +281,7 @@ index 59c6cbb6921..fbed47d6951 100644
const struct rawinput_device *device = NULL;
struct desktop *target_desktop = NULL, *desktop = NULL;
struct thread *target_thread = NULL, *foreground = NULL;
@@ -1668,6 +1671,8 @@ static int queue_rawinput_message( struct process* process, void *arg )
@@ -1662,6 +1665,8 @@ static int queue_rawinput_message( struct process* process, void *arg )
device = process->rawinput_mouse;
else if (raw_msg->data.rawinput.type == RIM_TYPEKEYBOARD)
device = process->rawinput_kbd;
@ -290,7 +290,7 @@ index 59c6cbb6921..fbed47d6951 100644
if (!device) return 0;
if (raw_msg->desktop) desktop = (struct desktop *)grab_object( raw_msg->desktop );
@@ -1986,6 +1991,37 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
@@ -1980,6 +1985,37 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
queue_hardware_message( desktop, msg, 1 );
}
@ -328,7 +328,7 @@ index 59c6cbb6921..fbed47d6951 100644
/* check message filter for a hardware message */
static int check_hw_message_filter( user_handle_t win, unsigned int msg_code,
user_handle_t filter_win, unsigned int first, unsigned int last )
@@ -2491,15 +2527,18 @@ DECL_HANDLER(send_hardware_message)
@@ -2485,15 +2521,18 @@ DECL_HANDLER(send_hardware_message)
switch (req->input.type)
{
@ -350,7 +350,7 @@ index 59c6cbb6921..fbed47d6951 100644
default:
set_error( STATUS_INVALID_PARAMETER );
}
@@ -3271,20 +3310,23 @@ DECL_HANDLER(get_rawinput_buffer)
@@ -3265,20 +3304,23 @@ DECL_HANDLER(get_rawinput_buffer)
{
struct message *msg = LIST_ENTRY( ptr, struct message, entry );
struct hardware_msg_data *data = msg->data;
@ -378,7 +378,7 @@ index 59c6cbb6921..fbed47d6951 100644
}
diff --git a/server/trace.c b/server/trace.c
index 2fb5afd5ef1..bbf129ca4f1 100644
index dfb39300668..3d2fc875176 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -386,24 +386,28 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )

View File

@ -1,430 +0,0 @@
From 344eb39bdfee74d4d826fa2f61a95736f0ee9823 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 15 May 2017 02:05:49 +0200
Subject: [PATCH] winebuild: Use multipass label system to generate fake dlls.
---
tools/winebuild/build.h | 6 ++
tools/winebuild/res32.c | 1 -
tools/winebuild/spec32.c | 145 ++++++++++++++++++++++-----------------
tools/winebuild/utils.c | 92 +++++++++++++++++++++++++
4 files changed, 181 insertions(+), 63 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 55d5b0b9dc28..8930df408d3b 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -343,6 +343,7 @@ extern size_t input_buffer_pos;
extern size_t input_buffer_size;
extern unsigned char *output_buffer;
extern size_t output_buffer_pos;
+extern size_t output_buffer_rva;
extern size_t output_buffer_size;
extern void init_input_buffer( const char *file );
@@ -358,6 +359,11 @@ extern void put_dword( unsigned int val );
extern void put_qword( unsigned int val );
extern void put_pword( unsigned int val );
extern void align_output( unsigned int align );
+extern void align_output_rva( unsigned int file_align, unsigned int rva_align );
+extern size_t label_pos( const char *name );
+extern size_t label_rva( const char *name );
+extern size_t label_rva_align( const char *name );
+extern void put_label( const char *name );
/* global variables */
diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index bd55bb2fa5c4..d9329019f8a3 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -539,7 +539,6 @@ void output_bin_resources( DLLSPEC *spec, unsigned int start_rva )
if (!spec->nb_resources) return;
tree = build_resource_tree( spec, &data_offset );
- init_output_buffer();
/* output the resource directories */
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 22dd399cb2b4..c38f1fe663c7 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -844,11 +844,11 @@ void output_spec32_file( DLLSPEC *spec )
/*******************************************************************
- * output_fake_module
+ * output_fake_module_pass
*
- * Build a fake binary module from a spec file.
+ * Helper to create a fake binary module from a spec file.
*/
-void output_fake_module( DLLSPEC *spec )
+static void output_fake_module_pass( DLLSPEC *spec )
{
static const unsigned char dll_code_section[] = { 0x31, 0xc0, /* xor %eax,%eax */
0xc2, 0x0c, 0x00 }; /* ret $12 */
@@ -860,21 +860,8 @@ void output_fake_module( DLLSPEC *spec )
const unsigned int section_align = page_size;
const unsigned int file_align = 0x200;
const unsigned int reloc_size = 8;
- const unsigned int lfanew = 0x40 + sizeof(fakedll_signature);
+ const unsigned int lfanew = (0x40 + sizeof(fakedll_signature) + 15) & ~15;
const unsigned int nb_sections = 2 + (spec->nb_resources != 0);
- const unsigned int text_size = (spec->characteristics & IMAGE_FILE_DLL) ?
- sizeof(dll_code_section) : sizeof(exe_code_section);
- unsigned char *resources;
- unsigned int resources_size;
- unsigned int image_size = 3 * section_align;
-
- resolve_imports( spec );
- output_bin_resources( spec, 3 * section_align );
- resources = output_buffer;
- resources_size = output_buffer_pos;
- if (resources_size) image_size += (resources_size + section_align - 1) & ~(section_align - 1);
-
- init_output_buffer();
put_word( 0x5a4d ); /* e_magic */
put_word( 0x40 ); /* e_cblp */
@@ -902,6 +889,7 @@ void output_fake_module( DLLSPEC *spec )
put_dword( lfanew );
put_data( fakedll_signature, sizeof(fakedll_signature) );
+ align_output_rva( 16, 16 );
put_dword( 0x4550 ); /* Signature */
switch(target_cpu)
@@ -925,11 +913,11 @@ void output_fake_module( DLLSPEC *spec )
IMAGE_NT_OPTIONAL_HDR32_MAGIC ); /* Magic */
put_byte( 7 ); /* MajorLinkerVersion */
put_byte( 10 ); /* MinorLinkerVersion */
- put_dword( text_size ); /* SizeOfCode */
+ put_dword( label_pos("text_end") - label_pos("text_start") ); /* SizeOfCode */
put_dword( 0 ); /* SizeOfInitializedData */
put_dword( 0 ); /* SizeOfUninitializedData */
- put_dword( section_align ); /* AddressOfEntryPoint */
- put_dword( section_align ); /* BaseOfCode */
+ put_dword( label_rva("entrypoint") ); /* AddressOfEntryPoint */
+ put_dword( label_rva("text_start") ); /* BaseOfCode */
if (get_ptr_size() == 4) put_dword( 0 ); /* BaseOfData */
put_pword( 0x10000000 ); /* ImageBase */
put_dword( section_align ); /* SectionAlignment */
@@ -941,8 +929,8 @@ void output_fake_module( DLLSPEC *spec )
put_word( spec->subsystem_major ); /* MajorSubsystemVersion */
put_word( spec->subsystem_minor ); /* MinorSubsystemVersion */
put_dword( 0 ); /* Win32VersionValue */
- put_dword( image_size ); /* SizeOfImage */
- put_dword( file_align ); /* SizeOfHeaders */
+ put_dword( label_rva_align("file_end") ); /* SizeOfImage */
+ put_dword( label_pos("header_end") ); /* SizeOfHeaders */
put_dword( 0 ); /* CheckSum */
put_word( spec->subsystem ); /* Subsystem */
put_word( spec->dll_characteristics ); /* DllCharacteristics */
@@ -955,10 +943,10 @@ void output_fake_module( DLLSPEC *spec )
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
- if (resources_size) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
+ if (spec->nb_resources) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
{
- put_dword( 3 * section_align );
- put_dword( resources_size );
+ put_dword( label_rva("res_start") );
+ put_dword( label_pos("res_end") - label_pos("res_start") );
}
else
{
@@ -968,8 +956,8 @@ void output_fake_module( DLLSPEC *spec )
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] */
- put_dword( 2 * section_align ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC] */
- put_dword( reloc_size );
+ put_dword( label_rva("reloc_start") ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC] */
+ put_dword( label_pos("reloc_end") - label_pos("reloc_start") );
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_COPYRIGHT] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_GLOBALPTR] */
@@ -982,62 +970,95 @@ void output_fake_module( DLLSPEC *spec )
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[15] */
/* .text section */
- put_data( ".text\0\0", 8 ); /* Name */
- put_dword( section_align ); /* VirtualSize */
- put_dword( section_align ); /* VirtualAddress */
- put_dword( text_size ); /* SizeOfRawData */
- put_dword( file_align ); /* PointerToRawData */
- put_dword( 0 ); /* PointerToRelocations */
- put_dword( 0 ); /* PointerToLinenumbers */
- put_word( 0 ); /* NumberOfRelocations */
- put_word( 0 ); /* NumberOfLinenumbers */
- put_dword( 0x60000020 /* CNT_CODE|MEM_EXECUTE|MEM_READ */ ); /* Characteristics */
+ put_data( ".text\0\0", 8 ); /* Name */
+ put_dword( label_rva_align("text_end") - label_rva("text_start") ); /* VirtualSize */
+ put_dword( label_rva("text_start") ); /* VirtualAddress */
+ put_dword( label_pos("text_end") - label_pos("text_start") ); /* SizeOfRawData */
+ put_dword( label_pos("text_start") ); /* PointerToRawData */
+ put_dword( 0 ); /* PointerToRelocations */
+ put_dword( 0 ); /* PointerToLinenumbers */
+ put_word( 0 ); /* NumberOfRelocations */
+ put_word( 0 ); /* NumberOfLinenumbers */
+ put_dword( 0x60000020 /* CNT_CODE|MEM_EXECUTE|MEM_READ */ ); /* Characteristics */
/* .reloc section */
- put_data( ".reloc\0", 8 ); /* Name */
- put_dword( section_align ); /* VirtualSize */
- put_dword( 2 * section_align );/* VirtualAddress */
- put_dword( reloc_size ); /* SizeOfRawData */
- put_dword( 2 * file_align ); /* PointerToRawData */
- put_dword( 0 ); /* PointerToRelocations */
- put_dword( 0 ); /* PointerToLinenumbers */
- put_word( 0 ); /* NumberOfRelocations */
- put_word( 0 ); /* NumberOfLinenumbers */
+ put_data( ".reloc\0", 8 ); /* Name */
+ put_dword( label_rva_align("reloc_end") - label_rva("reloc_start") ); /* VirtualSize */
+ put_dword( label_rva("reloc_start") ); /* VirtualAddress */
+ put_dword( label_pos("reloc_end") - label_pos("reloc_start") ); /* SizeOfRawData */
+ put_dword( label_pos("reloc_start") ); /* PointerToRawData */
+ put_dword( 0 ); /* PointerToRelocations */
+ put_dword( 0 ); /* PointerToLinenumbers */
+ put_word( 0 ); /* NumberOfRelocations */
+ put_word( 0 ); /* NumberOfLinenumbers */
put_dword( 0x42000040 /* CNT_INITIALIZED_DATA|MEM_DISCARDABLE|MEM_READ */ ); /* Characteristics */
/* .rsrc section */
- if (resources_size)
+ if (spec->nb_resources)
{
- put_data( ".rsrc\0\0", 8 ); /* Name */
- put_dword( (resources_size + section_align - 1) & ~(section_align - 1) ); /* VirtualSize */
- put_dword( 3 * section_align );/* VirtualAddress */
- put_dword( resources_size ); /* SizeOfRawData */
- put_dword( 3 * file_align ); /* PointerToRawData */
- put_dword( 0 ); /* PointerToRelocations */
- put_dword( 0 ); /* PointerToLinenumbers */
- put_word( 0 ); /* NumberOfRelocations */
- put_word( 0 ); /* NumberOfLinenumbers */
- put_dword( 0x40000040 /* CNT_INITIALIZED_DATA|MEM_READ */ ); /* Characteristics */
+ put_data( ".rsrc\0\0", 8 ); /* Name */
+ put_dword( label_rva_align("res_end") - label_rva("res_start") ); /* VirtualSize */
+ put_dword( label_rva("res_start") ); /* VirtualAddress */
+ put_dword( label_pos("res_end") - label_pos("res_start") ); /* SizeOfRawData */
+ put_dword( label_pos("res_start") ); /* PointerToRawData */
+ put_dword( 0 ); /* PointerToRelocations */
+ put_dword( 0 ); /* PointerToLinenumbers */
+ put_word( 0 ); /* NumberOfRelocations */
+ put_word( 0 ); /* NumberOfLinenumbers */
+ put_dword( 0x40000040 /* CNT_INITIALIZED_DATA|MEM_READ */ ); /* Characteristics */
}
+ align_output_rva( file_align, file_align );
+ put_label( "header_end" );
+
/* .text contents */
- align_output( file_align );
+ align_output_rva( file_align, section_align );
+ put_label( "text_start" );
+ put_label( "entrypoint" );
if (spec->characteristics & IMAGE_FILE_DLL)
put_data( dll_code_section, sizeof(dll_code_section) );
else
put_data( exe_code_section, sizeof(exe_code_section) );
+ put_label( "text_end" );
/* .reloc contents */
- align_output( file_align );
+ align_output_rva( file_align, section_align );
+ put_label( "reloc_start" );
put_dword( 0 ); /* VirtualAddress */
put_dword( 0 ); /* SizeOfBlock */
+ put_label( "reloc_end" );
/* .rsrc contents */
- if (resources_size)
+ if (spec->nb_resources)
{
- align_output( file_align );
- put_data( resources, resources_size );
+ align_output_rva( file_align, section_align );
+ put_label( "res_start" );
+ output_bin_resources( spec, label_rva("res_start") );
+ put_label( "res_end" );
}
+
+ put_label( "file_end" );
+}
+
+
+/*******************************************************************
+ * output_fake_module
+ *
+ * Build a fake binary module from a spec file.
+ */
+void output_fake_module( DLLSPEC *spec )
+{
+ resolve_imports( spec );
+
+ /* First pass */
+ init_output_buffer();
+ output_fake_module_pass( spec );
+
+ /* Second pass */
+ output_buffer_pos = 0;
+ output_buffer_rva = 0;
+ output_fake_module_pass( spec );
+
flush_output_buffer();
}
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 07a579004adc..80dec6db29ea 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -34,6 +34,7 @@
# include <sys/stat.h>
#endif
+#include "wine/list.h"
#include "build.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -542,8 +543,86 @@ size_t input_buffer_pos;
size_t input_buffer_size;
unsigned char *output_buffer;
size_t output_buffer_pos;
+size_t output_buffer_rva;
size_t output_buffer_size;
+struct label
+{
+ struct list entry;
+ const char *name;
+ size_t pos;
+ size_t rva;
+};
+
+static struct list labels = LIST_INIT( labels );
+
+struct label *get_label( const char *name )
+{
+ struct label *label;
+
+ LIST_FOR_EACH_ENTRY( label, &labels, struct label, entry )
+ {
+ if (!strcmp(name, label->name))
+ return label;
+ }
+
+ label = xmalloc( sizeof(*label) );
+ label->name = name;
+ label->pos = 0;
+ label->rva = 0;
+
+ list_add_tail( &labels, &label->entry );
+
+ return label;
+}
+
+size_t label_pos( const char *name )
+{
+ struct label *label = get_label( name );
+ return label->pos;
+}
+
+size_t label_rva( const char *name )
+{
+ struct label *label = get_label( name );
+ return label->rva;
+}
+
+size_t label_rva_align( const char *name )
+{
+ const unsigned int page_size = get_page_size();
+ size_t rva = label_rva( name );
+ size_t size = page_size - (rva % page_size);
+
+ if (size != page_size) rva += size;
+ return rva;
+}
+
+void put_label( const char *name )
+{
+ struct label *label = get_label( name );
+
+ if (label->pos || label->rva)
+ {
+ assert( label->pos == output_buffer_pos );
+ assert( label->rva == output_buffer_rva );
+ }
+
+ label->pos = output_buffer_pos;
+ label->rva = output_buffer_rva;
+}
+
+void free_labels( void )
+{
+ struct label *label, *label2;
+
+ LIST_FOR_EACH_ENTRY_SAFE( label, label2, &labels, struct label, entry )
+ {
+ list_remove( &label->entry );
+ free( label );
+ }
+}
+
static void check_output_buffer_space( size_t size )
{
if (output_buffer_pos + size >= output_buffer_size)
@@ -575,7 +654,9 @@ void init_output_buffer(void)
{
output_buffer_size = 1024;
output_buffer_pos = 0;
+ output_buffer_rva = 0;
output_buffer = xmalloc( output_buffer_size );
+ free_labels();
}
void flush_output_buffer(void)
@@ -585,6 +666,7 @@ void flush_output_buffer(void)
fatal_error( "Error writing to %s\n", output_file_name );
close_output_file();
free( output_buffer );
+ free_labels();
}
unsigned char get_byte(void)
@@ -624,12 +706,14 @@ void put_data( const void *data, size_t size )
check_output_buffer_space( size );
memcpy( output_buffer + output_buffer_pos, data, size );
output_buffer_pos += size;
+ output_buffer_rva += size;
}
void put_byte( unsigned char val )
{
check_output_buffer_space( 1 );
output_buffer[output_buffer_pos++] = val;
+ output_buffer_rva++;
}
void put_word( unsigned short val )
@@ -676,6 +760,14 @@ void align_output( unsigned int align )
output_buffer_pos += size;
}
+void align_output_rva( unsigned int file_align, unsigned int rva_align )
+{
+ size_t size = rva_align - (output_buffer_rva % rva_align);
+
+ if (size != rva_align) output_buffer_rva += size;
+ align_output( file_align );
+}
+
/* output a standard header for generated files */
void output_standard_file_header(void)
{
--
2.26.2

View File

@ -1,469 +0,0 @@
From 56e581b1709c2def25db836cc8126c0eabfb11e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 15 May 2017 16:27:56 +0200
Subject: [PATCH] winebuild: Add stub functions in fake dlls.
---
dlls/kernel32/tests/loader.c | 8 +-
dlls/ntdll/loader.c | 2 +
dlls/ntdll/thread.c | 35 ++++++
include/winternl.h | 2 +-
tools/winebuild/build.h | 1 +
tools/winebuild/spec32.c | 209 +++++++++++++++++++++++++++++++++--
tools/winebuild/utils.c | 10 +-
7 files changed, 252 insertions(+), 15 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 984246681cb..78100205c9d 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1594,9 +1594,7 @@ static void test_FakeDLL(void)
ok(ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError());
dir = RtlImageDirectoryEntryToData(ptr, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size);
-todo_wine
ok(dir != NULL, "RtlImageDirectoryEntryToData failed\n");
- if (dir == NULL) goto done;
names = RVAToAddr(dir->AddressOfNames, ptr);
ordinals = RVAToAddr(dir->AddressOfNameOrdinals, ptr);
@@ -1625,17 +1623,20 @@ todo_wine
/* check position in memory */
dll_rva = (DWORD_PTR)dll_func - (DWORD_PTR)module;
map_rva = funcs[ordinals[i]];
+ todo_wine
ok(map_rva == dll_rva, "%s: Rva of mapped function (0x%x) does not match dll (0x%x)\n",
func_name, dll_rva, map_rva);
/* check position in file */
map_offset = (DWORD_PTR)RtlImageRvaToVa(RtlImageNtHeader(ptr), ptr, map_rva, NULL) - (DWORD_PTR)ptr;
dll_offset = (DWORD_PTR)RtlImageRvaToVa(RtlImageNtHeader(module), module, dll_rva, NULL) - (DWORD_PTR)module;
+ todo_wine
ok(map_offset == dll_offset, "%s: File offset of mapped function (0x%x) does not match dll (0x%x)\n",
func_name, map_offset, dll_offset);
/* check function content */
map_func = RVAToAddr(map_rva, ptr);
+ todo_wine
ok(!memcmp(map_func, dll_func, 0x20), "%s: Function content does not match!\n", func_name);
if (!strcmp(func_name, "NtSetEvent"))
@@ -1649,10 +1650,11 @@ todo_wine
ok(event != NULL, "CreateEvent failed with error %u\n", GetLastError());
pNtSetEvent(event, 0);
ok(WaitForSingleObject(event, 0) == WAIT_OBJECT_0, "Event was not signaled\n");
+ pNtSetEvent(event, 0);
+ ok(WaitForSingleObject(event, 0) == WAIT_OBJECT_0, "Event was not signaled\n");
CloseHandle(event);
}
-done:
UnmapViewOfFile(ptr);
CloseHandle(map);
CloseHandle(file);
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 339b54a9e67..995dcd48786 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3388,6 +3388,7 @@ PIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE hModule)
}
extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
+extern void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord );
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
@@ -3405,6 +3406,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, void **entry, ULONG_PTR unknow
LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
NtCurrentTeb()->WOW32Reserved = __wine_syscall_dispatcher;
+ NtCurrentTeb()->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher;
if (process_detaching) return;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 3f84beb8f26..0eb7d901c4d 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -36,6 +36,7 @@
#include "ddk/wdm.h"
#include "wine/exception.h"
+WINE_DEFAULT_DEBUG_CHANNEL(thread);
WINE_DECLARE_DEBUG_CHANNEL(relay);
struct _KUSER_SHARED_DATA *user_shared_data = (void *)0x7ffe0000;
@@ -104,6 +105,39 @@ void __wine_syscall_dispatcher( void )
}
#endif
+void *WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
+{
+ UNICODE_STRING name;
+ NTSTATUS status;
+ HMODULE base;
+ WCHAR *moduleW;
+ void *proc = NULL;
+ DWORD len = strlen(module);
+
+ TRACE( "(%s, %u)\n", debugstr_a(module), ord );
+
+ if (!(moduleW = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) )))
+ return NULL;
+
+ ascii_to_unicode( moduleW, module, len );
+ moduleW[ len ] = 0;
+ RtlInitUnicodeString( &name, moduleW );
+
+ status = LdrGetDllHandle( NULL, 0, &name, &base );
+ if (status == STATUS_DLL_NOT_FOUND)
+ status = LdrLoadDll( NULL, 0, &name, &base );
+ if (status == STATUS_SUCCESS)
+ status = LdrAddRefDll( LDR_ADDREF_DLL_PIN, base );
+ if (status == STATUS_SUCCESS)
+ status = LdrGetProcedureAddress( base, NULL, ord, &proc );
+
+ if (status)
+ FIXME( "No procedure address found for %s.#%u, status %x\n", debugstr_a(module), ord, status );
+
+ RtlFreeHeap( GetProcessHeap(), 0, moduleW );
+ return proc;
+}
+
/***********************************************************************
* thread_init
*
@@ -116,6 +150,7 @@ TEB *thread_init( SIZE_T *info_size )
ULONG_PTR val;
TEB *teb = unix_funcs->init_threading( &nb_threads, &__wine_ldt_copy, info_size, __wine_syscall_dispatcher );
+ teb->Spare2 = (ULONG_PTR)__wine_fakedll_dispatcher;
peb = teb->Peb;
peb->FastPebLock = &peb_lock;
peb->ApiSetMap = &apiset_map;
diff --git a/include/winternl.h b/include/winternl.h
index 6de209d6f07..d9c31156025 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -399,7 +399,7 @@ typedef struct _TEB
PVOID Instrumentation[16]; /* f2c/16b8 */
PVOID WinSockData; /* f6c/1738 */
ULONG GdiBatchCount; /* f70/1740 */
- ULONG Spare2; /* f74/1744 */
+ ULONG Spare2; /* f74/1744 used for fakedll thunks */
ULONG GuaranteedStackBytes; /* f78/1748 */
PVOID ReservedForPerf; /* f7c/1750 */
PVOID ReservedForOle; /* f80/1758 */
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 8930df408d3..44113bad28a 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -358,6 +358,7 @@ extern void put_word( unsigned short val );
extern void put_dword( unsigned int val );
extern void put_qword( unsigned int val );
extern void put_pword( unsigned int val );
+extern void put_str( const char *str );
extern void align_output( unsigned int align );
extern void align_output_rva( unsigned int file_align, unsigned int rva_align );
extern size_t label_pos( const char *name );
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index c38f1fe663c..bf82ca497c0 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -843,6 +843,163 @@ void output_spec32_file( DLLSPEC *spec )
}
+static int needs_stub_exports( DLLSPEC *spec )
+{
+ if (target_cpu != CPU_x86)
+ return 0;
+ if (!(spec->characteristics & IMAGE_FILE_DLL))
+ return 0;
+ if (!spec->nb_entry_points)
+ return 0;
+ return 1;
+}
+
+
+static void create_stub_exports_text( DLLSPEC *spec )
+{
+ int i, nr_exports = spec->base <= spec->limit ? spec->limit - spec->base + 1 : 0;
+ size_t rva, thunk;
+
+ /* output stub code for exports */
+ for (i = 0; i < spec->nb_entry_points; i++)
+ {
+ ORDDEF *odp = &spec->entry_points[i];
+ const char *name = get_stub_name( odp, spec );
+
+ align_output_rva( 16, 16 );
+ put_label( name );
+ put_byte( 0x8b ); put_byte( 0xff ); /* mov edi, edi */
+ put_byte( 0x55 ); /* push ebp */
+ put_byte( 0x8b ); put_byte( 0xec ); /* mov ebp, esp */
+ put_byte( 0x68 ); put_dword( 0 ); /* push dword 0 */
+ put_byte( 0x68 ); put_dword( odp->ordinal ); /* push ORDINAL */
+ rva = output_buffer_rva + 5;
+ put_byte( 0xe8 ); put_dword( label_rva("_forward") - rva ); /* call _forward */
+ put_byte( 0x89 ); put_byte( 0xec ); /* mov esp, ebp */
+ put_byte( 0x5d ); /* pop ebp */
+ if (odp->type == TYPE_STDCALL)
+ {
+ put_byte( 0xc2 ); put_word( get_args_size(odp) ); /* ret X */
+ }
+ else
+ {
+ put_byte( 0xc3 ); /* ret */
+ }
+ }
+
+ /* output entry point */
+ align_output_rva( 16, 16 );
+ put_label( "entrypoint" );
+ put_byte( 0xb8 ); put_dword( 1 ); /* mov eax, 1 */
+ put_byte( 0xc2 ); put_word( 12 ); /* ret 12 */
+
+ /* output forward function */
+ align_output_rva( 16, 16 );
+ put_label( "_forward" );
+ put_byte( 0x8b ); put_byte( 0x6d ); put_byte( 0x00 ); /* mov ebp, dword[ebp] */
+ put_byte( 0x89 ); put_byte( 0x44 ); /* mov dword[esp+8], eax */
+ put_byte( 0x24 ); put_byte( 0x08 );
+ put_byte( 0x89 ); put_byte( 0x14 ); put_byte( 0x24 ); /* mov dword[esp], edx */
+ put_byte( 0x8b ); put_byte( 0x54 ); /* mov edx, dword[esp+4] */
+ put_byte( 0x24 ); put_byte( 0x04 );
+ put_byte( 0x89 ); put_byte( 0x4c ); /* mov dword[esp+4], ecx */
+ put_byte( 0x24 ); put_byte( 0x04 );
+ put_byte( 0xe8 ); put_dword( 0 ); /* call 1f */
+ thunk = output_buffer_rva;
+ put_byte( 0x59 ); /* pop ecx */
+ put_byte( 0x8b ); put_byte( 0x84 ); put_byte( 0x91 ); /* mov eax, dword[_functions + 4 * (edx - BASE)] */
+ put_dword( label_rva("_functions") - thunk - 4 * spec->base );
+ put_byte( 0x09 ); put_byte( 0xc0 ); /* or eax, eax */
+ rva = output_buffer_rva + 2;
+ put_byte( 0x74 ); put_byte( label_rva("_forward_load") - rva ); /* je _forward_load */
+
+ put_label( "_forward_done" );
+ put_byte( 0x89 ); put_byte( 0x44 ); /* mov dword[esp+12], eax */
+ put_byte( 0x24 ); put_byte( 0x0c );
+ put_byte( 0x5a ); /* pop edx */
+ put_byte( 0x59 ); /* pop ecx */
+ put_byte( 0x58 ); /* pop eax */
+ put_byte( 0xc3 ); /* ret */
+
+ align_output_rva( 16, 16 );
+ put_label( "_forward_load" );
+ put_byte( 0x8d ); put_byte( 0x84 ); put_byte( 0x91 ); /* lea eax, [_functions + 4 * (edx - BASE)] */
+ put_dword( label_rva("_functions") - thunk - 4 * spec->base );
+ put_byte( 0x50 ); /* push eax */
+ put_byte( 0x52 ); /* push edx */
+ put_byte( 0x8d ); put_byte( 0x81 ); /* lea eax, [dll_name] */
+ put_dword( label_rva("dll_name") - thunk );
+ put_byte( 0x50 ); /* push eax */
+ put_byte( 0x64 ); put_byte( 0xff ); /* call dword ptr fs:[0F74h] */
+ put_byte( 0x15 ); put_dword( 0xf74 );
+ put_byte( 0x5a ); /* pop edx */
+ put_byte( 0x89 ); put_byte( 0x02 ); /* mov dword[edx], eax */
+ rva = output_buffer_rva + 2;
+ put_byte( 0xeb ); put_byte( label_rva("_forward_done") - rva ); /* jmp _forward_done */
+
+ /* export directory */
+ align_output_rva( 16, 16 );
+ put_label( "export_start" );
+ put_dword( 0 ); /* Characteristics */
+ put_dword( 0 ); /* TimeDateStamp */
+ put_dword( 0 ); /* MajorVersion/MinorVersion */
+ put_dword( label_rva("dll_name") ); /* Name */
+ put_dword( spec->base ); /* Base */
+ put_dword( nr_exports ); /* NumberOfFunctions */
+ put_dword( spec->nb_names ); /* NumberOfNames */
+ put_dword( label_rva("export_funcs") ); /* AddressOfFunctions */
+ put_dword( label_rva("export_names") ); /* AddressOfNames */
+ put_dword( label_rva("export_ordinals") ); /* AddressOfNameOrdinals */
+
+ put_label( "export_funcs" );
+ for (i = spec->base; i <= spec->limit; i++)
+ {
+ ORDDEF *odp = spec->ordinals[i];
+ if (odp)
+ {
+ const char *name = get_stub_name( odp, spec );
+ put_dword( label_rva( name ) );
+ }
+ else
+ put_dword( 0 );
+ }
+
+ if (spec->nb_names)
+ {
+ put_label( "export_names" );
+ for (i = 0; i < spec->nb_names; i++)
+ put_dword( label_rva(strmake("str_%s", get_stub_name(spec->names[i], spec))) );
+
+ put_label( "export_ordinals" );
+ for (i = 0; i < spec->nb_names; i++)
+ put_word( spec->names[i]->ordinal - spec->base );
+ if (spec->nb_names % 2)
+ put_word( 0 );
+ }
+
+ put_label( "dll_name" );
+ put_str( spec->file_name );
+
+ for (i = 0; i < spec->nb_names; i++)
+ {
+ put_label( strmake("str_%s", get_stub_name(spec->names[i], spec)) );
+ put_str( spec->names[i]->name );
+ }
+
+ put_label( "export_end" );
+}
+
+
+static void create_stub_exports_data( DLLSPEC *spec )
+{
+ int i;
+
+ put_label( "_functions" );
+ for (i = spec->base; i <= spec->limit; i++)
+ put_dword( 0 );
+}
+
+
/*******************************************************************
* output_fake_module_pass
*
@@ -861,7 +1018,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
const unsigned int file_align = 0x200;
const unsigned int reloc_size = 8;
const unsigned int lfanew = (0x40 + sizeof(fakedll_signature) + 15) & ~15;
- const unsigned int nb_sections = 2 + (spec->nb_resources != 0);
+ const unsigned int nb_sections = 2 + (needs_stub_exports( spec ) != 0) + (spec->nb_resources != 0);
put_word( 0x5a4d ); /* e_magic */
put_word( 0x40 ); /* e_cblp */
@@ -918,7 +1075,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_dword( 0 ); /* SizeOfUninitializedData */
put_dword( label_rva("entrypoint") ); /* AddressOfEntryPoint */
put_dword( label_rva("text_start") ); /* BaseOfCode */
- if (get_ptr_size() == 4) put_dword( 0 ); /* BaseOfData */
+ if (get_ptr_size() == 4) put_dword( label_rva("data_start") ); /* BaseOfData */
put_pword( 0x10000000 ); /* ImageBase */
put_dword( section_align ); /* SectionAlignment */
put_dword( file_align ); /* FileAlignment */
@@ -941,7 +1098,8 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_dword( 0 ); /* LoaderFlags */
put_dword( 16 ); /* NumberOfRvaAndSizes */
- put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
+ put_dword( label_rva("export_start") ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
+ put_dword( label_pos("export_end") - label_pos("export_start") );
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
if (spec->nb_resources) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
{
@@ -981,6 +1139,21 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_word( 0 ); /* NumberOfLinenumbers */
put_dword( 0x60000020 /* CNT_CODE|MEM_EXECUTE|MEM_READ */ ); /* Characteristics */
+ /* .data section */
+ if (needs_stub_exports( spec ))
+ {
+ put_data( ".data\0\0", 8 ); /* Name */
+ put_dword( label_rva_align("data_end") - label_rva("data_start") ); /* VirtualSize */
+ put_dword( label_rva("data_start") ); /* VirtualAddress */
+ put_dword( label_pos("data_end") - label_pos("data_start") ); /* SizeOfRawData */
+ put_dword( label_pos("data_start") ); /* PointerToRawData */
+ put_dword( 0 ); /* PointerToRelocations */
+ put_dword( 0 ); /* PointerToLinenumbers */
+ put_word( 0 ); /* NumberOfRelocations */
+ put_word( 0 ); /* NumberOfLinenumbers */
+ put_dword( 0xc0000040 /* CNT_INITIALIZED_DATA|MEM_READ|MEM_WRITE */ ); /* Characteristics */
+ }
+
/* .reloc section */
put_data( ".reloc\0", 8 ); /* Name */
put_dword( label_rva_align("reloc_end") - label_rva("reloc_start") ); /* VirtualSize */
@@ -1013,13 +1186,31 @@ static void output_fake_module_pass( DLLSPEC *spec )
/* .text contents */
align_output_rva( file_align, section_align );
- put_label( "text_start" );
- put_label( "entrypoint" );
- if (spec->characteristics & IMAGE_FILE_DLL)
- put_data( dll_code_section, sizeof(dll_code_section) );
+ if (needs_stub_exports( spec ))
+ {
+ put_label( "text_start" );
+ create_stub_exports_text( spec );
+ put_label( "text_end" );
+ }
else
- put_data( exe_code_section, sizeof(exe_code_section) );
- put_label( "text_end" );
+ {
+ put_label( "text_start" );
+ put_label( "entrypoint" );
+ if (spec->characteristics & IMAGE_FILE_DLL)
+ put_data( dll_code_section, sizeof(dll_code_section) );
+ else
+ put_data( exe_code_section, sizeof(exe_code_section) );
+ put_label( "text_end" );
+ }
+
+ /* .data contents */
+ align_output_rva( file_align, section_align );
+ if (needs_stub_exports( spec ))
+ {
+ put_label( "data_start" );
+ create_stub_exports_data( spec );
+ put_label( "data_end" );
+ }
/* .reloc contents */
align_output_rva( file_align, section_align );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 80dec6db29e..d394a1382c6 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -549,7 +549,7 @@ size_t output_buffer_size;
struct label
{
struct list entry;
- const char *name;
+ char *name;
size_t pos;
size_t rva;
};
@@ -567,7 +567,7 @@ struct label *get_label( const char *name )
}
label = xmalloc( sizeof(*label) );
- label->name = name;
+ label->name = xstrdup( name );
label->pos = 0;
label->rva = 0;
@@ -619,6 +619,7 @@ void free_labels( void )
LIST_FOR_EACH_ENTRY_SAFE( label, label2, &labels, struct label, entry )
{
list_remove( &label->entry );
+ free( label->name );
free( label );
}
}
@@ -750,6 +751,11 @@ void put_pword( unsigned int val )
else put_dword( val );
}
+void put_str( const char *str )
+{
+ put_data( str, strlen(str) + 1 );
+}
+
void align_output( unsigned int align )
{
size_t size = align - (output_buffer_pos % align);
--
2.27.0

View File

@ -1,76 +0,0 @@
From fd72d405abba827ab5e2603551d48200aedad3ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 15 May 2017 17:56:48 +0200
Subject: [PATCH] winebuild: Add syscall thunks in fake dlls.
---
dlls/kernel32/tests/loader.c | 1 -
tools/winebuild/spec32.c | 27 +++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 182b61b731a2..98369c7d508c 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1639,7 +1639,6 @@ static void test_FakeDLL(void)
/* check function content */
map_func = RVAToAddr(map_rva, ptr);
- todo_wine
ok(!memcmp(map_func, dll_func, 0x20), "%s: Function content does not match!\n", func_name);
if (!strcmp(func_name, "NtSetEvent"))
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index bf82ca497c0d..6968e41260f1 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -860,13 +860,36 @@ static void create_stub_exports_text( DLLSPEC *spec )
int i, nr_exports = spec->base <= spec->limit ? spec->limit - spec->base + 1 : 0;
size_t rva, thunk;
+ /* output syscalls */
+ for (i = 0; i < spec->nb_syscalls; i++)
+ {
+ ORDDEF *odp = spec->syscalls[i];
+
+ align_output_rva( 16, 16 );
+ put_label( odp->link_name );
+ put_byte( 0xb8 ); put_dword( i ); /* mov eax, SYSCALL */
+ put_byte( 0x64 ); put_byte( 0xff ); /* call dword ptr fs:[0C0h] */
+ put_byte( 0x15 ); put_dword( 0xc0 );
+ put_byte( 0xc2 ); put_word( get_args_size(odp) ); /* ret X */
+ }
+
+ if (spec->nb_syscalls)
+ {
+ for (i = 0; i < 0x20; i++)
+ put_byte( 0 );
+ }
+
/* output stub code for exports */
for (i = 0; i < spec->nb_entry_points; i++)
{
ORDDEF *odp = &spec->entry_points[i];
- const char *name = get_stub_name( odp, spec );
+ const char *name;
+
+ if (odp->flags & FLAG_SYSCALL)
+ continue;
align_output_rva( 16, 16 );
+ name = get_stub_name( odp, spec );
put_label( name );
put_byte( 0x8b ); put_byte( 0xff ); /* mov edi, edi */
put_byte( 0x55 ); /* push ebp */
@@ -957,7 +980,7 @@ static void create_stub_exports_text( DLLSPEC *spec )
ORDDEF *odp = spec->ordinals[i];
if (odp)
{
- const char *name = get_stub_name( odp, spec );
+ const char *name = (odp->flags & FLAG_SYSCALL) ? odp->link_name : get_stub_name( odp, spec );
put_dword( label_rva( name ) );
}
else
--
2.26.2

View File

@ -1,27 +0,0 @@
From f92fc0572be02ce2eee2a9cbf60724372678a5af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 May 2017 03:22:25 +0200
Subject: [PATCH] winebuild: Fix size of relocation information in fake dlls.
---
tools/winebuild/spec32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 6968e41260f1..f95b45b9a0d5 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -1238,8 +1238,8 @@ static void output_fake_module_pass( DLLSPEC *spec )
/* .reloc contents */
align_output_rva( file_align, section_align );
put_label( "reloc_start" );
- put_dword( 0 ); /* VirtualAddress */
- put_dword( 0 ); /* SizeOfBlock */
+ put_dword( label_rva("text_start") ); /* VirtualAddress */
+ put_dword( 8 ); /* SizeOfBlock */
put_label( "reloc_end" );
/* .rsrc contents */
--
2.26.2

View File

@ -1,99 +0,0 @@
From 59efee63a7442dfee4d9e76b11f651a11a4b523e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 May 2017 21:46:27 +0200
Subject: [PATCH] winebuild: Try to make sure RVA matches between fake and
builtin DLLs.
---
dlls/kernel32/tests/loader.c | 1 -
libs/wine/loader.c | 13 +++++++++++--
tools/winebuild/spec32.c | 17 +++++++++++++++--
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 98369c7d508c..77e73b3ca37b 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1626,7 +1626,6 @@ static void test_FakeDLL(void)
/* check position in memory */
dll_rva = (DWORD_PTR)dll_func - (DWORD_PTR)module;
map_rva = funcs[ordinals[i]];
- todo_wine
ok(map_rva == dll_rva, "%s: Rva of mapped function (0x%x) does not match dll (0x%x)\n",
func_name, dll_rva, map_rva);
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index c3b59d902243..b6847ca77b31 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -335,8 +335,12 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
assert( size <= page_size );
/* module address must be aligned on 64K boundary */
- addr = (BYTE *)((nt_descr->OptionalHeader.ImageBase + 0xffff) & ~0xffff);
- if (wine_anon_mmap( addr, page_size, PROT_READ|PROT_WRITE, MAP_FIXED ) != addr) return NULL;
+ addr = *(BYTE **)&nt_descr->OptionalHeader.DataDirectory[15];
+ if (!addr || ((ULONG_PTR)addr & 0xffff) || mprotect( addr, page_size, PROT_READ | PROT_WRITE ))
+ {
+ addr = (BYTE *)((nt_descr->OptionalHeader.ImageBase + 0xffff) & ~0xffff);
+ if (wine_anon_mmap( addr, page_size, PROT_READ|PROT_WRITE, MAP_FIXED ) != addr) return NULL;
+ }
dos = (IMAGE_DOS_HEADER *)addr;
nt = (IMAGE_NT_HEADERS *)(dos + 1);
@@ -383,6 +387,11 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
nt->OptionalHeader.SizeOfImage = data_end;
nt->OptionalHeader.ImageBase = (ULONG_PTR)addr;
+ /* Clear DataDirectory[15] */
+
+ nt->OptionalHeader.DataDirectory[15].VirtualAddress = 0;
+ nt->OptionalHeader.DataDirectory[15].Size = 0;
+
/* Build the code section */
memcpy( sec->Name, ".text", sizeof(".text") );
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index f95b45b9a0d5..07d6eed05fcc 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -381,14 +381,25 @@ static void output_relay_debug( DLLSPEC *spec )
*/
static void output_syscall_thunks( DLLSPEC *spec )
{
+ const unsigned int page_size = get_page_size();
int i;
if (!spec->nb_syscalls)
return;
- output( "\n/* syscall thunks */\n\n" );
- output( "\t.text\n" );
+ /* Reserve space for PE header directly before syscalls. */
+ if (target_platform == PLATFORM_APPLE)
+ output( "\t.text\n" );
+ else
+ output( "\n\t.section \".text.startup\"\n" );
+
+ output( "\t.align %d\n", get_alignment(65536) );
+ output( "__wine_spec_pe_header_syscalls:\n" );
+ output( "__wine_spec_pe_header_syscalls_end:\n" );
+ output( "\t.byte 0\n" );
+ output( "\t.balign %d, 0\n", page_size );
+ output( "\n/* syscall thunks */\n\n" );
for (i = 0; i < spec->nb_syscalls; i++)
{
ORDDEF *odp = spec->syscalls[i];
@@ -813,6 +824,8 @@ void output_module( DLLSPEC *spec )
data_dirs[1] = ".L__wine_spec_imports"; /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
if (spec->nb_resources)
data_dirs[2] = ".L__wine_spec_resources"; /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
+ if (spec->nb_syscalls)
+ data_dirs[15] = "__wine_spec_pe_header_syscalls";
output_data_directories( data_dirs );
--
2.26.2

View File

@ -1,38 +0,0 @@
From 370eccb19c65a8b02abfa31a76651ae533dda22f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 25 May 2017 21:56:06 +0200
Subject: [PATCH] libs/wine: Use same file alignment for fake and builtin DLLs.
---
dlls/kernel32/tests/loader.c | 1 -
libs/wine/loader.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 77e73b3ca37b..1f525194ce73 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1632,7 +1632,6 @@ static void test_FakeDLL(void)
/* check position in file */
map_offset = (DWORD_PTR)RtlImageRvaToVa(RtlImageNtHeader(ptr), ptr, map_rva, NULL) - (DWORD_PTR)ptr;
dll_offset = (DWORD_PTR)RtlImageRvaToVa(RtlImageNtHeader(module), module, dll_rva, NULL) - (DWORD_PTR)module;
- todo_wine
ok(map_offset == dll_offset, "%s: File offset of mapped function (0x%x) does not match dll (0x%x)\n",
func_name, map_offset, dll_offset);
diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index b6847ca77b31..4597a6cb3243 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -398,7 +398,7 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
sec->SizeOfRawData = code_end - code_start;
sec->Misc.VirtualSize = sec->SizeOfRawData;
sec->VirtualAddress = code_start;
- sec->PointerToRawData = code_start;
+ sec->PointerToRawData = 0x200; /* file alignment */
sec->Characteristics = (IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ);
sec++;
--
2.26.2

View File

@ -1,104 +0,0 @@
From ac99500b2479f2c9cfed43408c26e0f78261c46b Mon Sep 17 00:00:00 2001
From: Paul Gofman <gofmanp@gmail.com>
Date: Fri, 3 Jan 2020 17:39:08 +0300
Subject: [PATCH] ntdll: Call NtOpenFile through syscall thunk.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48410
---
dlls/ntdll/actctx.c | 4 ++--
dlls/ntdll/loader.c | 2 +-
dlls/ntdll/locale.c | 4 ++--
dlls/ntdll/ntdll_misc.h | 8 ++++++++
dlls/ntdll/path.c | 2 +-
5 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index 1fa97ac0379..9bf425c6e2d 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -2926,7 +2926,7 @@ static NTSTATUS open_nt_file( HANDLE *handle, UNICODE_STRING *name )
attr.ObjectName = name;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- return NtOpenFile( handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
+ return __syscall_NtOpenFile( handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
}
static NTSTATUS get_manifest_in_module( struct actctx_loader* acl, struct assembly_identity* ai,
@@ -3243,7 +3243,7 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- if (!NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE,
+ if (!__syscall_NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT ))
{
sxs_ai = *ai;
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 5b26a556f0d..053d6a8ef1d 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2327,7 +2327,7 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm,
attr.ObjectName = nt_name;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- if ((status = NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io,
+ if ((status = __syscall_NtOpenFile( &handle, GENERIC_READ | SYNCHRONIZE, &attr, &io,
FILE_SHARE_READ | FILE_SHARE_DELETE,
FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE )))
{
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index d6bde700e42..16a7f911173 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -654,7 +654,7 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
return STATUS_NO_MEMORY;
valueW.Length = NTDLL_swprintf( valueW.Buffer, pathfmtW, dir, name ) * sizeof(WCHAR);
InitializeObjectAttributes( &attr, &valueW, 0, 0, NULL );
- status = NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
+ status = __syscall_NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
if (!status) TRACE( "found %s\n", debugstr_w( valueW.Buffer ));
RtlFreeUnicodeString( &valueW );
if (status != STATUS_OBJECT_NAME_NOT_FOUND && status != STATUS_OBJECT_PATH_NOT_FOUND) return status;
@@ -678,7 +678,7 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
wcscat( valueW.Buffer, name );
valueW.Length = wcslen(valueW.Buffer) * sizeof(WCHAR);
InitializeObjectAttributes( &attr, &valueW, 0, 0, NULL );
- status = NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
+ status = __syscall_NtOpenFile( file, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT );
if (!status) TRACE( "found %s\n", debugstr_w( valueW.Buffer ));
}
RtlFreeUnicodeString( &valueW );
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 47800db41b1..749edaa57cf 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -227,4 +227,12 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
while (len--) *dst++ = (unsigned char)*src++;
}
+#if defined(__i386__) || defined(__x86_64__)
+NTSTATUS WINAPI __syscall_NtOpenFile( PHANDLE handle, ACCESS_MASK access,
+ POBJECT_ATTRIBUTES attr, PIO_STATUS_BLOCK io,
+ ULONG sharing, ULONG options );
+#else
+#define __syscall_NtOpenFile NtOpenFile
+#endif
+
#endif
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 5f4eb11316f..d2112d1af0d 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -929,7 +929,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- nts = NtOpenFile( &handle, FILE_TRAVERSE | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE,
+ nts = __syscall_NtOpenFile( &handle, FILE_TRAVERSE | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
if (nts != STATUS_SUCCESS) goto out;
--
2.27.0

View File

@ -1 +1 @@
6e2a54ec76d225d76506fe909a9c300702636d5b
e0e3b6bc91f7db956e3a66f2938eea45d4055a39