Author: tkreuzer
Date: Sat Dec 15 05:08:23 2007
New Revision: 31224
URL: http://svn.reactos.org/svn/reactos?rev=31224&view=rev
Log:
- fix type field calculation in GDIOBJ_CovertToStockObject
- add some DPRINTs on problems
Modified:
trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Sat Dec 15 05:08:23 2007
@@ -640,6 +640,7 @@
if(((ULONG_PTR)PrevProcId & ~0x1) == 0)
{
DPRINT1("Attempted to free global gdi handle 0x%x, caller needs to get ownership first!!!\n", hObj);
+ DPRINT1("Type = 0x%lx, KernelData = 0x%p, ProcessId = 0x%p\n", Entry->Type, Entry->KernelData, Entry->ProcessId);
KeRosDumpStackFrames(NULL, 20);
}
else
@@ -685,8 +686,8 @@
DPRINT("NtGdiDeleteObject handle 0x%08x\n", hObject);
if(!IsObjectDead(hObject))
{
- return NULL != hObject
- ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE;
+ return NULL != hObject
+ ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE;
}
else
{
@@ -1123,8 +1124,13 @@
/* we're locking an object that belongs to our process. First calculate
the new object type including the stock object flag and then try to
exchange it.*/
- OldType = ((ULONG)hObj & GDI_HANDLE_BASETYPE_MASK);
- OldType |= GDI_HANDLE_GET_UPPER(hObj) >> GDI_ENTRY_UPPER_SHIFT;
+ /* On Windows the higher 16 bit of the type field don't contain the
+ full type from the handle, but the base type.
+ (type = BRSUH, PEN, EXTPEN, basetype = BRUSH) */
+ OldType = ((ULONG)hObj & GDI_HANDLE_BASETYPE_MASK) | ((ULONG)hObj >> GDI_ENTRY_UPPER_SHIFT);
+ /* We are currently not using bits 24..31 (flags) of the type field, but for compatibility
+ we copy them as we can't get them from the handle */
+ OldType |= Entry->Type & GDI_ENTRY_FLAGS_MASK;
/* As the object should be a stock object, set it's flag, but only in the lower 16 bits */
NewType = OldType | GDI_ENTRY_STOCK_MASK;
@@ -1197,6 +1203,7 @@
else
{
DPRINT1("Attempted to convert object 0x%x that is deleted! Should never get here!!!\n", hObj);
+ DPRINT1("OldType = 0x%x, Entry->Type = 0x%x, NewType = 0x%x, Entry->KernelData = 0x%x\n", OldType, Entry->Type, NewType, Entry->KernelData);
}
}
else if(PrevProcId == LockedProcessId)
@@ -1323,6 +1330,7 @@
else
{
DPRINT1("Attempted to change ownership of an object 0x%x currently being destroyed!!!\n", ObjectHandle);
+ DPRINT1("Entry->Type = 0x%lx, Entry->KernelData = 0x%p\n", Entry->Type, Entry->KernelData);
}
}
else if(PrevProcId == LockedProcessId)
Author: fireball
Date: Sat Dec 15 02:17:43 2007
New Revision: 31221
URL: http://svn.reactos.org/svn/reactos?rev=31221&view=rev
Log:
Filip Navara <xnavara at volny dot cz>
- Remove unused code from HvGetCellSize().
- Fix situation, when a new cell is allocated with a too small size, resulting in an empty free cell (a cell has to be able to store at least one HCELL_INDEX), then the free list code overrides the next cell after the empty one.
- Reenable commented out assert in HvpRemoveFree(), since now it works as expected.
Modified:
trunk/reactos/lib/cmlib/hivecell.c
Modified: trunk/reactos/lib/cmlib/hivecell.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivecell.c?rev=3…
==============================================================================
--- trunk/reactos/lib/cmlib/hivecell.c (original)
+++ trunk/reactos/lib/cmlib/hivecell.c Sat Dec 15 02:17:43 2007
@@ -103,7 +103,6 @@
HCELL_INDEX CellIndex,
BOOLEAN HoldingLock)
{
- LONG CellSize;
ULONG CellBlock;
ULONG CellLastBlock;
@@ -117,10 +116,6 @@
CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
CellLastBlock = ((CellIndex + HV_BLOCK_SIZE - 1) & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
-
- CellSize = HvpGetCellFullSize(RegistryHive, HvGetCell(RegistryHive, CellIndex));
- if (CellSize < 0)
- CellSize = -CellSize;
RtlSetBits(&RegistryHive->DirtyVector,
CellBlock, CellLastBlock - CellBlock);
@@ -229,7 +224,7 @@
pFreeCellOffset = FreeCellData;
}
- //ASSERT(FALSE);
+ ASSERT(FALSE);
}
static HCELL_INDEX CMAPI
@@ -349,8 +344,13 @@
FreeCell = HvpGetCellHeader(RegistryHive, FreeCellOffset);
/* Split the block in two parts */
- /* FIXME: There is some minimal cell size that we must respect. */
- if ((ULONG)FreeCell->Size > Size + sizeof(HCELL_INDEX))
+
+ /* The free block that is created has to be at least
+ sizeof(HCELL) + sizeof(HCELL_INDEX) big, so that free
+ cell list code can work. Moreover we round cell sizes
+ to 16 bytes, so creating a smaller block would result in
+ a cell that would never be allocated. */
+ if ((ULONG)FreeCell->Size > Size + 16)
{
NewCell = (PHCELL)((ULONG_PTR)FreeCell + Size);
NewCell->Size = FreeCell->Size - Size;