mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +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
|
@ -80,6 +80,36 @@ WriteRow(HANDLE hFile, LPDWORD lpdwBytesWritten, LPWSTR pszFunction, PTESTINFO p
|
|||
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
|
||||
TestMain(LPWSTR pszName, LPWSTR pszModule)
|
||||
{
|
||||
|
|
|
@ -91,5 +91,6 @@ int TestMain(LPWSTR pszExe, LPWSTR pszModule);
|
|||
extern TESTENTRY TestList[];
|
||||
INT NumTests(void);
|
||||
BOOL IsFunctionPresent(LPWSTR lpszFunction);
|
||||
VOID DumpMem(PVOID pData, ULONG cbSize, ULONG nWidth);
|
||||
|
||||
#endif /* _APITEST_H */
|
||||
|
|
Loading…
Reference in a new issue