ReactOS 0.4.15-dev-7093-g01a8288
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 <stdlib.h>
22#include <windef.h>
23#include <winbase.h>
24#include <wingdi.h>
25#include <winuser.h>
26#include <scrnsave.h>
27
28#include "resource.h"
29
30#define RANDOM(min, max) ((rand() % (int)(((max)+1) - (min))) + (min))
31
32#define APP_TIMER 1
33#define APP_TIMER_INTERVAL 10000
34
35static
38{
42
44 osvi.wProductType == VER_NT_WORKSTATION ?
47}
48
52{
53 static HBITMAP bitmap;
54
55 switch (uMsg)
56 {
57 case WM_CREATE:
58 {
60 if (bitmap == NULL)
61 {
62 /* Extremely unlikely, message not localized. */
64 L"Fatal Error: Could not load bitmap",
65 L"Error",
67 }
68
70 break;
71 }
72 case WM_PAINT:
73 {
74 BITMAP bm;
75 PAINTSTRUCT ps;
76 HDC hdc;
77 HDC hdcMem;
78 HBITMAP hbmOld;
79 RECT rect;
80
81 hdc = BeginPaint(hWnd, &ps);
83 hbmOld = SelectObject(hdcMem, bitmap);
84 GetObjectW(bitmap, sizeof(bm), &bm);
85
87 if (rect.right < bm.bmWidth || rect.bottom < bm.bmHeight)
88 {
89 StretchBlt(hdc, RANDOM(0, rect.right - (bm.bmWidth / 5)),
90 RANDOM(0, rect.bottom - (bm.bmHeight / 5)),
91 bm.bmWidth / 5, bm.bmHeight / 5, hdcMem, 0, 0,
92 bm.bmWidth, bm.bmHeight, SRCCOPY);
93 }
94 else
95 {
96 BitBlt(hdc, RANDOM(0, rect.right - bm.bmWidth),
97 RANDOM(0, rect.bottom - bm.bmHeight),
98 bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
99 }
100
101 SelectObject(hdcMem, hbmOld);
103 EndPaint(hWnd, &ps);
104 break;
105 }
106 case WM_TIMER:
107 {
109 break;
110 }
111 case WM_DESTROY:
112 {
116 break;
117 }
118 default:
119 {
120 /* Pass window messages to the default screensaver window procedure */
121 return DefScreenSaverProc(hWnd, uMsg, wParam, lParam);
122 }
123 }
124
125 return 0;
126}
127
128BOOL
129WINAPI
131{
132 return FALSE;
133}
134
135/* This function is only called once before opening the configuration dialog.
136 * Use it to show a message that no configuration is necessary and return FALSE to indicate that no configuration dialog shall be opened.
137 */
138BOOL
139WINAPI
141{
142 WCHAR szMessage[256];
143 WCHAR szTitle[25];
144
145 LoadStringW(hInst, IDS_TEXT, szMessage, _countof(szMessage));
147
149
150 return FALSE;
151}
HWND hWnd
Definition: settings.c:17
#define IDS_DESCRIPTION
Definition: resource.h:4
static HBITMAP GetScreenSaverBitmap(VOID)
Definition: logon.c:37
#define RANDOM(min, max)
Definition: logon.c:30
#define APP_TIMER_INTERVAL
Definition: logon.c:33
LRESULT CALLBACK ScreenSaverProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: logon.c:51
#define APP_TIMER
Definition: logon.c:32
BOOL WINAPI ScreenSaverConfigureDialog(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: logon.c:130
BOOL WINAPI RegisterDialogClasses(HANDLE hInst)
Definition: logon.c:140
#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 TRUE
Definition: types.h:120
#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
#define L(x)
Definition: ntvdm.h:50
LRESULT WINAPI DefScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: scrnsave.c:92
#define _countof(array)
Definition: sndvol32.h:68
& rect
Definition: startmenu.cpp:1413
Definition: bl.h:1331
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
Definition: uimain.c:89
OSVERSIONINFO osvi
Definition: ver.c:28
HDC hdcMem
Definition: welcome.c:104
#define GetModuleHandle
Definition: winbase.h:3762
#define GetVersionEx
Definition: winbase.h:3787
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
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
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
BOOL WINAPI DeleteDC(_In_ HDC)
#define WM_PAINT
Definition: winuser.h:1619
#define IMAGE_BITMAP
Definition: winuser.h:211
#define WM_CREATE
Definition: winuser.h:1607
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define LR_CREATEDIBSECTION
Definition: winuser.h:1097
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2172
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
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:1741
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define MB_ICONEXCLAMATION
Definition: winuser.h:784
#define MB_OK
Definition: winuser.h:789
#define WM_DESTROY
Definition: winuser.h:1608
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define VER_NT_WORKSTATION
__wchar_t WCHAR
Definition: xmlstorage.h:180