[SETUPLIB][REACTOS][USETUP] Turn setuplib into a DLL shared between TUI and GUI 1st-stage setups (#7523)

CORE-13525

Notes:
- Most of the exported functions have been turned from default cdecl to explicit stdcall / "NTAPI".
- The two InitializeSetup() phases have been collapsed to make the initialization simpler.

Average reductions (percentages; see PR #7523 for actual numbers):

x86 Debug builds:
reactos.exe: 35.1%
smss.exe   : 39.8%
Total (including setuplib.dll): 17.9%

x86 Release builds:
reactos.exe: 22.3%
smss.exe   : 25.0%
Total (including setuplib.dll): 10.6%

x64 Debug builds:
reactos.exe: 40.6%
smss.exe   : 41.6%
Total (including setuplib.dll): 20.0%

x64 Release builds:
reactos.exe: 22.8%
smss.exe   : 22.3%
Total (including setuplib.dll): 10.1%
This commit is contained in:
Hermès Bélusca-Maïto 2024-11-22 21:45:06 +01:00
parent e51e5de1f8
commit d7c1d220b5
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
35 changed files with 462 additions and 262 deletions

View file

@ -7,6 +7,16 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _SETUPLIB_
#define SPLIBAPI DECLSPEC_IMPORT
#else
#define SPLIBAPI
#endif
/* INCLUDES *****************************************************************/
/* Needed PSDK headers when using this library */
@ -20,9 +30,9 @@
#endif
/* NOTE: Please keep the header inclusion order! */
extern SPLIBAPI BOOLEAN IsUnattendedSetup; // HACK
extern HANDLE ProcessHeap;
/* NOTE: Please keep the header inclusion order! */
#include "errorcode.h"
#include "spapisup/fileqsup.h"
@ -153,19 +163,17 @@ typedef struct _USETUP_DATA
#include "install.h"
// HACK!!
extern BOOLEAN IsUnattendedSetup;
/* FUNCTIONS ****************************************************************/
#include "substset.h"
VOID
NTAPI
CheckUnattendedSetup(
IN OUT PUSETUP_DATA pSetupData);
VOID
NTAPI
InstallSetupInfFile(
IN OUT PUSETUP_DATA pSetupData);
@ -182,6 +190,7 @@ LoadSetupInf(
#define ERROR_SYSTEM_PARTITION_NOT_FOUND (ERROR_LAST_ERROR_CODE + 1)
BOOLEAN
NTAPI
InitSystemPartition(
/**/_In_ PPARTLIST PartitionList, /* HACK HACK! */
/**/_In_ PPARTENTRY InstallPartition, /* HACK HACK! */
@ -200,10 +209,12 @@ InitSystemPartition(
(isalnum(c) || (c) == L'.' || (c) == L'\\' || (c) == L'-' || (c) == L'_')
BOOLEAN
NTAPI
IsValidInstallDirectory(
_In_ PCWSTR InstallDir);
NTSTATUS
NTAPI
InitDestinationPaths(
_Inout_ PUSETUP_DATA pSetupData,
_In_ PCWSTR InstallationDir,
@ -211,11 +222,15 @@ InitDestinationPaths(
// NTSTATUS
ERROR_NUMBER
NTAPI
InitializeSetup(
IN OUT PUSETUP_DATA pSetupData,
IN ULONG InitPhase);
_Inout_ PUSETUP_DATA pSetupData,
_In_opt_ PSETUP_ERROR_ROUTINE ErrorRoutine,
_In_ PSPFILE_EXPORTS pSpFileExports,
_In_ PSPINF_EXPORTS pSpInfExports);
VOID
NTAPI
FinishSetup(
IN OUT PUSETUP_DATA pSetupData);
@ -236,6 +251,7 @@ typedef VOID
(__cdecl *PREGISTRY_STATUS_ROUTINE)(IN REGISTRY_STATUS, ...);
ERROR_NUMBER
NTAPI
UpdateRegistry(
IN OUT PUSETUP_DATA pSetupData,
/**/IN BOOLEAN RepairUpdateFlag, /* HACK HACK! */
@ -245,4 +261,8 @@ UpdateRegistry(
IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL,
IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL);
#ifdef __cplusplus
}
#endif
/* EOF */