ReactOS  0.4.14-dev-999-g61c8d34
logonui.c
Go to the documentation of this file.
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 
18 
19 
20 /* FUNCTIONS ****************************************************************/
21 
22 
23 static HDC
25 {
26  HDC hdcMem;
27 
28  hdcMem = NT5_DrawBaseBackground(hdcDesktop);
29 
30  return hdcMem;
31 }
32 
33 static VOID
35 {
36  /* Draw the logoff icon */
37  NT5_CreateLogoffScreen(L"Saving your settings...", hdcMem);
38 }
39 
40 static ULONG
42 {
43  UINT i, Length;
44  ULONG Value;
45  LPWSTR StopString;
46 
47  i = 0;
48  /* Get the string length */
50 
51  /* Check the string only consists of numbers */
52  while ((i < Length) && ((String[i] < L'0') || (String[i] > L'9'))) i++;
53  if ((i >= Length) || ((String[i] < L'0') || (String[i] > L'9')))
54  {
55  return (ULONG)-1;
56  }
57 
58  /* Convert it */
59  Value = wcstoul(&String[i], &StopString, 10);
60 
61  return Value;
62 }
63 
64 static ULONG
66 {
67  ULONG Value;
68 
69  /* Check the first string value */
70  Value = GetULONG(String1);
71  if (Value == (ULONG)-1)
72  {
73  /* Check the second string value isn't a switch */
74  if (String2[0] != L'-')
75  {
76  /* Check the value */
78  *i += 1;
79  }
80  }
81 
82  return Value;
83 }
84 
85 static BOOL
87 {
88  return TRUE;
89 }
90 
91 static VOID
93 {
94  HWND hDesktopWnd;
95  HDC hdcDesktop, hdcMem;
96 
97  /* Get the screen size */
100 
101  hDesktopWnd = GetDesktopWindow();
102 
103  /* Get the DC for the desktop */
104  hdcDesktop = GetDCEx(hDesktopWnd, NULL, DCX_CACHE);
105  if (hdcDesktop)
106  {
107  /* Initialize the base background onto a DC */
108  hdcMem = DrawBaseBackground(hdcDesktop);
109  if (hdcMem)
110  {
111  /* TEST : Draw logoff screen */
113 
114  /* Blit the off-screen DC to the desktop */
115  BitBlt(hdcDesktop,
116  0,
117  0,
118  g_pInfo->cx,
119  g_pInfo->cy,
120  hdcMem,
121  0,
122  0,
123  SRCCOPY);
124 
125  /* Delete the memory DC */
126  DeleteDC(hdcMem);
127  }
128 
129  /* Release the desktop DC */
130  ReleaseDC(hDesktopWnd, hdcDesktop);
131  }
132 }
133 
134 int WINAPI
136  IN HINSTANCE hPrevInstance,
137  IN LPWSTR lpszCmdLine,
138  IN int nCmdShow)
139 {
140  LPWSTR *lpArgs;
141  INT NumArgs;
142 
143  /* Allocate memory for the data */
146  sizeof(INFO));
147  if (!g_pInfo) return -1;
148 
150 
151  /* Get the command line args */
152  lpArgs = CommandLineToArgvW(lpszCmdLine, &NumArgs);
153  if (lpArgs)
154  {
155  /* Parse the command line */
156  if (ParseCmdline(NumArgs, lpArgs))
157  {
158  /* Start the main routine */
159  Run();
160  }
161  }
162 
163  /* Free the data */
165  0,
166  g_pInfo);
167 
168  return 0;
169 }
170 
171 /* EOF */
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2374
static int argc
Definition: ServiceArgs.c:12
#define IN
Definition: typedefs.h:39
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define TRUE
Definition: types.h:120
struct _INFO * PINFO
static HDC
Definition: imagelist.c:92
static VOID Run(VOID)
Definition: logonui.c:92
static WCHAR String[]
Definition: stringtable.c:55
HINSTANCE hInstance
Definition: logonui.h:8
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
INT cx
Definition: logonui.h:9
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:405
int32_t INT
Definition: typedefs.h:57
#define SM_CXSCREEN
Definition: winuser.h:949
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HDC DrawBaseBackground(HDC hdcDesktop)
Definition: logonui.c:24
unsigned int BOOL
Definition: ntddk_ex.h:94
INT cy
Definition: logonui.h:10
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
static ULONG GetULONG2(LPWSTR String1, LPWSTR String2, PINT i)
Definition: logonui.c:65
#define SM_CYSCREEN
Definition: winuser.h:950
int * PINT
Definition: windef.h:177
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINAPI
Definition: msvc.h:6
int WINAPI GetSystemMetrics(_In_ int)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID NT5_CreateLogoffScreen(LPWSTR lpText, HDC hdcMem)
Definition: NT5design.c:124
#define INFO
Definition: BusLogic958.h:58
static const WCHAR L[]
Definition: oid.c:1250
#define DCX_CACHE
Definition: winuser.h:2096
static VOID DrawLogoffScreen(HDC hdcMem)
Definition: logonui.c:34
HINSTANCE hInst
Definition: dxdiag.c:13
Definition: precomp.h:83
PINFO g_pInfo
Definition: logonui.c:17
BOOL WINAPI DeleteDC(_In_ HDC)
HDC NT5_DrawBaseBackground(HDC hdcDesktop)
Definition: NT5design.c:135
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
_In_ const STRING * String2
Definition: rtlfuncs.h:2292
static BOOL ParseCmdline(int argc, WCHAR *argv[])
Definition: logonui.c:86
unsigned int ULONG
Definition: retypes.h:1
static ULONG GetULONG(LPWSTR String)
Definition: logonui.c:41
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
int WINAPI wWinMain(IN HINSTANCE hInst, IN HINSTANCE hPrevInstance, IN LPWSTR lpszCmdLine, IN int nCmdShow)
Definition: logonui.c:135