diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-06-01 17:35:16 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-01 11:35:16 +0200 |
| commit | eb69484bd6436992fd745e4c9dc5bc940cc6f91b (patch) | |
| tree | 15ab3d6f0e4d4b86653e52217de807d60ef059cf | |
| parent | 195ac02ea18b715396362a8f96b3dcd3594bb5fc (diff) | |
| download | box64-eb69484bd6436992fd745e4c9dc5bc940cc6f91b.tar.gz box64-eb69484bd6436992fd745e4c9dc5bc940cc6f91b.zip | |
[WOW64] Override DOS stub to Wine builtin DLL (#2698)
| -rw-r--r-- | wow64/CMakeLists.txt | 21 | ||||
| -rwxr-xr-x | wow64/override_wine_builtin.py | 14 |
2 files changed, 35 insertions, 0 deletions
diff --git a/wow64/CMakeLists.txt b/wow64/CMakeLists.txt index 6221e75d..13d7947c 100644 --- a/wow64/CMakeLists.txt +++ b/wow64/CMakeLists.txt @@ -1,6 +1,22 @@ cmake_minimum_required(VERSION 3.13) project(wowbox64 C ASM) +if(${CMAKE_VERSION} VERSION_LESS "3.12.2") + find_package(PythonInterp 3) + if(NOT PYTHONINTERP_FOUND) + message( FATAL_ERROR "You need a Python interpreter, CMake will exit." ) + endif() + if(${PYTHON_VERSION_MAJOR} LESS 3) + message( FATAL_ERROR "You need a Python 3 interpreter, CMake will exit." ) + endif() +else() + find_package(Python3) + if(NOT Python3_Interpreter_FOUND) + message( FATAL_ERROR "You need a Python interpreter, CMake will exit." ) + endif() + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE INTERNAL "The Python3 executable" FORCE) +endif() + set(BOX64_ROOT "${CMAKE_SOURCE_DIR}/..") string(REPLACE "," ";" DYNAREC_ASM "${DYNAREC_ASM_STR}") @@ -122,4 +138,9 @@ add_compile_definitions(DYNAREC ARM64) target_link_options(wowbox64 PRIVATE -nostdlib -nodefaultlibs -lclang_rt.builtins-aarch64 -Wl,--image-base,0x004c0000) +add_custom_command( + TARGET wowbox64 POST_BUILD + COMMAND "${PYTHON_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/override_wine_builtin.py $<TARGET_FILE:wowbox64> +) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/wow64/override_wine_builtin.py b/wow64/override_wine_builtin.py new file mode 100755 index 00000000..ee95e958 --- /dev/null +++ b/wow64/override_wine_builtin.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +data = 'Wine builtin DLL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' + +def main(output_file): + + with open(output_file, 'r+b') as f: + f.seek(64) # Move cursor to DOS stub + f.write(data.encode('utf-8')) + +main(sys.argv[1]) \ No newline at end of file |