ReactOS 0.4.15-dev-8138-g1e75ea8
globals.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APPNAME   _T("MATRIX ScreenSaver 2.0")
 
#define DENSITY   24
 
#define DENSITY_MAX   50
 
#define DENSITY_MIN   5
 
#define MAX_INTENSITY   5
 
#define NUM_GLYPHS   26
 
#define GLYPH_WIDTH   14
 
#define GLYPH_HEIGHT   14
 
#define SPEED_MAX   10
 
#define SPEED_MIN   1
 
#define MAXMSG_WIDTH   0x100
 
#define MAXMSG_HEIGHT   0x100
 
#define MAXMSG_LENGTH   64
 
#define MSGSPEED_MAX   500
 
#define MSGSPEED_MIN   50
 
#define MAX_MESSAGES   16
 
#define FONT_MIN   8
 
#define FONT_MAX   30
 

Functions

void LoadSettings ()
 
void SaveSettings ()
 
BOOL ChangePassword (HWND hwnd)
 
BOOL VerifyPassword (HWND hwnd)
 
BOOL Configure (HWND hwndParent)
 
BOOL ScreenSaver (HWND hwndParent)
 
int crc_rand ()
 

Variables

TCHAR g_szMessages [MAX_MESSAGES][MAXMSG_LENGTH]
 
int g_nFontSize
 
TCHAR g_szFontName []
 
BOOL g_fFontBold
 
int g_nNumMessages
 
int g_nCurrentMessage
 
int g_nMessageSpeed
 
int g_nMatrixSpeed
 
int g_nDensity
 
BOOL g_fRandomizeMessages
 
HFONT g_hFont
 
BOOL g_fScreenSaving
 

Macro Definition Documentation

◆ APPNAME

#define APPNAME   _T("MATRIX ScreenSaver 2.0")

Definition at line 8 of file globals.h.

◆ DENSITY

#define DENSITY   24

Definition at line 10 of file globals.h.

◆ DENSITY_MAX

#define DENSITY_MAX   50

Definition at line 11 of file globals.h.

◆ DENSITY_MIN

#define DENSITY_MIN   5

Definition at line 12 of file globals.h.

◆ FONT_MAX

#define FONT_MAX   30

Definition at line 33 of file globals.h.

◆ FONT_MIN

#define FONT_MIN   8

Definition at line 32 of file globals.h.

◆ GLYPH_HEIGHT

#define GLYPH_HEIGHT   14

Definition at line 18 of file globals.h.

◆ GLYPH_WIDTH

#define GLYPH_WIDTH   14

Definition at line 17 of file globals.h.

◆ MAX_INTENSITY

#define MAX_INTENSITY   5

Definition at line 15 of file globals.h.

◆ MAX_MESSAGES

#define MAX_MESSAGES   16

Definition at line 30 of file globals.h.

◆ MAXMSG_HEIGHT

#define MAXMSG_HEIGHT   0x100

Definition at line 24 of file globals.h.

◆ MAXMSG_LENGTH

#define MAXMSG_LENGTH   64

Definition at line 25 of file globals.h.

◆ MAXMSG_WIDTH

#define MAXMSG_WIDTH   0x100

Definition at line 23 of file globals.h.

◆ MSGSPEED_MAX

#define MSGSPEED_MAX   500

Definition at line 27 of file globals.h.

◆ MSGSPEED_MIN

#define MSGSPEED_MIN   50

Definition at line 28 of file globals.h.

◆ NUM_GLYPHS

#define NUM_GLYPHS   26

Definition at line 16 of file globals.h.

◆ SPEED_MAX

#define SPEED_MAX   10

Definition at line 20 of file globals.h.

◆ SPEED_MIN

#define SPEED_MIN   1

Definition at line 21 of file globals.h.

Function Documentation

◆ ChangePassword()

BOOL ChangePassword ( HWND  hwnd)

Definition at line 48 of file password.c.

49{
50 // This only ever gets called under '95, when started with the /a option.
51 HINSTANCE hmpr = LoadLibrary(_T("MPR.DLL"));
52 PWDCHANGEPASSWORD PwdChangePassword;
53
54 if(hmpr == NULL)
55 return FALSE;
56
57 PwdChangePassword = (PWDCHANGEPASSWORD)GetProcAddress(hmpr, "PwdChangePasswordA");
58
59 if(PwdChangePassword == NULL)
60 {
61 FreeLibrary(hmpr);
62 return FALSE;
63 }
64
65 PwdChangePassword(_T("SCRSAVE"), hwnd, 0, 0);
66 FreeLibrary(hmpr);
67
68 return TRUE;
69}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
VOID(WINAPI * PWDCHANGEPASSWORD)(LPCTSTR lpcRegkeyname, HWND hwnd, UINT uiReserved1, UINT uiReserved2)
Definition: password.c:10
#define _T(x)
Definition: vfdio.h:22
#define LoadLibrary
Definition: winbase.h:3862
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by wWinMain().

