1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS Logon User Interface Host 4 * FILE: base/system/logonui/logonui.c 5 * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org) 6 */ 7 8 #include "logonui.h" 9 10 /* DATA **********************************************************************/ 11 12 13 14 15 /* GLOBALS ******************************************************************/ 16 17 PINFO g_pInfo = NULL; 18 19 20 /* FUNCTIONS ****************************************************************/ 21 22 23 static HDC 24 DrawBaseBackground(HDC hdcDesktop) 25 { 26 HDC hdcMem; 27 28 hdcMem = NT5_DrawBaseBackground(hdcDesktop); 29 30 return hdcMem; 31 } 32 33 static VOID 34 DrawLogoffScreen(HDC hdcMem) 35 { 36 /* Draw the logoff icon */ 37 NT5_CreateLogoffScreen(L"Saving your settings...", hdcMem); 38 } 39 40 #if 0 41 static ULONG 42 GetULONG(LPWSTR String) 43 { 44 UINT i, Length; 45 ULONG Value; 46 LPWSTR StopString; 47 48 i = 0; 49 /* Get the string length */ 50 Length = (UINT)wcslen(String); 51 52 /* Check the string only consists of numbers */ 53 while ((i < Length) && ((String[i] < L'0') || (String[i] > L'9'))) i++; 54 if ((i >= Length) || ((String[i] < L'0') || (String[i] > L'9'))) 55 { 56 return (ULONG)-1; 57 } 58 59 /* Convert it */ 60 Value = wcstoul(&String[i], &StopString, 10); 61 62 return Value; 63 } 64 65 static ULONG 66 GetULONG2(LPWSTR String1, LPWSTR String2, PINT i) 67 { 68 ULONG Value; 69 70 /* Check the first string value */ 71 Value = GetULONG(String1); 72 if (Value == (ULONG)-1) 73 { 74 /* Check the second string value isn't a switch */ 75 if (String2[0] != L'-') 76 { 77 /* Check the value */ 78 Value = GetULONG(String2); 79 *i += 1; 80 } 81 } 82 83 return Value; 84 } 85 #endif 86 87 static BOOL 88 ParseCmdline(int argc, WCHAR* argv[]) 89 { 90 return TRUE; 91 } 92 93 static VOID 94 Run(VOID) 95 { 96 HWND hDesktopWnd; 97 HDC hdcDesktop, hdcMem; 98 99 /* Get the screen size */ 100 g_pInfo->cx = GetSystemMetrics(SM_CXSCREEN); 101 g_pInfo->cy = GetSystemMetrics(SM_CYSCREEN); 102 103 hDesktopWnd = GetDesktopWindow(); 104 105 /* Get the DC for the desktop */ 106 hdcDesktop = GetDCEx(hDesktopWnd, NULL, DCX_CACHE); 107 if (hdcDesktop) 108 { 109 /* Initialize the base background onto a DC */ 110 hdcMem = DrawBaseBackground(hdcDesktop); 111 if (hdcMem) 112 { 113 /* TEST : Draw logoff screen */ 114 DrawLogoffScreen(hdcMem); 115 116 /* Blit the off-screen DC to the desktop */ 117 BitBlt(hdcDesktop, 118 0, 119 0, 120 g_pInfo->cx, 121 g_pInfo->cy, 122 hdcMem, 123 0, 124 0, 125 SRCCOPY); 126 127 /* Delete the memory DC */ 128 DeleteDC(hdcMem); 129 } 130 131 /* Release the desktop DC */ 132 ReleaseDC(hDesktopWnd, hdcDesktop); 133 } 134 } 135 136 int WINAPI 137 wWinMain(IN HINSTANCE hInst, 138 IN HINSTANCE hPrevInstance, 139 IN LPWSTR lpszCmdLine, 140 IN int nCmdShow) 141 { 142 LPWSTR *lpArgs; 143 INT NumArgs; 144 145 /* Allocate memory for the data */ 146 g_pInfo = (PINFO)HeapAlloc(GetProcessHeap(), 147 HEAP_ZERO_MEMORY, 148 sizeof(INFO)); 149 if (!g_pInfo) return -1; 150 151 g_pInfo->hInstance = hInst; 152 153 /* Get the command line args */ 154 lpArgs = CommandLineToArgvW(lpszCmdLine, &NumArgs); 155 if (lpArgs) 156 { 157 /* Parse the command line */ 158 if (ParseCmdline(NumArgs, lpArgs)) 159 { 160 /* Start the main routine */ 161 Run(); 162 } 163 } 164 165 /* Free the data */ 166 HeapFree(GetProcessHeap(), 167 0, 168 g_pInfo); 169 170 return 0; 171 } 172 173 /* EOF */ 174