From 2b7246fd3cd47e17601b17bfb621d7919968a31c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 7 Nov 2023 18:50:52 +0200 Subject: [PATCH] [CMAKE] Add support for "IMAGEBASE default" and use it for test/sample dlls --- modules/rostests/apitests/kernel32/redirptest/CMakeLists.txt | 4 ++-- modules/rostests/apitests/localspl/dll/CMakeLists.txt | 2 +- modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt | 2 +- modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt | 2 +- modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt | 2 +- sdk/cmake/CMakeMacros.cmake | 4 +++- sdk/tools/gen_baseaddress.py | 3 +++ subsystems/mvdm/samples/testvdd/CMakeLists.txt | 2 +- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/rostests/apitests/kernel32/redirptest/CMakeLists.txt b/modules/rostests/apitests/kernel32/redirptest/CMakeLists.txt index f074d2be718..0b5778c8b81 100644 --- a/modules/rostests/apitests/kernel32/redirptest/CMakeLists.txt +++ b/modules/rostests/apitests/kernel32/redirptest/CMakeLists.txt @@ -12,12 +12,12 @@ list(APPEND SOURCE2 ${CMAKE_CURRENT_BINARY_DIR}/redirtest.def) add_library(redirtest1 MODULE ${SOURCE1}) -set_module_type(redirtest1 win32dll) +set_module_type(redirtest1 win32dll IMAGEBASE default) add_importlibs(redirtest1 msvcrt kernel32 ntdll) add_rostests_file(TARGET redirtest1 RENAME kernel32test_versioned.dll) add_library(redirtest2 MODULE ${SOURCE2}) -set_module_type(redirtest2 win32dll) +set_module_type(redirtest2 win32dll IMAGEBASE default) add_importlibs(redirtest2 msvcrt kernel32 ntdll) add_rostests_file(TARGET redirtest2 SUBDIR testdata RENAME kernel32test_versioned.dll) add_rostests_file(FILE "${CMAKE_CURRENT_SOURCE_DIR}/redirtest2.manifest" SUBDIR testdata) diff --git a/modules/rostests/apitests/localspl/dll/CMakeLists.txt b/modules/rostests/apitests/localspl/dll/CMakeLists.txt index 77d7eac49f9..c4a15381aec 100644 --- a/modules/rostests/apitests/localspl/dll/CMakeLists.txt +++ b/modules/rostests/apitests/localspl/dll/CMakeLists.txt @@ -9,7 +9,7 @@ list(APPEND SOURCE add_library(localspl_apitest.dll MODULE ${SOURCE}) target_link_libraries(localspl_apitest.dll wine ${PSEH_LIB}) -set_module_type(localspl_apitest.dll win32dll) +set_module_type(localspl_apitest.dll win32dll IMAGEBASE default) add_importlibs(localspl_apitest.dll spoolss advapi32 msvcrt kernel32 ntdll) set_target_properties(localspl_apitest.dll PROPERTIES SUFFIX "") add_rostests_file(TARGET localspl_apitest.dll) diff --git a/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt index 021fba309c2..8c086a367a4 100644 --- a/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt @@ -7,5 +7,5 @@ add_library(win32u_2k3sp2 MODULE ${win32u_2k3sp2_asm} ${CMAKE_CURRENT_BINARY_DIR}/win32u_2k3sp2.def) -set_module_type(win32u_2k3sp2 module) +set_module_type(win32u_2k3sp2 module IMAGEBASE default) add_dependencies(win32u_2k3sp2 psdk) diff --git a/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt index 38737886d0c..743ded25e1f 100644 --- a/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt @@ -7,5 +7,5 @@ add_library(win32u_vista MODULE ${win32u_vista_asm} ${CMAKE_CURRENT_BINARY_DIR}/win32u_vista.def) -set_module_type(win32u_vista module) +set_module_type(win32u_vista module IMAGEBASE default) add_dependencies(win32u_vista psdk) diff --git a/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt index 457d5c1868a..6939993703a 100644 --- a/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt @@ -7,5 +7,5 @@ add_library(win32u_xpsp2 MODULE ${win32u_xpsp2_asm} ${CMAKE_CURRENT_BINARY_DIR}/win32u_xpsp2.def) -set_module_type(win32u_xpsp2 module) +set_module_type(win32u_xpsp2 module IMAGEBASE default) add_dependencies(win32u_xpsp2 psdk) diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake index b72b40b3cd9..6fcf476da69 100644 --- a/sdk/cmake/CMakeMacros.cmake +++ b/sdk/cmake/CMakeMacros.cmake @@ -643,7 +643,9 @@ function(set_module_type MODULE TYPE) # Set base address if(__module_IMAGEBASE) - set_image_base(${MODULE} ${__module_IMAGEBASE}) + if(NOT ${__module_IMAGEBASE} STREQUAL "default") + set_image_base(${MODULE} ${__module_IMAGEBASE}) + endif() elseif(${TYPE} STREQUAL win32dll) if(DEFINED baseaddress_${MODULE}) set_image_base(${MODULE} ${baseaddress_${MODULE}}) diff --git a/sdk/tools/gen_baseaddress.py b/sdk/tools/gen_baseaddress.py index f9d9f293543..e54afcfdf25 100644 --- a/sdk/tools/gen_baseaddress.py +++ b/sdk/tools/gen_baseaddress.py @@ -205,7 +205,10 @@ EXCLUDE = ( 'dllexport_test_dll1.dll', 'dllexport_test_dll2.dll', 'dllimport_test.dll', + 'localspl_apitest.dll', 'MyEventProvider.dll', + 'redirtest1.dll', + 'redirtest2.dll', 'w32kdll_2k3sp2.dll', 'w32kdll_ros.dll', 'w32kdll_xpsp2.dll', diff --git a/subsystems/mvdm/samples/testvdd/CMakeLists.txt b/subsystems/mvdm/samples/testvdd/CMakeLists.txt index c813da97c1d..5a4000faba3 100644 --- a/subsystems/mvdm/samples/testvdd/CMakeLists.txt +++ b/subsystems/mvdm/samples/testvdd/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND SOURCE add_library(testvdd MODULE ${SOURCE}) #set_module_type(testvdd win32dll UNICODE ENTRYPOINT VDDInitialize) -set_module_type(testvdd win32dll UNICODE) +set_module_type(testvdd win32dll UNICODE IMAGEBASE default) target_link_libraries(testvdd ${PSEH_LIB})