◆ Configure()

BOOL Configure ( HWND  hwndParent)

Definition at line 291 of file config.c.

292{
294
296 icc.dwSize = sizeof(icc);
297
299
300#ifdef _DEBUG
301 if(hwndParent == NULL)
302 hwndParent = 0;
303#else
304 if(hwndParent == NULL)
306#endif
307
309
310 return 0;
311}
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
static HWND hwndParent
Definition: cryptui.c:300
INT_PTR CALLBACK ConfigDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: config.c:56
#define IDD_CONFIG
Definition: resource.h:4
#define ICC_UPDOWN_CLASS
Definition: commctrl.h:62
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define GetModuleHandle
Definition: winbase.h:3827
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5761

◆ crc_rand()

int crc_rand ( )

Definition at line 18 of file matrix.c.

19{
20 const WORD mask = 0xb400;
21
22 if(_crc_reg & 1)
23 _crc_reg = (_crc_reg >> 1) ^ mask;
24 else
25 _crc_reg = (_crc_reg >> 1);
26
27 return _crc_reg;
28}
unsigned short WORD
Definition: ntddk_ex.h:93
GLenum GLint GLuint mask
Definition: glext.h:6028
static WORD _crc_reg
Definition: matrix.c:17

Referenced by CreateMatrix(), DoMatrixMessage(), InitMatrixMessage(), RandomGlyph(), RandomMatrixColumn(), and ScrollMatrixColumn().

◆ LoadSettings()

void LoadSettings ( )

Definition at line 53 of file settings.c.

54{
55 HKEY hKey = NULL;
56 int iItemIndex = -1;
57
59 {
60 TCHAR szBuffer[MAX_PATH];
61 DWORD dwAdvancedChecked;
62 DWORD type, size = sizeof(dwAdvancedChecked);
63 LSTATUS lstatus;
64
65 /* Restore last selected font */
66 if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
67 {
68 //Get combobox handle
70
71 //Search for match and return index if match found
72 iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
73 if(iItemIndex != CB_ERR)
74 {
75 ComboBox_SetCurSel(hWnd, iItemIndex);
77 }
78 }
79
80 /* Restore last selected character set */
81 if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("CodePage"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
82 {
83 //Get combobox handle
85
86 iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
87 if(iItemIndex != CB_ERR)
88 {
89 ComboBox_SetCurSel(hWnd, iItemIndex);
90 }
91 }
92
93 lstatus = RegQueryValueEx(hKey, _T("Advanced"), NULL, &type, (LPBYTE)&dwAdvancedChecked, &size);
94 if (lstatus == ERROR_SUCCESS && type == REG_DWORD && dwAdvancedChecked != FALSE)
95 {
97 }
98
100 }
101 else
102 {
103 /* Default font seems to be Arial */
105
106 iItemIndex = ComboBox_FindStringExact(hWnd, -1, _T("Arial"));
107 if(iItemIndex != CB_ERR)
108 {
109 ComboBox_SetCurSel(hWnd, iItemIndex);
111 }
112 }
113}
#define IDC_FONTCOMBO
Definition: resource.h:12
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
HWND hWnd
Definition: settings.c:17
#define RegCloseKey(hKey)
Definition: registry.h:49
HWND hCharmapDlg
Definition: charmap.c:21
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:161
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
#define KEY_READ
Definition: nt_native.h:1023
#define REG_DWORD
Definition: sdbapi.c:596
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:66
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:47
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
#define CB_ERR
Definition: winuser.h:2435
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_CLICK
Definition: winuser.h:1917
#define SendDlgItemMessage
Definition: winuser.h:5842
char TCHAR
Definition: xmlstorage.h:189

◆ SaveSettings()

void SaveSettings ( )

Definition at line 115 of file settings.c.

116{
117 HKEY hKey = NULL;
118
120 {
121 TCHAR szBuffer[MAX_PATH];
122
124 ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
125
126 if(*szBuffer != '\0')
127 RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
128
130 ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
131
132 if(*szBuffer != '\0')
133 RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
134
135 RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));
136
138 }
139}
#define REG_SZ
Definition: layer.c:22
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:58
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501

◆ ScreenSaver()

BOOL ScreenSaver ( HWND  hwndParent)

Definition at line 51 of file screensave.c.

