Author: tkreuzer
Date: Sat Dec 13 10:52:49 2008
New Revision: 38045
URL:
http://svn.reactos.org/svn/reactos?rev=38045&view=rev
Log:
Add DumpMem function to apitests lib for debugging purposes
Modified:
trunk/rostests/apitests/apitest.c
trunk/rostests/apitests/apitest.h
Modified: trunk/rostests/apitests/apitest.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apitest.c?rev=38…
==============================================================================
--- trunk/rostests/apitests/apitest.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/apitest.c [iso-8859-1] Sat Dec 13 10:52:49 2008
@@ -78,6 +78,36 @@
WriteFile(hFile, szLine, strlen(szLine), lpdwBytesWritten, NULL);
return TRUE;
+}
+
+static CHAR
+GetDisplayChar(CHAR c)
+{
+ if (c < 32) return '.';
+ return c;
+}
+
+VOID
+DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth)
+{
+ ULONG cLines = (cbSize + nWidth - 1) / nWidth;
+ ULONG cbLastLine = cbSize % nWidth;
+ INT i,j;
+
+ for (i = 0; i <= cLines; i++)
+ {
+ printf("%08lx: ", i*nWidth);
+ for (j = 0; j < (i == cLines? cbLastLine : nWidth); j++)
+ {
+ printf("%02x ", ((BYTE*)pData)[i*nWidth + j]);
+ }
+ printf(" ");
+ for (j = 0; j < (i == cLines? cbLastLine : nWidth); j++)
+ {
+ printf("%c", GetDisplayChar(((CHAR*)pData)[i*nWidth + j]));
+ }
+ printf("\n");
+ }
}
int
Modified: trunk/rostests/apitests/apitest.h
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apitest.h?rev=38…
==============================================================================
--- trunk/rostests/apitests/apitest.h [iso-8859-1] (original)
+++ trunk/rostests/apitests/apitest.h [iso-8859-1] Sat Dec 13 10:52:49 2008
@@ -91,5 +91,6 @@
extern TESTENTRY TestList[];
INT NumTests(void);
BOOL IsFunctionPresent(LPWSTR lpszFunction);
+VOID DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth);
#endif /* _APITEST_H */