Add the Diskpart utility by Lee Schroeder (milawynsrealm).

The following modifications were made:
- Removed the help texts because they were copied from Windows Diskpart.
- Used a single string resource per help text.
- Used only Unicode strings and Unicode string functions.
- Replaced the giant if-statement in the command dispatcher in interpreter.c by a command-table and a little loop.
- Improved the command-line parser. Argument count and argument vector are passed to the command and help functions for easy evaluation.
- Moved the help function for commands into the command specific file.

TODO:
- Implement all commands as the utility is only an empty frame.
- Add help texts.
- Translate help texts.
See issue #6402 for more details.

svn path=/trunk/; revision=53826
This commit is contained in:
Eric Kohl 2011-09-24 10:33:33 +00:00
parent 0ce2f14276
commit f7125a502c
47 changed files with 2002 additions and 0 deletions

View File

@ -1,6 +1,7 @@
add_subdirectory(autochk)
add_subdirectory(bootok)
add_subdirectory(diskpart)
add_subdirectory(expand)
add_subdirectory(format)
add_subdirectory(lsass)

View File

@ -0,0 +1,49 @@
set_rc_compiler()
add_executable(diskpart
active.c
add.c
assign.c
attach.c
attributes.c
automount.c
break.c
clean.c
compact.c
convert.c
create.c
delete.c
detach.c
detail.c
diskpart.c
expand.c
extend.c
filesystems.c
format.c
gpt.c
help.c
import.c
inactive.c
interpreter.c
list.c
merge.c
offline.c
online.c
recover.c
remove.c
repair.c
rescan.c
retain.c
san.c
select.c
setid.c
shrink.c
uniqueid.c
resource.rc)
set_module_type(calc win32cui)
add_importlibs(diskpart user32 msvcrt kernel32)
if(MSVC)
add_importlibs(diskpart ntdll)
endif()
add_cd_file(TARGET diskpart DESTINATION reactos/system32 FOR all)

View File

@ -0,0 +1,25 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/active.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL active_main(INT argc, WCHAR **argv)
{
printf("\nActive\n");
return TRUE;
}
/*
* help_active():
* Shows the description and explains each argument type of the active command
*/
VOID help_active(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_ACTIVE);
}

View File

@ -0,0 +1,23 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/add.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL add_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_add():
* Shows the description and explains each argument type of the add command
*/
VOID help_add(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_ADD);
}

View File

@ -0,0 +1,22 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/assign.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL assign_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_assign():
* Shows the description and explains each argument type of the assign command
*/
VOID help_assign(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_ASSIGN);
}

View File

@ -0,0 +1,23 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/attach.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL attach_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_attach():
* Shows the description and explains each argument type of the attach command
*/
VOID help_attach(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_ATTACH);
}

View File

@ -0,0 +1,22 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/attributes.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL attributes_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_attributes():
* Shows the description and explains each argument type of the attributes command
*/
VOID help_attributes(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_ATTRIBUTES);
}

View File

@ -0,0 +1,23 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/automount.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL automount_main(INT argc, WCHAR **argv)
{
printf("Automount\n");
return TRUE;
}
/*
* help_automount():
* Shows the description and explains each argument type of the automount command
*/
VOID help_automount(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_AUTOMOUNT);
}

View File

@ -0,0 +1,25 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/break.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL break_main(INT argc, WCHAR **argv)
{
printf("\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n");
return TRUE;
}
/*
* help_break():
* Shows the description and explains each argument type of the break command
*/
VOID help_break(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_BREAK);
}

View File

@ -0,0 +1,24 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/clean.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL clean_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_clean():
* Shows the description and explains each argument type of the clean command
*/
VOID help_clean(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_CLEAN);
}

View File

@ -0,0 +1,24 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/compact.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL compact_main(INT argc, WCHAR **argv)
{
return 0;
}
/*
* help_compact():
* Shows the description and explains each argument type of the compact command
*/
VOID help_compact(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_COMPACT);
}

View File

@ -0,0 +1,24 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/convert.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL convert_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_convert():
* Shows the description and explains each argument type of the convert command
*/
VOID help_convert(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_CONVERT);
}

View File

@ -0,0 +1,24 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/create.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL create_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_create():
* Shows the description and explains each argument type of the create command
*/
VOID help_create(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_CREATE);
}

View File

@ -0,0 +1,23 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/delete.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL delete_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* help_delete():
* Shows the description and explains each argument type of the delete command
*/
VOID help_delete(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_DELETE);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/detach.h
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL detach_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_detach(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_DETACH);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/detail.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL detail_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_detail(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_DETAIL);
}

View File

