https://git.reactos.org/?p=reactos.git;a=commitdiff;h=86f31289ef9c05d59e1f28...
commit 86f31289ef9c05d59e1f285d2a364ac5b52aaa0c Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Mon Jan 15 18:09:53 2018 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Tue Nov 6 00:04:19 2018 +0100
[BOOTDATA][SETUPLIB][REACTOS] INF support fixes.
- BOOTDATA: Use standard INF signature string, so that they can be opened successfully using ReactOS' or Windows' setupapi.dll with the INF_STYLE_WIN4 style.
- SETUPLIB: Use the correct INF_STYLE_* INF styles in SpInfOpenInfFile() calls.
- REACTOS : Switch thread locale to user-specified LocaleId when calling SetupOpenInfFileW(), so that the correct localized strings are used. --- base/setup/lib/install.c | 2 +- base/setup/lib/setuplib.c | 5 +++-- base/setup/reactos/spapisup/infsupp.c | 31 +++++++++++++++++++++++++------ boot/bootdata/caroots.inf | 2 +- boot/bootdata/hivebcd.inf | 2 +- boot/bootdata/hivecls.inf | 2 +- boot/bootdata/hivedef.inf | 2 +- boot/bootdata/hiveinst.inf | 2 +- boot/bootdata/hivesft.inf | 2 +- boot/bootdata/hivesys.inf | 2 +- boot/bootdata/livecd.inf | 2 +- boot/bootdata/packages/reactos.dff.in | 3 ++- boot/bootdata/setupreg.inf | 2 +- boot/bootdata/txtsetup.sif | 3 ++- 14 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/base/setup/lib/install.c b/base/setup/lib/install.c index f2875d0716..a9a489bf8c 100644 --- a/base/setup/lib/install.c +++ b/base/setup/lib/install.c @@ -783,7 +783,7 @@ PrepareFileCopy(
InfHandle = SpInfOpenInfFile(PathBuffer, NULL, - INF_STYLE_OLDNT, // INF_STYLE_WIN4, + INF_STYLE_WIN4, pSetupData->LanguageId, &ErrorLine); } diff --git a/base/setup/lib/setuplib.c b/base/setup/lib/setuplib.c index 9a7ea88a9a..c63c5dfb87 100644 --- a/base/setup/lib/setuplib.c +++ b/base/setup/lib/setuplib.c @@ -516,7 +516,7 @@ LoadSetupInf( pSetupData->SetupInf = SpInfOpenInfFile(FileNameBuffer, NULL, - /* INF_STYLE_WIN4 | */ INF_STYLE_OLDNT, + INF_STYLE_WIN4, pSetupData->LanguageId, &ErrorLine); if (pSetupData->SetupInf == INVALID_HANDLE_VALUE) @@ -531,7 +531,8 @@ LoadSetupInf( return ERROR_CORRUPT_TXTSETUPSIF;
/* Check 'Signature' string */ - if (_wcsicmp(Value, L"$ReactOS$") != 0) + if (_wcsicmp(Value, L"$ReactOS$") != 0 && + _wcsicmp(Value, L"$Windows NT$") != 0) { INF_FreeData(Value); return ERROR_SIGNATURE_TXTSETUPSIF; diff --git a/base/setup/reactos/spapisup/infsupp.c b/base/setup/reactos/spapisup/infsupp.c index c95aad8e6e..7c40e8421e 100644 --- a/base/setup/reactos/spapisup/infsupp.c +++ b/base/setup/reactos/spapisup/infsupp.c @@ -10,6 +10,7 @@ /* INCLUDES ******************************************************************/
#include "reactos.h" +#include <winnls.h>
#define NDEBUG #include <debug.h> @@ -38,10 +39,10 @@ SetupOpenInfFileExW( IN LCID LocaleId, OUT PUINT ErrorLine) { + HINF InfHandle; + LCID OldLocaleId; WCHAR Win32FileName[MAX_PATH];
- UNREFERENCED_PARAMETER(LocaleId); - /* * SetupOpenInfFileExW is called within setuplib with NT paths, however * the Win32 SetupOpenInfFileW API only takes Win32 paths. We therefore @@ -54,10 +55,28 @@ SetupOpenInfFileExW( return INVALID_HANDLE_VALUE; }
- return SetupOpenInfFileW(Win32FileName, - InfClass, - InfStyle, - ErrorLine); + /* + * Because SetupAPI's SetupOpenInfFileW() function does not allow the user + * to specify a given LCID to use to load localized string substitutions, + * we temporarily change the current thread locale before calling + * SetupOpenInfFileW(). When we have finished we restore the original + * thread locale. + */ + OldLocaleId = GetThreadLocale(); + if (OldLocaleId != LocaleId) + SetThreadLocale(LocaleId); + + /* Load the INF file */ + InfHandle = SetupOpenInfFileW(Win32FileName, + InfClass, + InfStyle, + ErrorLine); + + /* Restore the original thread locale */ + if (OldLocaleId != LocaleId) + SetThreadLocale(OldLocaleId); + + return InfHandle; }
diff --git a/boot/bootdata/caroots.inf b/boot/bootdata/caroots.inf index a7d09f9477..4c30bc9751 100644 --- a/boot/bootdata/caroots.inf +++ b/boot/bootdata/caroots.inf @@ -5,7 +5,7 @@ ; Data licensed under MPL 2.0 https://mozilla.org/MPL/2.0/
[Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$"
[AddReg] ; "SSL.com EV Root Certification Authority ECC" (664 bytes) diff --git a/boot/bootdata/hivebcd.inf b/boot/bootdata/hivebcd.inf index a7d904a3c6..0782558eb0 100644 --- a/boot/bootdata/hivebcd.inf +++ b/boot/bootdata/hivebcd.inf @@ -1,5 +1,5 @@ [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$"
[AddReg] BCD,"BCD00000000\Description\Control","System",0x00010001,1 diff --git a/boot/bootdata/hivecls.inf b/boot/bootdata/hivecls.inf index 4a953a1f86..446da70253 100644 --- a/boot/bootdata/hivecls.inf +++ b/boot/bootdata/hivecls.inf @@ -1,5 +1,5 @@ [Version] -Signature="$ReactOS$" +Signature = "$Windows NT$"
[AddReg] HKLM,"SOFTWARE\Classes",,0x00000010 diff --git a/boot/bootdata/hivedef.inf b/boot/bootdata/hivedef.inf index 618635a7d7..91ce76e328 100644 --- a/boot/bootdata/hivedef.inf +++ b/boot/bootdata/hivedef.inf @@ -1,5 +1,5 @@ [Version] -Signature="$ReactOS$" +Signature = "$Windows NT$"
[AddReg]
diff --git a/boot/bootdata/hiveinst.inf b/boot/bootdata/hiveinst.inf index d815185b3a..e4066a7401 100644 --- a/boot/bootdata/hiveinst.inf +++ b/boot/bootdata/hiveinst.inf @@ -1,5 +1,5 @@ [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$"
[AddReg] ; Enable _one_ driver per section by removing the leading semicolon. diff --git a/boot/bootdata/hivesft.inf b/boot/bootdata/hivesft.inf index e96e5de938..6ccd294c22 100644 --- a/boot/bootdata/hivesft.inf +++ b/boot/bootdata/hivesft.inf @@ -1,5 +1,5 @@ [Version] -Signature="$ReactOS$" +Signature = "$Windows NT$"
[AddReg]
diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index 76491a5d2e..41da57681e 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -1,5 +1,5 @@ [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$"
[AddReg]
diff --git a/boot/bootdata/livecd.inf b/boot/bootdata/livecd.inf index f826a7f6c4..fda2356a97 100644 --- a/boot/bootdata/livecd.inf +++ b/boot/bootdata/livecd.inf @@ -1,5 +1,5 @@ [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$"
[DelReg]
diff --git a/boot/bootdata/packages/reactos.dff.in b/boot/bootdata/packages/reactos.dff.in index f122a8f528..9424840238 100644 --- a/boot/bootdata/packages/reactos.dff.in +++ b/boot/bootdata/packages/reactos.dff.in @@ -11,7 +11,8 @@
.InfBegin [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$" +;Signature = "$ReactOS$"
; Directories relative to the installation directory. ; For specifying absolute directories, use the SystemPartitionFiles section, diff --git a/boot/bootdata/setupreg.inf b/boot/bootdata/setupreg.inf index 7dbf932b56..197918f13b 100644 --- a/boot/bootdata/setupreg.inf +++ b/boot/bootdata/setupreg.inf @@ -1,5 +1,5 @@ [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$"
[DelReg]
diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif index 808c2e2bc7..03609d2fcf 100644 --- a/boot/bootdata/txtsetup.sif +++ b/boot/bootdata/txtsetup.sif @@ -1,5 +1,6 @@ [Version] -Signature = "$ReactOS$" +Signature = "$Windows NT$" +;Signature = "$ReactOS$"
; ; The [SourceDisksNames] section lists all the available installation media