ReactOS  0.4.14-dev-77-gd9e7c48
diskpart.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wincon.h>
#include <conutils.h>
#include <ndk/cmfuncs.h>
#include <ndk/exfuncs.h>
#include <ndk/iofuncs.h>
#include <ndk/kefuncs.h>
#include <ndk/mmfuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/psfuncs.h>
#include <ndk/rtlfuncs.h>
#include <ndk/setypes.h>
#include <ndk/umfuncs.h>
#include "resource.h"
Include dependency graph for diskpart.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _COMMAND
 
struct  _PARTENTRY
 
struct  _BIOSDISKENTRY
 
struct  _DISKENTRY
 

Macros

#define WIN32_NO_STATUS
 
#define NTOS_MODE_USER
 
#define MAX_STRING_SIZE   1024
 
#define MAX_ARGS_COUNT   256
 

Typedefs

typedef struct _COMMAND COMMAND
 
typedef struct _COMMANDPCOMMAND
 
typedef enum _FORMATSTATE FORMATSTATE
 
typedef enum _FORMATSTATEPFORMATSTATE
 
typedef struct _PARTENTRY PARTENTRY
 
typedef struct _PARTENTRYPPARTENTRY
 
typedef struct _BIOSDISKENTRY BIOSDISKENTRY
 
typedef struct _BIOSDISKENTRYPBIOSDISKENTRY
 
typedef struct _DISKENTRY DISKENTRY
 
typedef struct _DISKENTRYPDISKENTRY
 

Enumerations

enum  _FORMATSTATE {
  Unformatted, UnformattedOrDamaged, UnknownFormat, Preformatted,
  Formatted, Unformatted, UnformattedOrDamaged, UnknownFormat,
  Preformatted, Formatted
}
 

Functions

BOOL active_main (INT argc, LPWSTR *argv)
 
BOOL add_main (INT argc, LPWSTR *argv)
 
BOOL assign_main (INT argc, LPWSTR *argv)
 
BOOL attach_main (INT argc, LPWSTR *argv)
 
BOOL attributes_main (INT argc, LPWSTR *argv)
 
BOOL automount_main (INT argc, LPWSTR *argv)
 
BOOL break_main (INT argc, LPWSTR *argv)
 
BOOL clean_main (INT argc, LPWSTR *argv)
 
BOOL compact_main (INT argc, LPWSTR *argv)
 
BOOL convert_main (INT argc, LPWSTR *argv)
 
BOOL create_main (INT argc, LPWSTR *argv)
 
BOOL delete_main (INT argc, LPWSTR *argv)
 
BOOL detach_main (INT argc, LPWSTR *argv)
 
BOOL detail_main (INT argc, LPWSTR *argv)
 
BOOL expand_main (INT argc, LPWSTR *argv)
 
BOOL extend_main (INT argc, LPWSTR *argv)
 
BOOL filesystems_main (INT argc, LPWSTR *argv)
 
BOOL format_main (INT argc, LPWSTR *argv)
 
BOOL gpt_main (INT argc, LPWSTR *argv)
 
BOOL help_main (INT argc, LPWSTR *argv)
 
VOID help_cmdlist (VOID)
 
BOOL import_main (INT argc, LPWSTR *argv)
 
BOOL inactive_main (INT argc, LPWSTR *argv)
 
BOOL InterpretScript (LPWSTR line)
 
BOOL InterpretCmd (INT argc, LPWSTR *argv)
 
VOID InterpretMain (VOID)
 
BOOL list_main (INT argc, LPWSTR *argv)
 
BOOL merge_main (INT argc, LPWSTR *argv)
 
BOOL offline_main (INT argc, LPWSTR *argv)
 
BOOL online_main (INT argc, LPWSTR *argv)
 
NTSTATUS CreatePartitionList (VOID)
 
VOID DestroyPartitionList (VOID)
 
BOOL recover_main (INT argc, LPWSTR *argv)
 
BOOL remove_main (INT argc, LPWSTR *argv)
 
BOOL repair_main (INT argc, LPWSTR *argv)
 
BOOL rescan_main (INT argc, LPWSTR *argv)
 
BOOL retain_main (INT argc, LPWSTR *argv)
 
BOOL san_main (INT argc, LPWSTR *argv)
 
BOOL select_main (INT argc, LPWSTR *argv)
 
BOOL setid_main (INT argc, LPWSTR *argv)
 
BOOL shrink_main (INT argc, LPWSTR *argv)
 
BOOL uniqueid_main (INT argc, LPWSTR *argv)
 

Variables

COMMAND cmds []
 
LIST_ENTRY DiskListHead
 
LIST_ENTRY BiosDiskListHead
 
PDISKENTRY CurrentDisk
 
PPARTENTRY CurrentPartition
 

Macro Definition Documentation

◆ MAX_ARGS_COUNT

#define MAX_ARGS_COUNT   256

Definition at line 70 of file diskpart.h.

◆ MAX_STRING_SIZE

#define MAX_STRING_SIZE   1024

Definition at line 69 of file diskpart.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 35 of file diskpart.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 17 of file diskpart.h.

Typedef Documentation

◆ BIOSDISKENTRY

◆ COMMAND

◆ DISKENTRY

◆ FORMATSTATE

◆ PARTENTRY

◆ PBIOSDISKENTRY

◆ PCOMMAND

◆ PDISKENTRY

◆ PFORMATSTATE

◆ PPARTENTRY

Enumeration Type Documentation

◆ _FORMATSTATE

Enumerator
Unformatted 
UnformattedOrDamaged 
UnknownFormat 
Preformatted 
Formatted 
Unformatted 
UnformattedOrDamaged 
UnknownFormat 
Preformatted 
Formatted 

Definition at line 73 of file diskpart.h.

