ReactOS 0.4.16-dev-297-gc569aee
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}
static int argc
Definition: ServiceArgs.c:12
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define StdOut
Definition: fc.c:14
void ConResPrintf(FILE *fp, UINT nID,...)
Definition: fc.c:33
#define StdErr
Definition: fc.c:15
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define IDS_DETAIL_INFO_DISK_ID
Definition: resource.h:35
#define IDS_LIST_VOLUME_LINE
Definition: resource.h:79
#define IDS_LIST_VOLUME_HEAD
Definition: resource.h:78
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define IDS_DETAIL_INFO_LUN_ID
Definition: resource.h:40
#define IDS_DETAIL_INFO_TARGET
Definition: resource.h:39
#define IDS_SELECT_NO_DISK
Definition: resource.h:85
#define IDS_DETAIL_INFO_PATH
Definition: resource.h:38
static BOOL IsDiskInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PDISKENTRY DiskEntry)
Definition: detail.c:18
LIST_ENTRY VolumeListHead
Definition: partlist.c:72
PDISKENTRY CurrentDisk
Definition: partlist.c:74
VOID PrintVolume(_In_ PVOLENTRY VolumeEntry)
Definition: list.c:230
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define L(x)
Definition: ntvdm.h:50
#define DPRINT
Definition: sndvol32.h:73
base of all file and directory entries
Definition: entries.h:83
USHORT TargetId
Definition: diskpart.h:169
USHORT PathId
Definition: diskpart.h:168
USHORT Lun
Definition: diskpart.h:170
PDRIVE_LAYOUT_INFORMATION LayoutBuffer
Definition: partlist.h:143
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ 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");
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
#define IDS_DETAIL_PARTITION_HIDDEN
Definition: resource.h:52
#define IDS_DETAIL_PARTITION_ACTIVE
Definition: resource.h:53
#define IDS_DETAIL_PARTITION_TYPE
Definition: resource.h:51
#define IDS_DETAIL_NO_VOLUME
Definition: resource.h:57
#define IDS_SELECT_PARTITION_NO_DISK
Definition: resource.h:90
#define IDS_DETAIL_PARTITION_OFFSET
Definition: resource.h:54
#define IDS_DETAIL_PARTITION_NUMBER
Definition: resource.h:50
static BOOL IsPartitionInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PPARTENTRY PartEntry)
Definition: detail.c:41
ULONG BytesPerSector
Definition: partlist.h:113
UCHAR PartitionType
Definition: partlist.h:73
BOOLEAN BootIndicator
Definition: partlist.h:72
ULONG PartitionNumber
Definition: partlist.h:75
ULARGE_INTEGER StartSector
Definition: partlist.h:69
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
uint64_t ULONGLONG
Definition: typedefs.h:67
static PPARTENTRY CurrentPartition
Definition: usetup.c:78

◆ 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}
#define IDS_LIST_DISK_LINE
Definition: resource.h:72
#define IDS_SELECT_NO_VOLUME
Definition: resource.h:92
#define IDS_LIST_DISK_HEAD
Definition: resource.h:71
#define IDS_DETAIL_NO_DISKS
Definition: resource.h:56
LIST_ENTRY DiskListHead
Definition: partlist.c:70
PVOLENTRY CurrentVolume
Definition: partlist.c:76
VOID PrintDisk(_In_ PDISKENTRY DiskEntry)
Definition: list.c:17

◆ 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}
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
uint32_t ULONG
Definition: typedefs.h:59

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}

Referenced by DetailPartition().