[NTOS:INBV] Implement rotation bar for boot screen
[reactos.git] / ntoskrnl / inbv / inbv.c
index a99677c..45520c2 100644 (file)
@@ -7,22 +7,93 @@
 
 /* GLOBALS *******************************************************************/
 
-KSPIN_LOCK BootDriverLock;
-KIRQL InbvOldIrql;
-INBV_DISPLAY_STATE InbvDisplayState;
+/*
+ * Enable this define if you want Inbv to use coloured headless mode.
+ */
+// #define INBV_HEADLESS_COLORS
+
+/*
+ * ReactOS uses the same boot screen for all the products.
+ * Also it doesn't use a parallel system thread for the
+ * rotating "progress" bar.
+ */
+
+/*
+ * Enable this define when ReactOS will have different SKUs
+ * (Workstation, Server, Storage Server, Cluster Server, etc...).
+ */
+// #define REACTOS_SKUS
+
+/*
+ * Enable this define when Inbv will support rotating progress bar.
+ */
+#define INBV_ROTBAR_IMPLEMENTED
+
+static KSPIN_LOCK BootDriverLock;
+static KIRQL InbvOldIrql;
+static INBV_DISPLAY_STATE InbvDisplayState = INBV_DISPLAY_STATE_DISABLED;
 BOOLEAN InbvBootDriverInstalled = FALSE;
-BOOLEAN InbvDisplayDebugStrings = FALSE;
-INBV_DISPLAY_STRING_FILTER InbvDisplayFilter;
-ULONG ProgressBarLeft, ProgressBarTop;
-BOOLEAN ShowProgressBar = FALSE;
-INBV_PROGRESS_STATE InbvProgressState;
-INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters;
-ULONG ResourceCount;
-PUCHAR ResourceList[64];
-BOOLEAN SysThreadCreated = FALSE;
-ROT_BAR_TYPE RotBarSelection;
-ULONG PltRotBarStatus;
-BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0};
+static BOOLEAN InbvDisplayDebugStrings = FALSE;
+static INBV_DISPLAY_STRING_FILTER InbvDisplayFilter = NULL;
+static ULONG ProgressBarLeft = 0, ProgressBarTop = 0;
+static BOOLEAN ShowProgressBar = FALSE;
+static INBV_PROGRESS_STATE InbvProgressState;
+static BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0};
+static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters = NULL;
+static ULONG ResourceCount = 0;
+static PUCHAR ResourceList[1 + IDB_MAX_RESOURCE]; // First entry == NULL, followed by 'ResourceCount' entries.
+
+#ifdef INBV_ROTBAR_IMPLEMENTED
+/*
+ * Change this to modify progress bar behaviour
+ */
+#define ROT_BAR_DEFAULT_MODE  RB_PROGRESS_BAR
+static BOOLEAN RotBarThreadActive = FALSE;
+static ROT_BAR_TYPE RotBarSelection;
+static ULONG PltRotBarStatus;
+static PVOID RotBarThread = NULL;
+static UCHAR RotBarBuffer[24 * 9];
+static UCHAR RotLineBuffer[640 * 6];
+#endif
+
+
+/*
+ * Headless terminal text colors
+ */
+
+#ifdef INBV_HEADLESS_COLORS
+
+// Conversion table CGA to ANSI color index
+static const UCHAR CGA_TO_ANSI_COLOR_TABLE[16] =
+{
+    0,  // Black
+    4,  // Blue
+    2,  // Green
+    6,  // Cyan
+    1,  // Red
+    5,  // Magenta
+    3,  // Brown/Yellow
+    7,  // Grey/White
+
+    60, // Bright Black
+    64, // Bright Blue
+    62, // Bright Green
+    66, // Bright Cyan
+    61, // Bright Red
+    65, // Bright Magenta
+    63, // Bright Yellow
+    67  // Bright Grey (White)
+};
+
+#define CGA_TO_ANSI_COLOR(CgaColor) \
+    CGA_TO_ANSI_COLOR_TABLE[CgaColor & 0x0F]
+
+#endif
+
+// Default colors: text in white, background in black
+static ULONG InbvTerminalTextColor = 37;
+static ULONG InbvTerminalBkgdColor = 40;
+
 
 /* FADING FUNCTION ***********************************************************/
 