@ -0,0 +1,110 @@
/*
* 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
* PROGRAMMERS: Lee Schroeder
*/
/* INCLUDES ******************************************************************/
#include "diskpart.h"
/* FUNCTIONS ******************************************************************/
VOID
PrintResourceString(INT resID, ...)
{
WCHAR szMsg[3072];
va_list arg_ptr;
va_start(arg_ptr, resID);
LoadStringW(GetModuleHandle(NULL), resID, szMsg, 3072);
vwprintf(szMsg, arg_ptr);
va_end(arg_ptr);
}
/*
* run_script(const char *filename):
* opens the file, reads the contents, convert the text into readable
* code for the computer, and then execute commands in order.
*/
BOOL run_script(LPCWSTR filename)
{
FILE *script_file;
WCHAR tmp_string[MAX_STRING_SIZE];
/* Open the file for processing */
script_file = _wfopen(filename, L"r");
if (script_file == NULL)
{
/* if there was problems opening the file */
PrintResourceString(IDS_ERROR_MSG_NO_SCRIPT, filename);
return FALSE; /* if there is no script, exit the program */
}
/* Read and process the script */
while (fgetws(tmp_string, MAX_STRING_SIZE, script_file) != NULL)
{
if (interpret_script(tmp_string) == FALSE)
return FALSE;
}
/* Close the file */
fclose(script_file);
return TRUE;
}
/*
* main():
* Main entry point of the application.
*/
int wmain(int argc, const WCHAR *argv[])
{
/* Gets the current name of the computer */
WCHAR comp_name[MAX_STRING_SIZE]; //used to store the name of the computer */
DWORD comp_size = MAX_STRING_SIZE; // used for the char size of comp_name */
BOOL interpreter_running = TRUE; //used for the main program loop */
/* Get the name of the computer for us and change the value of comp_name */
GetComputerName(comp_name, &comp_size);
/* TODO: Remove this section of code when program becomes stable enough for production use. */
wprintf(L"\n*WARNING*: This program is incomplete and may not work properly.\n");
/* Print the header information */
PrintResourceString(IDS_APP_HEADER, DISKPART_VERSION);
PrintResourceString(IDS_APP_LICENSE);
PrintResourceString(IDS_APP_CURR_COMPUTER, comp_name);
/* Find out if the user is loading a script */
if (argc >= 2)
{
/* if there are arguments when starting the program
determine if the script flag is enabled */
if ((wcsicmp(argv[1], L"/s") == 0) ||
(wcsicmp(argv[1], L"-s") == 0))
{
/* see if the user has put anything after the script flag; if not,
then it doesn't run the run_script() command. */
/* Alternative comment: Fail if the script name is missing */
if (argc == 3)
return EXIT_FAILURE;
interpreter_running = run_script(argv[2]);
}
}
/* the main program loop */
while (interpreter_running)
{
interpreter_running = interpret_main();
}
/* Let the user know the program is exiting */
PrintResourceString(IDS_APP_LEAVING);
return EXIT_SUCCESS;
}

View File

@ -0,0 +1,201 @@
/*
* 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
* PROGRAMMERS: Lee Schroeder
*/
#ifndef DISKPART_H
#define DISKPART_H
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "resource.h"
/* DEFINES *******************************************************************/
typedef struct _COMMAND
{
WCHAR *name;
BOOL (*func)(INT, WCHAR**);
VOID (*help)(INT, WCHAR**);
} COMMAND, *PCOMMAND;
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 DISKPART_VERSION L"0.0.019"
#define MAX_STRING_SIZE 1024
#define MAX_ARGS_COUNT 256
/* PROTOTYPES *****************************************************************/
/* active.c */
BOOL active_main(INT argc, WCHAR **argv);
VOID help_active(INT argc, WCHAR **argv);
/* add.c */
BOOL add_main(INT argc, WCHAR **argv);
VOID help_add(INT argc, WCHAR **argv);
/* assign.c */
BOOL assign_main(INT argc, WCHAR **argv);
VOID help_assign(INT argc, WCHAR **argv);
/* attach.c */
BOOL attach_main(INT argc, WCHAR **argv);
VOID help_attach(INT argc, WCHAR **argv);
/* attributes.h */
VOID help_attributes(INT argc, WCHAR **argv);
BOOL attributes_main(INT argc, WCHAR **argv);
/* automount.c */
BOOL automount_main(INT argc, WCHAR **argv);
VOID help_automount(INT argc, WCHAR **argv);
/* break.c */
BOOL break_main(INT argc, WCHAR **argv);
VOID help_break(INT argc, WCHAR **argv);
/* clean.c */
BOOL clean_main(INT argc, WCHAR **argv);
VOID help_clean(INT argc, WCHAR **argv);
/* compact.c */
BOOL compact_main(INT argc, WCHAR **argv);
VOID help_compact(INT argc, WCHAR **argv);
/* convert.c */
BOOL convert_main(INT argc, WCHAR **argv);
VOID help_convert(INT argc, WCHAR **argv);
/* create.c */
BOOL create_main(INT argc, WCHAR **argv);
VOID help_create(INT argc, WCHAR **argv);
/* delete.c */
BOOL delete_main(INT argc, WCHAR **argv);
VOID help_delete(INT argc, WCHAR **argv);
/* detach.c */
BOOL detach_main(INT argc, WCHAR **argv);
VOID help_detach(INT argc, WCHAR **argv);
/* detail.c */
BOOL detail_main(INT argc, WCHAR **argv);
VOID help_detail(INT argc, WCHAR **argv);
/* diskpart.c */
VOID PrintResourceString(INT resID, ...);
/* expand.c */
BOOL expand_main(INT argc, WCHAR **argv);
VOID help_expand(INT argc, WCHAR **argv);
/* extend.c */
BOOL extend_main(INT argc, WCHAR **argv);
VOID help_extend(INT argc, WCHAR **argv);
/* filesystem.c */
BOOL filesystems_main(INT argc, WCHAR **argv);
VOID help_filesystems(INT argc, WCHAR **argv);
/* format.c */
BOOL format_main(INT argc, WCHAR **argv);
VOID help_format(INT argc, WCHAR **argv);
/* gpt.c */
BOOL gpt_main(INT argc, WCHAR **argv);
VOID help_gpt(INT argc, WCHAR **argv);
/* help.c */
BOOL help_main(INT argc, WCHAR **argv);
VOID help_help(INT argc, WCHAR **argv);
VOID help_cmdlist(VOID);
VOID help_print_noerr(VOID);
/* import. c */
BOOL import_main(INT argc, WCHAR **argv);
VOID help_import(INT argc, WCHAR **argv);
/* inactive.c */
BOOL inactive_main(INT argc, WCHAR **argv);
VOID help_inactive(INT argc, WCHAR **argv);
/* interpreter.c */
BOOL interpret_script(WCHAR *line);
BOOL interpret_main(VOID);
BOOL interpret_cmd(INT argc, WCHAR **argv);
/* list.c */
BOOL list_main(INT argc, WCHAR **argv);
VOID help_list(INT argc, WCHAR **argv);
/* merge.c */
BOOL merge_main(INT argc, WCHAR **argv);
VOID help_merge(INT argc, WCHAR **argv);
/* offline.c */
BOOL offline_main(INT argc, WCHAR **argv);
VOID help_offline(INT argc, WCHAR **argv);
/* online.c */
BOOL online_main(INT argc, WCHAR **argv);
VOID help_online(INT argc, WCHAR **argv);
/* recover.c */
BOOL recover_main(INT argc, WCHAR **argv);
VOID help_recover(INT argc, WCHAR **argv);
/* remove.c */
BOOL remove_main(INT argc, WCHAR **argv);
VOID help_remove(INT argc, WCHAR **argv);
/* repair.c */
BOOL repair_main(INT argc, WCHAR **argv);
VOID help_repair(INT argc, WCHAR **argv);
/* rescan.c */
BOOL rescan_main(INT argc, WCHAR **argv);
VOID help_rescan(INT argc, WCHAR **argv);
/* retain.c */
BOOL retain_main(INT argc, WCHAR **argv);
VOID help_retain(INT argc, WCHAR **argv);
/* san.c */
BOOL san_main(INT argc, WCHAR **argv);
VOID help_san(INT argc, WCHAR **argv);
/* select.c */
BOOL select_main(INT argc, WCHAR **argv);
VOID help_select(INT argc, WCHAR **argv);
/* setid.c */
BOOL setid_main(INT argc, WCHAR **argv);
VOID help_setid(INT argc, WCHAR **argv);
/* shrink.c */
BOOL shrink_main(INT argc, WCHAR **argv);
VOID help_shrink(INT argc, WCHAR **argv);
/* uniqueid.c */
BOOL uniqueid_main(INT argc, WCHAR **argv);
VOID help_uniqueid(INT argc, WCHAR **argv);
#endif /* DISKPART_H */

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="diskpart" type="win32cui" installbase="system32" installname="diskpart.exe" unicode="true" >
<include base="diskpart">.</include>
<!-- library>ntdll</library -->
<library>user32</library>
<file>active.c</file>
<file>add.c</file>
<file>assign.c</file>
<file>attach.c</file>
<file>attributes.c</file>
<file>automount.c</file>
<file>break.c</file>
<file>clean.c</file>
<file>compact.c</file>
<file>convert.c</file>
<file>create.c</file>
<file>delete.c</file>
<file>detach.c</file>
<file>detail.c</file>
<file>diskpart.c</file>
<file>expand.c</file>
<file>extend.c</file>
<file>filesystems.c</file>
<file>format.c</file>
<file>gpt.c</file>
<file>help.c</file>
<file>import.c</file>
<file>inactive.c</file>
<file>interpreter.c</file>
<file>list.c</file>
<file>merge.c</file>
<file>offline.c</file>
<file>online.c</file>
<file>recover.c</file>
<file>remove.c</file>
<file>repair.c</file>
<file>rescan.c</file>
<file>retain.c</file>
<file>san.c</file>
<file>select.c</file>
<file>setid.c</file>
<file>shrink.c</file>
<file>uniqueid.c</file>
<file>diskpart.rc</file>
</module>

View File

@ -0,0 +1,7 @@
#define REACTOS_STR_FILE_DESCRIPTION "Disk Partitioning Tool\0"
#define REACTOS_STR_INTERNAL_NAME "diskpart\0"
#define REACTOS_STR_ORIGINAL_FILENAME "diskpart.exe\0"
#define REACTOS_STR_ORIGINAL_COPYRIGHT "(C) 2011 Lee Schroeder\0"
#include <reactos/version.rc>
#include "lang/en-US.rc"

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/expand.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL expand_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_expand(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_EXPAND);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/extend.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL extend_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_extend(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_EXTEND);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/filesystems.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL filesystems_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_filesystems(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_FILESYSTEMS);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/format.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL format_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_format(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_FORMAT);
}

View File

@ -0,0 +1,19 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/gpt.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL gpt_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_gpt(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_GPT);
}

View File

@ -0,0 +1,97 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/help.c
* PURPOSE: Manages all the partitions of the OS in an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
/*
* help_cmdlist():
* shows all the available commands and basic descriptions for diskpart
*/
VOID help_cmdlist(VOID)
{
/* Print the header information */
PrintResourceString(IDS_APP_HEADER, DISKPART_VERSION);
/* lists all the commands and the basic descriptions */
PrintResourceString(IDS_HELP_CMD_DESC_ACTIVE);
PrintResourceString(IDS_HELP_CMD_DESC_ADD);
PrintResourceString(IDS_HELP_CMD_DESC_ASSIGN);
PrintResourceString(IDS_HELP_CMD_DESC_ATTACH);
PrintResourceString(IDS_HELP_CMD_DESC_ATTRIBUTES);
PrintResourceString(IDS_HELP_CMD_DESC_AUTOMOUNT);
PrintResourceString(IDS_HELP_CMD_DESC_BREAK);
PrintResourceString(IDS_HELP_CMD_DESC_CLEAN);
PrintResourceString(IDS_HELP_CMD_DESC_COMPACT);
PrintResourceString(IDS_HELP_CMD_DESC_CONVERT);
PrintResourceString(IDS_HELP_CMD_DESC_CREATE);
PrintResourceString(IDS_HELP_CMD_DESC_DELETE);
PrintResourceString(IDS_HELP_CMD_DESC_DETACH);
PrintResourceString(IDS_HELP_CMD_DESC_DETAIL);
PrintResourceString(IDS_HELP_CMD_DESC_EXIT);
PrintResourceString(IDS_HELP_CMD_DESC_EXPAND);
PrintResourceString(IDS_HELP_CMD_DESC_EXTEND);
PrintResourceString(IDS_HELP_CMD_DESC_FS);
PrintResourceString(IDS_HELP_CMD_DESC_FORMAT);
PrintResourceString(IDS_HELP_CMD_DESC_GPT);
PrintResourceString(IDS_HELP_CMD_DESC_HELP);
PrintResourceString(IDS_HELP_CMD_DESC_IMPORT);
PrintResourceString(IDS_HELP_CMD_DESC_INACTIVE);
PrintResourceString(IDS_HELP_CMD_DESC_LIST);
PrintResourceString(IDS_HELP_CMD_DESC_MERGE);
PrintResourceString(IDS_HELP_CMD_DESC_OFFLINE);
PrintResourceString(IDS_HELP_CMD_DESC_ONLINE);
PrintResourceString(IDS_HELP_CMD_DESC_RECOVER);
PrintResourceString(IDS_HELP_CMD_DESC_REM);
PrintResourceString(IDS_HELP_CMD_DESC_REMOVE);
PrintResourceString(IDS_HELP_CMD_DESC_REPAIR);
PrintResourceString(IDS_HELP_CMD_DESC_RESCAN);
PrintResourceString(IDS_HELP_CMD_DESC_RETAIN);
PrintResourceString(IDS_HELP_CMD_DESC_SAN);
PrintResourceString(IDS_HELP_CMD_DESC_SELECT);
PrintResourceString(IDS_HELP_CMD_DESC_SETID);
PrintResourceString(IDS_HELP_CMD_DESC_SHRINK);
PrintResourceString(IDS_HELP_CMD_DESC_UNIQUEID);
printf("\n");
}
VOID help_help(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_HELP);
}
/* help_main(char *arg):
* main entry point for the help command. Gives help to users who needs it.
*/
BOOL help_main(INT argc, WCHAR **argv)
{
PCOMMAND cmdptr;
if (argc == 1)
{
help_cmdlist();
return TRUE;
}
/* Scan internal command table */
for (cmdptr = cmds; cmdptr->name; cmdptr++)
{
if (_wcsicmp(argv[0], cmdptr->name) == 0 && cmdptr->help != NULL)
{
cmdptr->help(argc, argv);
return TRUE;
}
}
help_cmdlist();
return TRUE;
}

View File

@ -0,0 +1,19 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/import.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL import_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_import(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_IMPORT);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/inactive.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL inactive_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_inactive(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_INACTIVE);
}

View File

@ -0,0 +1,188 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/interpreter.c
* PURPOSE: Reads the user input and then envokes the selected
* command by the user.
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL exit_main(INT argc, WCHAR **argv);
BOOL rem_main(INT argc, WCHAR **argv);
COMMAND cmds[] =
{
{L"active", active_main, help_active},
{L"add", add_main, help_add},
{L"assign", assign_main, help_assign},
{L"attributes", attributes_main, help_attributes},
{L"automount", automount_main, help_automount},
{L"break", break_main, help_break},
{L"clean", clean_main, help_clean},
{L"compact", compact_main, help_compact},
{L"convert", convert_main, help_convert},
{L"create", create_main, help_create},
{L"delete", delete_main, help_delete},
{L"detail", detail_main, help_detail},
{L"detach", detach_main, help_detach},
{L"exit", exit_main, NULL},
{L"expand", expand_main, help_expand},
{L"extend", extend_main, help_extend},
{L"filesystems", filesystems_main, help_filesystems},
{L"format", format_main, help_format},
{L"gpt", gpt_main, help_gpt},
{L"help", help_main, help_help},
{L"list", list_main, help_list},
{L"import", import_main, help_import},
{L"inactive", inactive_main, help_inactive},
{L"merge", merge_main, help_merge},
{L"offline", offline_main, help_offline},
{L"online", online_main, help_online},
{L"recover", recover_main, help_recover},
{L"rem", rem_main, NULL},
{L"remove", remove_main, help_remove},
{L"repair", repair_main, help_repair},
{L"rescan", rescan_main, help_rescan},
{L"retain", retain_main, help_retain},
{L"san", san_main, help_san},
{L"select", select_main, help_select},
{L"setid", setid_main, help_setid},
{L"shrink", shrink_main, help_shrink},
{L"uniqueid", uniqueid_main, help_uniqueid},
{NULL, NULL, NULL}
};
/* FUNCTIONS *****************************************************************/
BOOL
exit_main(INT argc, WCHAR **argv)
{
return FALSE;
}
BOOL
rem_main(INT argc, WCHAR **argv)
{
return TRUE;
}
/*
* interpret_cmd(char *cmd_line, char *arg_line):
* compares the command name to a list of available commands, and
* determines which function to envoke.
*/
BOOL
interpret_cmd(int argc, WCHAR **argv)
{
PCOMMAND cmdptr;
/* Scan internal command table */
for (cmdptr = cmds; cmdptr->name; cmdptr++)
{
if (wcsicmp(argv[0], cmdptr->name) == 0)
{
return cmdptr->func(argc, argv);
}
}
help_cmdlist();
return TRUE;
}
/*
* interpret_script(char *line):
* The main function used for when reading commands from scripts.
*/
BOOL
interpret_script(WCHAR *input_line)
{
WCHAR *args_vector[MAX_ARGS_COUNT];
INT args_count = 0;
BOOL bWhiteSpace = TRUE;
WCHAR *ptr;
memset(args_vector, 0, sizeof(args_vector));
ptr = input_line;
while (*ptr != 0)
{
if (iswspace(*ptr) || *ptr == L'\n')
{
*ptr = 0;
bWhiteSpace = TRUE;
}
else
{
if ((bWhiteSpace == TRUE) && (args_count < MAX_ARGS_COUNT))
{
args_vector[args_count] = ptr;
args_count++;
}
bWhiteSpace = FALSE;
}
ptr++;
}
/* sends the string to find the command */
return interpret_cmd(args_count, args_vector);
}
/*
* interpret_main():
* Contents for the main program loop as it reads each line, and then
* it sends the string to interpret_line, where it determines what
* command to use.
*/
BOOL
interpret_main(VOID)
{
WCHAR input_line[MAX_STRING_SIZE];
WCHAR *args_vector[MAX_ARGS_COUNT];
INT args_count = 0;
BOOL bWhiteSpace = TRUE;
WCHAR *ptr;
memset(args_vector, 0, sizeof(args_vector));
/* shown just before the input where the user places commands */
PrintResourceString(IDS_APP_PROMPT);
/* gets input from the user. */
fgetws(input_line, MAX_STRING_SIZE, stdin);
ptr = input_line;
while (*ptr != 0)
{
if (iswspace(*ptr) || *ptr == L'\n')
{
*ptr = 0;
bWhiteSpace = TRUE;
}
else
{
if ((bWhiteSpace == TRUE) && (args_count < MAX_ARGS_COUNT))
{
args_vector[args_count] = ptr;
args_count++;
}
bWhiteSpace = FALSE;
}
ptr++;
}
/* sends the string to find the command */
return interpret_cmd(args_count, args_vector);
}

View File

@ -0,0 +1,359 @@
/*
* ReactOS DiskPart Resource File
* Langauge: US English (en-US)
* Author: Lee Schroeder
*/
#include <windows.h>
#include "../resource.h"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
/* Basic application information */
STRINGTABLE DISCARDABLE
BEGIN
IDS_APP_HEADER, "\nReactOS DiskPart version %s\n"
IDS_APP_LICENSE, "Licensed under the GNU GPLv2\n"
IDS_APP_CURR_COMPUTER, "On computer: %s\n\n"
IDS_APP_LEAVING, "\nLeaving DiskPart...\n"
IDS_APP_PROMPT, "DISKPART> "
END
/* Disk Information Labels */
STRINGTABLE DISCARDABLE
BEGIN
IDS_DETAIL_INFO_DISK_ID, "Disk"
IDS_DETAIL_INFO_TYPE, "Type"
IDS_DETAIL_INFO_STATUS, "Status"
IDS_DETAIL_INFO_PATH, "Path"
IDS_DETAIL_INFO_TARGET, "Target"
IDS_DETAIL_INFO_LUN_ID, "LUN ID"
IDS_DETAIL_INFO_LOC_PATH, "Location Path"
IDS_DETAIL_INFO_CURR_RO_STATE, "Current Read-only State"
IDS_DETAIL_INFO_RO, "Read-only"
IDS_DETAIL_INFO_BOOT_DSK, "Boot Disk"
IDS_DETAIL_INFO_PAGE_FILE_DSK, "Pagefile Disk"
IDS_DETAIL_INFO_HIBER_FILE_DSK, "Hibernation File Disk"
IDS_DETAIL_INFO_CRASH_DSK, "Crashdump Disk"
IDS_DETAIL_INFO_CLST_DSK, "Clustered Disk"
END
/* Detail header titles */
STRINGTABLE DISCARDABLE
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"
END
/* Disk Status */
STRINGTABLE DISCARDABLE
BEGIN
IDS_STATUS_YES "Yes"
IDS_STATUS_NO "No"
IDS_STATUS_DISK_HEALTHY "Healthy"
IDS_STATUS_DISK_SICK "Sick"
IDS_STATUS_UNAVAILABLE "UNAVAILABLE"
IDS_STATUS_ONLINE "Online"
IDS_STATUS_OFFLINE "Offline"
IDS_STATUS_NO_MEDIA "No Media"
END
/* CMD Messages for commands */
STRINGTABLE DISCARDABLE
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
/* Help Command Descripions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_DESC_ACTIVE "ACTIVE\t\t- Mark the selected partition as active.\n"
IDS_HELP_CMD_DESC_ADD "ADD\t\t- Add a mirror to a simple volume.\n"
IDS_HELP_CMD_DESC_ASSIGN "ASSIGN\t\t- Assign a drive letter or mount point to the selected volume.\n"
IDS_HELP_CMD_DESC_ATTACH "ATTACH\t\t- Attaches a virtual disk file.\n"
IDS_HELP_CMD_DESC_ATTRIBUTES "ATTRIBUTES\t- Manipulate volume or disk attributes.\n"
IDS_HELP_CMD_DESC_AUTOMOUNT "AUTOMOUNT\t- Enable and Disable automatic mounting of basic volumes.\n"
IDS_HELP_CMD_DESC_BREAK "BREAK\t\t- Break a mirror set.\n"
IDS_HELP_CMD_DESC_CLEAN "CLEAN\t\t- Clear the configuration information, or all information, off\n\t\t the disk.\n"
IDS_HELP_CMD_DESC_COMPACT "COMPACT\t\t- Attempts to reduce the physical size of the file.\n"
IDS_HELP_CMD_DESC_CONVERT "CONVERT\t\t- Convert between different disk formats.\n"
IDS_HELP_CMD_DESC_CREATE "CREATE\t\t- Create a volume, partition, or virtual disk.\n"
IDS_HELP_CMD_DESC_DELETE "DELETE\t\t- Delete an object.\n"
IDS_HELP_CMD_DESC_DETACH "DETACH\t\t- Detaches a virtual disk file.\n"
IDS_HELP_CMD_DESC_DETAIL "DETAIL\t\t- Provide details about an object.\n"
IDS_HELP_CMD_DESC_EXIT "EXIT\t\t- Exit DiskPart.\n"
IDS_HELP_CMD_DESC_EXPAND "EXPAND\t\t- Expands the maximum size available on a virtual disk.\n"
IDS_HELP_CMD_DESC_EXTEND "EXTEND\t\t- Extend a volume.\n"
IDS_HELP_CMD_DESC_FS "FILESYSTEMS\t- Display current and supported file systems on the volume.\n"
IDS_HELP_CMD_DESC_FORMAT "FORMAT\t\t- Format the volume or partition.\n"
IDS_HELP_CMD_DESC_GPT "GPT\t\t- Assign attributes to the selected GPT partition.\n"
IDS_HELP_CMD_DESC_HELP "HELP\t\t- Display a list of commands.\n"
IDS_HELP_CMD_DESC_IMPORT "IMPORT\t\t- Import a disk group.\n"
IDS_HELP_CMD_DESC_INACTIVE "INACTIVE\t- Mark the selected partition as inactive.\n"
IDS_HELP_CMD_DESC_LIST "LIST\t\t- Display a list of objects.\n"
IDS_HELP_CMD_DESC_MERGE "MERGE\t\t- Merges a child disk with its parents.\n"
IDS_HELP_CMD_DESC_OFFLINE "OFFLINE\t\t- Offline an object that is currently marked as online.\n"
IDS_HELP_CMD_DESC_ONLINE "ONLINE\t\t- Online an object that is currently marked as offline.\n"
IDS_HELP_CMD_DESC_RECOVER "RECOVER\t\t- Refreshes the state of all disks in the invalid pack,\n\t\t and resynchronizes mirrored volumes and RAID5 volumes\n\t\t that have stale plex or parity data.\n"
IDS_HELP_CMD_DESC_REM "REM\t\t- Does nothing. This is used to comment scripts.\n"
IDS_HELP_CMD_DESC_REMOVE "REMOVE\t\t- Remove a drive letter or mount point assignment.\n"
IDS_HELP_CMD_DESC_REPAIR "REPAIR\t\t- Repair a RAID-5 volume with a failed member.\n"
IDS_HELP_CMD_DESC_RESCAN "RESCAN\t\t- Rescan the computer looking for disks and volumes.\n"
IDS_HELP_CMD_DESC_RETAIN "RETAIN\t\t- Place a retained partition under a simple volume.\n"
IDS_HELP_CMD_DESC_SAN "SAN\t\t- Display or set the SAN policy for the currently booted OS.\n"
IDS_HELP_CMD_DESC_SELECT "SELECT\t\t- Shift the focus to an object.\n"
IDS_HELP_CMD_DESC_SETID "SETID\t\t- Change the partition type.\n"
IDS_HELP_CMD_DESC_SHRINK "SHRINK\t\t- Reduce the size of the selected volume.\n"
IDS_HELP_CMD_DESC_UNIQUEID "UNIQUEID\t- Displays or sets the GUID partition table (GPT) identifier\n\t\t or master boot record (MBR) signature of a disk."
END
/* Common Error Messages */
STRINGTABLE DISCARDABLE
BEGIN
IDS_ERROR_MSG_NO_SCRIPT "Error opening script file: %s\n"
END
/* Active help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_ACTIVE "\n\
<Add active command help text here>\n\n"
END
/* Add help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_ADD "\n\
<Add add command help text here>\n\n"
END
/* Assign help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_ASSIGN "\n\
<Add assign command help text here>\n\n"
END
/* Attach help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_ATTACH "\n\
<Add attach command help text here>\n\n"
END
/* Attributes Command Messages */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_ATTRIBUTES "\n\
<Add attributes command help text here>\n\n"
END
/* Automount help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_AUTOMOUNT "\n\
<Add automount command help text here>\n\n"
END
/* Break help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_BREAK "\n\
<Add break command help text here>\n\n"
END
/* Clean help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_CLEAN "\n\
<Add clean command help text here>\n\n"
END
/* Compact help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_COMPACT "\n\
<Add compact command help text here>\n\n"
END
/* Convert help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_CONVERT "\n\
<Add convert command help text here>\n\n"
END
/* Delete help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_DELETE "\n\
<Add delete command help text here>\n\n"
END
/* Detach help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_DETACH "\n\
<Add detach command help text here>\n\n"
END
/* Expand help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_EXPAND "\n\
<Add expand command help text here>\n\n"
END
/* Extend help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_EXTEND "\n\
<Add extend command help text here>\n\n"
END
/* Filesystems help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_FILESYSTEMS "\n\
<Add filesystems command help text here>\n\n"
END
/* Format help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_FORMAT "\n\
<Add format command help text here>\n\n"
END
/* GPT help description */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_GPT "\n\
<Add gpt command help text here>\n\n"
END
/* Help help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_HELP "\n\
<Add help command help text here>\n\n"
END
/* Import help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_IMPORT "\n\
<Add import command help text here>\n\n"
END
/* Inactive help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_INACTIVE "\n\
<Add inactive command help text here>\n\n"
END
/* List help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_LIST "\n\
<Add list command help text here>\n\n"
END
/* Merge help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_MERGE "\n\
<Add merge command help text here>\n\n"
END
/* Offline help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_OFFLINE "\n\
<Add OFFLINE command help text here>\n\n"
END
/* Online help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_ONLINE "\n\
<Add ONLINE command help text here>\n\n"
END
/* Recover help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_RECOVER "\n\
<Add RECOVER command help text here>\n\n"
END
/* Remove help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_REMOVE "\n\
<Add REMOVE command help text here>\n\n"
END
/* Repair help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_REPAIR "\n\
<Add REPAIR command help text here>\n\n"
END
/* Rescan help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_RESCAN "\n\
<Add RESCAN command help text here>\n\n"
END
/* Retain help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_RETAIN "\n\
<Add RETAIN command help text here>\n\n"
END
/* San help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_SAN "\n\
<Add SAN command help text here>\n\n"
END
/* Select help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_SELECT "\n\
<Add SELECT command help text here>\n\n"
END
/* Setid help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_SETID "\n\
<Add SETID command help text here>\n\n"
END
/* Setid help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_SHRINK "\n\
<Add SHRINK command help text here>\n\n"
END
/* Uniqueid help descriptions */
STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_CMD_UNIQUEID "\n\
<Add UNIQUEID command help text here>\n\n"
END

View File

@ -0,0 +1,73 @@
/*
* 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
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
static VOID list_disk(VOID)
{
/* Header labels */
PrintResourceString(IDS_LIST_DISK_HEAD);
PrintResourceString(IDS_LIST_DISK_LINE);
printf("\n\n");
}
static VOID list_partition(VOID)
{
printf("List Partition!!\n");
}
static VOID list_volume(VOID)
{
PrintResourceString(IDS_LIST_VOLUME_HEAD);
}
static VOID list_vdisk(VOID)
{
printf("List VDisk!!\n");
}
BOOL list_main(INT argc, WCHAR **argv)
{
/* gets the first word from the string */
if (argc == 1)
{
help_list(0, NULL);
return TRUE;
}
/* 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();
}
else
{
help_list(0, NULL);
}
return TRUE;
}
VOID help_list(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_LIST);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/merge.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL merge_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_merge(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_MERGE);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/offline.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL offline_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_offline(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_OFFLINE);
}

View File

@ -0,0 +1,22 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/online.h
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL online_main(INT argc, WCHAR **argv)
{
help_online(0, NULL);
return TRUE;
}
VOID help_online(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_ONLINE);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/recover.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL recover_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_recover(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_RECOVER);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/remove.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL remove_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_remove(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_REMOVE);
}

View File

@ -0,0 +1,16 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/remove.h
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#ifndef REMOVE_H_INCLUDED
#define REMOVE_H_INCLUDED
/* FUNCTIONS *****************************************************************/
BOOL remove_main(INT argc, WCHAR **argv);
VOID help_remove(INT argc, WCHAR **argv);
#endif // REMOVE_H_INCLUDED

View File

@ -0,0 +1,22 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/repair.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL repair_main(INT argc, WCHAR **argv)
{
printf("\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n");
return TRUE;
}
VOID help_repair(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_REPAIR);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/rescan.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL rescan_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_rescan(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_RESCAN);
}

View File

@ -0,0 +1,128 @@
/*
* 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
* PROGRAMMERS: Lee Schroeder
*/
#ifndef RESOURCE_H
#define RESOURCE_H
#define IDS_APP_HEADER 0
#define IDS_APP_LICENSE 2
#define IDS_APP_CURR_COMPUTER 3
#define IDS_APP_LEAVING 4
#define IDS_APP_PROMPT 5
#define IDS_DETAIL_INFO_DISK_ID 6
#define IDS_DETAIL_INFO_TYPE 7
#define IDS_DETAIL_INFO_STATUS 8
#define IDS_DETAIL_INFO_PATH 9
#define IDS_DETAIL_INFO_TARGET 10
#define IDS_DETAIL_INFO_LUN_ID 11
#define IDS_DETAIL_INFO_LOC_PATH 12
#define IDS_DETAIL_INFO_CURR_RO_STATE 13
#define IDS_DETAIL_INFO_RO 14
#define IDS_DETAIL_INFO_BOOT_DSK 15
#define IDS_DETAIL_INFO_PAGE_FILE_DSK 16
#define IDS_DETAIL_INFO_HIBER_FILE_DSK 17
#define IDS_DETAIL_INFO_CRASH_DSK 18
#define IDS_DETAIL_INFO_CLST_DSK 19
#define IDS_LIST_DISK_HEAD 20
#define IDS_LIST_DISK_LINE 21
#define IDS_LIST_VOLUME_HEAD 22
#define IDS_STATUS_YES 31
#define IDS_STATUS_NO 32
#define IDS_STATUS_DISK_HEALTHY 33
#define IDS_STATUS_DISK_SICK 34
#define IDS_STATUS_UNAVAILABLE 35
#define IDS_STATUS_ONLINE 36
#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
#define IDS_HELP_CMD_DESC_ADD 59
#define IDS_HELP_CMD_DESC_ASSIGN 60
#define IDS_HELP_CMD_DESC_ATTRIBUTES 61
#define IDS_HELP_CMD_DESC_ATTACH 62
#define IDS_HELP_CMD_DESC_AUTOMOUNT 63
#define IDS_HELP_CMD_DESC_BREAK 64
#define IDS_HELP_CMD_DESC_CLEAN 65
#define IDS_HELP_CMD_DESC_COMPACT 66
#define IDS_HELP_CMD_DESC_CONVERT 67
#define IDS_HELP_CMD_DESC_CREATE 68
#define IDS_HELP_CMD_DESC_DELETE 69
#define IDS_HELP_CMD_DESC_DETAIL 70
#define IDS_HELP_CMD_DESC_DETACH 71
#define IDS_HELP_CMD_DESC_EXIT 72
#define IDS_HELP_CMD_DESC_EXTEND 73
#define IDS_HELP_CMD_DESC_EXPAND 74
#define IDS_HELP_CMD_DESC_FS 75
#define IDS_HELP_CMD_DESC_FORMAT 76
#define IDS_HELP_CMD_DESC_GPT 77
#define IDS_HELP_CMD_DESC_HELP 78
#define IDS_HELP_CMD_DESC_IMPORT 79
#define IDS_HELP_CMD_DESC_INACTIVE 80
#define IDS_HELP_CMD_DESC_LIST 81
#define IDS_HELP_CMD_DESC_MERGE 82
#define IDS_HELP_CMD_DESC_ONLINE 83
#define IDS_HELP_CMD_DESC_OFFLINE 84
#define IDS_HELP_CMD_DESC_RECOVER 85
#define IDS_HELP_CMD_DESC_REM 88
#define IDS_HELP_CMD_DESC_REMOVE 89
#define IDS_HELP_CMD_DESC_REPAIR 90
#define IDS_HELP_CMD_DESC_RESCAN 91
#define IDS_HELP_CMD_DESC_RETAIN 92
#define IDS_HELP_CMD_DESC_SAN 93
#define IDS_HELP_CMD_DESC_SELECT 94
#define IDS_HELP_CMD_DESC_SETID 95
#define IDS_HELP_CMD_DESC_SHRINK 96
#define IDS_HELP_CMD_DESC_UNIQUEID 97
#define IDS_ERROR_MSG_NO_SCRIPT 104
#define IDS_HELP_CMD_ACTIVE 105
#define IDS_HELP_CMD_ADD 106
#define IDS_HELP_CMD_ASSIGN 107
#define IDS_HELP_CMD_ATTACH 108
#define IDS_HELP_CMD_ATTRIBUTES 109
#define IDS_HELP_CMD_AUTOMOUNT 110
#define IDS_HELP_CMD_BREAK 111
#define IDS_HELP_CMD_CLEAN 112
#define IDS_HELP_CMD_COMPACT 113
#define IDS_HELP_CMD_CONVERT 114
#define IDS_HELP_CMD_CREATE 115
#define IDS_HELP_CMD_DELETE 116
#define IDS_HELP_CMD_DETACH 117
#define IDS_HELP_CMD_DETAIL 118
#define IDS_HELP_CMD_EXPAND 119
#define IDS_HELP_CMD_EXTEND 120
#define IDS_HELP_CMD_FILESYSTEMS 121
#define IDS_HELP_CMD_FORMAT 122
#define IDS_HELP_CMD_GPT 123
#define IDS_HELP_CMD_HELP 124
#define IDS_HELP_CMD_IMPORT 125
#define IDS_HELP_CMD_INACTIVE 126
#define IDS_HELP_CMD_LIST 127
#define IDS_HELP_CMD_MERGE 128
#define IDS_HELP_CMD_OFFLINE 129
#define IDS_HELP_CMD_ONLINE 130
#define IDS_HELP_CMD_RECOVER 131
#define IDS_HELP_CMD_REMOVE 132
#define IDS_HELP_CMD_REPAIR 133
#define IDS_HELP_CMD_RESCAN 134
#define IDS_HELP_CMD_RETAIN 135
#define IDS_HELP_CMD_SAN 136
#define IDS_HELP_CMD_SELECT 137
#define IDS_HELP_CMD_SETID 138
#define IDS_HELP_CMD_SHRINK 139
#define IDS_HELP_CMD_UNIQUEID 140
#endif // RESOURCE_H

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/retain.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL retain_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_retain(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_RETAIN);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/san.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL san_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_san(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_SAN);
}

View File

@ -0,0 +1,20 @@
/*
* 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
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL select_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_select(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_SELECT);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/setid.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL setid_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_setid(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_SETID);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/shrink.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL shrink_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_shrink(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_SHRINK);
}

View File

@ -0,0 +1,20 @@
/*
* PROJECT: ReactOS DiskPart
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/diskpart/uniqueid.c
* PURPOSE: Manages all the partitions of the OS in
* an interactive way
* PROGRAMMERS: Lee Schroeder
*/
#include "diskpart.h"
BOOL uniqueid_main(INT argc, WCHAR **argv)
{
return TRUE;
}
VOID help_uniqueid(INT argc, WCHAR **argv)
{
PrintResourceString(IDS_HELP_CMD_UNIQUEID);
}

View File

@ -7,6 +7,9 @@
<directory name="bootok">
<xi:include href="bootok/bootok.rbuild" />
</directory>
<directory name="diskpart">
<xi:include href="diskpart/diskpart.rbuild" />
</directory>
<directory name="expand">
<xi:include href="expand/expand.rbuild" />
</directory>