Author: rharabien
Date: Sun Jun 26 10:08:31 2011
New Revision: 52467
URL:
http://svn.reactos.org/svn/reactos?rev=52467&view=rev
Log:
[MSTSC][USETUP]
- Fix MSVC warnings
- Remove duplicated code in usetup progress bar
Modified:
trunk/reactos/base/applications/mstsc/connectdialog.c
trunk/reactos/base/setup/usetup/fslist.c
trunk/reactos/base/setup/usetup/inffile.c
trunk/reactos/base/setup/usetup/partlist.c
trunk/reactos/base/setup/usetup/progress.c
trunk/reactos/base/setup/usetup/progress.h
trunk/reactos/base/setup/usetup/registry.c
Modified: trunk/reactos/base/applications/mstsc/connectdialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/co…
==============================================================================
--- trunk/reactos/base/applications/mstsc/connectdialog.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mstsc/connectdialog.c [iso-8859-1] Sun Jun 26 10:08:31
2011
@@ -1136,10 +1136,10 @@
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 @@
}
}
- 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,
Modified: trunk/reactos/base/setup/usetup/fslist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/fslist.c…
==============================================================================
--- trunk/reactos/base/setup/usetup/fslist.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/fslist.c [iso-8859-1] Sun Jun 26 10:08:31 2011
@@ -172,11 +172,11 @@
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;
Modified: trunk/reactos/base/setup/usetup/inffile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/inffile.…
==============================================================================
--- trunk/reactos/base/setup/usetup/inffile.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/inffile.c [iso-8859-1] Sun Jun 26 10:08:31 2011
@@ -75,7 +75,7 @@
Status = InfOpenFile(
&hInf,
&FileNameU,
- LocaleId,
+ LANGIDFROMLCID(LocaleId),
&ErrorLineUL);
*ErrorLine = (UINT)ErrorLineUL;
if (!NT_SUCCESS(Status))
@@ -197,7 +197,7 @@
&hInf,
FileBuffer,
FileSize,
- LocaleId,
+ LANGIDFROMLCID(LocaleId),
&ErrorLineUL);
*ErrorLine = (UINT)ErrorLineUL;
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/base/setup/usetup/partlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Sun Jun 26 10:08:31 2011
@@ -1612,7 +1612,7 @@
PPARTENTRY PartEntry;
PLIST_ENTRY Entry1;
PLIST_ENTRY Entry2;
- ULONG i;
+ UCHAR i;
/* Check for empty disks */
if (IsListEmpty (&List->DiskListHead))
@@ -1965,7 +1965,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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)
{
Modified: trunk/reactos/base/setup/usetup/progress.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/progress…
==============================================================================
--- trunk/reactos/base/setup/usetup/progress.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/progress.c [iso-8859-1] Sun Jun 26 10:08:31 2011
@@ -290,17 +290,24 @@
VOID
ProgressNextStep(PPROGRESSBAR Bar)
{
+ ProgressSetStep(Bar, Bar->CurrentStep + 1);
+}
+
+
+VOID
+ProgressSetStep (PPROGRESSBAR Bar,
+ ULONG Step)
+{
CHAR TextBuffer[8];
COORD coPos;
DWORD Written;
ULONG NewPercent;
ULONG NewPos;
- if ((Bar->StepCount == 0) ||
- (Bar->CurrentStep == Bar->StepCount))
+ if (Step > Bar->StepCount)
return;
- Bar->CurrentStep++;
+ Bar->CurrentStep = Step;
/* Calculate new percentage */
NewPercent = (ULONG)(((100.0 * (float)Bar->CurrentStep) / (float)Bar->StepCount)
+ 0.5);
@@ -361,79 +368,4 @@
}
}
-
-VOID
-ProgressSetStep (PPROGRESSBAR Bar,
- ULONG Step)
-{
- CHAR TextBuffer[8];
- COORD coPos;
- DWORD Written;
- ULONG NewPercent;
- ULONG NewPos;
-
- if (Step > Bar->StepCount)
- return;
-
- Bar->CurrentStep = Step;
-
- /* 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);
- }
- }
- }
-}
-
/* EOF */
Modified: trunk/reactos/base/setup/usetup/progress.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/progress…
==============================================================================
--- trunk/reactos/base/setup/usetup/progress.h [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/progress.h [iso-8859-1] Sun Jun 26 10:08:31 2011
@@ -38,7 +38,7 @@
SHORT Width;
ULONG Percent;
- ULONG Pos;
+ SHORT Pos;
ULONG StepCount;
ULONG CurrentStep;
Modified: trunk/reactos/base/setup/usetup/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/registry…
==============================================================================
--- trunk/reactos/base/setup/usetup/registry.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/registry.c [iso-8859-1] Sun Jun 26 10:08:31 2011
@@ -398,8 +398,7 @@
UNICODE_STRING LocalKeyName;
ULONG Disposition;
NTSTATUS Status;
- ULONG FullNameLength;
- ULONG Length;
+ USHORT FullNameLength;
PWCHAR Ptr;
HANDLE LocalKeyHandle;
@@ -421,7 +420,7 @@
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 @@
}
/* 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 @@
}
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,