#include "usetup.h"
#include <debug.h>
Go to the source code of this file.
|
static BOOLEAN NTAPI | UpdateProgressPercentage (IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize) |
|
static VOID | DrawBorder (IN PPROGRESSBAR Bar) |
|
static VOID | DrawThickBorder (IN PPROGRESSBAR Bar) |
|
static VOID | DrawProgressBar (IN PPROGRESSBAR Bar) |
|
PPROGRESSBAR | CreateProgressBarEx (IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN SHORT ProgressColour, IN ULONG StepCount, IN PCSTR DescriptionText OPTIONAL, IN PCSTR ProgressFormatText OPTIONAL, IN PUPDATE_PROGRESS UpdateProgressProc OPTIONAL) |
|
PPROGRESSBAR | CreateProgressBar (IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN PCSTR DescriptionText OPTIONAL) |
|
VOID | DestroyProgressBar (IN OUT PPROGRESSBAR Bar) |
|
VOID | ProgressSetStepCount (IN PPROGRESSBAR Bar, IN ULONG StepCount) |
|
VOID | ProgressNextStep (IN PPROGRESSBAR Bar) |
|
VOID | ProgressSetStep (IN PPROGRESSBAR Bar, IN ULONG Step) |
|
◆ NDEBUG
◆ CreateProgressBar()
Definition at line 317 of file progress.c.
326{
327
329 TextTop, TextRight,
330 DoubleEdge,
332 0,
333 DescriptionText,
334 "%-3lu%%",
336}
static BOOLEAN NTAPI UpdateProgressPercentage(IN PPROGRESSBAR Bar, IN BOOLEAN AlwaysUpdate, OUT PSTR Buffer, IN SIZE_T cchBufferSize)
PPROGRESSBAR CreateProgressBarEx(IN SHORT Left, IN SHORT Top, IN SHORT Right, IN SHORT Bottom, IN SHORT TextTop, IN SHORT TextRight, IN BOOLEAN DoubleEdge, IN SHORT ProgressColour, IN ULONG StepCount, IN PCSTR DescriptionText OPTIONAL, IN PCSTR ProgressFormatText OPTIONAL, IN PUPDATE_PROGRESS UpdateProgressProc OPTIONAL)
static LPHIST_ENTRY Bottom
#define FOREGROUND_YELLOW
Referenced by FileCopyPage(), StartCheck(), and StartFormat().
◆ CreateProgressBarEx()
PPROGRESSBAR CreateProgressBarEx |
( |
IN SHORT |
Left, |
|
|
IN SHORT |
Top, |
|
|
IN SHORT |
Right, |
|
|
IN SHORT |
Bottom, |
|
|
IN SHORT |
TextTop, |
|
|
IN SHORT |
TextRight, |
|
|
IN BOOLEAN |
DoubleEdge, |
|
|
IN SHORT |
ProgressColour, |
|
|
IN ULONG |
StepCount, |
|
|
IN PCSTR DescriptionText |
OPTIONAL, |
|
|
IN PCSTR ProgressFormatText |
OPTIONAL, |
|
|
IN PUPDATE_PROGRESS UpdateProgressProc |
OPTIONAL |
|
) |
| |
Definition at line 272 of file progress.c.
285{
287
289 0,
293
298 Bar->TextTop = TextTop;
299 Bar->TextRight = TextRight;
300
302
303 Bar->DoubleEdge = DoubleEdge;
304 Bar->ProgressColour = ProgressColour;
305 Bar->DescriptionText = DescriptionText;
306 Bar->ProgressFormatText = ProgressFormatText;
307
308 Bar->UpdateProgressProc = UpdateProgressProc;
309
310
312
314}
VOID ProgressSetStepCount(IN PPROGRESSBAR Bar, IN ULONG StepCount)
struct _PROGRESSBAR * PPROGRESSBAR
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Referenced by CreateProgressBar(), and ProgressCountdown().
◆ DestroyProgressBar()
◆ DrawBorder()
Definition at line 48 of file progress.c.
50{
54
55
57 coPos.
Y =
Bar->Top + 1;
60 1,
61 coPos,
62 &Written);
63
64
65 coPos.
X =
Bar->Left + 1;
66 coPos.
Y =
Bar->Top + 1;
69 Bar->Right -
Bar->Left - 1,
70 coPos,
71 &Written);
72
73
75 coPos.
Y =
Bar->Top + 1;
78 1,
79 coPos,
80 &Written);
81
82
84 {
89 1,
90 coPos,
91 &Written);
92
96 1,
97 coPos,
98 &Written);
99 }
100
101
103 coPos.
Y =
Bar->Bottom;
106 1,
107 coPos,
108 &Written);
109
110
111 coPos.
X =
Bar->Left + 1;
112 coPos.
Y =
Bar->Bottom;
115 Bar->Right -
Bar->Left - 1,
116 coPos,
117 &Written);
118
119
120 coPos.
X =
Bar->Right;
121 coPos.
Y =
Bar->Bottom;
124 1,
125 coPos,
126 &Written);
127}
BOOL WINAPI FillConsoleOutputCharacterA(IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
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
CHAR CharUpperRightCorner
CHAR CharLowerRightCorner
Referenced by DrawProgressBar().
◆ DrawProgressBar()
Definition at line 214 of file progress.c.
216{
221
222
224 {
227 BarBorder.
Right += 5;
230 }
231
232
234
235
236 if (
Bar->DescriptionText)
238
239
240 if (
Bar->UpdateProgressProc &&
242 {
248 coPos,
249 &Written);
250 }
251
252
253 coPos.
X =
Bar->Left + 1;
254 for (coPos.
Y =
Bar->Top + 2; coPos.
Y <=
Bar->Bottom - 1; coPos.
Y++)
255 {
259 coPos,
260 &Written);
261
263 ' ',
265 coPos,
266 &Written);
267 }
268}
ACPI_SIZE strlen(const char *String)
BOOL WINAPI WriteConsoleOutputCharacterA(HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten)
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
static VOID DrawThickBorder(IN PPROGRESSBAR Bar)
static VOID DrawBorder(IN PPROGRESSBAR Bar)
char TextBuffer[BUFFERLEN]
VOID CONSOLE_SetTextXY(IN SHORT x, IN SHORT y, IN LPCSTR Text)
Referenced by ProgressSetStepCount().
◆ DrawThickBorder()
Definition at line 131 of file progress.c.
133{
137
138
140 coPos.
Y =
Bar->Top + 1;
143 1,
144 coPos,
145 &Written);
146
147
148 coPos.
X =
Bar->Left + 1;
149 coPos.
Y =
Bar->Top + 1;
152 Bar->Right -
Bar->Left - 1,
153 coPos,
154 &Written);
155
156
157 coPos.
X =
Bar->Right;
158 coPos.
Y =
Bar->Top + 1;
161 1,
162 coPos,
163 &Written);
164
165
167 {
172 1,
173 coPos,
174 &Written);
175
176 coPos.
X =
Bar->Right;
179 1,
180 coPos,
181 &Written);
182 }
183
184
186 coPos.
Y =
Bar->Bottom;
189 1,
190 coPos,
191 &Written);
192
193
194 coPos.
X =
Bar->Left + 1;
195 coPos.
Y =
Bar->Bottom;
198 Bar->Right -
Bar->Left - 1,
199 coPos,
200 &Written);
201
202
203 coPos.
X =
Bar->Right;
204 coPos.
Y =
Bar->Bottom;
207 1,
208 coPos,
209 &Written);
210}
CHAR CharDoubleLowerRightCorner
CHAR CharDoubleUpperRightCorner
CHAR CharDoubleLowerLeftCorner
CHAR CharDoubleUpperLeftCorner
CHAR CharDoubleHorizontalLine
CHAR CharDoubleVerticalLine
Referenced by DrawProgressBar().
◆ ProgressNextStep()
◆ ProgressSetStep()
Definition at line 368 of file progress.c.
371{
376
377 if (Step >
Bar->StepCount)
378 return;
379
380 Bar->CurrentStep = Step;
381
382
383 if (
Bar->UpdateProgressProc &&
385 {
391 coPos,
392 &Written);
393 }
394
395
396 NewPos = (((
Bar->Width - 2) * 2 *
Bar->CurrentStep + (
Bar->StepCount / 2)) /
Bar->StepCount);
397
398
399 if (
Bar->Pos != NewPos)
400 {
402
403 for (coPos.
Y =
Bar->Top + 2; coPos.
Y <=
Bar->Bottom - 1; coPos.
Y++)
404 {
405 coPos.
X =
Bar->Left + 1;
409 coPos,
410 &Written);
411 coPos.
X +=
Bar->Pos / 2;
412
413 if (NewPos & 1)
414 {
417 1,
418 coPos,
419 &Written);
421 }
422
423 if (coPos.
X <=
Bar->Right - 1)
424 {
426 ' ',
427 Bar->Right - coPos.
X,
428 coPos,
429 &Written);
430 }
431 }
432 }
433}
Referenced by FormatCallback(), ProgressCountdown(), ProgressNextStep(), and SetupUpdateMemoryInfo().
◆ ProgressSetStepCount()
◆ UpdateProgressPercentage()
Definition at line 20 of file progress.c.
25{
26
28
29
30 if (
Bar->StepCount == 0)
32 else
33 Bar->Progress = ((100 *
Bar->CurrentStep + (
Bar->StepCount / 2)) /
Bar->StepCount);
34
35
36 if (
Bar->ProgressFormatText &&
37 (AlwaysUpdate || (
Bar->Progress != OldProgress)) )
38 {
40 Bar->ProgressFormatText,
Bar->Progress);
42 }
44}
NTSTRSAFEVAPI RtlStringCchPrintfA(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Referenced by CreateProgressBar().