ReactOS 0.4.15-dev-6056-gb29b268
logon.c
Go to the documentation of this file.
1/*
2 * Copyright 2003 J Brown
3 * Copyright 2006 Eric Kohl
4 * Copyright 2007 Marc Piulachs (marc.piulachs@codexchange.net)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <stdarg.h>
22#include <windef.h>
23#include <winbase.h>
24#include <wingdi.h>
25#include <winuser.h>
26#include <scrnsave.h>
27#include <stdlib.h>
28#include <tchar.h>
29
30#include "resource.h"
31
32#define RANDOM( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
33
34#define APPNAME _T("Logon")
35#define APP_TIMER 1
36#define APP_TIMER_INTERVAL 2000
37
40{
42
46
47 switch(osvi.wProductType)
48 {
51 break;
52 default:
54 break;
55 }
56}
57
61{
62 static RECT rect;
63 static HBITMAP bitmap;
64
65 switch (message)
66 {
67 case WM_CREATE:
68 {
70 if (bitmap == NULL)
71 {
73 _T("Fatal Error: Could not load bitmap"),
74 _T("Error"),
76 }
77
81 NULL);
82
83 break;
84 }
85 case WM_PAINT:
86 {
87 BITMAP bm; /* Bitmap structure as seen in bmWidth & bmHeight */
88 PAINTSTRUCT ps;
89 HDC hdc;
90 HDC hdcMem;
91 HBITMAP hbmOld;
92
93 // Obtain window coordinates.
95
96 hdc = BeginPaint(hWnd, &ps);
98 hbmOld = SelectObject(hdcMem, bitmap);
99
100 GetObject(bitmap, sizeof(bm), &bm);
101
102 if (rect.right < bm.bmWidth ||
103 rect.bottom < bm.bmHeight)
104 {
106 hdc,
107 RANDOM (0, rect.right - (bm.bmWidth /5)),
108 RANDOM (0, rect.bottom - (bm.bmHeight /5)),
109 bm.bmWidth /5,
110 bm.bmHeight /5,
111 hdcMem,
112 0,
113 0,
114 bm.bmWidth,
115 bm.bmHeight,
116 SRCCOPY);
117 }
118 else
119 {
120 BitBlt(
121 hdc,
122 RANDOM (0, rect.right - bm.bmWidth),
123 RANDOM (0, rect.bottom - bm.bmHeight),
124 bm.bmWidth,
125 bm.bmHeight,
126 hdcMem,
127 0,
128 0,
129 SRCCOPY);
130 }
131
132 SelectObject(hdcMem, hbmOld);
134
135 EndPaint(hWnd, &ps);
136 break;
137 }
138 case WM_TIMER:
139 {
141 break;
142 }
143 case WM_DESTROY:
144 {
148 break;
149 }
150
151 default:
152 // Pass Windows Messages to the default screensaver window procedure
154 }
155
156 return 0;
157}
158
159BOOL
160WINAPI
162{
163 return FALSE;
164}
165
166// This function is only called one time before opening the configuration dialog.
167// Use it to show a message that no configuration is necessary and return FALSE to indicate that no configuration dialog shall be opened.
168BOOL
169WINAPI
171{
172 TCHAR szMessage[256];
173 TCHAR szTitle[25];
174
175 LoadString(hInst, IDS_TEXT, szMessage, sizeof(szMessage) / sizeof(TCHAR));
176 LoadString(hInst, IDS_DESCRIPTION, szTitle, sizeof(szTitle) / sizeof(TCHAR));
177
179
180 return FALSE;
181}
HWND hWnd
Definition: settings.c:17
#define IDS_DESCRIPTION
Definition: resource.h:4
#define RANDOM(min, max)
Definition: logon.c:32
#define APP_TIMER_INTERVAL
Definition: logon.c:36
#define APP_TIMER
Definition: logon.c:35
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: logon.c:161
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: logon.c:60
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
Definition: logon.c:170
HBITMAP GetScreenSaverBitmap(VOID)
Definition: logon.c:39
#define IDB_WORKSTATION
Definition: resource.h:4
#define IDS_TEXT
Definition: resource.h:3
#define IDB_SERVER
Definition: resource.h:5
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:92
& rect
Definition: startmenu.cpp:1413
Definition: bl.h:1331
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
Definition: uimain.c:89
Definition: tftpd.h:60
OSVERSIONINFO osvi
Definition: ver.c:28
#define _T(x)
Definition: vfdio.h:22
HDC hdcMem
Definition: welcome.c:104
#define ZeroMemory
Definition: winbase.h:1670
#define GetModuleHandle
Definition: winbase.h:3698
#define GetVersionEx
Definition: winbase.h:3723
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4468
BOOL WINAPI DeleteDC(_In_ HDC)
#define WM_PAINT
Definition: winuser.h:1610
#define IMAGE_BITMAP
Definition: winuser.h:211
#define WM_CREATE
Definition: winuser.h:1598
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define LR_CREATEDIBSECTION
Definition: winuser.h:1092
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_TIMER
Definition: winuser.h:1732
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define MB_OK
Definition: winuser.h:784
#define LoadImage
Definition: winuser.h:5805
#define LoadString
Definition: winuser.h:5809
#define MessageBox
Definition: winuser.h:5812
#define WM_DESTROY
Definition: winuser.h:1599
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define VER_NT_WORKSTATION
OSVERSIONINFOEXA OSVERSIONINFOEX
Definition: rtltypes.h:290
char TCHAR
Definition: xmlstorage.h:189