ReactOS  0.4.15-dev-5496-g599ba9c
detail.c File Reference
#include "diskpart.h"
#include <debug.h>
Include dependency graph for detail.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static BOOL IsDiskInVolume (_In_ PVOLENTRY VolumeEntry, _In_ PDISKENTRY DiskEntry)
 
static BOOL IsPartitionInVolume (_In_ PVOLENTRY VolumeEntry, _In_ PPARTENTRY PartEntry)
 
BOOL DetailDisk (_In_ INT argc, _In_ PWSTR *argv)
 
BOOL DetailPartition (_In_ INT argc, _In_ PWSTR *argv)
 
BOOL DetailVolume (_In_ INT argc, _In_ PWSTR *argv)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file detail.c.

Function Documentation

◆ DetailDisk()

BOOL DetailDisk ( _In_ INT  argc,
_In_ PWSTR argv 
)

Definition at line 68 of file detail.c.

71 {
73  PVOLENTRY VolumeEntry;
74  BOOL bPrintHeader = TRUE;
75 
76  DPRINT("DetailDisk()\n");
77 
78  if (argc > 2)
79  {
81  return TRUE;
82  }
83 
84  if (CurrentDisk == NULL)
85  {
87  return TRUE;
88  }
89 
90  /* TODO: Print more disk details */
91  ConPuts(StdOut, L"\n");
96 
98  while (Entry != &VolumeListHead)
99  {
100  VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
101 
102  if (IsDiskInVolume(VolumeEntry, CurrentDisk))
103  {
104  if (bPrintHeader)
105  {
106  ConPuts(StdOut, L"\n");
109  bPrintHeader = FALSE;
110  }
111 
112  PrintVolume(VolumeEntry);
113  }
114 
115  Entry = Entry->Flink;
116  }
117 
118  ConPuts(StdOut, L"\n");
119 
120  return TRUE;
121 }
USHORT TargetId
Definition: diskpart.h:167
static int argc
Definition: ServiceArgs.c:12
struct _Entry Entry
Definition: kefuncs.h:629
#define TRUE
Definition: types.h:120
#define IDS_DETAIL_INFO_TARGET
Definition: resource.h:39
PDISKENTRY CurrentDisk
Definition: partlist.c:74
#define IDS_DETAIL_INFO_DISK_ID
Definition: resource.h:35
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IsDiskInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PDISKENTRY DiskEntry)
Definition: detail.c:18
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
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
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
USHORT Lun
Definition: diskpart.h:168
void ConResPrintf(FILE *fp, UINT nID,...)
Definition: fc.c:33
#define IDS_SELECT_NO_DISK
Definition: resource.h:85
USHORT PathId
Definition: diskpart.h:166
#define IDS_DETAIL_INFO_LUN_ID
Definition: resource.h:40
#define IDS_LIST_VOLUME_LINE
Definition: resource.h:79
Definition: typedefs.h:119
#define IDS_LIST_VOLUME_HEAD
Definition: resource.h:78
#define NULL
Definition: types.h:112
#define StdOut
Definition: fc.c:14
#define IDS_DETAIL_INFO_PATH
Definition: resource.h:38
LIST_ENTRY VolumeListHead
Definition: partlist.c:72
#define DPRINT
Definition: sndvol32.h:71
VOID PrintVolume(_In_ PVOLENTRY VolumeEntry)
Definition: list.c:230
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:125
base of all file and directory entries
Definition: entries.h:82
#define StdErr
Definition: fc.c:15

◆ DetailPartition()

BOOL DetailPartition ( _In_ INT  argc,
_In_ PWSTR argv 
)

Definition at line 125 of file detail.c.

128 {
129  PPARTENTRY PartEntry;
130  ULONGLONG PartOffset;
132  PVOLENTRY VolumeEntry;
133  BOOL bVolumeFound = FALSE, bPrintHeader = TRUE;
134 
135  DPRINT("DetailPartition()\n");
136 
137  if (argc > 2)
138  {
140  return TRUE;
141  }
142 
143  if (CurrentDisk == NULL)
144  {
146  return TRUE;
147  }
148 
149  if (CurrentPartition == NULL)
150  {
152  return TRUE;
153  }
154 
155  PartEntry = CurrentPartition;
156  PartOffset = PartEntry->StartSector.QuadPart * CurrentDisk->BytesPerSector;
157 
158  /* TODO: Print more partition details */
159  ConPuts(StdOut, L"\n");
163  ConResPrintf(StdOut, IDS_DETAIL_PARTITION_ACTIVE, PartEntry->BootIndicator ? L"Yes" : L"No");
165 
167  while (Entry != &VolumeListHead)
168  {
169  VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
170 
171  if (IsPartitionInVolume(VolumeEntry, CurrentPartition))
172  {
173  if (bPrintHeader)
174  {
175  ConPuts(StdOut, L"\n");
178  bPrintHeader = FALSE;
179  }
180 
181  PrintVolume(VolumeEntry);
182  bVolumeFound = TRUE;
183  }
184 
185  Entry = Entry->Flink;
186  }
187 
188  if (bVolumeFound == FALSE)
190 
191  ConPuts(StdOut, L"\n");
192 
193  return TRUE;
194 }
#define IDS_SELECT_NO_PARTITION
Definition: resource.h:88
static int argc
Definition: ServiceArgs.c:12
#define IDS_DETAIL_PARTITION_ACTIVE
Definition: resource.h:53
ULONG PartitionNumber
Definition: partlist.h:55
ULARGE_INTEGER StartSector
Definition: partlist.h:49
struct _Entry Entry
Definition: kefuncs.h:629
#define TRUE
Definition: types.h:120
#define IDS_DETAIL_NO_VOLUME
Definition: resource.h:57
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
PDISKENTRY CurrentDisk
Definition: partlist.c:74
#define IDS_DETAIL_PARTITION_NUMBER
Definition: resource.h:50
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define L(x)
Definition: ntvdm.h:50
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_DETAIL_PARTITION_TYPE
Definition: resource.h:51
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
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
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
void ConResPrintf(FILE *fp, UINT nID,...)
Definition: fc.c:33
UCHAR PartitionType
Definition: partlist.h:53
ULONG BytesPerSector
Definition: partlist.h:95
#define IDS_DETAIL_PARTITION_OFFSET
Definition: resource.h:54
uint64_t ULONGLONG
Definition: typedefs.h:67
static BOOL IsPartitionInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PPARTENTRY PartEntry)
Definition: detail.c:41
#define IDS_SELECT_PARTITION_NO_DISK
Definition: resource.h:90
#define IDS_LIST_VOLUME_LINE
Definition: resource.h:79
Definition: typedefs.h:119
#define IDS_LIST_VOLUME_HEAD
Definition: resource.h:78
#define NULL
Definition: types.h:112
BOOLEAN BootIndicator
Definition: partlist.h:52
#define StdOut
Definition: fc.c:14
LIST_ENTRY VolumeListHead
Definition: partlist.c:72
#define IDS_DETAIL_PARTITION_HIDDEN
Definition: resource.h:52
#define DPRINT
Definition: sndvol32.h:71
VOID PrintVolume(_In_ PVOLENTRY VolumeEntry)
Definition: list.c:230
base of all file and directory entries
Definition: entries.h:82
#define StdErr
Definition: fc.c:15

