[CMAKE] Add support for "IMAGEBASE default" and use it for test/sample dlls

This commit is contained in:
Timo Kreuzer 2023-11-07 18:50:52 +02:00
parent 58f1201eae
commit 2b7246fd3c
8 changed files with 13 additions and 8 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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}})

View file

@ -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',

View file

@ -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})