Skip to content

Commit

Permalink
HACK: allow atttempting to fork/exec foreign PE
Browse files Browse the repository at this point in the history
This also disables claiming to support x86_64 and i686 on arm64.  This
will probably break ARM64EC, and whatever FEX emulation plugin that may
or may not work for i686 (I can't find any concrete instructions on how
to use it, just a reference to a registry key to plug FEX into, if I
knew where to get the binary to put there).
  • Loading branch information
jeremyd2019 committed Jun 13, 2024
1 parent 36d5394 commit 9666c82
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dlls/ntdll/unix/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,9 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_

if ((status = get_pe_file_info( &attr, &file_handle, &pe_info )))
{
if (status == STATUS_INVALID_IMAGE_NOT_MZ && !fork_and_exec( &attr, unixdir, params ))
if ((status == STATUS_INVALID_IMAGE_NOT_MZ ||
status == STATUS_INVALID_IMAGE_FORMAT ||
status == STATUS_INVALID_IMAGE_WIN_64) && !fork_and_exec( &attr, unixdir, params ))
{
memset( info, 0, sizeof(*info) );
free( redir.Buffer );
Expand Down
2 changes: 1 addition & 1 deletion server/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static inline int is_machine_supported( unsigned short machine )
{
unsigned int i;
for (i = 0; i < supported_machines_count; i++) if (supported_machines[i] == machine) return 1;
if (native_machine == IMAGE_FILE_MACHINE_ARM64) return machine == IMAGE_FILE_MACHINE_AMD64;
/* if (native_machine == IMAGE_FILE_MACHINE_ARM64) return machine == IMAGE_FILE_MACHINE_AMD64; */
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion server/registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ static void init_supported_machines(void)
if (prefix_type == PREFIX_64BIT)
{
supported_machines[count++] = IMAGE_FILE_MACHINE_ARM64;
supported_machines[count++] = IMAGE_FILE_MACHINE_I386;
/* supported_machines[count++] = IMAGE_FILE_MACHINE_I386; */
/* supported_machines[count++] = IMAGE_FILE_MACHINE_ARMNT; not supported yet */
}
#else
Expand Down

0 comments on commit 9666c82

Please sign in to comment.