mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:23:34 +00:00
Add DumpMem function to apitests lib for debugging purposes
svn path=/trunk/; revision=38045
This commit is contained in:
parent
4a3e577b8f
commit
702df456d2
2 changed files with 31 additions and 0 deletions
|
@ -80,6 +80,36 @@ WriteRow(HANDLE hFile, LPDWORD lpdwBytesWritten, LPWSTR pszFunction, PTESTINFO p
|
||||||
return TRUE;
|
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
|
int
|
||||||
TestMain(LPWSTR pszName, LPWSTR pszModule)
|
TestMain(LPWSTR pszName, LPWSTR pszModule)
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,5 +91,6 @@ int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
||||||
extern TESTENTRY TestList[];
|
extern TESTENTRY TestList[];
|
||||||
INT NumTests(void);
|
INT NumTests(void);
|
||||||
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
||||||
|
VOID DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth);
|
||||||
|
|
||||||
#endif /* _APITEST_H */
|
#endif /* _APITEST_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue