mirror of
https://github.com/reactos/reactos.git
synced 2024-06-15 00:51:45 +00:00
65ea40f2cb
Ports back a real fix: 0.4.15-dev-1173-gba09834c5e
[PARPORT] Fix I/O port length check Ports back logging and formatting: 0.4.15-dev-6794-g4eace8d762
[IPHLPAPI] Silence obsolete FIXME in GetAdaptersAddresses (#5834) CORE-14388 0.4.15-dev-6438-gb12ab486d8
[MUP] Mute DPRINT1's that slow down shared folder accesses (#5545) CORE-19105 And mutes some other loggings as well for stuff, that I either never want to port back, e.g. the IMM-implementations, or which is not really helpful in the older branches: fixme:(win32ss/user/user32/misc/imm.c:446) WINNLSEnableIME is UNIMPLEMENTED! fixme:(../dll/win32/iphlpapi/address.c:290) GetAdaptersAddresses - Semi Stub: Family 2, Flags 0x0000002e, Reserved 00000000, pAdapterAddress 00000000, pOutBufLen 0143EBD4. (dll/ntdll/ldr/ldrinit.c:1649) LdrpInitializeProcessCompat: Not applying automatic fix for winver 0xa00 due to policy (win32ss/gdi/gdi32/objects/text.c:543) GdiBCExtTextOut nothing when browsing the startmenu: fixme:(dll/win32/comctl32/toolbar.c:394) [00080086] TBSTYLE_REGISTERDROP not implemented fixme:(dll/win32/comctl32/toolbar.c:5636) [00080086] response 2045774661 not handled to NM_CUSTOMDRAW (CDDS_PREERASE) fixme:(dll/win32/comctl32/toolbar.c:5673) [00080086] response 3225142 not handled to NM_CUSTOMDRAW (CDDS_POSTERASE) fixme:(dll/win32/comctl32/toolbar.c:5636) [000200BA] response 9 not handled to NM_CUSTOMDRAW (CDDS_PREERASE) fixme:(dll/win32/comctl32/toolbar.c:5636) [00080086] response 2288892 not handled to NM_CUSTOMDRAW (CDDS_PREERASE) fixme:(dll/win32/comctl32/toolbar.c:5673) [00080086] response 3291448 not handled to NM_CUSTOMDRAW (CDDS_POSTERASE) and a bigger block regarding the parallel port during booting: (drivers/parallel/parport/parport.c:127) Parport DriverEntry (drivers/parallel/parport/fdo.c:391) AddDevice(B0B50548 B0FED980) (drivers/parallel/parport/fdo.c:25) AddDeviceInternal() (drivers/parallel/parport/fdo.c:513) FdoPnp() (drivers/parallel/parport/fdo.c:582) IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS (drivers/parallel/parport/fdo.c:513) FdoPnp() (drivers/parallel/parport/fdo.c:546) IRP_MJ_PNP / IRP_MN_START_DEVICE (drivers/parallel/parport/misc.c:42) Calling lower device B0FED980 (drivers/parallel/parport/fdo.c:116) FdoStartDevice () (drivers/parallel/parport/fdo.c:160) Port: BaseAddress 0x378 Length 8 (drivers/parallel/parport/fdo.c:160) Port: BaseAddress 0x778 Length 8 (drivers/parallel/parport/fdo.c:174) Interrupt: Level 20 Vector 55 (drivers/parallel/parport/fdo.c:195) New LPT port: Base 0x378 (drivers/parallel/parport/fdo.c:513) FdoPnp() (drivers/parallel/parport/fdo.c:586) Unknown minor function 0x9 (drivers/parallel/parport/fdo.c:513) FdoPnp() (drivers/parallel/parport/fdo.c:586) Unknown minor function 0x14 (drivers/parallel/parport/fdo.c:513) FdoPnp() (drivers/parallel/parport/fdo.c:564) IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations (drivers/parallel/parport/fdo.c:351) FdoQueryBusRelations() (drivers/parallel/parport/fdo.c:233) FdoCreateRawParallelPdo() (drivers/parallel/parport/fdo.c:378) Done (drivers/parallel/parport/pdo.c:165) PdoPnp()
294 lines
7.5 KiB
C
294 lines
7.5 KiB
C
/*
|
|
* PROJECT: Registry manipulation library
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* COPYRIGHT: Copyright 2005 Filip Navara <navaraf@reactos.org>
|
|
* Copyright 2001 - 2005 Eric Kohl
|
|
*/
|
|
|
|
#include "cmlib.h"
|
|
#define NDEBUG
|
|
#include <debug.h>
|
|
|
|
static BOOLEAN CMAPI
|
|
HvpWriteLog(
|
|
PHHIVE RegistryHive)
|
|
{
|
|
#if 0 // UNIMPLEMENTED
|
|
ULONG FileOffset;
|
|
UINT32 BufferSize;
|
|
UINT32 BitmapSize;
|
|
PUCHAR Buffer;
|
|
PUCHAR Ptr;
|
|
ULONG BlockIndex;
|
|
ULONG LastIndex;
|
|
PVOID BlockPtr;
|
|
BOOLEAN Success;
|
|
|
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
|
ASSERT(RegistryHive->BaseBlock->Length ==
|
|
RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
|
|
|
|
DPRINT("HvpWriteLog called\n");
|
|
|
|
if (RegistryHive->BaseBlock->Sequence1 !=
|
|
RegistryHive->BaseBlock->Sequence2)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
BitmapSize = RegistryHive->DirtyVector.SizeOfBitMap;
|
|
BufferSize = HV_LOG_HEADER_SIZE + sizeof(ULONG) + BitmapSize;
|
|
BufferSize = ROUND_UP(BufferSize, HBLOCK_SIZE);
|
|
|
|
DPRINT("Bitmap size %u buffer size: %u\n", BitmapSize, BufferSize);
|
|
|
|
Buffer = RegistryHive->Allocate(BufferSize, TRUE, TAG_CM);
|
|
if (Buffer == NULL)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
/* Update first update counter and CheckSum */
|
|
RegistryHive->BaseBlock->Type = HFILE_TYPE_LOG;
|
|
RegistryHive->BaseBlock->Sequence1++;
|
|
RegistryHive->BaseBlock->CheckSum =
|
|
HvpHiveHeaderChecksum(RegistryHive->BaseBlock);
|
|
|
|
/* Copy hive header */
|
|
RtlCopyMemory(Buffer, RegistryHive->BaseBlock, HV_LOG_HEADER_SIZE);
|
|
Ptr = Buffer + HV_LOG_HEADER_SIZE;
|
|
RtlCopyMemory(Ptr, "DIRT", 4);
|
|
Ptr += 4;
|
|
RtlCopyMemory(Ptr, RegistryHive->DirtyVector.Buffer, BitmapSize);
|
|
|
|
/* Write hive block and block bitmap */
|
|
FileOffset = 0;
|
|
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_LOG,
|
|
&FileOffset, Buffer, BufferSize);
|
|
RegistryHive->Free(Buffer, 0);
|
|
|
|
if (!Success)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
/* Write dirty blocks */
|
|
FileOffset = BufferSize;
|
|
BlockIndex = 0;
|
|
while (BlockIndex < RegistryHive->Storage[Stable].Length)
|
|
{
|
|
LastIndex = BlockIndex;
|
|
BlockIndex = RtlFindSetBits(&RegistryHive->DirtyVector, 1, BlockIndex);
|
|
if (BlockIndex == ~0U || BlockIndex < LastIndex)
|
|
{
|
|
break;
|
|
}
|
|
|
|
BlockPtr = (PVOID)RegistryHive->Storage[Stable].BlockList[BlockIndex].BlockAddress;
|
|
|
|
/* Write hive block */
|
|
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_LOG,
|
|
&FileOffset, BlockPtr, HBLOCK_SIZE);
|
|
if (!Success)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
BlockIndex++;
|
|
FileOffset += HBLOCK_SIZE;
|
|
}
|
|
|
|
Success = RegistryHive->FileSetSize(RegistryHive, HFILE_TYPE_LOG, FileOffset, FileOffset);
|
|
if (!Success)
|
|
{
|
|
DPRINT("FileSetSize failed\n");
|
|
return FALSE;
|
|
}
|
|
|
|
/* Flush the log file */
|
|
Success = RegistryHive->FileFlush(RegistryHive, HFILE_TYPE_LOG, NULL, 0);
|
|
if (!Success)
|
|
{
|
|
DPRINT("FileFlush failed\n");
|
|
}
|
|
|
|
/* Update second update counter and CheckSum */
|
|
RegistryHive->BaseBlock->Sequence2++;
|
|
RegistryHive->BaseBlock->CheckSum =
|
|
HvpHiveHeaderChecksum(RegistryHive->BaseBlock);
|
|
|
|
/* Write hive header again with updated sequence counter. */
|
|
FileOffset = 0;
|
|
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_LOG,
|
|
&FileOffset, RegistryHive->BaseBlock,
|
|
HV_LOG_HEADER_SIZE);
|
|
if (!Success)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
/* Flush the log file */
|
|
Success = RegistryHive->FileFlush(RegistryHive, HFILE_TYPE_LOG, NULL, 0);
|
|
if (!Success)
|
|
{
|
|
DPRINT("FileFlush failed\n");
|
|
}
|
|
#endif // UNIMPLEMENTED
|
|
return TRUE;
|
|
}
|
|
|
|
static BOOLEAN CMAPI
|
|
HvpWriteHive(
|
|
PHHIVE RegistryHive,
|
|
BOOLEAN OnlyDirty)
|
|
{
|
|
ULONG FileOffset;
|
|
ULONG BlockIndex;
|
|
ULONG LastIndex;
|
|
PVOID BlockPtr;
|
|
BOOLEAN Success;
|
|
|
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
|
ASSERT(RegistryHive->BaseBlock->Length ==
|
|
RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
|
|
|
|
DPRINT("HvpWriteHive called\n");
|
|
|
|
if (RegistryHive->BaseBlock->Sequence1 !=
|
|
RegistryHive->BaseBlock->Sequence2)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
/* Update first update counter and CheckSum */
|
|
RegistryHive->BaseBlock->Type = HFILE_TYPE_PRIMARY;
|
|
RegistryHive->BaseBlock->Sequence1++;
|
|
RegistryHive->BaseBlock->CheckSum =
|
|
HvpHiveHeaderChecksum(RegistryHive->BaseBlock);
|
|
|
|
/* Write hive block */
|
|
FileOffset = 0;
|
|
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_PRIMARY,
|
|
&FileOffset, RegistryHive->BaseBlock,
|
|
sizeof(HBASE_BLOCK));
|
|
if (!Success)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
BlockIndex = 0;
|
|
while (BlockIndex < RegistryHive->Storage[Stable].Length)
|
|
{
|
|
if (OnlyDirty)
|
|
{
|
|
LastIndex = BlockIndex;
|
|
BlockIndex = RtlFindSetBits(&RegistryHive->DirtyVector, 1, BlockIndex);
|
|
if (BlockIndex == ~0U || BlockIndex < LastIndex)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
BlockPtr = (PVOID)RegistryHive->Storage[Stable].BlockList[BlockIndex].BlockAddress;
|
|
FileOffset = (BlockIndex + 1) * HBLOCK_SIZE;
|
|
|
|
/* Write hive block */
|
|
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_PRIMARY,
|
|
&FileOffset, BlockPtr, HBLOCK_SIZE);
|
|
if (!Success)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
BlockIndex++;
|
|
}
|
|
|
|
Success = RegistryHive->FileFlush(RegistryHive, HFILE_TYPE_PRIMARY, NULL, 0);
|
|
if (!Success)
|
|
{
|
|
DPRINT("FileFlush failed\n");
|
|
}
|
|
|
|
/* Update second update counter and CheckSum */
|
|
RegistryHive->BaseBlock->Sequence2++;
|
|
RegistryHive->BaseBlock->CheckSum =
|
|
HvpHiveHeaderChecksum(RegistryHive->BaseBlock);
|
|
|
|
/* Write hive block */
|
|
FileOffset = 0;
|
|
Success = RegistryHive->FileWrite(RegistryHive, HFILE_TYPE_PRIMARY,
|
|
&FileOffset, RegistryHive->BaseBlock,
|
|
sizeof(HBASE_BLOCK));
|
|
if (!Success)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
Success = RegistryHive->FileFlush(RegistryHive, HFILE_TYPE_PRIMARY, NULL, 0);
|
|
if (!Success)
|
|
{
|
|
DPRINT("FileFlush failed\n");
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOLEAN CMAPI
|
|
HvSyncHive(
|
|
PHHIVE RegistryHive)
|
|
{
|
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
|
|
|
if (RtlFindSetBits(&RegistryHive->DirtyVector, 1, 0) == ~0U)
|
|
{
|
|
return TRUE;
|
|
}
|
|
|
|
/* Update hive header modification time */
|
|
KeQuerySystemTime(&RegistryHive->BaseBlock->TimeStamp);
|
|
|
|
/* Update log file */
|
|
if (!HvpWriteLog(RegistryHive))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
/* Update hive file */
|
|
if (!HvpWriteHive(RegistryHive, TRUE))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
/* Clear dirty bitmap. */
|
|
RtlClearAllBits(&RegistryHive->DirtyVector);
|
|
RegistryHive->DirtyCount = 0;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOLEAN
|
|
CMAPI
|
|
HvHiveWillShrink(IN PHHIVE RegistryHive)
|
|
{
|
|
/* No shrinking yet */
|
|
return FALSE;
|
|
}
|
|
|
|
BOOLEAN CMAPI
|
|
HvWriteHive(
|
|
PHHIVE RegistryHive)
|
|
{
|
|
ASSERT(RegistryHive->ReadOnly == FALSE);
|
|
|
|
/* Update hive header modification time */
|
|
KeQuerySystemTime(&RegistryHive->BaseBlock->TimeStamp);
|
|
|
|
/* Update hive file */
|
|
if (!HvpWriteHive(RegistryHive, FALSE))
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|