Author: hbelusca
Date: Fri Jul 14 23:16:21 2017
New Revision: 75346
URL:
http://svn.reactos.org/svn/reactos?rev=75346&view=rev
Log:
[USETUP][SETUPLIB]: Improve how the Setup* INF APIs are interfaced in the code.
Define prototypes compatibles (including their calling convention) to the ones defined by
setupapi (.h/.dll) so that it can be possible to either use
an internal implementation of these functions (via the inflib library), as currently done,
or using imported setupapi functions, as would be done by
the future 1st-stage GUI installer.
[SETUPLIB]: Cleanup the registry.c file and use the infsupp.h header.
Fixes build that was technically broken since r75247.
Added:
branches/setup_improvements/base/setup/lib/infsupp.h (with props)
Modified:
branches/setup_improvements/base/setup/lib/registry.c
branches/setup_improvements/base/setup/usetup/CMakeLists.txt
branches/setup_improvements/base/setup/usetup/inffile.c
branches/setup_improvements/base/setup/usetup/inffile.h
Added: branches/setup_improvements/base/setup/lib/infsupp.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/infsupp.h (added)
+++ branches/setup_improvements/base/setup/lib/infsupp.h [iso-8859-1] Fri Jul 14 23:16:21
2017
@@ -0,0 +1,53 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Setup Library
+ * FILE: base/setup/lib/infsupp.h
+ * PURPOSE: Interfacing with Setup* API .inf files support functions
+ * PROGRAMMER: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#pragma once
+
+// #ifndef __REACTOS__
+
+#define _SETUPAPI_
+#include <setupapi.h>
+
+/* Lower the MAX_INF_STRING_LENGTH value in order to avoid too much stack usage */
+#undef MAX_INF_STRING_LENGTH
+#define MAX_INF_STRING_LENGTH 1024 // Still larger than in infcommon.h
+
+// #else /* __REACTOS__ */
+
+// /* Functions from the INFLIB library */
+// #include <infcommon.h>
+
+#define INF_STYLE_WIN4 0x00000002
+
+#if 0
+/* FIXME: this structure is the one used in inflib, not in setupapi
+ * Delete it once we don't use inflib anymore */
+typedef struct _INFCONTEXT
+{
+ PVOID Inf;
+ PVOID CurrentInf;
+ PVOID Section;
+ PVOID Line;
+} INFCONTEXT;
+#else
+C_ASSERT(sizeof(INFCONTEXT) == 2 * sizeof(PVOID) + 2 * sizeof(UINT));
+#endif
+
+// #endif
+
+/* SetupOpenInfFileW with support for a user-provided LCID */
+HINF
+WINAPI
+SetupOpenInfFileExW(
+ IN PCWSTR FileName,
+ IN PCWSTR InfClass,
+ IN DWORD InfStyle,
+ IN LCID LocaleId,
+ OUT PUINT ErrorLine);
+
+/* EOF */
Propchange: branches/setup_improvements/base/setup/lib/infsupp.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/setup_improvements/base/setup/lib/registry.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/l…
==============================================================================
--- branches/setup_improvements/base/setup/lib/registry.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/lib/registry.c [iso-8859-1] Fri Jul 14 23:16:21
2017
@@ -29,96 +29,13 @@
#include "precomp.h"
#include "filesup.h"
+#include "infsupp.h"
#include "regutil.h"
#include "registry.h"
#define NDEBUG
#include <debug.h>
-
-
-/*
- * INF stuff -- Check usetup/inffile.h
- */
-// #include <infcommon.h>
-#include <setupapi.h>
-
-extern LONG InfGetFieldCount(PINFCONTEXT Context);
-extern BOOLEAN InfGetIntField(PINFCONTEXT Context,
- ULONG FieldIndex,
- INT *IntegerValue);
-extern BOOL
-WINAPI
-InfpFindFirstLineW(
- IN HINF InfHandle,
- IN PCWSTR Section,
- IN PCWSTR Key,
- IN OUT PINFCONTEXT Context);
-
-extern VOID InfCloseFile(HINF InfHandle);
-extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
- PINFCONTEXT ContextOut);
-extern BOOLEAN InfGetBinaryField(PINFCONTEXT Context,
- ULONG FieldIndex,
- PUCHAR ReturnBuffer,
- ULONG ReturnBufferSize,
- PULONG RequiredSize);
-extern BOOLEAN InfGetMultiSzField(PINFCONTEXT Context,
- ULONG FieldIndex,
- PWSTR ReturnBuffer,
- ULONG ReturnBufferSize,
- PULONG RequiredSize);
-extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
- ULONG FieldIndex,
- PWSTR ReturnBuffer,
- ULONG ReturnBufferSize,
- PULONG RequiredSize);
-
-#define SetupCloseInfFile InfCloseFile
-#define SetupFindNextLine InfFindNextLine
-#define SetupGetBinaryField InfGetBinaryField
-#define SetupGetMultiSzFieldW InfGetMultiSzField
-#define SetupGetStringFieldW InfGetStringField
-
-#define SetupFindFirstLineW InfpFindFirstLineW
-#define SetupGetFieldCount InfGetFieldCount
-#define SetupGetIntField InfGetIntField
-
-// SetupOpenInfFileW with support for a user-provided LCID
-#define SetupOpenInfFileExW InfpOpenInfFileW
-
-HINF
-WINAPI
-InfpOpenInfFileW(
- IN PCWSTR FileName,
- IN PCWSTR InfClass,
- IN DWORD InfStyle,
- IN LCID LocaleId,
- OUT PUINT ErrorLine);
-
-/*******************************************/
-
-
-
-// HACK!! These functions should actually be moved in the setup lib!
-// For the moment, see usetup/filesup.c (or .h)
-#if 1
-
-NTSTATUS
-SetupCopyFile(
- IN PCWSTR SourceFileName,
- IN PCWSTR DestinationFileName,
- IN BOOLEAN FailIfExists);
-
-#define MOVEFILE_REPLACE_EXISTING 1
-
-NTSTATUS
-SetupMoveFile(
- IN PCWSTR ExistingFileName,
- IN PCWSTR NewFileName,
- IN ULONG Flags);
-
-#endif
// #ifdef __REACTOS__
Modified: branches/setup_improvements/base/setup/usetup/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/CMakeLists.txt [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/CMakeLists.txt [iso-8859-1] Fri Jul 14
23:16:21 2017
@@ -38,8 +38,8 @@
endif()
add_executable(usetup ${SOURCE} usetup.rc)
-target_link_libraries(usetup setuplib zlib inflib ext2lib vfatlib)
+add_pch(usetup usetup.h SOURCE)
set_module_type(usetup nativecui)
+target_link_libraries(usetup inflib setuplib zlib ext2lib vfatlib)
add_importlibs(usetup ntdll)
-add_pch(usetup usetup.h SOURCE)
add_cd_file(TARGET usetup DESTINATION reactos/system32 NO_CAB NAME_ON_CD smss.exe FOR
bootcd regtest)
Modified: branches/setup_improvements/base/setup/usetup/inffile.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/inffile.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/inffile.c [iso-8859-1] Fri Jul 14
23:16:21 2017
@@ -21,7 +21,8 @@
* PROJECT: ReactOS text-mode setup
* FILE: base/setup/usetup/inffile.c
* PURPOSE: .inf files support functions
- * PROGRAMMER: Hervé Poussineau
+ * PROGRAMMERS: Hervé Poussineau
+ * Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES ******************************************************************/
@@ -31,13 +32,24 @@
#define NDEBUG
#include <debug.h>
-/* FUNCTIONS *****************************************************************/
-
+/* SETUP* API COMPATIBILITY FUNCTIONS ****************************************/
+
+/* Functions from the INFLIB library */
#ifdef __REACTOS__
-BOOL
-WINAPI
-InfpFindFirstLineW(
+extern VOID InfCloseFile(HINF InfHandle);
+// #define SetupCloseInfFile InfCloseFile
+VOID
+WINAPI
+SetupCloseInfFile(HINF InfHandle)
+{
+ InfCloseFile(InfHandle);
+}
+
+// #define SetupFindFirstLineW InfpFindFirstLineW
+BOOL
+WINAPI
+SetupFindFirstLineW(
IN HINF InfHandle,
IN PCWSTR Section,
IN PCWSTR Key,
@@ -55,10 +67,108 @@
return TRUE;
}
-
+extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
+ PINFCONTEXT ContextOut);
+// #define SetupFindNextLine InfFindNextLine
+BOOL
+WINAPI
+SetupFindNextLine(PINFCONTEXT ContextIn,
+ PINFCONTEXT ContextOut)
+{
+ return !!InfFindNextLine(ContextIn, ContextOut);
+}
+
+extern LONG InfGetFieldCount(PINFCONTEXT Context);
+// #define SetupGetFieldCount InfGetFieldCount
+LONG
+WINAPI
+SetupGetFieldCount(PINFCONTEXT Context)
+{
+ return InfGetFieldCount(Context);
+}
+
+extern BOOLEAN InfGetIntField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ INT *IntegerValue);
+// #define SetupGetIntField InfGetIntField
+BOOLEAN
+WINAPI
+SetupGetIntField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ INT *IntegerValue)
+{
+ return InfGetIntField(Context, FieldIndex, IntegerValue);
+}
+
+extern BOOLEAN InfGetBinaryField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PUCHAR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize);
+// #define SetupGetBinaryField InfGetBinaryField
+BOOL
+WINAPI
+SetupGetBinaryField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PUCHAR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize)
+{
+ return !!InfGetBinaryField(Context,
+ FieldIndex,
+ ReturnBuffer,
+ ReturnBufferSize,
+ RequiredSize);
+}
+
+extern BOOLEAN InfGetMultiSzField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PWSTR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize);
+// #define SetupGetMultiSzFieldW InfGetMultiSzField
+BOOL
+WINAPI
+SetupGetMultiSzFieldW(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PWSTR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize)
+{
+ return !!InfGetMultiSzField(Context,
+ FieldIndex,
+ ReturnBuffer,
+ ReturnBufferSize,
+ RequiredSize);
+}
+
+extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PWSTR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize);
+// #define SetupGetStringFieldW InfGetStringField
+BOOL
+WINAPI
+SetupGetStringFieldW(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PWSTR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize)
+{
+ return !!InfGetStringField(Context,
+ FieldIndex,
+ ReturnBuffer,
+ ReturnBufferSize,
+ RequiredSize);
+}
+
+
+/* SetupOpenInfFileW with support for a user-provided LCID */
+// #define SetupOpenInfFileExW InfpOpenInfFileW
HINF
WINAPI
-InfpOpenInfFileW(
+SetupOpenInfFileExW(
IN PCWSTR FileName,
IN PCWSTR InfClass,
IN DWORD InfStyle,
@@ -84,6 +194,8 @@
#endif /* __REACTOS__ */
+
+/* HELPER FUNCTIONS **********************************************************/
BOOLEAN
INF_GetData(
@@ -141,7 +253,6 @@
#endif /* !__REACTOS__ */
}
-
BOOLEAN
INF_GetDataField(
IN PINFCONTEXT Context,
@@ -182,7 +293,6 @@
#endif /* !__REACTOS__ */
}
-
HINF WINAPI
INF_OpenBufferedFileA(
IN PSTR FileBuffer,
Modified: branches/setup_improvements/base/setup/usetup/inffile.h
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/inffile.h [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/inffile.h [iso-8859-1] Fri Jul 14
23:16:21 2017
@@ -21,7 +21,8 @@
* PROJECT: ReactOS text-mode setup
* FILE: base/setup/usetup/inffile.h
* PURPOSE: .inf files support functions
- * PROGRAMMER: Hervé Poussineau
+ * PROGRAMMERS: Hervé Poussineau
+ * Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
@@ -32,41 +33,8 @@
#else /* __REACTOS__ */
+/* Functions from the INFLIB library */
#include <infcommon.h>
-
-extern VOID InfSetHeap(PVOID Heap);
-extern VOID InfCloseFile(HINF InfHandle);
-extern BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn,
- PINFCONTEXT ContextOut);
-extern BOOLEAN InfGetBinaryField(PINFCONTEXT Context,
- ULONG FieldIndex,
- PUCHAR ReturnBuffer,
- ULONG ReturnBufferSize,
- PULONG RequiredSize);
-extern BOOLEAN InfGetMultiSzField(PINFCONTEXT Context,
- ULONG FieldIndex,
- PWSTR ReturnBuffer,
- ULONG ReturnBufferSize,
- PULONG RequiredSize);
-extern BOOLEAN InfGetStringField(PINFCONTEXT Context,
- ULONG FieldIndex,
- PWSTR ReturnBuffer,
- ULONG ReturnBufferSize,
- PULONG RequiredSize);
-
-#define SetupCloseInfFile InfCloseFile
-#define SetupFindNextLine InfFindNextLine
-#define SetupGetBinaryField InfGetBinaryField
-#define SetupGetMultiSzFieldW InfGetMultiSzField
-#define SetupGetStringFieldW InfGetStringField
-
-
-#define SetupFindFirstLineW InfpFindFirstLineW
-#define SetupGetFieldCount InfGetFieldCount
-#define SetupGetIntField InfGetIntField
-
-// SetupOpenInfFileW with support for a user-provided LCID
-#define SetupOpenInfFileExW InfpOpenInfFileW
#define INF_STYLE_WIN4 0x00000002
@@ -81,17 +49,72 @@
} INFCONTEXT;
C_ASSERT(sizeof(INFCONTEXT) == 2 * sizeof(PVOID) + 2 * sizeof(UINT));
+extern VOID InfSetHeap(PVOID Heap);
+
+// #define SetupCloseInfFile InfCloseFile
+VOID
+WINAPI
+SetupCloseInfFile(HINF InfHandle);
+
+// #define SetupFindFirstLineW InfpFindFirstLineW
BOOL
WINAPI
-InfpFindFirstLineW(
+SetupFindFirstLineW(
IN HINF InfHandle,
IN PCWSTR Section,
IN PCWSTR Key,
IN OUT PINFCONTEXT Context);
+// #define SetupFindNextLine InfFindNextLine
+BOOL
+WINAPI
+SetupFindNextLine(PINFCONTEXT ContextIn,
+ PINFCONTEXT ContextOut);
+
+// #define SetupGetFieldCount InfGetFieldCount
+LONG
+WINAPI
+SetupGetFieldCount(PINFCONTEXT Context);
+
+// #define SetupGetIntField InfGetIntField
+BOOLEAN
+WINAPI
+SetupGetIntField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ INT *IntegerValue);
+
+// #define SetupGetBinaryField InfGetBinaryField
+BOOL
+WINAPI
+SetupGetBinaryField(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PUCHAR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize);
+
+// #define SetupGetMultiSzFieldW InfGetMultiSzField
+BOOL
+WINAPI
+SetupGetMultiSzFieldW(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PWSTR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize);
+
+// #define SetupGetStringFieldW InfGetStringField
+BOOL
+WINAPI
+SetupGetStringFieldW(PINFCONTEXT Context,
+ ULONG FieldIndex,
+ PWSTR ReturnBuffer,
+ ULONG ReturnBufferSize,
+ PULONG RequiredSize);
+
+/* SetupOpenInfFileW with support for a user-provided LCID */
+// #define SetupOpenInfFileExW InfpOpenInfFileW
HINF
WINAPI
-InfpOpenInfFileW(
+SetupOpenInfFileExW(
IN PCWSTR FileName,
IN PCWSTR InfClass,
IN DWORD InfStyle,
@@ -99,6 +122,9 @@
OUT PUINT ErrorLine);
#endif /* __REACTOS__ */
+
+
+/* HELPER FUNCTIONS **********************************************************/
BOOLEAN
INF_GetData(