52{
53 HMODULE hUser32;
54 UINT nPreviousState;
55 MSG msg;
56
58
59 SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
60
61 // Dynamically locate API call from USER32 - not present in all versions
62 hUser32 = GetModuleHandle(_T("USER32.DLL"));
63 pfnEnumDisplayMonitors = (PVOID)GetProcAddress(hUser32, "EnumDisplayMonitors");
64
65 // If we're running Win2k+ then the API is available...so call it!
66 if(pfnEnumDisplayMonitors && hwndParent == 0)
67 {
68 pfnEnumDisplayMonitors(NULL, NULL, MonitorEnumProc, 0);
69 }
70 // Otherwise simulate by calling enum-proc manually
71 else
72 {
73 RECT rect;
74
75 rect.left = 0;
77 rect.top = 0;
79
81 }
82
83 // run message loop to handle all screen-saver windows
84 while(GetMessage(&msg, NULL,0,0))
85 {
88 }
89
90 SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
91
92 return TRUE;
93}
#define msg(x)
Definition: auth_time.c:54
void InitScreenSaveClass()
unsigned int UINT
Definition: ndis.h:50
BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, RECT *rcMonitor, LPARAM Param)
Definition: screensave.c:33
& rect
Definition: startmenu.cpp:1413
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
void * PVOID
Definition: typedefs.h:50
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define SM_CYSCREEN
Definition: winuser.h:960
#define GetMessage
Definition: winuser.h:5790
#define SM_CXSCREEN
Definition: winuser.h:959
#define DispatchMessage
Definition: winuser.h:5765
#define SystemParametersInfo
Definition: winuser.h:5858
int WINAPI GetSystemMetrics(_In_ int)

Referenced by wWinMain().

◆ VerifyPassword()

BOOL VerifyPassword ( HWND  hwnd)

Definition at line 12 of file password.c.

13{
14 // Under NT, we return TRUE immediately. This lets the saver quit,
15 // and the system manages passwords. Under '95, we call VerifyScreenSavePwd.
16 // This checks the appropriate registry key and, if necessary,
17 // pops up a verify dialog
18
19 HINSTANCE hpwdcpl;
20 VERIFYSCREENSAVEPWD VerifyScreenSavePwd;
21 BOOL fResult;
22
23 if(GetVersion() < 0x80000000)
24 return TRUE;
25
26 hpwdcpl = LoadLibrary(_T("PASSWORD.CPL"));
27
28 if(hpwdcpl == NULL)
29 {
30 return FALSE;
31 }
32
33
34 VerifyScreenSavePwd = (VERIFYSCREENSAVEPWD)GetProcAddress(hpwdcpl, "VerifyScreenSavePwd");
35
36 if(VerifyScreenSavePwd == NULL)
37 {
38 FreeLibrary(hpwdcpl);
39 return FALSE;
40 }
41
42 fResult = VerifyScreenSavePwd(hwnd);
43 FreeLibrary(hpwdcpl);
44
45 return fResult;
46}
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL(WINAPI * VERIFYSCREENSAVEPWD)(HWND hwnd)
Definition: password.c:9
DWORD WINAPI GetVersion()
Definition: redirtest.c:5

Referenced by MatrixWndProc().

Variable Documentation

◆ g_fFontBold

BOOL g_fFontBold
extern

◆ g_fRandomizeMessages

BOOL g_fRandomizeMessages
extern

Definition at line 21 of file settings.c.

Referenced by ConfigDlgProc(), DoMatrixMessage(), LoadSettings(), and SaveSettings().

◆ g_fScreenSaving

BOOL g_fScreenSaving
extern

Definition at line 23 of file settings.c.

◆ g_hFont

HFONT g_hFont
extern

Definition at line 25 of file settings.c.

Referenced by ConfigDlgProc(), SetMatrixMessage(), and SetMessageFont().

◆ g_nCurrentMessage

int g_nCurrentMessage
extern

◆ g_nDensity

int g_nDensity
extern

Definition at line 19 of file settings.c.

Referenced by ConfigDlgProc(), LoadSettings(), and SaveSettings().

◆ g_nFontSize

int g_nFontSize
extern

◆ g_nMatrixSpeed

int g_nMatrixSpeed
extern

Definition at line 18 of file settings.c.

Referenced by ConfigDlgProc(), LoadSettings(), MatrixWndProc(), and SaveSettings().

◆ g_nMessageSpeed

int g_nMessageSpeed
extern

Definition at line 15 of file settings.c.

Referenced by ConfigDlgProc(), DoMatrixMessage(), LoadSettings(), MessageSpeed(), and SaveSettings().

◆ g_nNumMessages

int g_nNumMessages
extern

Definition at line 14 of file settings.c.

Referenced by ConfigDlgProc(), DoMatrixMessage(), LoadSettings(), and SaveSettings().

◆ g_szFontName

TCHAR g_szFontName[]
extern

◆ g_szMessages

TCHAR g_szMessages[MAX_MESSAGES][MAXMSG_LENGTH]
extern