Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions android/patches/dlls_ntdll_loader_c.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index bc71fe0..ef39f34 100644
index bc71fe0..b5d0539 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -4429,7 +4429,7 @@ static void load_arm64ec_module(void)
@@ -4089,6 +4089,11 @@ void WINAPI LdrShutdownThread(void)
/* don't do any detach calls if process is exiting */
if (process_detaching) return;

+ if (NtCurrentTeb()->SkipThreadAttach) {
+ heap_thread_detach();
+ return;
+ }
+
RtlProcessFlsData( NtCurrentTeb()->FlsSlots, 1 );

RtlEnterCriticalSection( &loader_section );
@@ -4429,7 +4434,7 @@ static void load_arm64ec_module(void)
ULONG buffer[16];
KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer;
UNICODE_STRING nameW = RTL_CONSTANT_STRING( L"\\Registry\\Machine\\Software\\Microsoft\\Wow64\\amd64" );
Expand All @@ -11,19 +23,42 @@ index bc71fe0..ef39f34 100644
OBJECT_ATTRIBUTES attr;
WINE_MODREF *wm;
NTSTATUS status;
@@ -4479,6 +4479,7 @@ static void build_wow64_main_module(void)
@@ -4479,6 +4484,7 @@ static void build_wow64_main_module(void)
static void (WINAPI *pWow64LdrpInitialize)( CONTEXT *ctx );

void (WINAPI *pWow64PrepareForException)( EXCEPTION_RECORD *rec, CONTEXT *context ) = NULL;
+NTSTATUS (WINAPI *pWow64SuspendLocalThread)( HANDLE thread, ULONG *count ) = NULL;

static void init_wow64( CONTEXT *context )
{
@@ -4503,6 +4504,7 @@ static void init_wow64( CONTEXT *context )
@@ -4503,6 +4509,7 @@ static void init_wow64( CONTEXT *context )

GET_PTR( Wow64LdrpInitialize );
GET_PTR( Wow64PrepareForException );
+ GET_PTR( Wow64SuspendLocalThread );
#undef GET_PTR
imports_fixup_done = TRUE;
}
@@ -4598,6 +4605,8 @@ void loader_init( CONTEXT *context, void **entry )

if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );

+ if (NtCurrentTeb()->SkipLoaderInit) return;
+
RtlEnterCriticalSection( &loader_section );

if (!imports_fixup_done)
@@ -4701,6 +4710,13 @@ void loader_init( CONTEXT *context, void **entry )
#ifdef __arm64ec__
arm64ec_thread_init();
#endif
+
+ if (NtCurrentTeb()->SkipThreadAttach)
+ {
+ RtlLeaveCriticalSection( &loader_section );
+ return;
+ }
+
wm = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
}

34 changes: 31 additions & 3 deletions android/patches/dlls_wow64_syscall_c.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c
index d2a977e..fddd3c6 100644
index d2a977e..dde24d8 100644
--- a/dlls/wow64/syscall.c
+++ b/dlls/wow64/syscall.c
@@ -726,6 +726,29 @@ static HMODULE load_64bit_module( const WCHAR *name )
@@ -102,6 +102,7 @@ static void (WINAPI *pBTCpuProcessInit)(void);
static NTSTATUS (WINAPI *pBTCpuSetContext)(HANDLE,HANDLE,void *,void *);
static void (WINAPI *pBTCpuThreadInit)(void);
static void (WINAPI *pBTCpuSimulate)(void) __attribute__((used));
+static NTSTATUS (WINAPI *pBTCpuSuspendLocalThread)(HANDLE,ULONG *);
static void * (WINAPI *p__wine_get_unix_opcode)(void);
static void * (WINAPI *pKiRaiseUserExceptionDispatcher)(void);
void (WINAPI *pBTCpuFlushInstructionCache2)( const void *, SIZE_T ) = NULL;
@@ -726,6 +727,29 @@ static HMODULE load_64bit_module( const WCHAR *name )
return module;
}

Expand Down Expand Up @@ -32,7 +40,7 @@ index d2a977e..fddd3c6 100644

/**********************************************************************
* get_cpu_dll_name
@@ -740,11 +763,17 @@ static const WCHAR *get_cpu_dll_name(void)
@@ -740,11 +764,17 @@ static const WCHAR *get_cpu_dll_name(void)
HANDLE key;
ULONG size;

Expand All @@ -51,3 +59,23 @@ index d2a977e..fddd3c6 100644
break;
case IMAGE_FILE_MACHINE_ARMNT:
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Wow64\\arm" );
@@ -839,6 +869,7 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
GET_PTR( BTCpuProcessInit );
GET_PTR( BTCpuThreadInit );
GET_PTR( BTCpuResetToConsistentState );
+ GET_PTR( BTCpuSuspendLocalThread );
GET_PTR( BTCpuSetContext );
GET_PTR( BTCpuSimulate );
GET_PTR( BTCpuFlushInstructionCache2 );
@@ -1525,3 +1556,11 @@ NTSTATUS WINAPI Wow64RaiseException( int code, EXCEPTION_RECORD *rec )

return STATUS_SUCCESS;
}
+
+/**********************************************************************
+ * Wow64SuspendLocalThread (wow64.@)
+ */
+NTSTATUS WINAPI Wow64SuspendLocalThread( HANDLE thread, ULONG *count )
+{
+ return pBTCpuSuspendLocalThread( thread, count );
+}
15 changes: 0 additions & 15 deletions android/patches/test-bylaws/dlls_wow64_process_c.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,3 @@ index 269843a..85a5006 100644
- return NtSuspendThread( handle, count );
+ return RtlWow64SuspendThread( handle, count );
}


@@ -1146,3 +1146,12 @@ NTSTATUS WINAPI wow64_NtWow64QueryInformationProcess64( UINT *args )
return STATUS_NOT_IMPLEMENTED;
}
}
+
+
+/**********************************************************************
+ * Wow64SuspendLocalThread (wow64.@)
+ */
+NTSTATUS WINAPI Wow64SuspendLocalThread( HANDLE thread, ULONG *count )
+{
+ return NtSuspendThread( thread, count );
+}
Loading