Rebase against 480bae108c96dfe370feba2680dbefc42ef97571

This commit is contained in:
Alistair Leslie-Hughes
2019-08-27 08:47:31 +10:00
parent fcfeaf092c
commit ff10ae6e74
10 changed files with 74 additions and 441 deletions

View File

@@ -1,7 +1,7 @@
From 4b84757bba03d22cb225103cc7e52805a8d223f0 Mon Sep 17 00:00:00 2001
From 1bde7847e392610773a57ee77731ac6d4caf26aa 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: winebuild: Add stub functions in fake dlls.
Subject: [PATCH] winebuild: Add stub functions in fake dlls.
---
dlls/kernel32/tests/loader.c | 8 +-
@@ -13,10 +13,10 @@ Subject: winebuild: Add stub functions in fake dlls.
6 files changed, 255 insertions(+), 15 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 589e9f66..4a35a592 100644
index 3b87ca4d151..ed5ed28b510 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1550,9 +1550,7 @@ static void test_FakeDLL(void)
@@ -1555,9 +1555,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 589e9f66..4a35a592 100644
names = RVAToAddr(dir->AddressOfNames, ptr);
ordinals = RVAToAddr(dir->AddressOfNameOrdinals, ptr);
@@ -1581,17 +1579,20 @@ todo_wine
@@ -1586,17 +1584,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 589e9f66..4a35a592 100644
ok(!memcmp(map_func, dll_func, 0x20), "%s: Function content does not match!\n", func_name);
if (!strcmp(func_name, "NtSetEvent"))
@@ -1605,10 +1606,11 @@ todo_wine
@@ -1610,10 +1611,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,7 +61,7 @@ index 589e9f66..4a35a592 100644
CloseHandle(map);
CloseHandle(file);
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 8dfcd0b5..4a4eb047 100644
index edd11baf11a..1f33e759b77 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -430,6 +430,45 @@ static wine_signal_handler handlers[256];
@@ -110,32 +110,32 @@ index 8dfcd0b5..4a4eb047 100644
enum i386_trap_code
{
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
@@ -2321,6 +2360,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
@@ -2343,6 +2382,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
(*teb)->Tib.Self = &(*teb)->Tib;
(*teb)->Tib.ExceptionList = (void *)~0UL;
(*teb)->WOW32Reserved = __wine_syscall_dispatcher;
+ (*teb)->Spare3 = __wine_fakedll_dispatcher;
+ (*teb)->Spare2 = __wine_fakedll_dispatcher;
thread_data = (struct x86_thread_data *)(*teb)->SystemReserved2;
if (!(thread_data->fs = wine_ldt_alloc_fs()))
{
diff --git a/include/winternl.h b/include/winternl.h
index 5d128b46..64640f4b 100644
index b3ad0d361d2..ba1e1a355fd 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -397,7 +397,7 @@ typedef struct _TEB
@@ -396,7 +396,7 @@ typedef struct _TEB
PVOID Instrumentation[16]; /* f2c/16b8 */
PVOID WinSockData; /* f6c/1738 */
ULONG GdiBatchCount; /* f70/1740 */
ULONG Spare2; /* f74/1744 */
- PVOID Spare3; /* f78/1748 */
+ PVOID Spare3; /* f78/1748 used for fakedll thunks */
PVOID Spare4; /* f7c/1750 */
- ULONG Spare2; /* f74/1744 */
+ ULONG Spare2; /* f74/1744 used for fakedll thunks */
ULONG GuaranteedStackBytes; /* f78/1748 */
PVOID ReservedForPerf; /* f7c/1750 */
PVOID ReservedForOle; /* f80/1758 */
ULONG WaitingOnLoaderLock; /* f84/1760 */
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 56e9af3d..6b12d496 100644
index e9967874d51..dcfb37e906b 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -344,6 +344,7 @@ extern void put_word( unsigned short val );
@@ -356,6 +356,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 );
@@ -144,10 +144,10 @@ index 56e9af3d..6b12d496 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 55587cb6..2f172033 100644
index e86188f175a..88b3d4b4090 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -794,6 +794,163 @@ void BuildSpec32File( DLLSPEC *spec )
@@ -881,6 +881,163 @@ void output_spec32_file( DLLSPEC *spec )
}
@@ -311,7 +311,7 @@ index 55587cb6..2f172033 100644
/*******************************************************************
* output_fake_module_pass
*
@@ -812,7 +969,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -899,7 +1056,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
const unsigned int section_align = page_size;
const unsigned int file_align = 0x200;
const unsigned int lfanew = (0x40 + sizeof(fakedll_signature) + 15) & ~15;
@@ -320,7 +320,7 @@ index 55587cb6..2f172033 100644
put_word( 0x5a4d ); /* e_magic */
put_word( 0x40 ); /* e_cblp */
@@ -869,7 +1026,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -956,7 +1113,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 */
@@ -329,7 +329,7 @@ index 55587cb6..2f172033 100644
put_pword( 0x10000000 ); /* ImageBase */
put_dword( section_align ); /* SectionAlignment */
put_dword( file_align ); /* FileAlignment */
@@ -892,7 +1049,8 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -979,7 +1136,8 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_dword( 0 ); /* LoaderFlags */
put_dword( 16 ); /* NumberOfRvaAndSizes */
@@ -339,7 +339,7 @@ index 55587cb6..2f172033 100644
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
if (spec->nb_resources) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
{
@@ -932,6 +1090,21 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -1019,6 +1177,21 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_word( 0 ); /* NumberOfLinenumbers */
put_dword( 0x60000020 /* CNT_CODE|MEM_EXECUTE|MEM_READ */ ); /* Characteristics */
@@ -361,7 +361,7 @@ index 55587cb6..2f172033 100644
/* .reloc section */
put_data( ".reloc\0", 8 ); /* Name */
put_dword( label_rva_align("reloc_end") - label_rva("reloc_start") ); /* VirtualSize */
@@ -964,13 +1137,31 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -1051,13 +1224,31 @@ static void output_fake_module_pass( DLLSPEC *spec )
/* .text contents */
align_output_rva( file_align, section_align );
@@ -400,10 +400,10 @@ index 55587cb6..2f172033 100644
/* .reloc contents */
align_output_rva( file_align, section_align );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index b9c2b329..f4ed3261 100644
index 07ae445be15..a9f5b9ae336 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -528,7 +528,7 @@ size_t output_buffer_size;
@@ -533,7 +533,7 @@ size_t output_buffer_size;
struct label
{
struct list entry;
@@ -412,7 +412,7 @@ index b9c2b329..f4ed3261 100644
size_t pos;
size_t rva;
};
@@ -546,7 +546,7 @@ struct label *get_label( const char *name )
@@ -551,7 +551,7 @@ struct label *get_label( const char *name )
}
label = xmalloc( sizeof(*label) );
@@ -421,7 +421,7 @@ index b9c2b329..f4ed3261 100644
label->pos = 0;
label->rva = 0;
@@ -598,6 +598,7 @@ void free_labels( void )
@@ -603,6 +603,7 @@ void free_labels( void )
LIST_FOR_EACH_ENTRY_SAFE( label, label2, &labels, struct label, entry )
{
list_remove( &label->entry );
@@ -429,7 +429,7 @@ index b9c2b329..f4ed3261 100644
free( label );
}
}
@@ -732,6 +733,11 @@ void put_pword( unsigned int val )
@@ -734,6 +735,11 @@ void put_pword( unsigned int val )
else put_dword( val );
}
@@ -442,5 +442,5 @@ index b9c2b329..f4ed3261 100644
{
size_t size = align - (output_buffer_pos % align);
--
2.20.1
2.17.1