/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav Blažević
- * Copyright 2015-2017 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen@reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#if defined(APPCOMPAT_USE_DBGPRINTEX) && APPCOMPAT_USE_DBGPRINTEX
return NT_SUCCESS(DbgPrintEx(DPFLTR_APPCOMPAT_ID, Level, "%s", Buffer));
#else
- OutputDebugStringA(Buffer);
+ DbgPrint("%s", Buffer);
return TRUE;
#endif
}
/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav Blažević
- * Copyright 2015,2016 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen@reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
PVOID Prev;
} SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY;
-
+/* FIXME: This is not threadsafe */
static RTL_AVL_TABLE g_SdbpAllocationTable;
static void SdbpRemoveAllocation(PVOID address, int line, const char* file)
{
- char buf[512];
SHIM_ALLOC_ENTRY Lookup = {0};
PSHIM_ALLOC_ENTRY Entry;
- sprintf(buf, "\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n", file, line);
- OutputDebugStringA(buf);
+ DbgPrint("\r\n===============\r\n%s(%d): SdbpFree called, tracing alloc:\r\n", file, line);
Lookup.Address = address;
while (Lookup.Address)
Lookup = *Entry;
RtlDeleteElementGenericTableAvl(&g_SdbpAllocationTable, Entry);
- sprintf(buf, " > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Lookup.File, Lookup.Line,
+ DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Lookup.File, Lookup.Line,
Lookup.Next ? "Invalidated " : "", Lookup.Prev ? "Re" : "", Lookup.Size, Lookup.Address);
- OutputDebugStringA(buf);
Lookup.Address = Lookup.Prev;
}
else
Lookup.Address = NULL;
}
}
- sprintf(buf, "\r\n===============\r\n");
- OutputDebugStringA(buf);
+ DbgPrint("===============\r\n");
}
#endif
{
#if SDBAPI_DEBUG_ALLOC
if (g_SdbpAllocationTable.NumberGenericTableElements != 0)
- __debugbreak();
+ {
+ PSHIM_ALLOC_ENTRY Entry;
+
+ DbgPrint("\r\n===============\r\n===============\r\nSdbpHeapDeinit: Dumping leaks\r\n");
+ Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, TRUE);
+
+ while (Entry)
+ {
+ DbgPrint(" > %s(%d): %s%sAlloc( %d ) ==> %p\r\n", Entry->File, Entry->Line,
+ Entry->Next ? "Invalidated " : "", Entry->Prev ? "Re" : "", Entry->Size, Entry->Address);
+
+ Entry = RtlEnumerateGenericTableAvl(&g_SdbpAllocationTable, FALSE);
+ }
+ DbgPrint("===============\r\n===============\r\n");
+ }
+ /*__debugbreak();*/
#endif
HeapDestroy(g_Heap);
}
PWSTR SdbpStrDup(LPCWSTR string)
{
- PWSTR ret = SdbpAlloc(SdbpStrsize(string));
+ PWSTR ret = SdbAlloc(SdbpStrsize(string));
lstrcpyW(ret, string);
return ret;
}
/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav Blažević
- * Copyright 2015,2016 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen@reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
PDB buf = db->string_buffer;
if (db->string_buffer == NULL)
{
- db->string_buffer = buf = SdbpAlloc(sizeof(DB));
+ db->string_buffer = buf = SdbAlloc(sizeof(DB));
if (buf == NULL)
return FALSE;
buf->size = 128;