[CMLIB/NTOSKRNL]:

- Move cmindex.c and cmname.c to cmlib, because bootmgr/winload use the kernel's cm implementation, unlike our freeldr which uses an almost copy-pasted-but-not-shared-because-hey-why-not-have-to-fix-the-bugs-in-two-places-instead-of-just-one implementation.
- Minor fixes to headers to allow those two files to be used/built outside of ntoskrnl.

svn path=/trunk/; revision=69444
This commit is contained in:
Alex Ionescu 2015-10-04 20:18:49 +00:00
parent f7a1eb0c1a
commit 85b39039dd
5 changed files with 94 additions and 37 deletions

View file

@ -6,6 +6,8 @@ add_definitions(
list(APPEND SOURCE list(APPEND SOURCE
cminit.c cminit.c
cmindex.c
cmname.c
cmtools.c cmtools.c
hivebin.c hivebin.c
hivecell.c hivecell.c

View file

@ -1,14 +1,14 @@
/* /*
* PROJECT: ReactOS Kernel * PROJECT: ReactOS Registry Library
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/config/cmindex.c * FILE: lib/cmlib/cmindex.c
* PURPOSE: Configuration Manager - Cell Indexes * PURPOSE: Configuration Manager - Cell Indexes
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include "ntoskrnl.h" #include "cmlib.h"
#define NDEBUG #define NDEBUG
#include "debug.h" #include "debug.h"

View file

@ -55,6 +55,8 @@
#define OBJ_CASE_INSENSITIVE 0x00000040L #define OBJ_CASE_INSENSITIVE 0x00000040L
#define USHORT_MAX USHRT_MAX #define USHORT_MAX USHRT_MAX
#define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
VOID NTAPI VOID NTAPI
KeQuerySystemTime( KeQuerySystemTime(
OUT PLARGE_INTEGER CurrentTime); OUT PLARGE_INTEGER CurrentTime);
@ -114,6 +116,8 @@
#include <ntdef.h> #include <ntdef.h>
#include <ntddk.h> #include <ntddk.h>
#undef PAGED_CODE
#define PAGED_CODE()
/* Prevent inclusion of Windows headers through <wine/unicode.h> */ /* Prevent inclusion of Windows headers through <wine/unicode.h> */
#define _WINDEF_ #define _WINDEF_
@ -248,7 +252,7 @@ typedef struct _HV_TRACK_CELL_REF
extern ULONG CmlibTraceLevel; extern ULONG CmlibTraceLevel;
/* /*
* Public functions. * Public Hive functions.
*/ */
NTSTATUS CMAPI NTSTATUS CMAPI
HvInitialize( HvInitialize(
@ -336,6 +340,41 @@ BOOLEAN CMAPI
HvWriteHive( HvWriteHive(
PHHIVE RegistryHive); PHHIVE RegistryHive);
BOOLEAN
CMAPI
HvTrackCellRef(
PHV_TRACK_CELL_REF CellRef,
PHHIVE Hive,
HCELL_INDEX Cell
);
VOID
CMAPI
HvReleaseFreeCellRefArray(
PHV_TRACK_CELL_REF CellRef
);
/*
* Private functions.
*/
PHBIN CMAPI
HvpAddBin(
PHHIVE RegistryHive,
ULONG Size,
HSTORAGE_TYPE Storage);
NTSTATUS CMAPI
HvpCreateHiveFreeCellList(
PHHIVE Hive);
ULONG CMAPI
HvpHiveHeaderChecksum(
PHBASE_BLOCK HiveHeader);
/* Old-style Public "Cmlib" functions */
BOOLEAN CMAPI BOOLEAN CMAPI
CmCreateRootNode( CmCreateRootNode(
PHHIVE Hive, PHHIVE Hive,
@ -389,36 +428,54 @@ CmCopyKeyValueName(
_Out_ PWCHAR ValueNameBuffer, _Out_ PWCHAR ValueNameBuffer,
_Inout_ ULONG BufferLength); _Inout_ ULONG BufferLength);
BOOLEAN /* NT-style Public Cm functions */
CMAPI
HvTrackCellRef( LONG
PHV_TRACK_CELL_REF CellRef, NTAPI
PHHIVE Hive, CmpCompareCompressedName(
HCELL_INDEX Cell IN PCUNICODE_STRING SearchName,
); IN PWCHAR CompressedName,
IN ULONG NameLength
);
USHORT
NTAPI
CmpCompressedNameSize(
IN PWCHAR Name,
IN ULONG Length
);
HCELL_INDEX
NTAPI
CmpFindSubKeyByName(
IN PHHIVE Hive,
IN PCM_KEY_NODE Parent,
IN PCUNICODE_STRING SearchName
);
/* To be implemented by the user of this library */
PVOID
NTAPI
CmpAllocate(
IN SIZE_T Size,
IN BOOLEAN Paged,
IN ULONG Tag
);
VOID VOID
CMAPI NTAPI
HvReleaseFreeCellRefArray( CmpFree(
PHV_TRACK_CELL_REF CellRef IN PVOID Ptr,
); IN ULONG Quota
);
/* VOID
* Private functions. NTAPI
*/ CmpCopyCompressedName(
IN PWCHAR Destination,
PHBIN CMAPI IN ULONG DestinationLength,
HvpAddBin( IN PWCHAR Source,
PHHIVE RegistryHive, IN ULONG SourceLength
ULONG Size, );
HSTORAGE_TYPE Storage);
NTSTATUS CMAPI
HvpCreateHiveFreeCellList(
PHHIVE Hive);
ULONG CMAPI
HvpHiveHeaderChecksum(
PHBASE_BLOCK HiveHeader);
#endif /* _CMLIB_H_ */ #endif /* _CMLIB_H_ */

View file

@ -1,14 +1,14 @@
/* /*
* PROJECT: ReactOS Kernel * PROJECT: ReactOS Registry Library
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: ntoskrnl/config/cmname.c * FILE: lib/cmlib/cmname.c
* PURPOSE: Configuration Manager - Name Management * PURPOSE: Configuration Manager - Name Management
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include "ntoskrnl.h" #include "cmlib.h"
#define NDEBUG #define NDEBUG
#include "debug.h" #include "debug.h"

View file

@ -56,13 +56,11 @@ list(APPEND SOURCE
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmdelay.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmdelay.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmhook.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmhook.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmhvlist.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmhvlist.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmindex.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cminit.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cminit.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmkcbncb.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmkcbncb.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmkeydel.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmkeydel.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmlazy.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmlazy.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmmapvw.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmmapvw.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmname.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmnotify.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmnotify.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmparse.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmparse.c
${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmquota.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/cmquota.c