Rebase against 123c0543e0bb4c99fbee0a568e786405ff886a93.

This commit is contained in:
Zebediah Figura
2020-03-27 16:55:10 -05:00
parent e5da84dc36
commit f9d1798edb
7 changed files with 72 additions and 79 deletions

View File

@@ -1,22 +1,22 @@
From c6c3f424a6ee8983f37d3ce212dfd5519a195055 Mon Sep 17 00:00:00 2001
From 4855e0338f57525304221ba1c29c3926a9f16263 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/signal_i386.c | 40 +++++++
dlls/ntdll/signal_i386.c | 34 ++++++
include/winternl.h | 2 +-
tools/winebuild/build.h | 1 +
tools/winebuild/spec32.c | 209 +++++++++++++++++++++++++++++++++--
tools/winebuild/utils.c | 10 +-
6 files changed, 255 insertions(+), 15 deletions(-)
6 files changed, 249 insertions(+), 15 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 4d9a26075..29cf15585 100644
index e72dea9ca51..bf3cf00f964 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1559,9 +1559,7 @@ static void test_FakeDLL(void)
@@ -1560,9 +1560,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);
@@ -26,7 +26,7 @@ index 4d9a26075..29cf15585 100644
names = RVAToAddr(dir->AddressOfNames, ptr);
ordinals = RVAToAddr(dir->AddressOfNameOrdinals, ptr);
@@ -1590,17 +1588,20 @@ todo_wine
@@ -1591,17 +1589,20 @@ todo_wine
/* check position in memory */
dll_rva = (DWORD_PTR)dll_func - (DWORD_PTR)module;
map_rva = funcs[ordinals[i]];
@@ -47,7 +47,7 @@ index 4d9a26075..29cf15585 100644
ok(!memcmp(map_func, dll_func, 0x20), "%s: Function content does not match!\n", func_name);
if (!strcmp(func_name, "NtSetEvent"))
@@ -1614,10 +1615,11 @@ todo_wine
@@ -1615,10 +1616,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");
@@ -61,19 +61,13 @@ index 4d9a26075..29cf15585 100644
CloseHandle(map);
CloseHandle(file);
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index a0f8b3a2e..e55164630 100644
index a0f8b3a2ec6..72285f0b456 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -445,6 +445,45 @@ static wine_signal_handler handlers[256];
@@ -445,6 +445,39 @@ static wine_signal_handler handlers[256];
extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
extern NTSTATUS WINAPI __syscall_NtGetContextThread( HANDLE handle, CONTEXT *context );
+/* convert from straight ASCII to Unicode without depending on the current codepage */
+static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
+{
+ while (len--) *dst++ = (unsigned char)*src++;
+}
+
+static void* WINAPI __wine_fakedll_dispatcher( const char *module, ULONG ord )
+{
+ UNICODE_STRING name;
@@ -110,7 +104,7 @@ index a0f8b3a2e..e55164630 100644
enum i386_trap_code
{
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
@@ -2307,6 +2346,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
@@ -2307,6 +2340,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
(*teb)->Tib.Self = &(*teb)->Tib;
(*teb)->Tib.ExceptionList = (void *)~0UL;
(*teb)->WOW32Reserved = __wine_syscall_dispatcher;
@@ -119,7 +113,7 @@ index a0f8b3a2e..e55164630 100644
if (!(thread_data->fs = wine_ldt_alloc_fs()))
{
diff --git a/include/winternl.h b/include/winternl.h
index 713e71802..754bdae14 100644
index 1fbf05b0125..f44722093ba 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -398,7 +398,7 @@ typedef struct _TEB
@@ -132,7 +126,7 @@ index 713e71802..754bdae14 100644
PVOID ReservedForPerf; /* f7c/1750 */
PVOID ReservedForOle; /* f80/1758 */
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 53d4ba192..09a654de1 100644
index e0d33036440..6712a694773 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -357,6 +357,7 @@ extern void put_word( unsigned short val );
@@ -144,7 +138,7 @@ index 53d4ba192..09a654de1 100644
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 e67cb48cd..692db4c7e 100644
index e67cb48cd08..692db4c7e0b 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -884,6 +884,163 @@ void output_spec32_file( DLLSPEC *spec )
@@ -400,10 +394,10 @@ index e67cb48cd..692db4c7e 100644
/* .reloc contents */
align_output_rva( file_align, section_align );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index f53e09227..0f4642d43 100644
index b0be1b594b3..b1e34c5da18 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -548,7 +548,7 @@ size_t output_buffer_size;
@@ -549,7 +549,7 @@ size_t output_buffer_size;
struct label
{
struct list entry;
@@ -412,7 +406,7 @@ index f53e09227..0f4642d43 100644
size_t pos;
size_t rva;
};
@@ -566,7 +566,7 @@ struct label *get_label( const char *name )
@@ -567,7 +567,7 @@ struct label *get_label( const char *name )
}
label = xmalloc( sizeof(*label) );
@@ -421,7 +415,7 @@ index f53e09227..0f4642d43 100644
label->pos = 0;
label->rva = 0;
@@ -618,6 +618,7 @@ void free_labels( void )
@@ -619,6 +619,7 @@ void free_labels( void )
LIST_FOR_EACH_ENTRY_SAFE( label, label2, &labels, struct label, entry )
{
list_remove( &label->entry );
@@ -429,7 +423,7 @@ index f53e09227..0f4642d43 100644
free( label );
}
}
@@ -749,6 +750,11 @@ void put_pword( unsigned int val )
@@ -750,6 +751,11 @@ void put_pword( unsigned int val )
else put_dword( val );
}
@@ -442,5 +436,5 @@ index f53e09227..0f4642d43 100644
{
size_t size = align - (output_buffer_pos % align);
--
2.25.0
2.25.1

View File

@@ -1,4 +1,4 @@
From 162663c659f87dc2ddf09202e7988ff4d50368e7 Mon Sep 17 00:00:00 2001
From 3d74d528e07008df764caef28993d551bfd934ba 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.
@@ -9,13 +9,13 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48410
dlls/ntdll/directory.c | 2 +-
dlls/ntdll/loader.c | 2 +-
dlls/ntdll/locale.c | 4 ++--
dlls/ntdll/ntdll_misc.h | 9 +++++++++
dlls/ntdll/ntdll_misc.h | 8 ++++++++
dlls/ntdll/path.c | 2 +-
dlls/ntdll/process.c | 2 +-
7 files changed, 17 insertions(+), 8 deletions(-)
7 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index c5134198285..0c6cda1cfaa 100644
index d5f376f224e..cb6b9bb5097 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -2890,7 +2890,7 @@ static NTSTATUS open_nt_file( HANDLE *handle, UNICODE_STRING *name )
@@ -37,10 +37,10 @@ index c5134198285..0c6cda1cfaa 100644
{
sxs_ai = *ai;
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 95af2dde240..ba50aa1b807 100644
index 993a661015e..7d1ed8c83ba 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -3012,7 +3012,7 @@ NTSTATUS DIR_get_unix_cwd( char **cwd )
@@ -3000,7 +3000,7 @@ NTSTATUS DIR_get_unix_cwd( char **cwd )
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
@@ -50,10 +50,10 @@ index 95af2dde240..ba50aa1b807 100644
RtlFreeUnicodeString( &dirW );
if (status != STATUS_SUCCESS) goto done;
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 7e8fd20e9d7..8fcd53b26ba 100644
index 9cd2d7255ae..34e799e4e2a 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2375,7 +2375,7 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm,
@@ -2372,7 +2372,7 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm,
attr.ObjectName = nt_name;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
@@ -63,7 +63,7 @@ index 7e8fd20e9d7..8fcd53b26ba 100644
FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE )))
{
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index afd65f3c02c..52f5d1f1d83 100644
index 123b8985b1c..20d13407077 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -659,7 +659,7 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
@@ -85,14 +85,13 @@ index afd65f3c02c..52f5d1f1d83 100644
}
RtlFreeUnicodeString( &valueW );
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 94e8bf54576..0d8a603c859 100644
index 3c33d304a24..e3d3d418adf 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -289,4 +289,13 @@ extern BOOL read_process_memory_stats(int unix_pid, VM_COUNTERS *pvmi) DECLSPEC_
/* string functions */
int __cdecl NTDLL_tolower( int c );
int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 );
+
@@ -323,4 +323,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,
@@ -103,7 +102,7 @@ index 94e8bf54576..0d8a603c859 100644
+
#endif
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 610646be85b..e37c8957e24 100644
index 65539fa0188..635eba0251f 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -1021,7 +1021,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir)
@@ -116,7 +115,7 @@ index 610646be85b..e37c8957e24 100644
if (nts != STATUS_SUCCESS) goto out;
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index a1c688745a7..83d610010b3 100644
index 5d5ea6d20d1..0d8096af91f 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -1396,7 +1396,7 @@ static NTSTATUS get_pe_file_info( UNICODE_STRING *path, ULONG attributes,