Author: mjansen
Date: Thu Jul 27 20:36:51 2017
New Revision: 75429
URL:
http://svn.reactos.org/svn/reactos?rev=75429&view=rev
Log:
[APPHELP] Use DbgPrint instead of OutputDebugString + fix SDBAPI_DEBUG_ALLOC
Modified:
trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
trunk/reactos/dll/appcompat/apphelp/apphelp.c
trunk/reactos/dll/appcompat/apphelp/sdbapi.c
trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c
trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
Modified: trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/CMak…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/CMakeLists.txt [iso-8859-1] Thu Jul 27 20:36:51
2017
@@ -3,6 +3,7 @@
remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601)
+#add_definitions(-DSDBAPI_DEBUG_ALLOC)
spec2def(apphelp.dll apphelp.spec ADD_IMPORTLIB)
Modified: trunk/reactos/dll/appcompat/apphelp/apphelp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/apph…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/apphelp.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/apphelp.c [iso-8859-1] Thu Jul 27 20:36:51 2017
@@ -1,7 +1,7 @@
/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav BlaževiÄ
- * Copyright 2015-2017 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -152,7 +152,7 @@
#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
}
Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdba…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] Thu Jul 27 20:36:51 2017
@@ -1,7 +1,7 @@
/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav BlaževiÄ
- * Copyright 2015,2016 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -46,7 +46,7 @@
PVOID Prev;
} SHIM_ALLOC_ENTRY, *PSHIM_ALLOC_ENTRY;
-
+/* FIXME: This is not threadsafe */
static RTL_AVL_TABLE g_SdbpAllocationTable;
@@ -109,12 +109,10 @@
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)
@@ -125,9 +123,8 @@
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
@@ -135,8 +132,7 @@
Lookup.Address = NULL;
}
}
- sprintf(buf, "\r\n===============\r\n");
- OutputDebugStringA(buf);
+ DbgPrint("===============\r\n");
}
#endif
@@ -155,7 +151,22 @@
{
#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);
}
@@ -267,7 +278,7 @@
PWSTR SdbpStrDup(LPCWSTR string)
{
- PWSTR ret = SdbpAlloc(SdbpStrsize(string));
+ PWSTR ret = SdbAlloc(SdbpStrsize(string));
lstrcpyW(ret, string);
return ret;
}
Modified: trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbf…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbfileattr.c [iso-8859-1] Thu Jul 27 20:36:51
2017
@@ -1,7 +1,7 @@
/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav Blaevic
- * Copyright 2015 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -97,7 +97,7 @@
attr->type = tag;
attr->flags = ATTRIBUTE_AVAILABLE;
- dest = attr->lpattr = SdbpAlloc((len+1) * sizeof(WCHAR));
+ dest = attr->lpattr = SdbAlloc((len+1) * sizeof(WCHAR));
while (len--)
*(dest++) = *(string++);
*dest = 0;
Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] Thu Jul 27 20:36:51 2017
@@ -1,7 +1,7 @@
/*
* Copyright 2011 André Hentschel
* Copyright 2013 Mislav BlaževiÄ
- * Copyright 2015,2016 Mark Jansen
+ * Copyright 2015-2017 Mark Jansen (mark.jansen(a)reactos.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -62,7 +62,7 @@
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;