mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 09:11:25 +00:00
[SETUPLIB] Add a setuplib_static library, used for the dll and the unit-tests.
Since the setuplib.dll isn't available after installing ReactOS, build
instead a static library that is then used for the dll, and linked into
the setuplib_unittest, so that it can be run in our test-suite.
Addendum to commit d7c1d220
.
This commit is contained in:
parent
2c2cdfddd3
commit
f135cab83e
4 changed files with 58 additions and 31 deletions
|
@ -35,14 +35,18 @@ list(APPEND SOURCE
|
||||||
setuplib.c
|
setuplib.c
|
||||||
precomp.h)
|
precomp.h)
|
||||||
|
|
||||||
|
# Static library used for the dll and for setuplib_unittest.
|
||||||
|
add_library(setuplib_static ${SOURCE})
|
||||||
|
add_pch(setuplib_static precomp.h SOURCE)
|
||||||
|
add_dependencies(setuplib_static xdk) # psdk
|
||||||
|
|
||||||
add_library(setuplib SHARED
|
add_library(setuplib SHARED
|
||||||
${SOURCE}
|
main.c
|
||||||
setuplib.rc
|
setuplib.rc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/setuplib.def)
|
${CMAKE_CURRENT_BINARY_DIR}/setuplib.def)
|
||||||
|
target_link_libraries(setuplib setuplib_static)
|
||||||
|
|
||||||
add_pch(setuplib precomp.h SOURCE)
|
|
||||||
add_dependencies(setuplib xdk) # psdk
|
add_dependencies(setuplib xdk) # psdk
|
||||||
|
|
||||||
set_module_type(setuplib nativedll)
|
set_module_type(setuplib nativedll)
|
||||||
target_link_libraries(setuplib ext2lib vfatlib btrfslib ${PSEH_LIB})
|
target_link_libraries(setuplib ext2lib vfatlib btrfslib ${PSEH_LIB})
|
||||||
add_importlibs(setuplib ntdll)
|
add_importlibs(setuplib ntdll)
|
||||||
|
|
49
base/setup/lib/main.c
Normal file
49
base/setup/lib/main.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS Setup Library
|
||||||
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||||
|
* PURPOSE: DLL Main Routine
|
||||||
|
* COPYRIGHT: Copyright 2025 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
|
/* PSDK/NDK Headers */
|
||||||
|
#define WIN32_NO_STATUS
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
|
||||||
|
#define NTOS_MODE_USER
|
||||||
|
// #include <ndk/umfuncs.h>
|
||||||
|
#include <ndk/rtlfuncs.h>
|
||||||
|
|
||||||
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
extern HANDLE ProcessHeap;
|
||||||
|
|
||||||
|
/* ENTRY-POINT ***************************************************************/
|
||||||
|
|
||||||
|
/* Declared in ndk/umfuncs.h */
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
LdrDisableThreadCalloutsForDll(
|
||||||
|
_In_ PVOID BaseAddress);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
DllMain(
|
||||||
|
_In_ HINSTANCE hDll,
|
||||||
|
_In_ ULONG dwReason,
|
||||||
|
_In_opt_ PVOID pReserved)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(pReserved);
|
||||||
|
|
||||||
|
if (dwReason == DLL_PROCESS_ATTACH)
|
||||||
|
{
|
||||||
|
LdrDisableThreadCalloutsForDll(hDll);
|
||||||
|
ProcessHeap = RtlGetProcessHeap();
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
|
@ -1405,31 +1405,4 @@ Cleanup:
|
||||||
return ErrorNumber;
|
return ErrorNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ENTRY-POINT ***************************************************************/
|
|
||||||
|
|
||||||
/* Declared in ndk/umfuncs.h */
|
|
||||||
NTSTATUS
|
|
||||||
NTAPI
|
|
||||||
LdrDisableThreadCalloutsForDll(
|
|
||||||
_In_ PVOID BaseAddress);
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
NTAPI
|
|
||||||
DllMain(
|
|
||||||
_In_ HINSTANCE hDll,
|
|
||||||
_In_ ULONG dwReason,
|
|
||||||
_In_opt_ PVOID pReserved)
|
|
||||||
{
|
|
||||||
UNREFERENCED_PARAMETER(pReserved);
|
|
||||||
|
|
||||||
if (dwReason == DLL_PROCESS_ATTACH)
|
|
||||||
{
|
|
||||||
LdrDisableThreadCalloutsForDll(hDll);
|
|
||||||
ProcessHeap = RtlGetProcessHeap();
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -11,7 +11,8 @@ list(APPEND SOURCE
|
||||||
precomp.h)
|
precomp.h)
|
||||||
|
|
||||||
add_executable(setuplib_unittest ${SOURCE})
|
add_executable(setuplib_unittest ${SOURCE})
|
||||||
|
target_link_libraries(setuplib_unittest setuplib_static ${PSEH_LIB})
|
||||||
set_module_type(setuplib_unittest win32cui)
|
set_module_type(setuplib_unittest win32cui)
|
||||||
add_importlibs(setuplib_unittest setuplib msvcrt kernel32)
|
add_importlibs(setuplib_unittest msvcrt kernel32 ntdll)
|
||||||
#add_pch(setuplib_unittest precomp.h SOURCE)
|
#add_pch(setuplib_unittest precomp.h SOURCE)
|
||||||
add_rostests_file(TARGET setuplib_unittest)
|
add_rostests_file(TARGET setuplib_unittest)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue