2011-09-24 10:33:33 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS DiskPart
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-09-18 10:13:50 +00:00
|
|
|
* FILE: base/system/diskpart/diskpart.h
|
2016-10-01 22:58:21 +00:00
|
|
|
* PURPOSE: Manages all the partitions of the OS in an interactive way.
|
2011-09-24 10:33:33 +00:00
|
|
|
* PROGRAMMERS: Lee Schroeder
|
|
|
|
*/
|
2014-01-13 13:07:50 +00:00
|
|
|
|
2011-09-24 10:33:33 +00:00
|
|
|
#ifndef DISKPART_H
|
|
|
|
#define DISKPART_H
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2014-01-13 13:07:50 +00:00
|
|
|
#include <stdio.h>
|
2015-07-19 17:33:29 +00:00
|
|
|
#include <stdlib.h>
|
2014-01-13 13:07:50 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include <windef.h>
|
2015-07-19 17:33:29 +00:00
|
|
|
#include <winbase.h>
|
2015-07-20 19:17:06 +00:00
|
|
|
#include <winreg.h>
|
|
|
|
#include <wincon.h>
|
|
|
|
|
2016-10-07 22:50:32 +00:00
|
|
|
#include <conutils.h>
|
|
|
|
|
2015-07-20 19:17:06 +00:00
|
|
|
/*
|
|
|
|
#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>
|
|
|
|
*/
|
|
|
|
|
2015-07-19 17:33:29 +00:00
|
|
|
#define NTOS_MODE_USER
|
2015-07-20 19:17:06 +00:00
|
|
|
#include <ndk/cmfuncs.h>
|
2015-07-19 17:33:29 +00:00
|
|
|
#include <ndk/exfuncs.h>
|
|
|
|
#include <ndk/iofuncs.h>
|
2015-07-20 19:17:06 +00:00
|
|
|
#include <ndk/kefuncs.h>
|
|
|
|
#include <ndk/mmfuncs.h>
|
2015-07-19 17:33:29 +00:00
|
|
|
#include <ndk/obfuncs.h>
|
|
|
|
#include <ndk/psfuncs.h>
|
|
|
|
#include <ndk/rtlfuncs.h>
|
2015-07-20 19:17:06 +00:00
|
|
|
#include <ndk/setypes.h>
|
2015-07-19 17:33:29 +00:00
|
|
|
#include <ndk/umfuncs.h>
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
/* DEFINES *******************************************************************/
|
|
|
|
|
|
|
|
typedef struct _COMMAND
|
|
|
|
{
|
2013-05-29 11:40:43 +00:00
|
|
|
LPWSTR name;
|
2011-09-24 10:33:33 +00:00
|
|
|
BOOL (*func)(INT, WCHAR**);
|
2013-05-29 11:40:43 +00:00
|
|
|
INT help;
|
|
|
|
INT help_desc;
|
2011-09-24 10:33:33 +00:00
|
|
|
} COMMAND, *PCOMMAND;
|
|
|
|
|
|
|
|
extern COMMAND cmds[];
|
|
|
|
|
|
|
|
/* NOERR codes for the program */
|
2015-07-19 17:33:29 +00:00
|
|
|
//#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
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
#define MAX_STRING_SIZE 1024
|
|
|
|
#define MAX_ARGS_COUNT 256
|
|
|
|
|
2015-07-20 19:17:06 +00:00
|
|
|
|
|
|
|
typedef enum _FORMATSTATE
|
|
|
|
{
|
|
|
|
Unformatted,
|
|
|
|
UnformattedOrDamaged,
|
|
|
|
UnknownFormat,
|
|
|
|
Preformatted,
|
|
|
|
Formatted
|
|
|
|
} FORMATSTATE, *PFORMATSTATE;
|
|
|
|
|
|
|
|
typedef struct _PARTENTRY
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
|
|
|
|
struct _DISKENTRY *DiskEntry;
|
|
|
|
|
|
|
|
ULARGE_INTEGER StartSector;
|
|
|
|
ULARGE_INTEGER SectorCount;
|
|
|
|
|
|
|
|
BOOLEAN BootIndicator;
|
|
|
|
UCHAR PartitionType;
|
|
|
|
ULONG HiddenSectors;
|
|
|
|
ULONG PartitionNumber;
|
|
|
|
ULONG PartitionIndex;
|
|
|
|
|
|
|
|
CHAR DriveLetter;
|
|
|
|
CHAR VolumeLabel[17];
|
|
|
|
CHAR FileSystemName[9];
|
|
|
|
|
|
|
|
BOOLEAN LogicalPartition;
|
|
|
|
|
|
|
|
/* Partition is partitioned disk space */
|
|
|
|
BOOLEAN IsPartitioned;
|
|
|
|
|
|
|
|
/* Partition is new. Table does not exist on disk yet */
|
|
|
|
BOOLEAN New;
|
|
|
|
|
|
|
|
/* Partition was created automatically. */
|
|
|
|
BOOLEAN AutoCreate;
|
|
|
|
|
|
|
|
FORMATSTATE FormatState;
|
|
|
|
|
|
|
|
/* Partition must be checked */
|
|
|
|
BOOLEAN NeedsCheck;
|
|
|
|
|
|
|
|
struct _FILE_SYSTEM_ITEM *FileSystem;
|
|
|
|
} PARTENTRY, *PPARTENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _BIOSDISKENTRY
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
ULONG DiskNumber;
|
|
|
|
ULONG Signature;
|
|
|
|
ULONG Checksum;
|
|
|
|
BOOLEAN Recognized;
|
|
|
|
CM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
|
|
|
|
CM_INT13_DRIVE_PARAMETER Int13DiskData;
|
|
|
|
} BIOSDISKENTRY, *PBIOSDISKENTRY;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _DISKENTRY
|
|
|
|
{
|
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
|
|
|
|
ULONGLONG Cylinders;
|
|
|
|
ULONG TracksPerCylinder;
|
|
|
|
ULONG SectorsPerTrack;
|
|
|
|
ULONG BytesPerSector;
|
|
|
|
|
|
|
|
ULARGE_INTEGER SectorCount;
|
|
|
|
ULONG SectorAlignment;
|
|
|
|
ULONG CylinderAlignment;
|
|
|
|
|
|
|
|
BOOLEAN BiosFound;
|
|
|
|
ULONG BiosDiskNumber;
|
|
|
|
// ULONG Signature;
|
|
|
|
// ULONG Checksum;
|
|
|
|
|
|
|
|
ULONG DiskNumber;
|
|
|
|
USHORT Port;
|
|
|
|
USHORT Bus;
|
|
|
|
USHORT Id;
|
|
|
|
|
|
|
|
/* Has the partition list been modified? */
|
|
|
|
BOOLEAN Dirty;
|
|
|
|
|
|
|
|
BOOLEAN NewDisk;
|
|
|
|
BOOLEAN NoMbr; /* MBR is absent */
|
|
|
|
|
|
|
|
UNICODE_STRING DriverName;
|
|
|
|
|
|
|
|
PDRIVE_LAYOUT_INFORMATION LayoutBuffer;
|
|
|
|
|
|
|
|
PPARTENTRY ExtendedPartition;
|
|
|
|
|
|
|
|
LIST_ENTRY PrimaryPartListHead;
|
|
|
|
LIST_ENTRY LogicalPartListHead;
|
|
|
|
|
|
|
|
} DISKENTRY, *PDISKENTRY;
|
|
|
|
|
|
|
|
|
2015-07-19 17:33:29 +00:00
|
|
|
/* GLOBAL VARIABLES ***********************************************************/
|
|
|
|
|
2015-07-20 19:17:06 +00:00
|
|
|
extern LIST_ENTRY DiskListHead;
|
|
|
|
extern LIST_ENTRY BiosDiskListHead;
|
|
|
|
|
|
|
|
extern PDISKENTRY CurrentDisk;
|
|
|
|
extern PPARTENTRY CurrentPartition;
|
2015-07-19 17:33:29 +00:00
|
|
|
|
2011-09-24 10:33:33 +00:00
|
|
|
/* PROTOTYPES *****************************************************************/
|
|
|
|
|
|
|
|
/* active.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL active_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* add.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL add_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* assign.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL assign_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* attach.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL attach_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* attributes.h */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL attributes_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* automount.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL automount_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* break.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL break_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* clean.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL clean_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* compact.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL compact_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* convert.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL convert_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* create.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL create_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* delete.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL delete_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* detach.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL detach_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* detail.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL detail_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* diskpart.c */
|
|
|
|
|
|
|
|
/* expand.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL expand_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* extend.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL extend_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* filesystem.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL filesystems_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* format.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL format_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* gpt.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL gpt_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* help.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL help_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
VOID help_cmdlist(VOID);
|
|
|
|
|
|
|
|
/* import. c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL import_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* inactive.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL inactive_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* interpreter.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL InterpretScript(LPWSTR line);
|
|
|
|
BOOL InterpretCmd(INT argc, LPWSTR *argv);
|
2012-07-24 20:23:24 +00:00
|
|
|
VOID InterpretMain(VOID);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* list.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL list_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* merge.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL merge_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* offline.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL offline_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* online.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL online_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
2015-07-20 19:17:06 +00:00
|
|
|
/* partlist.c */
|
|
|
|
NTSTATUS
|
|
|
|
CreatePartitionList(VOID);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
DestroyPartitionList(VOID);
|
|
|
|
|
2011-09-24 10:33:33 +00:00
|
|
|
/* recover.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL recover_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* remove.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL remove_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* repair.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL repair_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* rescan.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL rescan_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* retain.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL retain_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* san.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL san_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* select.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL select_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* setid.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL setid_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* shrink.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL shrink_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
/* uniqueid.c */
|
2013-05-29 11:40:43 +00:00
|
|
|
BOOL uniqueid_main(INT argc, LPWSTR *argv);
|
2011-09-24 10:33:33 +00:00
|
|
|
|
|
|
|
#endif /* DISKPART_H */
|