◆ DetailVolume()

BOOL DetailVolume ( _In_ INT  argc,
_In_ PWSTR argv 
)

Definition at line 198 of file detail.c.

201 {
202  PDISKENTRY DiskEntry;
204  BOOL bDiskFound = FALSE, bPrintHeader = TRUE;
205 
206  DPRINT("DetailVolume()\n");
207 
208  if (argc > 2)
209  {
211  return TRUE;
212  }
213 
214  if (CurrentVolume == NULL)
215  {
217  return TRUE;
218  }
219 
220 
222  while (Entry != &DiskListHead)
223  {
224  DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
225 
226  if (IsDiskInVolume(CurrentVolume, DiskEntry))
227  {
228  if (bPrintHeader)
229  {
230  ConPuts(StdOut, L"\n");
233  bPrintHeader = FALSE;
234  }
235 
236  PrintDisk(DiskEntry);
237  bDiskFound = TRUE;
238  }
239 
240  Entry = Entry->Flink;
241  }
242 
243  if (bDiskFound == FALSE)
245 
246  /* TODO: Print more volume details */
247 
248  ConPuts(StdOut, L"\n");
249 
250  return TRUE;
251 }
static int argc
Definition: ServiceArgs.c:12
#define IDS_LIST_DISK_LINE
Definition: resource.h:72
struct _Entry Entry
Definition: kefuncs.h:629
#define TRUE
Definition: types.h:120
VOID PrintDisk(_In_ PDISKENTRY DiskEntry)
Definition: list.c:17
#define IDS_SELECT_NO_VOLUME
Definition: resource.h:92
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_LIST_DISK_HEAD
Definition: resource.h:71
static BOOL IsDiskInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PDISKENTRY DiskEntry)
Definition: detail.c:18
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
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
LIST_ENTRY DiskListHead
Definition: partlist.c:70
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
#define IDS_DETAIL_NO_DISKS
Definition: resource.h:56
#define NULL
Definition: types.h:112
#define StdOut
Definition: fc.c:14
PVOLENTRY CurrentVolume
Definition: partlist.c:76
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:82
#define StdErr
Definition: fc.c:15

◆ IsDiskInVolume()

static BOOL IsDiskInVolume ( _In_ PVOLENTRY  VolumeEntry,
_In_ PDISKENTRY  DiskEntry 
)
static

Definition at line 18 of file detail.c.

21 {
22  ULONG i;
23 
24  if ((VolumeEntry == NULL) ||
25  (VolumeEntry->pExtents == NULL) ||
26  (DiskEntry == NULL))
27  return FALSE;
28 
29  for (i = 0; i < VolumeEntry->pExtents->NumberOfDiskExtents; i++)
30  {
31  if (VolumeEntry->pExtents->Extents[i].DiskNumber == DiskEntry->DiskNumber)
32  return TRUE;
33  }
34 
35  return FALSE;
36 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1

Referenced by DetailDisk(), and DetailVolume().

◆ IsPartitionInVolume()

static BOOL IsPartitionInVolume ( _In_ PVOLENTRY  VolumeEntry,
_In_ PPARTENTRY  PartEntry 
)
static

Definition at line 41 of file detail.c.

44 {
45  ULONG i;
46 
47  if ((VolumeEntry == NULL) ||
48  (VolumeEntry->pExtents == NULL) ||
49  (PartEntry == NULL) ||
50  (PartEntry->DiskEntry == NULL))
51  return FALSE;
52 
53  for (i = 0; i < VolumeEntry->pExtents->NumberOfDiskExtents; i++)
54  {
55  if (VolumeEntry->pExtents->Extents[i].DiskNumber == PartEntry->DiskEntry->DiskNumber)
56  {
57  if ((VolumeEntry->pExtents->Extents[i].StartingOffset.QuadPart == PartEntry->StartSector.QuadPart * PartEntry->DiskEntry->BytesPerSector) &&
58  (VolumeEntry->pExtents->Extents[i].ExtentLength.QuadPart == PartEntry->SectorCount.QuadPart * PartEntry->DiskEntry->BytesPerSector))
59  return TRUE;
60  }
61  }
62 
63  return FALSE;
64 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1

Referenced by DetailPartition().