74 {
79  Formatted
enum _FORMATSTATE * PFORMATSTATE
enum _FORMATSTATE FORMATSTATE

Function Documentation

◆ active_main()

BOOL active_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file active.c.

12 {
13  ConPuts(StdOut, L"\nActive\n");
14  return TRUE;
15 }
#define TRUE
Definition: types.h:120
static const WCHAR L[]
Definition: oid.c:1250
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76

◆ add_main()

BOOL add_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file add.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ assign_main()

BOOL assign_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file assign.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ attach_main()

BOOL attach_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file attach.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ attributes_main()

BOOL attributes_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file attributes.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ automount_main()

BOOL automount_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file automount.c.

12 {
13  ConPuts(StdOut, L"Automount\n");
14  return TRUE;
15 }
#define TRUE
Definition: types.h:120
static const WCHAR L[]
Definition: oid.c:1250
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76

◆ break_main()

BOOL break_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file break.c.

12 {
13  ConPuts(StdOut, L"\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n");
14  return TRUE;
15 }
#define TRUE
Definition: types.h:120
static const WCHAR L[]
Definition: oid.c:1250
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76

◆ clean_main()

BOOL clean_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file clean.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ compact_main()

BOOL compact_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file compact.c.

12 {
13  return 0;
14 }

◆ convert_main()

BOOL convert_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file convert.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ create_main()

BOOL create_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file create.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ CreatePartitionList()

NTSTATUS CreatePartitionList ( VOID  )

Definition at line 2023 of file partlist.c.

2024 {
2025  PPARTLIST List;
2026  PDISKENTRY SystemDisk;
2030  ULONG ReturnSize;
2031  NTSTATUS Status;
2032  ULONG DiskNumber;
2036 
2038  0,
2039  sizeof(PARTLIST));
2040  if (List == NULL)
2041  return NULL;
2042 
2043  List->SystemPartition = NULL;
2044 
2045  InitializeListHead(&List->DiskListHead);
2046  InitializeListHead(&List->BiosDiskListHead);
2047 
2048  /*
2049  * Enumerate the disks seen by the BIOS; this will be used later
2050  * to map drives seen by NTOS with their corresponding BIOS names.
2051  */
2053 
2054  /* Enumerate disks seen by NTOS */
2056  &Sdi,
2057  sizeof(Sdi),
2058  &ReturnSize);
2059  if (!NT_SUCCESS(Status))
2060  {
2061  DPRINT1("NtQuerySystemInformation() failed, Status 0x%08lx", Status);
2063  return NULL;
2064  }
2065 
2066  for (DiskNumber = 0; DiskNumber < Sdi.NumberOfDisks; DiskNumber++)
2067  {
2069  L"\\Device\\Harddisk%lu\\Partition0",
2070  DiskNumber);
2072 
2074  &Name,
2076  NULL,
2077  NULL);
2078 
2082  &Iosb,
2085  if (NT_SUCCESS(Status))
2086  {
2087  AddDiskToList(FileHandle, DiskNumber, List);
2089  }
2090  }
2091 
2095 
2096  /*
2097  * Retrieve the system partition: the active partition on the system
2098  * disk (the one that will be booted by default by the hardware).
2099  */
2100  SystemDisk = GetSystemDisk(List);
2101  List->SystemPartition = (SystemDisk ? GetActiveDiskPartition(SystemDisk) : NULL);
2102 
2103  return List;
2104 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
struct _PARTLIST * PPARTLIST
static PPARTENTRY GetActiveDiskPartition(IN PDISKENTRY DiskEntry)
Definition: partlist.c:1967
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
static VOID UpdateDiskSignatures(IN PPARTLIST List)
Definition: partlist.c:1391
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE FileHandle
Definition: stats.c:38
#define FILE_READ_DATA
Definition: nt_native.h:628
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
return Iosb
Definition: create.c:4426
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static VOID UpdateHwDiskNumbers(IN PPARTLIST List)
Definition: partlist.c:1421
#define MAX_PATH
Definition: compat.h:26
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
static PDISKENTRY GetSystemDisk(IN PPARTLIST List)
Definition: partlist.c:1894
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
HANDLE ProcessHeap
Definition: servman.c:15
Status
Definition: gdiplustypes.h:24
static VOID EnumerateBiosDiskEntries(IN PPARTLIST PartList)
Definition: partlist.c:515
static VOID AddDiskToList(IN HANDLE FileHandle, IN ULONG DiskNumber, IN PPARTLIST List)
Definition: partlist.c:1482
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define DPRINT1
Definition: precomp.h:8
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static VOID AssignDriveLetters(IN PPARTLIST List)
Definition: partlist.c:316

Referenced by LoadSetupData(), rescan_main(), SelectPartitionPage(), UpgradeRepairPage(), and wmain().

◆ delete_main()

BOOL delete_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file delete.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ DestroyPartitionList()

VOID DestroyPartitionList ( VOID  )

Definition at line 1120 of file partlist.c.

