ReactOS 0.4.16-dev-1993-gbf8741d
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 WCHAR szBuffer[40];
76
77 DPRINT("DetailDisk()\n");
78
79 if (argc > 2)
80 {
82 return TRUE;
83 }
84
85 if (CurrentDisk == NULL)
86 {
88 return TRUE;
89 }
90
91 /* TODO: Print more disk details */
92 ConPuts(StdOut, L"\n");
93 if (CurrentDisk->LayoutBuffer->PartitionStyle == PARTITION_STYLE_GPT)
94 PrintGUID(szBuffer, &CurrentDisk->LayoutBuffer->Gpt.DiskId);
95 else if (CurrentDisk->LayoutBuffer->PartitionStyle == PARTITION_STYLE_MBR)
96 swprintf(szBuffer, L"%08lx", CurrentDisk->LayoutBuffer->Mbr.Signature);
97 else
98 wcscpy(szBuffer, L"00000000");
103
105 while (Entry != &VolumeListHead)
106 {
107 VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
108
109 if (IsDiskInVolume(VolumeEntry, CurrentDisk))
110 {
111 if (bPrintHeader)
112 {
113 ConPuts(StdOut, L"\n");
116 bPrintHeader = FALSE;
117 }
118
119 PrintVolume(VolumeEntry);
120 }
121
122 Entry = Entry->Flink;
123 }
124
125 ConPuts(StdOut, L"\n");
126
127 return TRUE;
128}
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:44
#define IDS_LIST_VOLUME_LINE
Definition: resource.h:89
#define IDS_LIST_VOLUME_HEAD
Definition: resource.h:88
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:203
#define IDS_DETAIL_INFO_LUN_ID
Definition: resource.h:49
#define IDS_DETAIL_INFO_TARGET
Definition: resource.h:48
#define IDS_SELECT_NO_DISK
Definition: resource.h:95
#define IDS_DETAIL_INFO_PATH
Definition: resource.h:47
wcscpy
static BOOL IsDiskInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PDISKENTRY DiskEntry)
Definition: detail.c:18
LIST_ENTRY VolumeListHead
Definition: partlist.c:75
VOID PrintGUID(_Out_ PWSTR pszBuffer, _In_ GUID *pGuid)
Definition: misc.c:187
PDISKENTRY CurrentDisk
Definition: partlist.c:77
VOID PrintVolume(_In_ PVOLENTRY VolumeEntry)
Definition: list.c:437
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
@ PARTITION_STYLE_GPT
Definition: imports.h:202
@ PARTITION_STYLE_MBR
Definition: imports.h:201
#define DPRINT
Definition: sndvol32.h:73
base of all file and directory entries
Definition: entries.h:83
USHORT TargetId
Definition: diskpart.h:195
USHORT PathId
Definition: diskpart.h:194
USHORT Lun
Definition: diskpart.h:196
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
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ DetailPartition()

BOOL DetailPartition ( _In_ INT  argc,
_In_ PWSTR argv 
)

Definition at line 132 of file detail.c.

