mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
Add a Logon screensaver similar to the one of Windows developed by Marc Piulachs (marc DOT piulachs AT codexchange DOT net)
I modified the code, so the screensaver is listed as "Logon ScreenSaver" instead of "Default ScreenSaver" I also added the other screensavers we have to the Boot-CD. Some of them highlight some bugs in ReactOS, when you try to use them. See issue #2505 for more details. svn path=/trunk/; revision=28038
This commit is contained in:
parent
a629f387b9
commit
a2b61f49fb
8 changed files with 395 additions and 35 deletions
307
reactos/base/applications/screensavers/logon/logon.c
Normal file
307
reactos/base/applications/screensavers/logon/logon.c
Normal file
|
@ -0,0 +1,307 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2003 J Brown
|
||||||
|
* Copyright 2006 Eric Kohl
|
||||||
|
* Copyright 2007 Marc Piulachs (marc.piulachs@codexchange.net)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define RANDOM( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
|
||||||
|
|
||||||
|
#define APPNAME _T("Logon")
|
||||||
|
#define APP_TIMER 1
|
||||||
|
#define APP_TIMER_INTERVAL 2000
|
||||||
|
|
||||||
|
#define BITMAP_HEIGHT 240;
|
||||||
|
#define BITMAP_WIDTH 340
|
||||||
|
|
||||||
|
HINSTANCE hInstance;
|
||||||
|
|
||||||
|
BOOL fullscreen = FALSE;
|
||||||
|
|
||||||
|
void DrawScreen (HDC hdc, HDC hMemDC , RECT rect)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int width = BITMAP_WIDTH;
|
||||||
|
int height = BITMAP_HEIGHT;
|
||||||
|
|
||||||
|
if (!fullscreen)
|
||||||
|
{
|
||||||
|
width = width / 20;
|
||||||
|
height = height / 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = RANDOM (0, rect.right - width);
|
||||||
|
y = RANDOM (0, rect.bottom - height);
|
||||||
|
|
||||||
|
BitBlt(
|
||||||
|
hdc,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
hMemDC,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
SRCCOPY);
|
||||||
|
}
|
||||||
|
|
||||||
|
HBITMAP GetScreenSaverBitmap (void)
|
||||||
|
{
|
||||||
|
OSVERSIONINFOEX osvi;
|
||||||
|
|
||||||
|
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
|
||||||
|
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||||
|
GetVersionEx ((OSVERSIONINFO *) &osvi);
|
||||||
|
|
||||||
|
switch(osvi.wProductType)
|
||||||
|
{
|
||||||
|
case VER_NT_WORKSTATION:
|
||||||
|
return LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_WORKSTATION));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_SERVER));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
static POINT ptLast;
|
||||||
|
static POINT ptCursor;
|
||||||
|
static BOOL fFirstTime = TRUE;
|
||||||
|
|
||||||
|
static PAINTSTRUCT ps;
|
||||||
|
static RECT rect;
|
||||||
|
static HDC hDC;
|
||||||
|
static HDC hMemDC;
|
||||||
|
static HBRUSH hBlkBrush;
|
||||||
|
static HBITMAP bitmap;
|
||||||
|
|
||||||
|
switch (msg)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
{
|
||||||
|
hDC = GetDC(hwnd);
|
||||||
|
hBlkBrush = (HBRUSH) GetStockObject(BLACK_BRUSH);
|
||||||
|
hMemDC = CreateCompatibleDC(hDC);
|
||||||
|
GetClientRect(hwnd, &rect);
|
||||||
|
|
||||||
|
bitmap = GetScreenSaverBitmap ();
|
||||||
|
|
||||||
|
if(bitmap == NULL)
|
||||||
|
{
|
||||||
|
MessageBox(
|
||||||
|
hwnd,
|
||||||
|
_T("Fatal Error: Could not load bitmap"),
|
||||||
|
_T("Error"),
|
||||||
|
MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetTimer (
|
||||||
|
hwnd,
|
||||||
|
APP_TIMER,
|
||||||
|
APP_TIMER_INTERVAL,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_PAINT:
|
||||||
|
{
|
||||||
|
hDC = BeginPaint(hwnd, &ps);
|
||||||
|
SelectObject(hMemDC, bitmap);
|
||||||
|
DrawScreen (hDC , hMemDC , rect);
|
||||||
|
EndPaint(hwnd, &ps);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_TIMER :
|
||||||
|
{
|
||||||
|
if (wParam == APP_TIMER)
|
||||||
|
{
|
||||||
|
InvalidateRect(hwnd, NULL, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case WM_ERASEBKGND:
|
||||||
|
{
|
||||||
|
SelectObject(hDC, hBlkBrush);
|
||||||
|
|
||||||
|
PatBlt(
|
||||||
|
hDC,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
rect.right,
|
||||||
|
rect.bottom,
|
||||||
|
PATCOPY);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WM_DESTROY:
|
||||||
|
{
|
||||||
|
KillTimer (hwnd, APP_TIMER);
|
||||||
|
DeleteObject(bitmap);
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// break out of screen-saver if any keyboard activity
|
||||||
|
case WM_NOTIFY:
|
||||||
|
case WM_SYSKEYDOWN:
|
||||||
|
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// break out of screen-saver if any mouse activity
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
case WM_RBUTTONDOWN:
|
||||||
|
case WM_RBUTTONUP:
|
||||||
|
case WM_MBUTTONDOWN:
|
||||||
|
case WM_MBUTTONUP:
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
// If we've got a parent then we must be a preview
|
||||||
|
if(GetParent(hwnd) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if(fFirstTime)
|
||||||
|
{
|
||||||
|
GetCursorPos(&ptLast);
|
||||||
|
fFirstTime = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetCursorPos(&ptCursor);
|
||||||
|
|
||||||
|
// if the mouse has moved more than 3 pixels then exit
|
||||||
|
if(abs(ptCursor.x - ptLast.x) >= 3 || abs(ptCursor.y - ptLast.y) >= 3)
|
||||||
|
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||||
|
|
||||||
|
ptLast = ptCursor;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitSaver(HWND hwndParent)
|
||||||
|
{
|
||||||
|
WNDCLASS wc;
|
||||||
|
ZeroMemory(&wc, sizeof(wc));
|
||||||
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wc.lpfnWndProc = WndProc;
|
||||||
|
wc.lpszClassName = APPNAME;
|
||||||
|
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||||
|
RegisterClass(&wc);
|
||||||
|
|
||||||
|
if (hwndParent != 0)
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
GetClientRect(hwndParent, &rect);
|
||||||
|
CreateWindow(APPNAME, APPNAME,
|
||||||
|
WS_VISIBLE | WS_CHILD,
|
||||||
|
0, 0,
|
||||||
|
rect.right,
|
||||||
|
rect.bottom,
|
||||||
|
hwndParent, 0,
|
||||||
|
hInstance, NULL);
|
||||||
|
fullscreen = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HWND hwnd;
|
||||||
|
hwnd = CreateWindow(APPNAME, APPNAME,
|
||||||
|
WS_VISIBLE | WS_POPUP | WS_EX_TOPMOST,
|
||||||
|
0, 0,
|
||||||
|
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
|
||||||
|
HWND_DESKTOP, 0,
|
||||||
|
hInstance, NULL);
|
||||||
|
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||||
|
ShowCursor(FALSE);
|
||||||
|
fullscreen = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
|
||||||
|
{
|
||||||
|
int ch = *szCmdLine++;
|
||||||
|
|
||||||
|
if(ch == '-' || ch == '/')
|
||||||
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
|
if(ch >= 'A' && ch <= 'Z')
|
||||||
|
ch += 'a' - 'A';
|
||||||
|
|
||||||
|
*chOption = ch;
|
||||||
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
|
if(ch == ':')
|
||||||
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
|
while(ch == ' ' || ch == '\t')
|
||||||
|
ch = *szCmdLine++;
|
||||||
|
|
||||||
|
if(isdigit(ch))
|
||||||
|
{
|
||||||
|
unsigned int i = atoi(szCmdLine - 1);
|
||||||
|
*hwndParent = (HWND)i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*hwndParent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WINAPI WinMain (HINSTANCE hInst,
|
||||||
|
HINSTANCE hPrev,
|
||||||
|
LPSTR lpCmdLine,
|
||||||
|
int iCmdShow)
|
||||||
|
{
|
||||||
|
HWND hwndParent;
|
||||||
|
UINT nPreviousState;
|
||||||
|
int chOption;
|
||||||
|
MSG Message;
|
||||||
|
|
||||||
|
hInstance = hInst;
|
||||||
|
|
||||||
|
ParseCommandLine(lpCmdLine, &chOption, &hwndParent);
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
|
||||||
|
|
||||||
|
switch (chOption)
|
||||||
|
{
|
||||||
|
case 's':
|
||||||
|
InitSaver(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p':
|
||||||
|
InitSaver(hwndParent);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c':
|
||||||
|
default:
|
||||||
|
MessageBox(0,
|
||||||
|
_T("No options need to be set."),
|
||||||
|
_T("About"),
|
||||||
|
MB_OK | MB_ICONWARNING);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (GetMessage(&Message, 0, 0, 0))
|
||||||
|
DispatchMessage(&Message);
|
||||||
|
|
||||||
|
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
|
||||||
|
|
||||||
|
return Message.wParam;
|
||||||
|
}
|
17
reactos/base/applications/screensavers/logon/logon.rbuild
Normal file
17
reactos/base/applications/screensavers/logon/logon.rbuild
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<module name="logon" type="win32scr" installbase="system32" installname="logon.scr">
|
||||||
|
<include base="logon">.</include>
|
||||||
|
<define name="__USE_W32API" />
|
||||||
|
<define name="__REACTOS__" />
|
||||||
|
<define name="UNICODE" />
|
||||||
|
<define name="_UNICODE" />
|
||||||
|
|
||||||
|
<library>kernel32</library>
|
||||||
|
<library>user32</library>
|
||||||
|
<library>gdi32</library>
|
||||||
|
<library>opengl32</library>
|
||||||
|
<library>glu32</library>
|
||||||
|
<library>winmm</library>
|
||||||
|
|
||||||
|
<file>logon.c</file>
|
||||||
|
<file>logon.rc</file>
|
||||||
|
</module>
|
21
reactos/base/applications/screensavers/logon/logon.rc
Normal file
21
reactos/base/applications/screensavers/logon/logon.rc
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
|
#define REACTOS_VERSION_DLL
|
||||||
|
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Logon ScreenSaver\0"
|
||||||
|
#define REACTOS_STR_INTERNAL_NAME "logon\0"
|
||||||
|
#define REACTOS_STR_ORIGINAL_FILENAME "logon.scr\0"
|
||||||
|
|
||||||
|
#include <reactos/version.rc>
|
||||||
|
|
||||||
|
IDB_WORKSTATION BITMAP DISCARDABLE "res/0.bmp"
|
||||||
|
IDB_SERVER BITMAP DISCARDABLE "res/1.bmp"
|
||||||
|
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
IDS_DESCRIPTION "Logon ScreenSaver"
|
||||||
|
END
|
BIN
reactos/base/applications/screensavers/logon/res/0.bmp
Normal file
BIN
reactos/base/applications/screensavers/logon/res/0.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 KiB |
BIN
reactos/base/applications/screensavers/logon/res/1.bmp
Normal file
BIN
reactos/base/applications/screensavers/logon/res/1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 KiB |
4
reactos/base/applications/screensavers/logon/resource.h
Normal file
4
reactos/base/applications/screensavers/logon/resource.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
#define IDS_DESCRIPTION 1
|
||||||
|
#define IDB_WORKSTATION 0x100
|
||||||
|
#define IDB_SERVER 0x200
|
|
@ -1,13 +1,21 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||||
<group>
|
<group>
|
||||||
<directory name="matrix">
|
|
||||||
<xi:include href="matrix/matrix.rbuild" />
|
|
||||||
</directory>
|
|
||||||
<directory name="cylfrac">
|
<directory name="cylfrac">
|
||||||
<xi:include href="cylfrac/cylfrac.rbuild" />
|
<xi:include href="cylfrac/cylfrac.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
||||||
|
<directory name="logon">
|
||||||
|
<xi:include href="logon/logon.rbuild" />
|
||||||
|
</directory>
|
||||||
|
|
||||||
|
<directory name="matrix">
|
||||||
|
<xi:include href="matrix/matrix.rbuild" />
|
||||||
|
</directory>
|
||||||
|
|
||||||
<directory name="scrnsave">
|
<directory name="scrnsave">
|
||||||
<xi:include href="scrnsave/scrnsave.rbuild" />
|
<xi:include href="scrnsave/scrnsave.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
||||||
</group>
|
</group>
|
|
@ -30,38 +30,41 @@ Signature = "$ReactOS$"
|
||||||
|
|
||||||
|
|
||||||
; Base files
|
; Base files
|
||||||
base\applications\cacls\cacls.exe 1
|
base\applications\cacls\cacls.exe 1
|
||||||
base\applications\calc\calc.exe 1
|
base\applications\calc\calc.exe 1
|
||||||
base\applications\charmap\charmap.exe 1
|
base\applications\charmap\charmap.exe 1
|
||||||
base\applications\cmdutils\find\find.exe 1
|
base\applications\cmdutils\find\find.exe 1
|
||||||
base\applications\cmdutils\more\more.exe 1
|
base\applications\cmdutils\more\more.exe 1
|
||||||
base\applications\control\control.exe 1
|
base\applications\control\control.exe 1
|
||||||
base\applications\mscutils\devmgmt\devmgmt.exe 1
|
base\applications\mscutils\devmgmt\devmgmt.exe 1
|
||||||
base\applications\games\solitaire\sol.exe 1
|
base\applications\games\solitaire\sol.exe 1
|
||||||
base\applications\games\winemine\winemine.exe 1
|
base\applications\games\winemine\winemine.exe 1
|
||||||
base\applications\hh\hh.exe 1
|
base\applications\hh\hh.exe 1
|
||||||
base\applications\hostname\hostname.exe 1
|
base\applications\hostname\hostname.exe 1
|
||||||
base\applications\msconfig\msconfig.exe 1
|
base\applications\msconfig\msconfig.exe 1
|
||||||
base\applications\network\arp\arp.exe 1
|
base\applications\network\arp\arp.exe 1
|
||||||
base\applications\network\route\route.exe 1
|
base\applications\network\route\route.exe 1
|
||||||
base\applications\network\finger\finger.exe 1
|
base\applications\network\finger\finger.exe 1
|
||||||
base\applications\network\ftp\ftp.exe 1
|
base\applications\network\ftp\ftp.exe 1
|
||||||
base\applications\network\ipconfig\ipconfig.exe 1
|
base\applications\network\ipconfig\ipconfig.exe 1
|
||||||
base\applications\network\netstat\netstat.exe 1
|
base\applications\network\netstat\netstat.exe 1
|
||||||
base\applications\network\ping\ping.exe 1
|
base\applications\network\ping\ping.exe 1
|
||||||
base\applications\network\telnet\telnet.exe 1
|
base\applications\network\telnet\telnet.exe 1
|
||||||
base\applications\network\tracert\tracert.exe 1
|
base\applications\network\tracert\tracert.exe 1
|
||||||
base\applications\network\whois\whois.exe 1
|
base\applications\network\whois\whois.exe 1
|
||||||
base\applications\notepad\notepad.exe 1
|
base\applications\notepad\notepad.exe 1
|
||||||
base\applications\regedit\regedit.exe 4
|
base\applications\regedit\regedit.exe 4
|
||||||
base\applications\regedit\clb\clb.dll 1
|
base\applications\regedit\clb\clb.dll 1
|
||||||
base\applications\sc\sc.exe 1
|
base\applications\sc\sc.exe 1
|
||||||
base\applications\screensavers\matrix\matrix.scr 1
|
base\applications\screensavers\cylfrac\cylfrac.scr 1
|
||||||
base\applications\mscutils\servman\servman.exe 1
|
base\applications\screensavers\logon\logon.scr 1
|
||||||
base\applications\shutdown\shutdown.exe 1
|
base\applications\screensavers\matrix\matrix.scr 1
|
||||||
base\applications\sndvol32\sndvol32.exe 1
|
base\applications\screensavers\scrnsave\scrnsave.scr 1
|
||||||
base\applications\taskmgr\taskmgr.exe 1
|
base\applications\mscutils\servman\servman.exe 1
|
||||||
base\applications\wordpad\wordpad.exe 1
|
base\applications\shutdown\shutdown.exe 1
|
||||||
|
base\applications\sndvol32\sndvol32.exe 1
|
||||||
|
base\applications\taskmgr\taskmgr.exe 1
|
||||||
|
base\applications\wordpad\wordpad.exe 1
|
||||||
|
|
||||||
base\services\dhcp\dhcp.exe 1
|
base\services\dhcp\dhcp.exe 1
|
||||||
base\services\eventlog\eventlog.exe 1
|
base\services\eventlog\eventlog.exe 1
|
||||||
|
|
Loading…
Reference in a new issue