@@ -36,10 +107,10 @@ typedef struct tagRGBQUAD
 } RGBQUAD,*LPRGBQUAD;
 /*******************************/
 
-static RGBQUAD _MainPalette[16];
+static RGBQUAD MainPalette[16];
 
 #define PALETTE_FADE_STEPS  15
-#define PALETTE_FADE_TIME   20 * 10000 /* 20ms */
+#define PALETTE_FADE_TIME   20 * 1000 /* 20ms */
 
 /** From bootvid/precomp.h **/
 //
@@ -68,20 +139,16 @@ VOID NTAPI InbvAcquireLock(VOID);
 VOID NTAPI InbvReleaseLock(VOID);
 
 static VOID
-NTAPI
-BootImageFadeIn(VOID)
+BootLogoFadeIn(VOID)
 {
-    UCHAR PaletteBitmapBuffer[sizeof(BITMAPINFOHEADER) + sizeof(_MainPalette)];
+    UCHAR PaletteBitmapBuffer[sizeof(BITMAPINFOHEADER) + sizeof(MainPalette)];
     PBITMAPINFOHEADER PaletteBitmap = (PBITMAPINFOHEADER)PaletteBitmapBuffer;
     LPRGBQUAD Palette = (LPRGBQUAD)(PaletteBitmapBuffer + sizeof(BITMAPINFOHEADER));
 
     ULONG Iteration, Index, ClrUsed;
-    LARGE_INTEGER Interval;
-
-    Interval.QuadPart = -PALETTE_FADE_TIME;
 
     /* Check if we're installed and we own it */
-    if ((InbvBootDriverInstalled) &&
+    if (InbvBootDriverInstalled &&
         (InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
     {
         /* Acquire the lock */
@@ -91,7 +158,7 @@ BootImageFadeIn(VOID)
          * Build a bitmap containing the fade in palette. The palette entries
          * are then processed in a loop and set using VidBitBlt function.
          */
-        ClrUsed = sizeof(_MainPalette) / sizeof(_MainPalette[0]);
+        ClrUsed = RTL_NUMBER_OF(MainPalette);
         RtlZeroMemory(PaletteBitmap, sizeof(BITMAPINFOHEADER));
         PaletteBitmap->biSize = sizeof(BITMAPINFOHEADER);
         PaletteBitmap->biBitCount = 4;
@@ -105,24 +172,24 @@ BootImageFadeIn(VOID)
             for (Index = 0; Index < ClrUsed; Index++)
             {
                 Palette[Index].rgbRed = (UCHAR)
-                    (_MainPalette[Index].rgbRed * Iteration / PALETTE_FADE_STEPS);
+                    (MainPalette[Index].rgbRed * Iteration / PALETTE_FADE_STEPS);
                 Palette[Index].rgbGreen = (UCHAR)
-                    (_MainPalette[Index].rgbGreen * Iteration / PALETTE_FADE_STEPS);
+                    (MainPalette[Index].rgbGreen * Iteration / PALETTE_FADE_STEPS);
                 Palette[Index].rgbBlue = (UCHAR)
-                    (_MainPalette[Index].rgbBlue * Iteration / PALETTE_FADE_STEPS);
+                    (MainPalette[Index].rgbBlue * Iteration / PALETTE_FADE_STEPS);
             }
 
             VidBitBlt(PaletteBitmapBuffer, 0, 0);
 
-            /* Wait for a bit. */
-            KeDelayExecutionThread(KernelMode, FALSE, &Interval);
+            /* Wait for a bit */
+            KeStallExecutionProcessor(PALETTE_FADE_TIME);
         }
 
         /* Release the lock */
         InbvReleaseLock();
 
-        /* Wait for a bit. */
-        KeDelayExecutionThread(KernelMode, FALSE, &Interval);
+        /* Wait for a bit */
+        KeStallExecutionProcessor(PALETTE_FADE_TIME);
     }
 }
 
@@ -154,8 +221,8 @@ FindBitmapResource(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
                                      InLoadOrderLinks);
 
         /* Check for a match */
-        if ((RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE)) ||
-            (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE)))
+        if (RtlEqualUnicodeString(&LdrEntry->BaseDllName, &UpString, TRUE) ||
+            RtlEqualUnicodeString(&LdrEntry->BaseDllName, &MpString, TRUE))
         {
             /* Break out */
             break;
@@ -166,7 +233,7 @@ FindBitmapResource(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
     if (NextEntry != ListHead)
     {
         /* Try to find the resource */
-        ResourceInfo.Type = 2; //RT_BITMAP;
+        ResourceInfo.Type = 2; // RT_BITMAP;
         ResourceInfo.Name = ResourceId;
         ResourceInfo.Language = 0;
         Status = LdrFindResource_U(LdrEntry->DllBase,
@@ -200,7 +267,7 @@ InbvDriverInitialize(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
                      IN ULONG Count)
 {
     PCHAR CommandLine;
-    BOOLEAN CustomLogo = FALSE;
+    BOOLEAN ResetMode = FALSE; // By default do not reset the video mode
     ULONG i;
 
     /* Quit if we're already installed */
@@ -210,21 +277,18 @@ InbvDriverInitialize(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
     KeInitializeSpinLock(&BootDriverLock);
     if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
     {
-        /* Check if we have a custom boot logo */
-        CommandLine = _strupr(LoaderBlock->LoadOptions);
-        CustomLogo = strstr(CommandLine, "BOOTLOGO") ? TRUE: FALSE;
+        /* Reset the video mode in case we do not have a custom boot logo */
+        CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
+        ResetMode   = (CommandLine == NULL) || (strstr(CommandLine, "BOOTLOGO") == NULL);
     }
 
     /* Initialize the video */
-    InbvBootDriverInstalled = VidInitialize(FALSE);
+    InbvBootDriverInstalled = VidInitialize(ResetMode);
     if (InbvBootDriverInstalled)
     {
-        /* Now reset the display, but only if there's a custom boot logo */
-        VidResetDisplay(CustomLogo);
-
         /* Find bitmap resources in the kernel */
-        ResourceCount = min(IDB_CLUSTER_SERVER, Count);
-        for (i = 1; i <= Count; i++)
+        ResourceCount = min(Count, RTL_NUMBER_OF(ResourceList) - 1);
+        for (i = 1; i <= ResourceCount; i++)
         {
             /* Do the lookup */
             ResourceList[i] = FindBitmapResource(LoaderBlock, i);
@@ -294,7 +358,7 @@ InbvEnableBootDriver(IN BOOLEAN Enable)
         if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED) VidCleanUp();
 
         /* Set the new display state */
-        InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED:
+        InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED :
                                     INBV_DISPLAY_STATE_DISABLED;
 
         /* Release the lock */
@@ -303,7 +367,7 @@ InbvEnableBootDriver(IN BOOLEAN Enable)
     else
     {
         /* Set the new display state */
-        InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED:
+        InbvDisplayState = Enable ? INBV_DISPLAY_STATE_OWNED :
                                     INBV_DISPLAY_STATE_DISABLED;
     }
 }
@@ -329,7 +393,7 @@ NTAPI
 InbvSetDisplayOwnership(IN BOOLEAN DisplayOwned)
 {
     /* Set the new display state */
-    InbvDisplayState = DisplayOwned ? INBV_DISPLAY_STATE_OWNED:
+    InbvDisplayState = DisplayOwned ? INBV_DISPLAY_STATE_OWNED :
                                       INBV_DISPLAY_STATE_LOST;
 }
 
@@ -366,7 +430,7 @@ InbvDisplayString(IN PCHAR String)
         InbvAcquireLock();
 
         /* Make sure we're installed and display the string */
-        if (InbvBootDriverInstalled) VidDisplayString((PUCHAR) String);
+        if (InbvBootDriverInstalled) VidDisplayString((PUCHAR)String);
 
         /* Print the string on the EMS port */
         HeadlessDispatch(HeadlessCmdPutString,
@@ -449,7 +513,7 @@ NTAPI
 InbvResetDisplay(VOID)
 {
     /* Check if we're installed and we own it */
-    if ((InbvBootDriverInstalled) &&
+    if (InbvBootDriverInstalled &&
         (InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
     {
         /* Do the reset */
@@ -465,18 +529,32 @@ VOID
 NTAPI
 InbvSetScrollRegion(IN ULONG Left,
                     IN ULONG Top,
-                    IN ULONG Width,
-                    IN ULONG Height)
+                    IN ULONG Right,
+                    IN ULONG Bottom)
 {
     /* Just call bootvid */
-    VidSetScrollRegion(Left, Top, Width, Height);
+    VidSetScrollRegion(Left, Top, Right, Bottom);
 }
 
 VOID
 NTAPI
 InbvSetTextColor(IN ULONG Color)
 {
-    /* FIXME: Headless */
+    HEADLESS_CMD_SET_COLOR HeadlessSetColor;
+
+    /* Set color for EMS port */
+#ifdef INBV_HEADLESS_COLORS
+    InbvTerminalTextColor = 30 + CGA_TO_ANSI_COLOR(Color);
+#else
+    InbvTerminalTextColor = 37;
+#endif
+    HeadlessSetColor.TextColor = InbvTerminalTextColor;
+    HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
+    HeadlessDispatch(HeadlessCmdSetColor,
+                     &HeadlessSetColor,
+                     sizeof(HeadlessSetColor),
+                     NULL,
+                     NULL);
 
     /* Update the text color */
     VidSetTextColor(Color);
@@ -486,10 +564,12 @@ VOID
 NTAPI
 InbvSolidColorFill(IN ULONG Left,
                    IN ULONG Top,
-                   IN ULONG Width,
-                   IN ULONG Height,
+                   IN ULONG Right,
+                   IN ULONG Bottom,
                    IN ULONG Color)
 {
+    HEADLESS_CMD_SET_COLOR HeadlessSetColor;
+
     /* Make sure we own it */
     if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
     {
@@ -500,10 +580,25 @@ InbvSolidColorFill(IN ULONG Left,
         if (InbvBootDriverInstalled)
         {
             /* Call bootvid */
-            VidSolidColorFill(Left, Top, Width, Height, (UCHAR)Color);
+            VidSolidColorFill(Left, Top, Right, Bottom, (UCHAR)Color);
         }
 
-        /* FIXME: Headless */
+        /* Set color for EMS port and clear display */
+#ifdef INBV_HEADLESS_COLORS
+        InbvTerminalBkgdColor = 40 + CGA_TO_ANSI_COLOR(Color);
+#else
+        InbvTerminalBkgdColor = 40;
+#endif
+        HeadlessSetColor.TextColor = InbvTerminalTextColor;
+        HeadlessSetColor.BkgdColor = InbvTerminalBkgdColor;
+        HeadlessDispatch(HeadlessCmdSetColor,
+                         &HeadlessSetColor,
+                         sizeof(HeadlessSetColor),
+                         NULL,
+                         NULL);
+        HeadlessDispatch(HeadlessCmdClearDisplay,
+                         NULL, 0,
+                         NULL, NULL);
 
         /* Release the lock */
         InbvReleaseLock();
@@ -518,8 +613,8 @@ InbvUpdateProgressBar(IN ULONG Progress)
     ULONG FillCount, BoundedProgress;
 
     /* Make sure the progress bar is enabled, that we own and are installed */
-    if ((ShowProgressBar) &&
-        (InbvBootDriverInstalled) &&
+    if (ShowProgressBar &&
+        InbvBootDriverInstalled &&
         (InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
     {
         /* Compute fill count */
@@ -551,7 +646,7 @@ InbvBufferToScreenBlt(IN PUCHAR Buffer,
                       IN ULONG Delta)
 {
     /* Check if we're installed and we own it */
-    if ((InbvBootDriverInstalled) &&
+    if (InbvBootDriverInstalled &&
         (InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
     {
         /* Do the blit */
@@ -566,7 +661,7 @@ InbvBitBlt(IN PUCHAR Buffer,
            IN ULONG Y)
 {
     /* Check if we're installed and we own it */
-    if ((InbvBootDriverInstalled) &&
+    if (InbvBootDriverInstalled &&
         (InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
     {
         /* Acquire the lock */
@@ -590,7 +685,7 @@ InbvScreenToBufferBlt(IN PUCHAR Buffer,
                       IN ULONG Delta)
 {
     /* Check if we're installed and we own it */
-    if ((InbvBootDriverInstalled) &&
+    if (InbvBootDriverInstalled &&
         (InbvDisplayState == INBV_DISPLAY_STATE_OWNED))
     {
         /* Do the blit */
@@ -605,7 +700,7 @@ InbvSetProgressBarCoordinates(IN ULONG Left,
 {
     /* Update the coordinates */
     ProgressBarLeft = Left;
-    ProgressBarTop = Top;
+    ProgressBarTop  = Top;
 
     /* Enable the progress bar */
     ShowProgressBar = TRUE;
@@ -656,7 +751,7 @@ InbvGetResourceAddress(IN ULONG ResourceNumber)
     if (ResourceNumber > ResourceCount) return NULL;
 
     /* Return the address */
-    return ResourceList[ResourceNumber--];
+    return ResourceList[ResourceNumber];
 }
 
 NTSTATUS
@@ -674,81 +769,230 @@ NtDisplayString(IN PUNICODE_STRING DisplayString)
     return STATUS_SUCCESS;
 }
 
+#ifdef INBV_ROTBAR_IMPLEMENTED
+static
+VOID
+NTAPI
+InbvRotationThread(
+    _In_ PVOID Context)
+{
+    ULONG X, Y, Index, Total = 18;
+    LARGE_INTEGER Delay;
+
+    InbvAcquireLock();
+    if (RotBarSelection == RB_SQUARE_CELLS)
+    {
+        Delay.QuadPart = -800000; // 0.08 sec
+        Index = 0;
+    }
+    else
+    {
+        Delay.QuadPart = -600000; // 0.06 sec
+        Index = 32;
+    }
+    X = ProgressBarLeft + 2;
+    Y = ProgressBarTop + 2;
+    InbvReleaseLock();
+
+    while (InbvDisplayState == INBV_DISPLAY_STATE_OWNED && PltRotBarStatus != 3)
+    {
+        InbvAcquireLock();
+
+        if (RotBarSelection == RB_SQUARE_CELLS)
+        {
+            if (Index >= 3)
+            {
+                /* Fill previous bar position */
+                VidSolidColorFill(X + ((Index - 3) * 8), Y, (X + ((Index - 3) * 8)) + 8 - 1, Y + 9 - 1, 0);
+            }
+            if (Index < Total - 1)
+            {
+                /* Draw the progress bar bit */
+                if (Index < 2)
+                {
+                    /* Appearing from the left */
+                    VidBufferToScreenBlt(RotBarBuffer + 8 * (2 - Index) / 2, X, Y, 22 - 8 * (2 - Index), 9, 24);
+                }
+                else if (Index >= Total - 3)
+                {
+                    /* Hiding to the right */
+                    VidBufferToScreenBlt(RotBarBuffer, X + ((Index - 2) * 8), Y, 22 - 8 * (4 - (Total - Index)), 9, 24);
+                }
+                else
+                {
+                    VidBufferToScreenBlt(RotBarBuffer, X + ((Index - 2) * 8), Y, 22, 9, 24);
+                }
+            }
+            Index = (Index + 1) % Total;
+        }
+        else if (RotBarSelection == RB_PROGRESS_BAR)
+        {
+            /* Right part */
+            VidBufferToScreenBlt(RotLineBuffer, Index, 474, 640 - Index, 6, 640);
+            if (Index > 0)
+            {
+                /* Left part */
+                VidBufferToScreenBlt(RotLineBuffer + (640 - Index) / 2, 0, 474, Index - 2, 6, 640);
+            }
+            Index = (Index + 32) % 640;
+        }
+
+        InbvReleaseLock();
+
+        /* Wait for a bit */
+        KeDelayExecutionThread(KernelMode, FALSE, &Delay);
+    }
+    PsTerminateSystemThread(STATUS_SUCCESS);
+}
+
+VOID
+NTAPI
+INIT_FUNCTION
+InbvRotBarInit(VOID)
+{
+    NTSTATUS Status;
+    HANDLE ThreadHandle = NULL;
+
+    if (!InbvBootDriverInstalled || RotBarSelection == RB_UNSPECIFIED)
+        return;
+
+    RotBarThread = NULL;
+    PltRotBarStatus = 0;
+
+    Status = PsCreateSystemThread(&ThreadHandle,
+                                  SYNCHRONIZE,
+                                  NULL,
+                                  NULL,
+                                  NULL,
+                                  InbvRotationThread,
+                                  NULL);
+
+    if (NT_SUCCESS(Status))
+    {
+        Status = ObReferenceObjectByHandle(ThreadHandle,
+                                           SYNCHRONIZE,
+                                           PsThreadType,
+                                           KernelMode,
+                                           &RotBarThread,
+                                           NULL);
+        if (NT_SUCCESS(Status))
+        {
+            KeSetPriorityThread(RotBarThread, HIGH_PRIORITY);
+            RotBarThreadActive = TRUE;
+        }
+        ObCloseHandle(ThreadHandle, KernelMode);
+    }
+}
+
+VOID
+NTAPI
+INIT_FUNCTION
+InbvRotBarStop(VOID)
+{
+    if (!RotBarThread)
+    {
+        RotBarThreadActive = FALSE;
+        return;
+    }
+
+    InbvAcquireLock();
+    PltRotBarStatus = 3;
+    InbvReleaseLock();
+
+    KeWaitForSingleObject(RotBarThread,
+                          Executive,
+                          KernelMode,
+                          FALSE,
+                          NULL);
+    ObDereferenceObject(RotBarThread);
+    RotBarThread = NULL;
+    RotBarThreadActive = FALSE;
+}
+#endif
+
 VOID
 NTAPI
 INIT_FUNCTION
 DisplayBootBitmap(IN BOOLEAN TextMode)
 {
-    PBITMAPINFOHEADER BitmapInfoHeader;
-    LPRGBQUAD Palette;
+    PVOID Header = NULL, Footer = NULL, Screen = NULL;
 
-    PVOID Header, Band, Text, Screen;
+#ifdef INBV_ROTBAR_IMPLEMENTED
+    UCHAR Buffer[24 * 9];
+    PVOID Bar = NULL, LineBmp = NULL;
     ROT_BAR_TYPE TempRotBarSelection = RB_UNSPECIFIED;
+    LARGE_INTEGER Delay;
+#endif
 
-#ifdef CORE_6781_resolved
-    UCHAR Buffer[64];
+#ifdef REACTOS_SKUS
+    PVOID Text = NULL;
 #endif
 
+#ifdef INBV_ROTBAR_IMPLEMENTED
     /* Check if the system thread has already been created */
-    if (SysThreadCreated)
+    if (RotBarThreadActive)
     {
         /* Reset the progress bar */
-        InbvAcquireLock();
-        RotBarSelection = RB_UNSPECIFIED;
-        InbvReleaseLock();
+        InbvRotBarStop();
     }
+#endif
 
-    /* Check if this is text mode */
     ShowProgressBar = FALSE;
+
+    /* Check if this is text mode */
     if (TextMode)
     {
-        /* Check if this is a server OS */
+        /* Check the type of the OS: workstation or server */
         if (SharedUserData->NtProductType == NtProductWinNt)
         {
-            /* It's not, set workstation settings */
+            /* Workstation; set colors */
             InbvSetTextColor(15);
             InbvSolidColorFill(0, 0, 639, 479, 7);
             InbvSolidColorFill(0, 421, 639, 479, 1);
 
             /* Get resources */
-            Header = InbvGetResourceAddress(IDB_LOGO_HEADER);
-            Band = InbvGetResourceAddress(IDB_LOGO_BAND);
+            Header = InbvGetResourceAddress(IDB_WKSTA_HEADER);
+            Footer = InbvGetResourceAddress(IDB_WKSTA_FOOTER);
         }
         else
         {
-            /* Set server settings */
+            /* Server; set colors */
             InbvSetTextColor(14);
             InbvSolidColorFill(0, 0, 639, 479, 6);
             InbvSolidColorFill(0, 421, 639, 479, 1);
 
             /* Get resources */
             Header = InbvGetResourceAddress(IDB_SERVER_HEADER);
-            Band = InbvGetResourceAddress(IDB_SERVER_BAND);
+            Footer = InbvGetResourceAddress(IDB_SERVER_FOOTER);
         }
 
         /* Set the scrolling region */
         InbvSetScrollRegion(32, 80, 631, 400);
 
         /* Make sure we have resources */
-        if ((Header) && (Band))
+        if (Header && Footer)
         {
             /* BitBlt them on the screen */
-            InbvBitBlt(Band, 0, 419);
+            InbvBitBlt(Footer, 0, 419);
             InbvBitBlt(Header, 0, 0);
         }
     }
     else
     {
         /* Is the boot driver installed? */
-        Text = NULL;
         if (!InbvBootDriverInstalled) return;
 
         /* Load the standard boot screen */
-        Screen = InbvGetResourceAddress(IDB_BOOT_LOGO);
+        Screen = InbvGetResourceAddress(IDB_BOOT_SCREEN);
+
+#ifdef REACTOS_SKUS
+        Text = NULL;
         if (SharedUserData->NtProductType == NtProductWinNt)
         {
-            /* Workstation product, display appropriate status bar color */
-            InbvGetResourceAddress(IDB_BAR_PRO);
+#ifdef INBV_ROTBAR_IMPLEMENTED
+            /* Workstation product, use appropriate status bar color */
+            Bar = InbvGetResourceAddress(IDB_BAR_WKSTA);
+#endif
         }
         else
         {
@@ -769,35 +1013,43 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
                 Text = InbvGetResourceAddress(IDB_SERVER_LOGO);
             }
 
-            /* Server product, display appropriate status bar color */
-            InbvGetResourceAddress(IDB_BAR_SERVER);
+#ifdef INBV_ROTBAR_IMPLEMENTED
+            /* Server product, use appropriate status bar color */
+            Bar = InbvGetResourceAddress(IDB_BAR_SERVER);
+#endif
         }
+#else
+        /* Use default status bar */
+        Bar = InbvGetResourceAddress(IDB_BAR_WKSTA);
+#endif
 
-        /* Make sure we had a logo */
+        /* Make sure we have a logo */
         if (Screen)
         {
-            /* Choose progress bar */
-            TempRotBarSelection = RB_SQUARE_CELLS;
+            PBITMAPINFOHEADER BitmapInfoHeader;
+            LPRGBQUAD Palette;
 
             /*
-             * Save the main image palette and replace it with black palette, so
-             * we can do fade in effect later.
+             * Save the main image palette and replace it with black palette,
+             * so that we can do fade in effect later.
              */
             BitmapInfoHeader = (PBITMAPINFOHEADER)Screen;
             Palette = (LPRGBQUAD)((PUCHAR)Screen + BitmapInfoHeader->biSize);
-            RtlCopyMemory(_MainPalette, Palette, sizeof(_MainPalette));
-            RtlZeroMemory(Palette, sizeof(_MainPalette));
+            RtlCopyMemory(MainPalette, Palette, sizeof(MainPalette));
+            RtlZeroMemory(Palette, sizeof(MainPalette));
 
             /* Blit the background */
             InbvBitBlt(Screen, 0, 0);
 
-            /* Set progress bar coordinates and display it */
-            InbvSetProgressBarCoordinates(257, 352);
+#ifdef INBV_ROTBAR_IMPLEMENTED
+            /* Choose progress bar */
+            TempRotBarSelection = ROT_BAR_DEFAULT_MODE;
+#endif
 
-            /* Display the boot logo and fade it in */
-            BootImageFadeIn();
+            /* Set progress bar coordinates and display it */
+            InbvSetProgressBarCoordinates(259, 352);
 
-#ifdef CORE_6781_resolved
+#ifdef REACTOS_SKUS
             /* Check for non-workstation products */
             if (SharedUserData->NtProductType != NtProductWinNt)
             {
@@ -812,26 +1064,66 @@ DisplayBootBitmap(IN BOOLEAN TextMode)
 #endif
         }
 
-#ifdef CORE_6781_resolved
+#ifdef REACTOS_SKUS
         /* Draw the SKU text if it exits */
         if (Text) InbvBitBlt(Text, 180, 121);
 #endif
 
-        /* Draw the progress bar bit */
-//      if (Bar) InbvBitBlt(Bar, 0, 0);
+#ifdef INBV_ROTBAR_IMPLEMENTED
+        if (Bar)
+        {
+            /* Save previous screen pixels to buffer */
+            InbvScreenToBufferBlt(Buffer, 0, 0, 22, 9, 24);
+            /* Draw the progress bar bit */
+            InbvBitBlt(Bar, 0, 0);
+            /* Store it in global buffer */
+            InbvScreenToBufferBlt(RotBarBuffer, 0, 0, 22, 9, 24);
+            /* Restore screen pixels */
+            InbvBufferToScreenBlt(Buffer, 0, 0, 22, 9, 24);
+        }
 
-        /* Set filter which will draw text display if needed */
-        InbvInstallDisplayStringFilter(DisplayFilter);
-    }
+        LineBmp = InbvGetResourceAddress(IDB_ROTATING_LINE);
+        if (LineBmp && TempRotBarSelection == RB_PROGRESS_BAR)
+        {
+            /* Draw the line */
+            InbvBitBlt(LineBmp, 0, 474);
+            /* Store it in global buffer */
+            InbvScreenToBufferBlt(RotLineBuffer, 0, 474, 640, 6, 640);
+        }
+#endif
 
-    /* Do we have a system thread? */
-    if (SysThreadCreated)
-    {
-        /* We do, set the progress bar location */
+        /* Display the boot logo and fade it in */
+        BootLogoFadeIn();
+
+#ifdef INBV_ROTBAR_IMPLEMENTED
+        if (TempRotBarSelection != RB_PROGRESS_BAR)
+        {
+            /* Hide simple progress bar if not used */
+            ShowProgressBar = FALSE;
+        }
+
+        /* Do we have a system thread? */
+        if (!RotBarThreadActive)
+        {
+            /* We don't, initialize the progress bar */
+            RotBarSelection = TempRotBarSelection;
+            InbvRotBarInit();
+        }
+
+        /* Start rotating bar */
         InbvAcquireLock();
-        RotBarSelection = TempRotBarSelection;
-        //InbvRotBarInit();
+        PltRotBarStatus = 1;
         InbvReleaseLock();
+
+        if (TempRotBarSelection != RB_UNSPECIFIED)
+        {
+            Delay.QuadPart = -3000000; // 0.3 sec
+            KeDelayExecutionThread(KernelMode, FALSE, &Delay);
+        }
+#endif
+
+        /* Set filter which will draw text display if needed */
+        InbvInstallDisplayStringFilter(DisplayFilter);
     }
 }
 
@@ -864,6 +1156,10 @@ NTAPI
 INIT_FUNCTION
 FinalizeBootLogo(VOID)
 {
+#ifdef INBV_ROTBAR_IMPLEMENTED
+    /* Reset rotation bar */
+    InbvRotBarStop();
+#endif
     /* Acquire lock and check the display state */
     InbvAcquireLock();
     if (InbvGetDisplayState() == INBV_DISPLAY_STATE_OWNED)
@@ -871,8 +1167,6 @@ FinalizeBootLogo(VOID)
         /* Clear the screen */
         VidSolidColorFill(0, 0, 639, 479, 0);
     }
-
-    /* Reset progress bar and lock */
-    PltRotBarStatus = 3;
+    /* Reset lock */
     InbvReleaseLock();
 }