1121 {
1122  PDISKENTRY DiskEntry;
1123  PBIOSDISKENTRY BiosDiskEntry;
1124  PPARTENTRY PartEntry;
1126 
1127  CurrentDisk = NULL;
1129 
1130  /* Release disk and partition info */
1131  while (!IsListEmpty(&DiskListHead))
1132  {
1134  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
1135 
1136  /* Release driver name */
1137  RtlFreeUnicodeString(&DiskEntry->DriverName);
1138 
1139  /* Release primary partition list */
1140  while (!IsListEmpty(&DiskEntry->PrimaryPartListHead))
1141  {
1142  Entry = RemoveHeadList(&DiskEntry->PrimaryPartListHead);
1143  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
1144 
1145  RtlFreeHeap(RtlGetProcessHeap(), 0, PartEntry);
1146  }
1147 
1148  /* Release logical partition list */
1149  while (!IsListEmpty(&DiskEntry->LogicalPartListHead))
1150  {
1151  Entry = RemoveHeadList(&DiskEntry->LogicalPartListHead);
1152  PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
1153 
1154  RtlFreeHeap(RtlGetProcessHeap(), 0, PartEntry);
1155  }
1156 
1157  /* Release layout buffer */
1158  if (DiskEntry->LayoutBuffer != NULL)
1159  RtlFreeHeap(RtlGetProcessHeap(), 0, DiskEntry->LayoutBuffer);
1160 
1161 
1162  /* Release disk entry */
1163  RtlFreeHeap(RtlGetProcessHeap(), 0, DiskEntry);
1164  }
1165 
1166  /* Release the bios disk info */
1167  while (!IsListEmpty(&BiosDiskListHead))
1168  {
1170  BiosDiskEntry = CONTAINING_RECORD(Entry, BIOSDISKENTRY, ListEntry);
1171 
1172  RtlFreeHeap(RtlGetProcessHeap(), 0, BiosDiskEntry);
1173  }
1174 }
LIST_ENTRY DiskListHead
Definition: partlist.c:70
LIST_ENTRY PrimaryPartListHead
Definition: partlist.h:124
PDISKENTRY CurrentDisk
Definition: partlist.c:73
struct _Entry Entry
Definition: kefuncs.h:640
LIST_ENTRY BiosDiskListHead
Definition: partlist.c:71
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
UNICODE_STRING DriverName
Definition: partlist.h:116
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
Definition: typedefs.h:117
LIST_ENTRY LogicalPartListHead
Definition: partlist.h:125
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:118
base of all file and directory entries
Definition: entries.h:82
PPARTENTRY CurrentPartition
Definition: partlist.c:74

◆ detach_main()

BOOL detach_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file detach.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ detail_main()

BOOL detail_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file detail.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ expand_main()

BOOL expand_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file expand.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ extend_main()

BOOL extend_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file extend.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ filesystems_main()

BOOL filesystems_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file filesystems.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ format_main()

BOOL format_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file format.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ gpt_main()

BOOL gpt_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file gpt.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ help_cmdlist()

VOID help_cmdlist ( VOID  )

Definition at line 15 of file help.c.

16 {
17  PCOMMAND cmdptr;
18 
19  /* Print the header information */
21  ConPuts(StdOut, L"\n");
22 
23  /* List all the commands and the basic descriptions */
24  for (cmdptr = cmds; cmdptr->name; cmdptr++)
25  ConResPuts(StdOut, cmdptr->help_desc);
26 
27  ConPuts(StdOut, L"\n");
28 }
COMMAND cmds[]
Definition: main.c:21
INT help_desc
Definition: diskpart.h:56
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define IDS_APP_HEADER
Definition: resource.h:13
#define StdOut
Definition: stream.h:76
Definition: main.c:14
WCHAR * name
Definition: main.c:16

Referenced by help_main(), and InterpretCmd().

◆ help_main()

BOOL help_main ( INT  argc,
LPWSTR argv 
)

Definition at line 33 of file help.c.

34 {
35  PCOMMAND cmdptr;
36 
37  if (argc == 1)
38  {
39  help_cmdlist();
40  return TRUE;
41  }
42 
43  /* Scan internal command table */
44  for (cmdptr = cmds; cmdptr->name; cmdptr++)
45  {
46  if (_wcsicmp(argv[1], cmdptr->name) == 0)
47  {
48  ConResPuts(StdOut, cmdptr->help);
49  return TRUE;
50  }
51  }
52 
53  help_cmdlist();
54 
55  return TRUE;
56 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
COMMAND cmds[]
Definition: main.c:21
VOID help_cmdlist(VOID)
Definition: help.c:15
#define argv
Definition: mplay32.c:18
INT help
Definition: diskpart.h:55
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
#define StdOut
Definition: stream.h:76
Definition: main.c:14
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
WCHAR * name
Definition: main.c:16

◆ import_main()

BOOL import_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file import.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ inactive_main()

BOOL inactive_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file inactive.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ InterpretCmd()

BOOL InterpretCmd ( INT  argc,
LPWSTR argv 
)

◆ InterpretMain()

VOID InterpretMain ( VOID  )

Definition at line 145 of file interpreter.c.

146 {
147  WCHAR input_line[MAX_STRING_SIZE];
148  LPWSTR args_vector[MAX_ARGS_COUNT];
149  INT args_count = 0;
150  BOOL bWhiteSpace = TRUE;
151  BOOL bRun = TRUE;
152  LPWSTR ptr;
153 
154  while (bRun != FALSE)
155  {
156  args_count = 0;
157  memset(args_vector, 0, sizeof(args_vector));
158 
159  /* Shown just before the input where the user places commands */
161 
162  /* Get input from the user. */
163  fgetws(input_line, MAX_STRING_SIZE, stdin);
164 
165  ptr = input_line;
166  while (*ptr != 0)
167  {
168  if (iswspace(*ptr) || *ptr == L'\n')
169  {
170  *ptr = 0;
171  bWhiteSpace = TRUE;
172  }
173  else
174  {
175  if ((bWhiteSpace != FALSE) && (args_count < MAX_ARGS_COUNT))
176  {
177  args_vector[args_count] = ptr;
178  args_count++;
179  }
180  bWhiteSpace = FALSE;
181  }
182  ptr++;
183  }
184 
185  /* Send the string to find the command */
186  bRun = InterpretCmd(args_count, args_vector);
187  }
188 }
#define TRUE
Definition: types.h:120
FILE * stdin
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
#define MAX_STRING_SIZE
Definition: diskpart.h:69
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define iswspace(_c)
Definition: ctype.h:669
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_APP_PROMPT
Definition: resource.h:18
BOOL InterpretCmd(int argc, LPWSTR *argv)
Definition: interpreter.c:68
#define MAX_ARGS_COUNT
Definition: diskpart.h:70
#define StdOut
Definition: stream.h:76
wchar_t * fgetws(wchar_t *buf, int bufsize, FILE *file)
Definition: wmain.c:22
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39

Referenced by wmain().

◆ InterpretScript()

BOOL InterpretScript ( LPWSTR  line)

Definition at line 102 of file interpreter.c.

103 {
104  LPWSTR args_vector[MAX_ARGS_COUNT];
105  INT args_count = 0;
106  BOOL bWhiteSpace = TRUE;
107  LPWSTR ptr;
108 
109  memset(args_vector, 0, sizeof(args_vector));
110 
111  ptr = input_line;
112  while (*ptr != 0)
113  {
114  if (iswspace(*ptr) || *ptr == L'\n')
115  {
116  *ptr = 0;
117  bWhiteSpace = TRUE;
118  }
119  else
120  {
121  if ((bWhiteSpace != FALSE) && (args_count < MAX_ARGS_COUNT))
122  {
123  args_vector[args_count] = ptr;
124  args_count++;
125  }
126 
127  bWhiteSpace = FALSE;
128  }
129 
130  ptr++;
131  }
132 
133  /* sends the string to find the command */
134  return InterpretCmd(args_count, args_vector);
135 }
#define TRUE
Definition: types.h:120
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
#define iswspace(_c)
Definition: ctype.h:669
static const WCHAR L[]
Definition: oid.c:1250
BOOL InterpretCmd(int argc, LPWSTR *argv)
Definition: interpreter.c:68
#define MAX_ARGS_COUNT
Definition: diskpart.h:70
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39

Referenced by RunScript().

◆ list_main()

BOOL list_main ( INT  argc,
LPWSTR argv 
)

Definition at line 235 of file list.c.

238 {
239  /* gets the first word from the string */
240  if (argc == 1)
241  {
243  return TRUE;
244  }
245 
246  /* determines which to list (disk, partition, etc.) */
247  if (!wcsicmp(argv[1], L"disk"))
248  ListDisk();
249  else if (!wcsicmp(argv[1], L"partition"))
250  ListPartition();
251  else if (!wcsicmp(argv[1], L"volume"))
252  ListVolume();
253  else if (!wcsicmp(argv[1], L"vdisk"))
254  ListVdisk();
255  else
257 
258  return TRUE;
259 }
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
#define argv
Definition: mplay32.c:18
static VOID ListPartition(VOID)
Definition: list.c:85
#define IDS_HELP_CMD_LIST
Definition: resource.h:132
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
#define wcsicmp
Definition: string.h:1152
static VOID ListVdisk(VOID)
Definition: list.c:229
static VOID ListVolume(VOID)
Definition: list.c:222
#define StdOut
Definition: stream.h:76
static VOID ListDisk(VOID)
Definition: list.c:28

◆ merge_main()

BOOL merge_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file merge.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ offline_main()

BOOL offline_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file offline.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ online_main()

BOOL online_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file online.c.

12 {
14  return TRUE;
15 }
#define TRUE
Definition: types.h:120
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
#define IDS_HELP_CMD_ONLINE
Definition: resource.h:135
#define StdOut
Definition: stream.h:76

◆ recover_main()

BOOL recover_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file recover.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ remove_main()

BOOL remove_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file remove.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ repair_main()

BOOL repair_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file repair.c.

12 {
13  ConPuts(StdOut, L"\nTODO: Add code later since Win 7 Home Premium doesn't have this feature.\n");
14  return TRUE;
15 }
#define TRUE
Definition: types.h:120
static const WCHAR L[]
Definition: oid.c:1250
INT ConPuts(IN PCON_STREAM Stream, IN LPWSTR szStr)
Definition: outstream.c:427
#define StdOut
Definition: stream.h:76

◆ rescan_main()

BOOL rescan_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file rescan.c.

12 {
17 
18  return TRUE;
19 }
PPARTLIST CreatePartitionList(VOID)
Definition: partlist.c:2023
#define TRUE
Definition: types.h:120
#define IDS_RESCAN_END
Definition: resource.h:45
#define IDS_RESCAN_START
Definition: resource.h:44
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
VOID DestroyPartitionList(IN PPARTLIST List)
Definition: partlist.c:2107
#define StdOut
Definition: stream.h:76

◆ retain_main()

BOOL retain_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file retain.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ san_main()

BOOL san_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file san.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ select_main()

BOOL select_main ( INT  argc,
LPWSTR argv 
)

Definition at line 161 of file select.c.

164 {
165  /* gets the first word from the string */
166  if (argc == 1)
167  {
169  return TRUE;
170  }
171 
172  /* determines which to list (disk, partition, etc.) */
173  if (!wcsicmp(argv[1], L"disk"))
174  SelectDisk(argc, argv);
175  else if (!wcsicmp(argv[1], L"partition"))
177  else
179 
180  return TRUE;
181 }
static VOID SelectPartition(INT argc, LPWSTR *argv)
Definition: select.c:76
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
#define argv
Definition: mplay32.c:18
static VOID SelectDisk(INT argc, LPWSTR *argv)
Definition: select.c:18
#define IDS_HELP_CMD_SELECT
Definition: resource.h:142
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
#define wcsicmp
Definition: string.h:1152
#define StdOut
Definition: stream.h:76

◆ setid_main()

BOOL setid_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file setid.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ shrink_main()

BOOL shrink_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file shrink.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

◆ uniqueid_main()

BOOL uniqueid_main ( INT  argc,
LPWSTR argv 
)

Definition at line 11 of file uniqueid.c.

12 {
13  return TRUE;
14 }
#define TRUE
Definition: types.h:120

Variable Documentation

◆ BiosDiskListHead

LIST_ENTRY BiosDiskListHead

◆ cmds

◆ CurrentDisk

◆ CurrentPartition

PPARTENTRY CurrentPartition

Definition at line 74 of file partlist.c.

Referenced by CreatePartitionList(), and DestroyPartitionList().

◆ DiskListHead

LIST_ENTRY DiskListHead