[DISKPART]

Implement the "list disk" and "select disk" commands.

svn path=/trunk/; revision=68442
This commit is contained in:
Eric Kohl 2015-07-19 17:33:29 +00:00
parent f51b244380
commit 3df39cf7a0
10 changed files with 394 additions and 56 deletions

View file

@ -42,7 +42,7 @@ list(APPEND SOURCE
add_executable(diskpart ${SOURCE} diskpart.rc)
set_module_type(diskpart win32cui UNICODE)
add_importlibs(diskpart user32 advapi32 msvcrt kernel32)
add_importlibs(diskpart user32 advapi32 msvcrt kernel32 ntdll)
if(MSVC)
add_importlibs(diskpart ntdll)

View file

@ -2,8 +2,7 @@
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/diskpart.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
@ -13,9 +12,18 @@
/* INCLUDES ******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#define NTOS_MODE_USER
#include <ndk/exfuncs.h>
#include <ndk/iofuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/psfuncs.h>
#include <ndk/rtlfuncs.h>
#include <ndk/umfuncs.h>
#include "resource.h"
@ -32,16 +40,21 @@ typedef struct _COMMAND
extern COMMAND cmds[];
/* NOERR codes for the program */
#define ERROR_NONE 0
#define ERROR_FATAL 1
#define ERROR_CMD_ARG 2
#define ERROR_FILE 3
#define ERROR_SERVICE 4
#define ERROR_SYNTAX 5
//#define ERROR_NONE 0
//#define ERROR_FATAL 1
//#define ERROR_CMD_ARG 2
//#define ERROR_FILE 3
//#define ERROR_SERVICE 4
//#define ERROR_SYNTAX 5
#define MAX_STRING_SIZE 1024
#define MAX_ARGS_COUNT 256
/* GLOBAL VARIABLES ***********************************************************/
ULONG CurrentDisk;
ULONG CurrentPartition;
/* PROTOTYPES *****************************************************************/
/* active.c */

View file

@ -37,9 +37,21 @@ END
/* Detail header titles */
STRINGTABLE
BEGIN
IDS_LIST_DISK_HEAD "Disk ### Status\tSize\tFree\tDyn\tGpt\n"
IDS_LIST_DISK_LINE "-------- ------\t----\t----\t---\t---\n"
IDS_LIST_VOLUME_HEAD "Volume ###\tLtr\tLabel\n"
IDS_LIST_DISK_HEAD "\n Disk ### Status Size Free Dyn Gpt\n"
IDS_LIST_DISK_LINE " -------- ---------- ------- ------- --- ---\n"
IDS_LIST_DISK_FORMAT "%c %7lu %-10s %4I64u %-2s %4I64u %-2s %1s %1s\n"
IDS_LIST_VOLUME_HEAD " Volume ### Ltr Label\n"
END
/* Select command strings */
STRINGTABLE
BEGIN
IDS_SELECT_NO_DISK "\nThere is no disk currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_DISK "\nDisk %lu is now the selected disk.\n\n"
IDS_SELECT_NO_VOLUME "\nThere is no volume currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_VOLUME "\nVolume %lu is now the selected volume.\n\n"
IDS_SELECT_NO_PARTITION "\nThere is no partition currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_PARTITION "\nPartition %lu is now the selected partition.\n\n"
END
/* Disk Status */
@ -58,8 +70,6 @@ END
/* CMD Messages for commands */
STRINGTABLE
BEGIN
IDS_MSG_CURRENT_DSK_STATUS "is now the selected disk."
IDS_MSG_NO_DISK "There is no disk currently selected.\nPlease select a disk and try again."
IDS_MSG_ARG_SYNTAX_ERROR "The argument(s) specified for this command are not valid.\nFor more information on the command type:"
END
@ -111,6 +121,8 @@ STRINGTABLE
BEGIN
IDS_ERROR_MSG_NO_SCRIPT "Error opening script: %s\n"
IDS_ERROR_MSG_BAD_ARG "Error processing argument: %s\n"
IDS_ERROR_INVALID_ARGS "Invalid arguments\n"
IDS_ERROR_INVALID_DISK "Invalid disk\n"
END
/* Active help descriptions */

View file

@ -38,11 +38,23 @@ END
/* Detail header titles */
STRINGTABLE
BEGIN
IDS_LIST_DISK_HEAD "Disc ### Stare\tDimensiune\tLiber\tDyn\tGpt\n"
IDS_LIST_DISK_LINE "-------- ------\t----\t----\t---\t---\n"
IDS_LIST_DISK_HEAD "\n Disc ### Stare Dimensiune Liber Dyn Gpt\n"
IDS_LIST_DISK_LINE " -------- ---------- ---------- ------- --- ---\n"
IDS_LIST_DISK_FORMAT "%c %7lu %-10s %4I64u %-2s %4I64u %-2s %1s %1s\n"
IDS_LIST_VOLUME_HEAD "Volum ###\tLtr\tEtichetă\n"
END
/* Select command strings */
STRINGTABLE
BEGIN
IDS_SELECT_NO_DISK "\nThere is no disk currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_DISK "\nDisk %lu is now the selected disk.\n\n"
IDS_SELECT_NO_VOLUME "\nThere is no volume currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_VOLUME "\nVolume %lu is now the selected volume.\n\n"
IDS_SELECT_NO_PARTITION "\nThere is no partition currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_PARTITION "\nPartition %lu is now the selected partition.\n\n"
END
/* Disk Status */
STRINGTABLE
BEGIN
@ -59,8 +71,6 @@ END
/* CMD Messages for commands */
STRINGTABLE
BEGIN
IDS_MSG_CURRENT_DSK_STATUS " a devenit discul curent."
IDS_MSG_NO_DISK "Momentan nici un disc nu este selectat.\nAlegeți un disc apoi reîncercați."
IDS_MSG_ARG_SYNTAX_ERROR "Argument(e) nevalid(e) pentru această comandă.\nPentru mai multe informații, executați comanda:"
END
@ -112,6 +122,8 @@ STRINGTABLE
BEGIN
IDS_ERROR_MSG_NO_SCRIPT "Eroare la deschiderea fișierului script: %s\n"
IDS_ERROR_MSG_BAD_ARG "Eroare la prelucrarea argumentului: %s\n"
IDS_ERROR_INVALID_ARGS "Invalid arguments\n"
IDS_ERROR_INVALID_DISK "Invalid disk\n"
END
/* Active help descriptions */

View file

@ -39,11 +39,23 @@ END
/* Detail header titles */
STRINGTABLE
BEGIN
IDS_LIST_DISK_HEAD "Диск ### Состояние\tРазмер\tСвободно\tДин\tGPT\n"
IDS_LIST_DISK_LINE "-------- ---------\t------\t--------\t---\t---\n"
IDS_LIST_DISK_HEAD "\n Диск ### Состояние Размер Свободно Дин GPT\n"
IDS_LIST_DISK_LINE " -------- ---------- ------- -------- --- ---\n"
IDS_LIST_DISK_FORMAT "%c %7lu %-10s %4I64u %-2s %4I64u %-2s %1s %1s\n"
IDS_LIST_VOLUME_HEAD "Том ###\tИмя\tМетка\n"
END
/* Select command strings */
STRINGTABLE
BEGIN
IDS_SELECT_NO_DISK "\nThere is no disk currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_DISK "\nDisk %lu is now the selected disk.\n\n"
IDS_SELECT_NO_VOLUME "\nThere is no volume currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_VOLUME "\nVolume %lu is now the selected volume.\n\n"
IDS_SELECT_NO_PARTITION "\nThere is no partition currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_PARTITION "\nPartition %lu is now the selected partition.\n\n"
END
/* Disk Status */
STRINGTABLE
BEGIN
@ -60,8 +72,6 @@ END
/* CMD Messages for commands */
STRINGTABLE
BEGIN
IDS_MSG_CURRENT_DSK_STATUS "выбран текущим диском."
IDS_MSG_NO_DISK "Диск для преобразования не выбран.\nВыберите диск и повторите попытку."
IDS_MSG_ARG_SYNTAX_ERROR "Указаны неверные параметры команды.\nЧтобы получить дополнительные сведения о данной команде, введите:"
END
@ -113,6 +123,8 @@ STRINGTABLE
BEGIN
IDS_ERROR_MSG_NO_SCRIPT "Ошибка открытия скрипта: %s\n"
IDS_ERROR_MSG_BAD_ARG "Ошибка обработки параметров: %s\n"
IDS_ERROR_INVALID_ARGS "Invalid arguments\n"
IDS_ERROR_INVALID_DISK "Invalid disk\n"
END
/* Active help descriptions */

View file

@ -41,11 +41,23 @@ END
/* Detail header titles */
STRINGTABLE
BEGIN
IDS_LIST_DISK_HEAD "Disk ### Status\tSize\tFree\tDyn\tGpt\n"
IDS_LIST_DISK_LINE "-------- ------\t----\t----\t---\t---\n"
IDS_LIST_DISK_HEAD "\n Disk ### Status Size Free Dyn Gpt\n"
IDS_LIST_DISK_LINE " -------- ---------- ------- ------- --- ---\n"
IDS_LIST_DISK_FORMAT "%c %7lu %-10s %4I64u %-2s %4I64u %-2s %1s %1s\n"
IDS_LIST_VOLUME_HEAD "Volume ###\tLtr\tLabel\n"
END
/* Select command strings */
STRINGTABLE
BEGIN
IDS_SELECT_NO_DISK "\nThere is no disk currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_DISK "\nDisk %lu is now the selected disk.\n\n"
IDS_SELECT_NO_VOLUME "\nThere is no volume currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_VOLUME "\nVolume %lu is now the selected volume.\n\n"
IDS_SELECT_NO_PARTITION "\nThere is no partition currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_PARTITION "\nPartition %lu is now the selected partition.\n\n"
END
/* Disk Status */
STRINGTABLE
BEGIN
@ -62,8 +74,6 @@ END
/* CMD Messages for commands */
STRINGTABLE
BEGIN
IDS_MSG_CURRENT_DSK_STATUS "është disku i përzgjedhur."
IDS_MSG_NO_DISK "Nuk ka disk të përzgjedhur.\nJu lutem zgjidhni një disk dhe provoni përsëri."
IDS_MSG_ARG_SYNTAX_ERROR "Argumente(t) e specifikuara per kete komande nuk jane të vlefshme.\nPër më shume informacione mbi komanden shkruani:"
END
@ -115,6 +125,8 @@ STRINGTABLE
BEGIN
IDS_ERROR_MSG_NO_SCRIPT "Error në hapjen e skriptes: %s\n"
IDS_ERROR_MSG_BAD_ARG "Error argumenti i procesimit: %s\n"
IDS_ERROR_INVALID_ARGS "Invalid arguments\n"
IDS_ERROR_INVALID_DISK "Invalid disk\n"
END
/* Active help descriptions */

View file

@ -39,11 +39,23 @@ END
/* Detail header titles */
STRINGTABLE
BEGIN
IDS_LIST_DISK_HEAD "Disk ### Durum\tBoyut\tBoş\tDev\tGpt\n"
IDS_LIST_DISK_LINE "-------- ------\t----\t----\t---\t---\n"
IDS_LIST_DISK_HEAD "\n Disk ### Durum Boyut Boş Dev Gpt\n"
IDS_LIST_DISK_LINE " -------- ---------- ------- ------- --- ---\n"
IDS_LIST_DISK_FORMAT "%c %7lu %-10s %4I64u %-2s %4I64u %-2s %1s %1s\n"
IDS_LIST_VOLUME_HEAD "Birim ###\tHarf\tEtiket\n"
END
/* Select command strings */
STRINGTABLE
BEGIN
IDS_SELECT_NO_DISK "\nThere is no disk currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_DISK "\nDisk %lu is now the selected disk.\n\n"
IDS_SELECT_NO_VOLUME "\nThere is no volume currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_VOLUME "\nVolume %lu is now the selected volume.\n\n"
IDS_SELECT_NO_PARTITION "\nThere is no partition currently selected.\nPlease select a disk and try again.\n\n"
IDS_SELECT_PARTITION "\nPartition %lu is now the selected partition.\n\n"
END
/* Disk Status */
STRINGTABLE
BEGIN
@ -60,8 +72,6 @@ END
/* CMD Messages for commands */
STRINGTABLE
BEGIN
IDS_MSG_CURRENT_DSK_STATUS "şimdi seçili disktir."
IDS_MSG_NO_DISK "Bir disk şimdilik seçilmemiş.\nLütfen bir disk seçiniz ve yeniden deneyiniz."
IDS_MSG_ARG_SYNTAX_ERROR "Bu komut için belirtilen değiştirgen(ler) geçerli değil.\nKomu türü üzerinde daha çok bilgi için:"
END
@ -113,6 +123,8 @@ STRINGTABLE
BEGIN
IDS_ERROR_MSG_NO_SCRIPT "Betik açmada yanlışlık: %s\n"
IDS_ERROR_MSG_BAD_ARG "Değiştirgen işlemede yanlışlık: %s\n"
IDS_ERROR_INVALID_ARGS "Invalid arguments\n"
IDS_ERROR_INVALID_DISK "Invalid disk\n"
END
/* Active help descriptions */

View file

@ -2,38 +2,168 @@
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/list.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
static VOID list_disk(VOID)
#define NDEBUG
#include <debug.h>
static
ULONGLONG
RoundingDivide(
IN ULONGLONG Dividend,
IN ULONGLONG Divisor)
{
return (Dividend + Divisor / 2) / Divisor;
}
static
VOID
ListDisk(VOID)
{
WCHAR Buffer[MAX_PATH];
OBJECT_ATTRIBUTES ObjectAttributes;
SYSTEM_DEVICE_INFORMATION Sdi;
IO_STATUS_BLOCK Iosb;
DISK_GEOMETRY DiskGeometry;
ULONG ReturnSize;
ULONG DiskNumber;
UNICODE_STRING Name;
HANDLE FileHandle;
NTSTATUS Status;
ULARGE_INTEGER DiskSize;
ULARGE_INTEGER FreeSize;
LPWSTR lpSizeUnit;
LPWSTR lpFreeUnit;
Status = NtQuerySystemInformation(SystemDeviceInformation,
&Sdi,
sizeof(SYSTEM_DEVICE_INFORMATION),
&ReturnSize);
if (!NT_SUCCESS(Status))
{
return;
}
/* Header labels */
PrintResourceString(IDS_LIST_DISK_HEAD);
PrintResourceString(IDS_LIST_DISK_LINE);
printf("\n\n");
for (DiskNumber = 0; DiskNumber < Sdi.NumberOfDisks; DiskNumber++)
{
swprintf(Buffer,
L"\\Device\\Harddisk%d\\Partition0",
DiskNumber);
RtlInitUnicodeString(&Name,
Buffer);
InitializeObjectAttributes(&ObjectAttributes,
&Name,
0,
NULL,
NULL);
Status = NtOpenFile(&FileHandle,
FILE_READ_DATA | FILE_READ_ATTRIBUTES | SYNCHRONIZE,
&ObjectAttributes,
&Iosb,
FILE_SHARE_READ,
FILE_SYNCHRONOUS_IO_NONALERT);
if (NT_SUCCESS(Status))
{
Status = NtDeviceIoControlFile(FileHandle,
NULL,
NULL,
NULL,
&Iosb,
IOCTL_DISK_GET_DRIVE_GEOMETRY,
NULL,
0,
&DiskGeometry,
sizeof(DISK_GEOMETRY));
if (NT_SUCCESS(Status))
{
DiskSize.QuadPart = DiskGeometry.Cylinders.QuadPart *
(ULONGLONG)DiskGeometry.TracksPerCylinder *
(ULONGLONG)DiskGeometry.SectorsPerTrack *
(ULONGLONG)DiskGeometry.BytesPerSector;
if (DiskSize.QuadPart >= 10737418240) /* 10 GB */
{
DiskSize.QuadPart = RoundingDivide(DiskSize.QuadPart, 1073741824);
lpSizeUnit = L"GB";
}
else
{
DiskSize.QuadPart = RoundingDivide(DiskSize.QuadPart, 1048576);
if (DiskSize.QuadPart == 0)
DiskSize.QuadPart = 1;
lpSizeUnit = L"MB";
}
/* FIXME */
FreeSize.QuadPart = 0;
lpFreeUnit = L"B";
PrintResourceString(IDS_LIST_DISK_FORMAT,
(CurrentDisk == DiskNumber) ? L'*': ' ',
DiskNumber,
L"Online",
DiskSize.QuadPart,
lpSizeUnit,
FreeSize.QuadPart,
lpFreeUnit,
L" ",
L" ");
}
else
{
printf("Status 0x%lx\n", Status);
}
NtClose(FileHandle);
}
else
{
printf("Status 0x%lx\n", Status);
}
}
wprintf(L"\n\n");
}
static VOID list_partition(VOID)
static
VOID
ListPartition(VOID)
{
printf("List Partition!!\n");
}
static VOID list_volume(VOID)
static
VOID
ListVolume(VOID)
{
PrintResourceString(IDS_LIST_VOLUME_HEAD);
}
static VOID list_vdisk(VOID)
static
VOID
ListVdisk(VOID)
{
printf("List VDisk!!\n");
}
BOOL list_main(INT argc, LPWSTR *argv)
BOOL
list_main(
INT argc,
LPWSTR *argv)
{
/* gets the first word from the string */
if (argc == 1)
@ -43,14 +173,14 @@ BOOL list_main(INT argc, LPWSTR *argv)
}
/* determines which to list (disk, partition, etc.) */
if(!wcsicmp(argv[1], L"disk"))
list_disk();
else if(!wcsicmp(argv[1], L"partition"))
list_partition();
else if(!wcsicmp(argv[1], L"volume"))
list_volume();
else if(!wcsicmp(argv[1], L"vdisk"))
list_vdisk();
if (!wcsicmp(argv[1], L"disk"))
ListDisk();
else if (!wcsicmp(argv[1], L"partition"))
ListPartition();
else if (!wcsicmp(argv[1], L"volume"))
ListVolume();
else if (!wcsicmp(argv[1], L"vdisk"))
ListVdisk();
else
PrintResourceString(IDS_HELP_CMD_LIST);

View file

@ -2,8 +2,7 @@
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/lang/resource.h
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
@ -33,9 +32,17 @@
#define IDS_DETAIL_INFO_CRASH_DSK 19
#define IDS_DETAIL_INFO_CLST_DSK 20
#define IDS_LIST_DISK_HEAD 21
#define IDS_LIST_DISK_LINE 22
#define IDS_LIST_VOLUME_HEAD 23
#define IDS_LIST_DISK_HEAD 3300
#define IDS_LIST_DISK_LINE 3301
#define IDS_LIST_DISK_FORMAT 3302
#define IDS_LIST_VOLUME_HEAD 3303
#define IDS_SELECT_NO_DISK 4400
#define IDS_SELECT_DISK 4401
#define IDS_SELECT_NO_VOLUME 4402
#define IDS_SELECT_VOLUME 4403
#define IDS_SELECT_NO_PARTITION 4404
#define IDS_SELECT_PARTITION 4405
#define IDS_STATUS_YES 31
#define IDS_STATUS_NO 32
@ -46,8 +53,6 @@
#define IDS_STATUS_OFFLINE 37
#define IDS_STATUS_NO_MEDIA 38
#define IDS_MSG_CURRENT_DSK_STATUS 39
#define IDS_MSG_NO_DISK 40
#define IDS_MSG_ARG_SYNTAX_ERROR 41
#define IDS_HELP_CMD_DESC_ACTIVE 58
@ -128,3 +133,7 @@
#define IDS_HELP_CMD_SETID 138
#define IDS_HELP_CMD_SHRINK 139
#define IDS_HELP_CMD_UNIQUEID 140
#define IDS_ERROR_INVALID_ARGS 211
#define IDS_ERROR_INVALID_DISK 212

View file

@ -2,14 +2,140 @@
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/select.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL select_main(INT argc, LPWSTR *argv)
#define NDEBUG
#include <debug.h>
ULONG CurrentDisk = (ULONG)-1;
ULONG CurrentPartition = (ULONG)-1;
static
VOID
SelectDisk(
INT argc,
LPWSTR *argv)
{
SYSTEM_DEVICE_INFORMATION Sdi;
ULONG ReturnSize;
NTSTATUS Status;
LONG value;
LPWSTR endptr = NULL;
DPRINT("Select Disk()\n");
if (argc > 3)
{
PrintResourceString(IDS_ERROR_INVALID_ARGS);
return;
}
if (argc == 2)
{
if (CurrentDisk == (ULONG)-1)
PrintResourceString(IDS_SELECT_NO_DISK);
else
PrintResourceString(IDS_SELECT_DISK, CurrentDisk);
return;
}
value = wcstol(argv[2], &endptr, 10);
if (((value == 0) && (endptr == argv[2])) ||
(value < 0))
{
PrintResourceString(IDS_ERROR_INVALID_ARGS);
return;
}
Status = NtQuerySystemInformation(SystemDeviceInformation,
&Sdi,
sizeof(SYSTEM_DEVICE_INFORMATION),
&ReturnSize);
if (!NT_SUCCESS(Status))
{
return;
}
if ((ULONG)value >= Sdi.NumberOfDisks)
{
PrintResourceString(IDS_ERROR_INVALID_DISK);
return;
}
CurrentDisk = (ULONG)value;
CurrentPartition = (ULONG)-1;
PrintResourceString(IDS_SELECT_DISK, CurrentDisk);
}
static
VOID
SelectPartition(
INT argc,
LPWSTR *argv)
{
LONG value;
LPWSTR endptr = NULL;
DPRINT("Select Partition()\n");
if (argc > 3)
{
PrintResourceString(IDS_ERROR_INVALID_ARGS);
return;
}
if (argc == 2)
{
if (CurrentPartition == (ULONG)-1)
PrintResourceString(IDS_SELECT_NO_PARTITION);
else
PrintResourceString(IDS_SELECT_PARTITION, CurrentPartition);
return;
}
value = wcstol(argv[2], &endptr, 10);
if (((value == 0) && (endptr == argv[2])) ||
(value < 0))
{
PrintResourceString(IDS_ERROR_INVALID_ARGS);
return;
}
/* FIXME: Check the new partition number */
CurrentPartition = (ULONG)value;
PrintResourceString(IDS_SELECT_PARTITION, CurrentPartition);
}
BOOL
select_main(
INT argc,
LPWSTR *argv)
{
/* gets the first word from the string */
if (argc == 1)
{
PrintResourceString(IDS_HELP_CMD_SELECT);
return TRUE;
}
/* determines which to list (disk, partition, etc.) */
if (!wcsicmp(argv[1], L"disk"))
SelectDisk(argc, argv);
else if (!wcsicmp(argv[1], L"partition"))
SelectPartition(argc, argv);
else
PrintResourceString(IDS_HELP_CMD_SELECT);
return TRUE;
}