From phnt headers.
From: Billy Laws blaws05@gmail.com
From phnt headers. --- dlls/ntdll/ntdll_misc.h | 13 ----- dlls/ntdll/process.c | 4 +- dlls/ntdll/signal_arm64ec.c | 7 ++- include/winternl.h | 108 ++++++++++++++++++++---------------- 4 files changed, 67 insertions(+), 65 deletions(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 52875efa6b5..bda4dd61d25 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -122,19 +122,6 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) extern TEB_FLS_DATA *fls_alloc_data(void); extern void heap_thread_detach(void);
-#if defined __aarch64__ || defined __arm64ec__ -/* equivalent of WOW64INFO, stored after the 64-bit PEB */ -struct arm64ec_shared_info -{ - ULONG Wow64ExecuteFlags; - USHORT NativeMachineType; - USHORT EmulatedMachineType; - HANDLE SectionHandle; - CROSS_PROCESS_WORK_LIST *CrossProcessWorkList; - void *unknown; -}; -#endif - /* register context */
#ifdef __i386__ diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 8906e254cc0..521074f9765 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -328,10 +328,10 @@ void WINAPI RtlOpenCrossProcessEmulatorWorkConnection( HANDLE process, HANDLE *s else { PROCESS_BASIC_INFORMATION basic; - struct arm64ec_shared_info info; + CHPEV2_PROCESS_INFO info;
if (!NtQueryInformationProcess( process, ProcessBasicInformation, &basic, sizeof(basic), NULL ) && - !NtReadVirtualMemory( process, (PEB *)basic.PebBaseAddress + 1, &info, sizeof(info), NULL )) + !NtReadVirtualMemory( process, ((PEB *)basic.PebBaseAddress)->ChpeV2ProcessInfo, &info, sizeof(info), NULL )) handle = info.SectionHandle; } #endif diff --git a/dlls/ntdll/signal_arm64ec.c b/dlls/ntdll/signal_arm64ec.c index e44ac9fc467..27af5f5d746 100644 --- a/dlls/ntdll/signal_arm64ec.c +++ b/dlls/ntdll/signal_arm64ec.c @@ -76,7 +76,7 @@ static inline BOOL is_valid_arm64ec_frame( ULONG_PTR frame ) /********************************************************************** * create_cross_process_work_list */ -static NTSTATUS create_cross_process_work_list( struct arm64ec_shared_info *info ) +static NTSTATUS create_cross_process_work_list( CHPEV2_PROCESS_INFO *info ) { SIZE_T map_size = 0x4000; LARGE_INTEGER size; @@ -147,7 +147,7 @@ static BOOL send_cross_process_notification( HANDLE process, UINT id, const void NTSTATUS arm64ec_process_init( HMODULE module ) { NTSTATUS status = STATUS_SUCCESS; - struct arm64ec_shared_info *info = (struct arm64ec_shared_info *)(RtlGetCurrentPeb() + 1); + CHPEV2_PROCESS_INFO *info = (CHPEV2_PROCESS_INFO *)(RtlGetCurrentPeb() + 1);
__os_arm64x_dispatch_call_no_redirect = RtlFindExportedRoutineByName( module, "ExitToX64" ); __os_arm64x_dispatch_fptr = RtlFindExportedRoutineByName( module, "DispatchJump" ); @@ -172,6 +172,7 @@ NTSTATUS arm64ec_process_init( HMODULE module ) GET_PTR( UpdateProcessorInformation ); #undef GET_PTR
+ RtlGetCurrentPeb()->ChpeV2ProcessInfo = info; info->NativeMachineType = IMAGE_FILE_MACHINE_ARM64; info->EmulatedMachineType = IMAGE_FILE_MACHINE_AMD64;
@@ -744,7 +745,7 @@ static NTSTATUS WINAPI LdrpSetX64Information( ULONG type, ULONG_PTR input, void */ void WINAPI ProcessPendingCrossProcessEmulatorWork(void) { - struct arm64ec_shared_info *info = (struct arm64ec_shared_info *)(RtlGetCurrentPeb() + 1); + CHPEV2_PROCESS_INFO *info = RtlGetCurrentPeb()->ChpeV2ProcessInfo; CROSS_PROCESS_WORK_LIST *list = (void *)info->CrossProcessWorkList; CROSS_PROCESS_WORK_ENTRY *entry; BOOLEAN flush = FALSE; diff --git a/include/winternl.h b/include/winternl.h index 224ad4bff0d..519a7cce480 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -291,6 +291,52 @@ typedef struct _TEB_FLS_DATA void **fls_data_chunks[8]; } TEB_FLS_DATA, *PTEB_FLS_DATA;
+/* undocumented layout of WOW64INFO.CrossProcessWorkList and CHPEV2_PROCESS_INFO.CrossProcessWorkList */ + +typedef struct +{ + UINT next; + UINT id; + ULONGLONG addr; + ULONGLONG size; + UINT args[4]; +} CROSS_PROCESS_WORK_ENTRY; + +typedef union +{ + struct + { + UINT first; + UINT counter; + }; + volatile LONGLONG hdr; +} CROSS_PROCESS_WORK_HDR; + +typedef struct +{ + CROSS_PROCESS_WORK_HDR free_list; + CROSS_PROCESS_WORK_HDR work_list; + ULONGLONG unknown[4]; + CROSS_PROCESS_WORK_ENTRY entries[1]; +} CROSS_PROCESS_WORK_LIST; + +typedef enum +{ + CrossProcessPreVirtualAlloc = 0, + CrossProcessPostVirtualAlloc = 1, + CrossProcessPreVirtualFree = 2, + CrossProcessPostVirtualFree = 3, + CrossProcessPreVirtualProtect = 4, + CrossProcessPostVirtualProtect = 5, + CrossProcessFlushCache = 6, + CrossProcessFlushCacheHeavy = 7, + CrossProcessMemoryWrite = 8, +} CROSS_PROCESS_NOTIFICATION; + +#define CROSS_PROCESS_LIST_FLUSH 0x80000000 +#define CROSS_PROCESS_LIST_ENTRY(list,pos) \ + ((CROSS_PROCESS_WORK_ENTRY *)((char *)(list) + ((pos) & ~CROSS_PROCESS_LIST_FLUSH))) + typedef struct _CHPE_V2_CPU_AREA_INFO { BOOLEAN InSimulation; /* 000 */ @@ -304,6 +350,17 @@ typedef struct _CHPE_V2_CPU_AREA_INFO ULONG64 EmulatorDataInline; /* 050 */ } CHPE_V2_CPU_AREA_INFO, *PCHPE_V2_CPU_AREA_INFO;
+/* equivalent of WOW64INFO, stored after the 64-bit PEB */ +typedef struct _CHPEV2_PROCESS_INFO +{ + ULONG Wow64ExecuteFlags; /* 000 */ + USHORT NativeMachineType; /* 004 */ + USHORT EmulatedMachineType; /* 006 */ + HANDLE SectionHandle; /* 008 */ + CROSS_PROCESS_WORK_LIST *CrossProcessWorkList; /* 010 */ + void *unknown; /* 018 */ +} CHPEV2_PROCESS_INFO, *PCHPEV2_PROCESS_INFO; + #define TEB_ACTIVE_FRAME_CONTEXT_FLAG_EXTENDED 0x00000001 #define TEB_ACTIVE_FRAME_FLAG_EXTENDED 0x00000001
@@ -399,7 +456,10 @@ typedef struct _PEB SIZE_T MinimumStackCommit; /* 208/318 */ PVOID *FlsCallback; /* 20c/320 */ LIST_ENTRY FlsListHead; /* 210/328 */ - PRTL_BITMAP FlsBitmap; /* 218/338 */ + union { + PRTL_BITMAP FlsBitmap; /* 218/338 */ + CHPEV2_PROCESS_INFO *ChpeV2ProcessInfo; /* /338 */ + } DUMMYUNIONNAME; ULONG FlsBitmapBits[4]; /* 21c/340 */ ULONG FlsHighIndex; /* 22c/350 */ PVOID WerRegistrationData; /* 230/358 */ @@ -4213,52 +4273,6 @@ C_ASSERT( sizeof(WOW64INFO) == 40 ); #define WOW64_CPUFLAGS_MSFT64 0x01 #define WOW64_CPUFLAGS_SOFTWARE 0x02
-/* undocumented layout of WOW64INFO.CrossProcessWorkList */ - -typedef struct -{ - UINT next; - UINT id; - ULONGLONG addr; - ULONGLONG size; - UINT args[4]; -} CROSS_PROCESS_WORK_ENTRY; - -typedef union -{ - struct - { - UINT first; - UINT counter; - }; - volatile LONGLONG hdr; -} CROSS_PROCESS_WORK_HDR; - -typedef struct -{ - CROSS_PROCESS_WORK_HDR free_list; - CROSS_PROCESS_WORK_HDR work_list; - ULONGLONG unknown[4]; - CROSS_PROCESS_WORK_ENTRY entries[1]; -} CROSS_PROCESS_WORK_LIST; - -typedef enum -{ - CrossProcessPreVirtualAlloc = 0, - CrossProcessPostVirtualAlloc = 1, - CrossProcessPreVirtualFree = 2, - CrossProcessPostVirtualFree = 3, - CrossProcessPreVirtualProtect = 4, - CrossProcessPostVirtualProtect = 5, - CrossProcessFlushCache = 6, - CrossProcessFlushCacheHeavy = 7, - CrossProcessMemoryWrite = 8, -} CROSS_PROCESS_NOTIFICATION; - -#define CROSS_PROCESS_LIST_FLUSH 0x80000000 -#define CROSS_PROCESS_LIST_ENTRY(list,pos) \ - ((CROSS_PROCESS_WORK_ENTRY *)((char *)(list) + ((pos) & ~CROSS_PROCESS_LIST_FLUSH))) - /* wow64.dll functions */ void * WINAPI Wow64AllocateTemp(SIZE_T); void WINAPI Wow64ApcRoutine(ULONG_PTR,ULONG_PTR,ULONG_PTR,CONTEXT*);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=147643
Your paranoid android.
=== debian11b (64 bit WoW report) ===
dinput: joystick8.c:5759: Test failed: input 1: WaitForSingleObject returned 0x102 joystick8.c:5760: Test failed: input 1: got 0 WM_INPUT messages joystick8.c:5763: Test failed: input 1: got dwType 0 joystick8.c:5764: Test failed: input 1: got header.dwSize 0 joystick8.c:5766: Test failed: input 1: got hDevice 0000000000000000 joystick8.c:5768: Test failed: input 1: got dwSizeHid 0 joystick8.c:5769: Test failed: input 1: got dwCount 0
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000003B00F8, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032