--- /dev/null
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Logon User Interface Host
+ * FILE: subsys/system/logonui/NT5design.c
+ * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org)
+ */
+
+#include "logonui.h"
+
+
+/* GLOBALS ******************************************************************/
+
+#define NT5_TOP_BORDER_HEIGHT 80
+#define NT5_BOTTOM_BORDER_HEIGHT 96
+
+
+/* FUNCTIONS ****************************************************************/
+
+static VOID
+NT5_DrawLogoffCaptionText(LPWSTR lpText,
+ HDC hdcMem)
+{
+ HFONT hFont;
+ LOGFONTW LogFont;
+ RECT TextRect;
+ INT PrevBkMode;
+
+ /* Setup the font we'll use */
+ ZeroMemory(&LogFont, sizeof(LOGFONTW));
+ LogFont.lfCharSet = DEFAULT_CHARSET;
+ LogFont.lfHeight = 22;
+ LogFont.lfWeight = 109; // From WinXP disassembly
+ wcscpy_s(LogFont.lfFaceName, LF_FACESIZE, L"Arial");
+
+ /* Create it */
+ hFont = CreateFontIndirectW(&LogFont);
+ if (hFont)
+ {
+ /* Set the font and font colour */
+ SelectObject(hdcMem, hFont);
+ SetTextColor(hdcMem, RGB(255, 255, 255));
+
+ /* Create the text rect */
+ TextRect.top = (g_pInfo->cy / 2) + 34;
+ TextRect.bottom = (g_pInfo->cy / 2) + 34 + (GetDeviceCaps(hdcMem, LOGPIXELSY));
+ TextRect.left = g_pInfo->cx / 3;
+ TextRect.right = (g_pInfo->cx / 2) + 35 + 137;
+
+ /* Set the background mode to transparent */
+ PrevBkMode = SetBkMode(hdcMem, TRANSPARENT);
+
+ /* Draw the text to the mem DC */
+ DrawTextW(hdcMem,
+ lpText,
+ -1,
+ &TextRect,
+ DT_NOPREFIX | DT_WORDBREAK | DT_RIGHT); // WinXP disassembly uses 0x812
+
+ /* Set the previous background mode */
+ SetBkMode(hdcMem, PrevBkMode);
+
+ /* Delete the font */
+ DeleteObject(hFont);
+ }
+}
+
+static VOID
+NT5_DrawLogoffIcon(HDC hdcMem)
+{
+ HBITMAP hBitmap;
+ BITMAP bitmap;
+ HDC hTempDC;
+
+ /* Load the XP logo */
+ hBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance,
+ MAKEINTRESOURCEW(IDB_MAIN_ROS_LOGO),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ if (hBitmap)
+ {
+ /* Get the bitmap dimensions */
+ GetObjectW(hBitmap, sizeof(BITMAP), &bitmap);
+
+ /* Create a temp DC for the bitmap */
+ hTempDC = CreateCompatibleDC(hdcMem);
+ if (hTempDC)
+ {
+ /* Select the bitmap onto the temp DC */
+ SelectObject(hTempDC, hBitmap);
+
+ /* Paint it onto the centre block */
+ BitBlt(hdcMem,
+ (g_pInfo->cx / 2) + 35,
+ (g_pInfo->cy / 2) - 72,
+ bitmap.bmWidth,
+ bitmap.bmHeight,
+ hTempDC,
+ 0,
+ 0,
+ SRCCOPY);
+
+ /* Delete the DC */
+ DeleteDC(hTempDC);
+ }
+
+ /* Delete the bitmap */
+ DeleteObject(hBitmap);
+ }
+}
+
+VOID
+NT5_RefreshLogoffScreenText(LPWSTR lpText,
+ HDC hdcMem)
+{
+ /* FIXME: clear previous text */
+
+ /* Draw the new text */
+ NT5_DrawLogoffCaptionText(lpText, hdcMem);
+}
+
+VOID
+NT5_CreateLogoffScreen(LPWSTR lpText,
+ HDC hdcMem)
+{
+ /* Draw the reactos logo */
+ NT5_DrawLogoffIcon(hdcMem);
+
+ /* Draw the first text string */
+ NT5_DrawLogoffCaptionText(lpText, hdcMem);
+}
+
+HDC
+NT5_DrawBaseBackground(HDC hdcDesktop)
+{
+ HBITMAP hBitmap = NULL;
+ HDC hdcMem = NULL;
+ BOOL bRet = FALSE;
+
+
+ /* Create an an off screen DC to match the desktop DC */
+ hdcMem = CreateCompatibleDC(hdcDesktop);
+ if (hdcMem)
+ {
+ /* Create a bitmap to draw the logoff screen onto */
+ hBitmap = CreateCompatibleBitmap(hdcDesktop, g_pInfo->cx, g_pInfo->cy);
+ if (hBitmap)
+ {
+ /* Select it onto our off screen DC*/
+ SelectObject(hdcMem, hBitmap);
+
+ /* Draw the centre block */
+ {
+ HBITMAP hTempBitmap;
+ HBRUSH hBrush;
+ BITMAP bitmap;
+ HDC hTempDC;
+
+ /* Paint the blue centre block */
+ hBrush = CreateSolidBrush(RGB(90, 126, 220));
+ SelectObject(hdcMem, hBrush);
+ PatBlt(hdcMem,
+ 0,
+ NT5_TOP_BORDER_HEIGHT,
+ g_pInfo->cx,
+ g_pInfo->cy - NT5_TOP_BORDER_HEIGHT - NT5_BOTTOM_BORDER_HEIGHT,
+ PATCOPY);
+ DeleteObject(hBrush);
+
+ /* Load the shine effect */
+ hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance,
+ MAKEINTRESOURCEW(IDB_MAIN_PANEL_SHINE),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ if (hTempBitmap)
+ {
+ /* Get the bitmap dimensions */
+ GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
+
+ /* Create a temp DC for the bitmap */
+ hTempDC = CreateCompatibleDC(hdcDesktop);
+ if (hTempDC)
+ {
+ /* Select the bitmap onto the temp DC */
+ SelectObject(hTempDC, hTempBitmap);
+
+ /* Paint it onto the top left of the centre block */
+ BitBlt(hdcMem,
+ 0,
+ NT5_TOP_BORDER_HEIGHT,
+ bitmap.bmWidth,
+ bitmap.bmHeight,
+ hTempDC,
+ 0,
+ 0,
+ SRCCOPY);
+
+ /* Delete the DC */
+ DeleteDC(hTempDC);
+ }
+
+ /* Delete the bitmap */
+ DeleteObject(hTempBitmap);
+ }
+ }
+
+ /* Draw the top border */
+ {
+ HBITMAP hTempBitmap;
+ HBRUSH hBrush;
+ BITMAP bitmap;
+ HDC hTempDC;
+
+ /* Create the blue brush and paint the top bar */
+ hBrush = CreateSolidBrush(RGB(0, 48, 156));
+ SelectObject(hdcMem, hBrush);
+ PatBlt(hdcMem, 0, 0, g_pInfo->cx, NT5_TOP_BORDER_HEIGHT, PATCOPY);
+ DeleteObject(hBrush);
+
+ /* Load the top divider strip */
+ hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance,
+ MAKEINTRESOURCEW(IDB_TOP_DIVIDER_STRIP),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ if (hTempBitmap)
+ {
+ /* Get the bitmap dimensions */
+ GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
+
+ /* Create a temp DC for the bitmap */
+ hTempDC = CreateCompatibleDC(hdcDesktop);
+ if (hTempDC)
+ {
+ /* Select the bitmap onto the temp DC */
+ SelectObject(hTempDC, hTempBitmap);
+
+ /* Paint the bitmap */
+ StretchBlt(hdcMem,
+ 0,
+ NT5_TOP_BORDER_HEIGHT - bitmap.bmHeight,
+ g_pInfo->cx,
+ NT5_TOP_BORDER_HEIGHT,
+ hTempDC,
+ 0,
+ 0,
+ bitmap.bmWidth,
+ NT5_TOP_BORDER_HEIGHT,
+ SRCCOPY);
+
+ /* Delete the DC */
+ DeleteDC(hTempDC);
+ }
+
+ /* Delete the bitmap */
+ DeleteObject(hTempBitmap);
+ }
+ }
+
+ /* Draw the bottom border */
+ {
+ HBITMAP hTempBitmap;
+ TRIVERTEX vertex[2];
+ GRADIENT_RECT gRect;
+ BITMAP bitmap;
+ HDC hTempDC;
+
+ /*
+ * We paint the divider strip first as it's 3
+ * pixels high but MS only show 2 of them.
+ */
+
+ /* Load the bottom divider strip */
+ hTempBitmap = (HBITMAP)LoadImage(g_pInfo->hInstance,
+ MAKEINTRESOURCE(IDB_BOTTOM_DIVIDER_STRIP),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ if (hTempBitmap)
+ {
+ /* Get the bitmap dimensions */
+ GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap);
+
+ /* Create a temp DC for the bitmap */
+ hTempDC = CreateCompatibleDC(hdcDesktop);
+ if (hTempDC)
+ {
+ /* Select the bitmap onto the temp DC */
+ SelectObject(hTempDC, hTempBitmap);
+
+ /* Paint the bitmap */
+ StretchBlt(hdcMem,
+ 0,
+ g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT,
+ g_pInfo->cx,
+ g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight,
+ hTempDC,
+ 0,
+ 0,
+ bitmap.bmWidth,
+ g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight,
+ SRCCOPY);
+
+ /* Delete the DC */
+ DeleteDC(hTempDC);
+ }
+
+ /* Delete the bitmap */
+ DeleteObject(hTempBitmap);
+ }
+
+ /* Setup the left hand vertex */
+ vertex[0].x = 0;
+ vertex[0].y = g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + 2; // paint over 1 pixel of the bitmap
+ vertex[0].Red = 0x3900;
+ vertex[0].Green = 0x3400;
+ vertex[0].Blue = 0xAE00;
+ vertex[0].Alpha = 0x0000;
+
+ /* Setup the right hand vertex */
+ vertex[1].x = g_pInfo->cx;
+ vertex[1].y = g_pInfo->cy;
+ vertex[1].Red = 0x0000;
+ vertex[1].Green = 0x3000;
+ vertex[1].Blue = 0x9600;
+ vertex[1].Alpha = 0x0000;
+
+ /* Set the vertex structs */
+ gRect.UpperLeft = 0;
+ gRect.LowerRight = 1;
+
+ /* Paint the gradient across the bottom */
+ GradientFill(hdcMem,
+ vertex,
+ 2,
+ &gRect,
+ 1,
+ GRADIENT_FILL_RECT_H);
+ }
+
+ /* Delete the bitmap */
+ DeleteObject(hBitmap);
+ }
+ }
+
+ return hdcMem;
+}
+
+/* EOF */
--- /dev/null
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Logon User Interface Host
+ * FILE: subsys/system/logonui/logonui.c
+ * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org)
+ */
+
+#include "logonui.h"
+
+/* DATA **********************************************************************/
+
+
+
+
+/* GLOBALS ******************************************************************/
+
+PINFO g_pInfo = NULL;
+
+
+/* FUNCTIONS ****************************************************************/
+
+
+static HDC
+DrawBaseBackground(HDC hdcDesktop)
+{
+ HDC hdcMem;
+
+ hdcMem = NT5_DrawBaseBackground(hdcDesktop);
+
+ return hdcMem;
+}
+
+static VOID
+DrawLogoffScreen(HDC hdcMem)
+{
+ /* Draw the logoff icon */
+ NT5_CreateLogoffScreen(L"Saving your settings...", hdcMem);
+}
+
+static ULONG
+GetULONG(LPWSTR String)
+{
+ UINT i, Length;
+ ULONG Value;
+ LPWSTR StopString;
+
+ i = 0;
+ /* Get the string length */
+ Length = (UINT)wcslen(String);
+
+ /* Check the string only consists of numbers */
+ while ((i < Length) && ((String[i] < L'0') || (String[i] > L'9'))) i++;
+ if ((i >= Length) || ((String[i] < L'0') || (String[i] > L'9')))
+ {
+ return (ULONG)-1;
+ }
+
+ /* Convert it */
+ Value = wcstoul(&String[i], &StopString, 10);
+
+ return Value;
+}
+
+static ULONG
+GetULONG2(LPWSTR String1, LPWSTR String2, PINT i)
+{
+ ULONG Value;
+
+ /* Check the first string value */
+ Value = GetULONG(String1);
+ if (Value == (ULONG)-1)
+ {
+ /* Check the second string value isn't a switch */
+ if (String2[0] != L'-')
+ {
+ /* Check the value */
+ Value = GetULONG(String2);
+ *i += 1;
+ }
+ }
+
+ return Value;
+}
+
+static BOOL
+ParseCmdline(int argc, WCHAR* argv[])
+{
+ return TRUE;
+}
+
+static VOID
+Run()
+{
+ HWND hDesktopWnd;
+ HDC hdcDesktop, hdcMem;
+
+ /* Get the screen size */
+ g_pInfo->cx = GetSystemMetrics(SM_CXSCREEN);
+ g_pInfo->cy = GetSystemMetrics(SM_CYSCREEN);
+
+ hDesktopWnd = GetDesktopWindow();
+
+ /* Get the DC for the desktop */
+ hdcDesktop = GetDCEx(hDesktopWnd, NULL, DCX_CACHE);
+ if (hdcDesktop)
+ {
+ /* Initialize the base background onto a DC */
+ hdcMem = DrawBaseBackground(hdcDesktop);
+ if (hdcMem)
+ {
+ /* TEST : Draw logoff screen */
+ DrawLogoffScreen(hdcMem);
+
+ /* Blit the off-screen DC to the desktop */
+ BitBlt(hdcDesktop,
+ 0,
+ 0,
+ g_pInfo->cx,
+ g_pInfo->cy,
+ hdcMem,
+ 0,
+ 0,
+ SRCCOPY);
+
+ /* Delete the memory DC */
+ DeleteDC(hdcMem);
+ }
+
+ /* Release the desktop DC */
+ ReleaseDC(hDesktopWnd, hdcDesktop);
+ }
+}
+
+int WINAPI
+wWinMain(IN HINSTANCE hInst,
+ IN HINSTANCE hPrevInstance,
+ IN LPWSTR lpszCmdLine,
+ IN int nCmdShow)
+{
+ LPWSTR *lpArgs;
+ INT NumArgs;
+
+ /* Allocate memory for the data */
+ g_pInfo = (PINFO)HeapAlloc(GetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ sizeof(INFO));
+ if (!g_pInfo) return -1;
+
+ g_pInfo->hInstance = hInst;
+
+ /* Get the command line args */
+ lpArgs = CommandLineToArgvW(lpszCmdLine, &NumArgs);
+ if (lpArgs)
+ {
+ /* Parse the command line */
+ if (ParseCmdline(NumArgs, lpArgs))
+ {
+ /* Start the main routine */
+ Run();
+ }
+ }
+
+ /* Free the data */
+ HeapFree(GetProcessHeap(),
+ 0,
+ g_pInfo);
+
+ return 0;
+}
+
+/* EOF */