📄 w2k_dump.c
字号:
{
DWORD dStart, dStop, i;
PPDB_ROOT ppr;
PVOID pData;
DWORD dData;
if ((ppr = imgPdbRoot (pip)) != NULL)
{
if (dOptions & DISPLAY_OPTION_STREAM)
{
dStart = dOptions & DISPLAY_OPTION_STREAM_MASK;
dStop = min (dStart + 1, (DWORD) ppr->wCount);
}
else
{
dStart = 0;
dStop = ppr->wCount;
}
for (i = dStart; i < dStop; i++)
{
if ((pData = imgPdbStream (pip, i, &dData)) != NULL)
{
printf (awPdbStream,
i, ppr->wCount-1,
dData, dData);
DisplayMemory (pData, dData, pBase, dOptions);
imgMemoryDestroy (pData);
}
}
imgMemoryDestroy (ppr);
}
return;
}
// -----------------------------------------------------------------
VOID WINAPI DisplayFile (PWORD pwPath,
PVOID pBase,
DWORD dOptions)
{
BYTE abType [PDB_SIGNATURE_TEXT];
PVOID pData;
DWORD dData = 0;
PIMG_PDB pip = NULL;
if ((pData = imgFileLoad (pwPath, &dData)) != NULL)
{
printf (awFileOk, pwPath, dData, dData);
if (imgPdbVerify (pData, dData))
{
pip = (PIMG_PDB) pData;
lstrcpynA (abType, pip->Header.Signature.abSignature,
PDB_SIGNATURE_TEXT);
printf (awFileType, abType);
}
if ((pip != NULL) && (dOptions & DISPLAY_OPTION_PDB))
{
DisplayPdb (pip, pBase, dOptions);
}
else
{
DisplayMemory (pData, dData, pBase, dOptions);
}
imgMemoryDestroy (pData);
}
else
{
printf (awFileError, pwPath);
}
return;
}
// =================================================================
// OPTION MANAGEMENT
// =================================================================
VOID WINAPI OptionSet (BOOL fPlus,
PDWORD pdOptions,
DWORD dMask,
DWORD dValue,
DWORD dDefault)
{
DWORD dNewValue = *pdOptions & dMask;
*pdOptions &= ~dMask;
if (fPlus)
{
dNewValue = dValue & dMask;
}
else
{
if (dNewValue == (dValue & dMask))
{
dNewValue = dDefault & dMask;
}
}
*pdOptions |= dNewValue;
return;
}
// -----------------------------------------------------------------
DWORD WINAPI OptionNumber (PWORD pwNumber,
PDWORD pdDigits)
{
DWORD i;
DWORD dNumber = 0;
*pdDigits = 0;
for (i = 0; (pwNumber [i] >= '0') && (pwNumber [i] <= '9'); i++)
{
dNumber *= 10;
dNumber += (pwNumber [i] - '0');
(*pdDigits)++;
}
return dNumber;
}
// =================================================================
// MAIN PROGRAM
// =================================================================
DWORD Main (DWORD argc, PTBYTE *argv, PTBYTE *argp)
{
DWORD dOptions, dStream, dDigits, i, j;
BOOL fPlus;
printf (atAbout);
if (argc < 2)
{
printf (atUsage, awArguments);
printf (awMoreInfo);
}
else
{
dOptions = DISPLAY_OPTION_DEFAULT;
for (i = 1; i < argc; i++)
{
if ((argv [i] [0] == '+') || (argv [i] [0] == '-'))
{
for (j = 0; argv [i] [j]; j++)
{
switch (argv [i] [j])
{
case '+':
{
fPlus = TRUE;
break;
}
case '-':
{
fPlus = FALSE;
break;
}
case 'b':
case 'B':
{
OptionSet (fPlus, &dOptions,
DISPLAY_OPTION_FORMAT,
DISPLAY_OPTION_BYTE,
DISPLAY_OPTION_DEFAULT);
break;
}
case 'w':
case 'W':
{
OptionSet (fPlus, &dOptions,
DISPLAY_OPTION_FORMAT,
DISPLAY_OPTION_WORD,
DISPLAY_OPTION_DEFAULT);
break;
}
case 'd':
case 'D':
{
OptionSet (fPlus, &dOptions,
DISPLAY_OPTION_FORMAT,
DISPLAY_OPTION_DWORD,
DISPLAY_OPTION_DEFAULT);
break;
}
case 'q':
case 'Q':
{
OptionSet (fPlus, &dOptions,
DISPLAY_OPTION_FORMAT,
DISPLAY_OPTION_QWORD,
DISPLAY_OPTION_DEFAULT);
break;
}
case 'p':
case 'P':
{
OptionSet (fPlus, &dOptions,
DISPLAY_OPTION_PDB,
DISPLAY_OPTION_PDB,
DISPLAY_OPTION_DEFAULT);
break;
}
}
}
}
else
{
if (argv [i] [0] == '/')
{
dStream = OptionNumber (argv [i] + 1, &dDigits)
& DISPLAY_OPTION_STREAM_MASK;
if (dDigits)
{
dOptions &= ~DISPLAY_OPTION_STREAM_MASK;
dOptions |= dStream;
dOptions |= DISPLAY_OPTION_STREAM;
}
else
{
dOptions ^= DISPLAY_OPTION_STREAM;
}
}
else
{
DisplayFile (argv [i], (PVOID) 0, dOptions);
}
}
}
}
return 0;
}
// =================================================================
// END OF PROGRAM
// =================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -