mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 20:36:35 +00:00
- Add debugging macros support to CmLib (to use, set the CmlibTraceLevel debugging mask in cminit.c).
- Add tracing to hivecell.c. svn path=/trunk/; revision=31213
This commit is contained in:
parent
4aae9354ae
commit
61fab841f2
5 changed files with 58 additions and 1 deletions
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "cmlib.h"
|
#include "cmlib.h"
|
||||||
|
|
||||||
|
ULONG CmlibTraceLevel = 0;
|
||||||
|
|
||||||
BOOLEAN CMAPI
|
BOOLEAN CMAPI
|
||||||
CmCreateRootNode(
|
CmCreateRootNode(
|
||||||
PHHIVE Hive,
|
PHHIVE Hive,
|
||||||
|
|
|
@ -25,6 +25,30 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Debug support switch
|
||||||
|
//
|
||||||
|
#define _CMLIB_DEBUG_ 1
|
||||||
|
|
||||||
|
//
|
||||||
|
// These define the Debug Masks Supported
|
||||||
|
//
|
||||||
|
#define CMLIB_HCELL_DEBUG 0x01
|
||||||
|
|
||||||
|
//
|
||||||
|
// Debug/Tracing support
|
||||||
|
//
|
||||||
|
#if _CMLIB_DEBUG_
|
||||||
|
#ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
|
||||||
|
#define CMLTRACE DbgPrintEx
|
||||||
|
#else
|
||||||
|
#define CMLTRACE(x, ...) \
|
||||||
|
if (x & CmlibTraceLevel) DbgPrint(__VA_ARGS__)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define CMLTRACE(x, ...) DPRINT(__VA_ARGS__)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _TYPEDEFS_HOST_H
|
#ifndef _TYPEDEFS_HOST_H
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
|
|
||||||
|
@ -158,6 +182,7 @@ typedef struct _CMHIVE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern ULONG CmlibTraceLevel;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public functions.
|
* Public functions.
|
||||||
|
|
|
@ -16,6 +16,9 @@ HvpGetCellHeader(
|
||||||
{
|
{
|
||||||
PVOID Block;
|
PVOID Block;
|
||||||
|
|
||||||
|
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx\n",
|
||||||
|
__FUNCTION__, RegistryHive, CellIndex);
|
||||||
|
|
||||||
ASSERT(CellIndex != HCELL_NIL);
|
ASSERT(CellIndex != HCELL_NIL);
|
||||||
if (!RegistryHive->Flat)
|
if (!RegistryHive->Flat)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +109,9 @@ HvMarkCellDirty(
|
||||||
|
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
||||||
|
|
||||||
|
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx, HoldingLock %b\n",
|
||||||
|
__FUNCTION__, RegistryHive, CellIndex, HoldingLock);
|
||||||
|
|
||||||
if ((CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT != Stable)
|
if ((CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT != Stable)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -321,6 +327,9 @@ HvAllocateCell(
|
||||||
|
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
||||||
|
|
||||||
|
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, Size %x, %s, Vicinity %08lx\n",
|
||||||
|
__FUNCTION__, RegistryHive, Size, (Storage == 0) ? "Stable" : "Volatile", Vicinity);
|
||||||
|
|
||||||
/* Round to 16 bytes multiple. */
|
/* Round to 16 bytes multiple. */
|
||||||
Size = ROUND_UP(Size + sizeof(HCELL), 16);
|
Size = ROUND_UP(Size + sizeof(HCELL), 16);
|
||||||
|
|
||||||
|
@ -356,6 +365,9 @@ HvAllocateCell(
|
||||||
FreeCell->Size = -FreeCell->Size;
|
FreeCell->Size = -FreeCell->Size;
|
||||||
RtlZeroMemory(FreeCell + 1, Size - sizeof(HCELL));
|
RtlZeroMemory(FreeCell + 1, Size - sizeof(HCELL));
|
||||||
|
|
||||||
|
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - CellIndex %08lx\n",
|
||||||
|
__FUNCTION__, FreeCellOffset);
|
||||||
|
|
||||||
return FreeCellOffset;
|
return FreeCellOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +385,9 @@ HvReallocateCell(
|
||||||
|
|
||||||
ASSERT(CellIndex != HCELL_NIL);
|
ASSERT(CellIndex != HCELL_NIL);
|
||||||
|
|
||||||
|
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx, Size %x\n",
|
||||||
|
__FUNCTION__, RegistryHive, CellIndex, Size);
|
||||||
|
|
||||||
Storage = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
|
Storage = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
|
||||||
|
|
||||||
OldCell = HvGetCell(RegistryHive, CellIndex);
|
OldCell = HvGetCell(RegistryHive, CellIndex);
|
||||||
|
@ -416,6 +431,9 @@ HvFreeCell(
|
||||||
|
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
||||||
|
|
||||||
|
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx\n",
|
||||||
|
__FUNCTION__, RegistryHive, CellIndex);
|
||||||
|
|
||||||
Free = HvpGetCellHeader(RegistryHive, CellIndex);
|
Free = HvpGetCellHeader(RegistryHive, CellIndex);
|
||||||
|
|
||||||
ASSERT(Free->Size < 0);
|
ASSERT(Free->Size < 0);
|
||||||
|
|
|
@ -163,7 +163,7 @@ HvpWriteHive(
|
||||||
RegistryHive->BaseBlock->Type = HFILE_TYPE_PRIMARY;
|
RegistryHive->BaseBlock->Type = HFILE_TYPE_PRIMARY;
|
||||||
RegistryHive->BaseBlock->Sequence1++;
|
RegistryHive->BaseBlock->Sequence1++;
|
||||||
RegistryHive->BaseBlock->CheckSum =
|
RegistryHive->BaseBlock->CheckSum =
|
||||||
HvpHiveHeaderChecksum(RegistryHive->BaseBlock);
|
HvpHiveHeaderChecksum(RegistryHive->BaseBlock);
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
FileOffset = 0;
|
FileOffset = 0;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "mkhive.h"
|
#include "mkhive.h"
|
||||||
#include <bitmap.c>
|
#include <bitmap.c>
|
||||||
|
@ -157,3 +158,14 @@ ExFreePool(
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ULONG
|
||||||
|
__cdecl
|
||||||
|
DbgPrint(
|
||||||
|
IN CHAR *Format,
|
||||||
|
IN ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, Format);
|
||||||
|
vprintf(Format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue