[DISKPART] Improvements to the dump, help and delete commands

- Print help only if a help string exists.
- Use the command table for the dump sub commands.
- Add sub commands for the delete command.
This commit is contained in:
Eric Kohl 2022-05-21 10:43:38 +02:00
parent de972e2bc2
commit 417687e92e
15 changed files with 219 additions and 134 deletions

View file

@ -28,7 +28,10 @@ HelpCommandList(VOID)
/* List all the commands and the basic descriptions */
for (cmdptr = cmds; cmdptr->cmd1; cmdptr++)
{
if (cmdptr->cmd1 != NULL && cmdptr->cmd2 == NULL && cmdptr->cmd3 == NULL)
if ((cmdptr->cmd1 != NULL) &&
(cmdptr->cmd2 == NULL) &&
(cmdptr->cmd3 == NULL) &&
(cmdptr->help != IDS_NONE))
{
K32LoadStringW(GetModuleHandle(NULL), cmdptr->help, szOutput, ARRAYSIZE(szOutput));
ConPrintf(StdOut, szFormat, cmdptr->cmd1, szOutput);
@ -57,7 +60,10 @@ HelpCommand(
{
if (pCommand->cmd1 != NULL && pCommand->cmd2 == NULL && pCommand->cmd3 == NULL)
{
if (wcsicmp(pCommand->cmd1, cmdptr->cmd1) == 0 && cmdptr->cmd2 != NULL && cmdptr->cmd3 == NULL)
if ((wcsicmp(pCommand->cmd1, cmdptr->cmd1) == 0) &&
(cmdptr->cmd2 != NULL) &&
(cmdptr->cmd3 == NULL) &&
(cmdptr->help != IDS_NONE))
{
K32LoadStringW(GetModuleHandle(NULL), cmdptr->help, szOutput, ARRAYSIZE(szOutput));
ConPrintf(StdOut, szFormat, cmdptr->cmd2, szOutput);
@ -68,7 +74,8 @@ HelpCommand(
{
if ((wcsicmp(pCommand->cmd1, cmdptr->cmd1) == 0) &&
(wcsicmp(pCommand->cmd2, cmdptr->cmd2) == 0) &&
(cmdptr->cmd3 != NULL))
(cmdptr->cmd3 != NULL) &&
(cmdptr->help != IDS_NONE))
{
K32LoadStringW(GetModuleHandle(NULL), cmdptr->help, szOutput, ARRAYSIZE(szOutput));
ConPrintf(StdOut, szFormat, cmdptr->cmd3, szOutput);