ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

logonui.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   See COPYING in the top level directory
00003  * PROJECT:     ReactOS Logon User Interface Host
00004  * FILE:        subsys/system/logonui/logonui.c
00005  * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org)
00006  */
00007 
00008 #include "logonui.h"
00009 
00010 /* DATA **********************************************************************/
00011 
00012 
00013 
00014 
00015 /* GLOBALS ******************************************************************/
00016 
00017 PINFO g_pInfo = NULL;
00018 
00019 
00020 /* FUNCTIONS ****************************************************************/
00021 
00022 
00023 static HDC
00024 DrawBaseBackground(HDC hdcDesktop)
00025 {
00026     HDC hdcMem;
00027 
00028     hdcMem = NT5_DrawBaseBackground(hdcDesktop);
00029 
00030     return hdcMem;
00031 }
00032 
00033 static VOID
00034 DrawLogoffScreen(HDC hdcMem)
00035 {
00036     /* Draw the logoff icon */
00037     NT5_CreateLogoffScreen(L"Saving your settings...", hdcMem);
00038 }
00039 
00040 static ULONG
00041 GetULONG(LPWSTR String)
00042 {
00043     UINT i, Length;
00044     ULONG Value;
00045     LPWSTR StopString;
00046 
00047     i = 0;
00048     /* Get the string length */
00049     Length = (UINT)wcslen(String);
00050 
00051     /* Check the string only consists of numbers */
00052     while ((i < Length) && ((String[i] < L'0') || (String[i] > L'9'))) i++;
00053     if ((i >= Length) || ((String[i] < L'0') || (String[i] > L'9')))
00054     {
00055         return (ULONG)-1;
00056     }
00057 
00058     /* Convert it */
00059     Value = wcstoul(&String[i], &StopString, 10);
00060 
00061     return Value;
00062 }
00063 
00064 static ULONG
00065 GetULONG2(LPWSTR String1, LPWSTR String2, PINT i)
00066 {
00067     ULONG Value;
00068 
00069     /* Check the first string value */
00070     Value = GetULONG(String1);
00071     if (Value == (ULONG)-1)
00072     {
00073         /* Check the second string value isn't a switch */
00074         if (String2[0] != L'-')
00075         {
00076             /* Check the value */
00077             Value = GetULONG(String2);
00078             *i += 1;
00079         }
00080     }
00081 
00082     return Value;
00083 }
00084 
00085 static BOOL
00086 ParseCmdline(int argc, WCHAR* argv[])
00087 {
00088     return TRUE;
00089 }
00090 
00091 static VOID
00092 Run()
00093 {
00094     HWND hDesktopWnd;
00095     HDC hdcDesktop, hdcMem;
00096 
00097     /* Get the screen size */
00098     g_pInfo->cx = GetSystemMetrics(SM_CXSCREEN);
00099     g_pInfo->cy = GetSystemMetrics(SM_CYSCREEN);
00100 
00101     hDesktopWnd = GetDesktopWindow();
00102 
00103     /* Get the DC for the desktop */
00104     hdcDesktop = GetDCEx(hDesktopWnd, NULL, DCX_CACHE);
00105     if (hdcDesktop)
00106     {
00107         /* Initialize the base background onto a DC */
00108         hdcMem = DrawBaseBackground(hdcDesktop);
00109         if (hdcMem)
00110         {
00111             /* TEST : Draw logoff screen */
00112             DrawLogoffScreen(hdcMem);
00113 
00114             /* Blit the off-screen DC to the desktop */
00115             BitBlt(hdcDesktop,
00116                    0,
00117                    0,
00118                    g_pInfo->cx,
00119                    g_pInfo->cy,
00120                    hdcMem,
00121                    0,
00122                    0,
00123                    SRCCOPY);
00124 
00125             /* Delete the memory DC */
00126             DeleteDC(hdcMem);
00127         }
00128 
00129         /* Release the desktop DC */
00130         ReleaseDC(hDesktopWnd, hdcDesktop);
00131     }
00132 }
00133 
00134 int WINAPI
00135 wWinMain(IN HINSTANCE hInst,
00136          IN HINSTANCE hPrevInstance,
00137          IN LPWSTR lpszCmdLine,
00138          IN int nCmdShow)
00139 {
00140     LPWSTR *lpArgs;
00141     INT NumArgs;
00142 
00143     /* Allocate memory for the data */
00144     g_pInfo = (PINFO)HeapAlloc(GetProcessHeap(),
00145                                HEAP_ZERO_MEMORY,
00146                                sizeof(INFO));
00147     if (!g_pInfo) return -1;
00148 
00149     g_pInfo->hInstance = hInst;
00150 
00151     /* Get the command line args */
00152     lpArgs = CommandLineToArgvW(lpszCmdLine, &NumArgs);
00153     if (lpArgs)
00154     {
00155         /* Parse the command line */
00156         if (ParseCmdline(NumArgs, lpArgs))
00157         {
00158             /* Start the main routine */
00159             Run();
00160         }
00161     }
00162 
00163     /* Free the data */
00164     HeapFree(GetProcessHeap(),
00165              0,
00166              g_pInfo);
00167 
00168     return 0;
00169 }
00170 
00171 /* EOF */

Generated on Sun May 27 2012 04:18:48 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.