135{
136 PPARTENTRY PartEntry;
137 ULONGLONG PartOffset;
139 PVOLENTRY VolumeEntry;
140 BOOL bVolumeFound = FALSE, bPrintHeader = TRUE;
141 WCHAR szBuffer[40];
142
143 DPRINT("DetailPartition()\n");
144
145 if (argc > 2)
146 {
148 return TRUE;
149 }
150
151 if (CurrentDisk == NULL)
152 {
154 return TRUE;
155 }
156
157 if (CurrentPartition == NULL)
158 {
160 return TRUE;
161 }
162
163 PartEntry = CurrentPartition;
164 PartOffset = PartEntry->StartSector.QuadPart * CurrentDisk->BytesPerSector;
165
166 /* TODO: Print more partition details */
167 ConPuts(StdOut, L"\n");
170 {
171 PrintGUID(szBuffer, &PartEntry->Gpt.PartitionType);
173 ConResPrintf(StdOut, IDS_DETAIL_PARTITION_HIDDEN, (PartEntry->Gpt.Attributes & GPT_BASIC_DATA_ATTRIBUTE_HIDDEN) ? L"Yes" : L"No");
174 ConResPrintf(StdOut, IDS_DETAIL_PARTITION_REQUIRED, (PartEntry->Gpt.Attributes & GPT_ATTRIBUTE_PLATFORM_REQUIRED) ? L"Yes" : L"No");
176 }
178 {
179 swprintf(szBuffer, L"%02x", PartEntry->Mbr.PartitionType);
183 }
185
187 while (Entry != &VolumeListHead)
188 {
189 VolumeEntry = CONTAINING_RECORD(Entry, VOLENTRY, ListEntry);
190
191 if (IsPartitionInVolume(VolumeEntry, CurrentPartition))
192 {
193 if (bPrintHeader)
194 {
195 ConPuts(StdOut, L"\n");
198 bPrintHeader = FALSE;
199 }
200
201 PrintVolume(VolumeEntry);
202 bVolumeFound = TRUE;
203 }
204
205 Entry = Entry->Flink;
206 }
207
208 if (bVolumeFound == FALSE)
210
211 ConPuts(StdOut, L"\n");
212
213 return TRUE;
214}
#define IDS_SELECT_NO_PARTITION
Definition: resource.h:100
#define IDS_DETAIL_PARTITION_HIDDEN
Definition: resource.h:61
#define IDS_DETAIL_PARTITION_ACTIVE
Definition: resource.h:62
#define IDS_DETAIL_PARTITION_TYPE
Definition: resource.h:60
#define IDS_DETAIL_PARTITION_ATTRIBUTE
Definition: resource.h:65
#define IDS_DETAIL_PARTITION_REQUIRED
Definition: resource.h:64
#define IDS_DETAIL_NO_VOLUME
Definition: resource.h:67
#define IDS_SELECT_PARTITION_NO_DISK
Definition: resource.h:102
#define IDS_DETAIL_PARTITION_OFFSET
Definition: resource.h:63
#define IDS_DETAIL_PARTITION_NUMBER
Definition: resource.h:59
static BOOL IsPartitionInVolume(_In_ PVOLENTRY VolumeEntry, _In_ PPARTENTRY PartEntry)
Definition: detail.c:41
ULONG BytesPerSector
Definition: partlist.h:113
DWORD PartitionStyle
Definition: diskpart.h:202
DWORD64 Attributes
Definition: diskpart.h:114
BOOLEAN BootIndicator
Definition: diskpart.h:106
MBR_PARTITION_DATA Mbr
Definition: diskpart.h:128
GPT_PARTITION_DATA Gpt
Definition: diskpart.h:129
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 218 of file detail.c.

221{
222 PDISKENTRY DiskEntry;
224 BOOL bDiskFound = FALSE, bPrintHeader = TRUE;
225
226 DPRINT("DetailVolume()\n");
227
228 if (argc > 2)
229 {
231 return TRUE;
232 }
233
234 if (CurrentVolume == NULL)
235 {
237 return TRUE;
238 }
239
240
242 while (Entry != &DiskListHead)
243 {
244 DiskEntry = CONTAINING_RECORD(Entry, DISKENTRY, ListEntry);
245
246 if (IsDiskInVolume(CurrentVolume, DiskEntry))
247 {
248 if (bPrintHeader)
249 {
250 ConPuts(StdOut, L"\n");
253 bPrintHeader = FALSE;
254 }
255
256 PrintDisk(DiskEntry);
257 bDiskFound = TRUE;
258 }
259
260 Entry = Entry->Flink;
261 }
262
263 if (bDiskFound == FALSE)
265
266 /* TODO: Print more volume details */
267
268 ConPuts(StdOut, L"\n");
269
270 return TRUE;
271}
#define IDS_LIST_DISK_LINE
Definition: resource.h:82
#define IDS_SELECT_NO_VOLUME
Definition: resource.h:104
#define IDS_LIST_DISK_HEAD
Definition: resource.h:81
#define IDS_DETAIL_NO_DISKS
Definition: resource.h:66
LIST_ENTRY DiskListHead
Definition: partlist.c:73
PVOLENTRY CurrentVolume
Definition: partlist.c:79
VOID PrintDisk(_In_ PDISKENTRY DiskEntry)
Definition: list.c:83

◆ 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().