mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:41:42 +00:00
[MSTSC][USETUP]
- Fix MSVC warnings - Remove duplicated code in usetup progress bar svn path=/trunk/; revision=52467
This commit is contained in:
parent
6641b0995e
commit
28157f42c1
7 changed files with 24 additions and 95 deletions
|
@ -1136,10 +1136,10 @@ DlgProc(HWND hDlg,
|
|||
SRCCOPY);
|
||||
|
||||
SelectObject(hdcMem, hBmpOld);
|
||||
txtRc.left = bmpRc.right * 0.25;
|
||||
txtRc.left = bmpRc.right / 4;
|
||||
txtRc.top = 10;
|
||||
txtRc.right = bmpRc.right * 0.75;
|
||||
txtRc.bottom = pInfo->headerbitmap.bmHeight * 0.5;
|
||||
txtRc.right = bmpRc.right * 3 / 4;
|
||||
txtRc.bottom = pInfo->headerbitmap.bmHeight / 2;
|
||||
|
||||
ZeroMemory(&lf, sizeof(LOGFONTW));
|
||||
|
||||
|
@ -1172,10 +1172,10 @@ DlgProc(HWND hDlg,
|
|||
}
|
||||
}
|
||||
|
||||
txtRc.left = bmpRc.right * 0.25;
|
||||
txtRc.left = bmpRc.right / 4;
|
||||
txtRc.top = txtRc.bottom - 5;
|
||||
txtRc.right = bmpRc.right * 0.75;
|
||||
txtRc.bottom = pInfo->headerbitmap.bmHeight * 0.9;
|
||||
txtRc.right = bmpRc.right * 3 / 4;
|
||||
txtRc.bottom = pInfo->headerbitmap.bmHeight * 9 / 10;
|
||||
|
||||
if (LoadStringW(hInst,
|
||||
IDS_HEADERTEXT2,
|
||||
|
|
|
@ -172,11 +172,11 @@ DrawFileSystemList(
|
|||
|
||||
if (ListEntry == &List->Selected->ListEntry)
|
||||
CONSOLE_SetInvertedTextXY(List->Left,
|
||||
List->Top + Index,
|
||||
List->Top + (SHORT)Index,
|
||||
Buffer);
|
||||
else
|
||||
CONSOLE_SetTextXY(List->Left,
|
||||
List->Top + Index,
|
||||
List->Top + (SHORT)Index,
|
||||
Buffer);
|
||||
Index++;
|
||||
ListEntry = ListEntry->Flink;
|
||||
|
|
|
@ -75,7 +75,7 @@ InfpOpenInfFileW(
|
|||
Status = InfOpenFile(
|
||||
&hInf,
|
||||
&FileNameU,
|
||||
LocaleId,
|
||||
LANGIDFROMLCID(LocaleId),
|
||||
&ErrorLineUL);
|
||||
*ErrorLine = (UINT)ErrorLineUL;
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -197,7 +197,7 @@ INF_OpenBufferedFileA(
|
|||
&hInf,
|
||||
FileBuffer,
|
||||
FileSize,
|
||||
LocaleId,
|
||||
LANGIDFROMLCID(LocaleId),
|
||||
&ErrorLineUL);
|
||||
*ErrorLine = (UINT)ErrorLineUL;
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
|
@ -1612,7 +1612,7 @@ SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber)
|
|||
PPARTENTRY PartEntry;
|
||||
PLIST_ENTRY Entry1;
|
||||
PLIST_ENTRY Entry2;
|
||||
ULONG i;
|
||||
UCHAR i;
|
||||
|
||||
/* Check for empty disks */
|
||||
if (IsListEmpty (&List->DiskListHead))
|
||||
|
@ -1965,7 +1965,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
PartEntry->PartInfo[0].StartingOffset.QuadPart =
|
||||
PartEntry->UnpartitionedOffset + DiskEntry->TrackSize;
|
||||
PartEntry->PartInfo[0].HiddenSectors =
|
||||
PartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector;
|
||||
(ULONG)(PartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector);
|
||||
PartEntry->PartInfo[0].PartitionLength.QuadPart =
|
||||
PartEntry->UnpartitionedLength - DiskEntry->TrackSize;
|
||||
PartEntry->PartInfo[0].PartitionType = PARTITION_ENTRY_UNUSED;
|
||||
|
@ -1996,7 +1996,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart =
|
||||
PartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize;
|
||||
PrevPartEntry->PartInfo[1].HiddenSectors =
|
||||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector;
|
||||
(ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector);
|
||||
|
||||
if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry)
|
||||
{
|
||||
|
@ -2024,7 +2024,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart =
|
||||
PartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize;
|
||||
PrevPartEntry->PartInfo[1].HiddenSectors =
|
||||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector;
|
||||
(ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector);
|
||||
|
||||
if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry)
|
||||
{
|
||||
|
@ -2081,7 +2081,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
NewPartEntry->PartInfo[0].StartingOffset.QuadPart =
|
||||
PartEntry->UnpartitionedOffset + DiskEntry->TrackSize;
|
||||
NewPartEntry->PartInfo[0].HiddenSectors =
|
||||
NewPartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector;
|
||||
(ULONG)(NewPartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector);
|
||||
NewPartEntry->PartInfo[0].PartitionLength.QuadPart =
|
||||
PartitionSize - DiskEntry->TrackSize;
|
||||
NewPartEntry->PartInfo[0].PartitionType = PARTITION_ENTRY_UNUSED;
|
||||
|
@ -2112,7 +2112,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart =
|
||||
NewPartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize;
|
||||
PrevPartEntry->PartInfo[1].HiddenSectors =
|
||||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector;
|
||||
(ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector);
|
||||
|
||||
if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry)
|
||||
{
|
||||
|
@ -2140,7 +2140,7 @@ CreateNewPartition (PPARTLIST List,
|
|||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart =
|
||||
NewPartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize;
|
||||
PrevPartEntry->PartInfo[1].HiddenSectors =
|
||||
PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector;
|
||||
(ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector);
|
||||
|
||||
if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry)
|
||||
{
|
||||
|
|
|
@ -290,75 +290,7 @@ ProgressSetStepCount(PPROGRESSBAR Bar,
|
|||
VOID
|
||||
ProgressNextStep(PPROGRESSBAR Bar)
|
||||
{
|
||||
CHAR TextBuffer[8];
|
||||
COORD coPos;
|
||||
DWORD Written;
|
||||
ULONG NewPercent;
|
||||
ULONG NewPos;
|
||||
|
||||
if ((Bar->StepCount == 0) ||
|
||||
(Bar->CurrentStep == Bar->StepCount))
|
||||
return;
|
||||
|
||||
Bar->CurrentStep++;
|
||||
|
||||
/* Calculate new percentage */
|
||||
NewPercent = (ULONG)(((100.0 * (float)Bar->CurrentStep) / (float)Bar->StepCount) + 0.5);
|
||||
|
||||
/* Redraw precentage if changed */
|
||||
if (Bar->Percent != NewPercent)
|
||||
{
|
||||
Bar->Percent = NewPercent;
|
||||
|
||||
sprintf(TextBuffer, "%-3lu%%", Bar->Percent);
|
||||
|
||||
coPos.X = Bar->Left + (Bar->Width - 2) / 2;
|
||||
coPos.Y = Bar->Top;
|
||||
WriteConsoleOutputCharacterA(StdOutput,
|
||||
TextBuffer,
|
||||
4,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
|
||||
/* Calculate bar position */
|
||||
NewPos = (ULONG)((((float)(Bar->Width - 2) * 2.0 * (float)Bar->CurrentStep) / (float)Bar->StepCount) + 0.5);
|
||||
|
||||
/* Redraw bar if changed */
|
||||
if (Bar->Pos != NewPos)
|
||||
{
|
||||
Bar->Pos = NewPos;
|
||||
|
||||
for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++)
|
||||
{
|
||||
coPos.X = Bar->Left + 1;
|
||||
FillConsoleOutputCharacterA(StdOutput,
|
||||
0xDB,
|
||||
Bar->Pos / 2,
|
||||
coPos,
|
||||
&Written);
|
||||
coPos.X += Bar->Pos/2;
|
||||
|
||||
if (NewPos & 1)
|
||||
{
|
||||
FillConsoleOutputCharacterA(StdOutput,
|
||||
0xDD,
|
||||
1,
|
||||
coPos,
|
||||
&Written);
|
||||
coPos.X++;
|
||||
}
|
||||
|
||||
if (coPos.X <= Bar->Right - 1)
|
||||
{
|
||||
FillConsoleOutputCharacterA(StdOutput,
|
||||
' ',
|
||||
Bar->Right - coPos.X,
|
||||
coPos,
|
||||
&Written);
|
||||
}
|
||||
}
|
||||
}
|
||||
ProgressSetStep(Bar, Bar->CurrentStep + 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct _PROGRESS
|
|||
SHORT Width;
|
||||
|
||||
ULONG Percent;
|
||||
ULONG Pos;
|
||||
SHORT Pos;
|
||||
|
||||
ULONG StepCount;
|
||||
ULONG CurrentStep;
|
||||
|
|
|
@ -398,8 +398,7 @@ CreateNestedKey (PHANDLE KeyHandle,
|
|||
UNICODE_STRING LocalKeyName;
|
||||
ULONG Disposition;
|
||||
NTSTATUS Status;
|
||||
ULONG FullNameLength;
|
||||
ULONG Length;
|
||||
USHORT FullNameLength;
|
||||
PWCHAR Ptr;
|
||||
HANDLE LocalKeyHandle;
|
||||
|
||||
|
@ -421,7 +420,7 @@ CreateNestedKey (PHANDLE KeyHandle,
|
|||
RtlCreateUnicodeString (&LocalKeyName,
|
||||
ObjectAttributes->ObjectName->Buffer);
|
||||
LocalObjectAttributes.ObjectName = &LocalKeyName;
|
||||
FullNameLength = LocalKeyName.Length / sizeof(WCHAR);
|
||||
FullNameLength = LocalKeyName.Length;
|
||||
|
||||
/* Remove the last part of the key name and try to create the key again. */
|
||||
while (Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||
|
@ -452,10 +451,9 @@ CreateNestedKey (PHANDLE KeyHandle,
|
|||
}
|
||||
|
||||
/* Add removed parts of the key name and create them too. */
|
||||
Length = wcslen (LocalKeyName.Buffer);
|
||||
while (TRUE)
|
||||
{
|
||||
if (Length == FullNameLength)
|
||||
if (LocalKeyName.Length == FullNameLength)
|
||||
{
|
||||
Status = STATUS_SUCCESS;
|
||||
*KeyHandle = LocalKeyHandle;
|
||||
|
@ -463,9 +461,8 @@ CreateNestedKey (PHANDLE KeyHandle,
|
|||
}
|
||||
NtClose (LocalKeyHandle);
|
||||
|
||||
LocalKeyName.Buffer[Length] = L'\\';
|
||||
Length = wcslen (LocalKeyName.Buffer);
|
||||
LocalKeyName.Length = Length * sizeof(WCHAR);
|
||||
LocalKeyName.Buffer[LocalKeyName.Length / sizeof(WCHAR)] = L'\\';
|
||||
LocalKeyName.Length = wcslen (LocalKeyName.Buffer) * sizeof(WCHAR);
|
||||
|
||||
Status = NtCreateKey (&LocalKeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue