ReactOS  0.4.14-dev-317-g96040ec
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define LoadLibrary
Definition: winbase.h:3686
smooth NULL
Definition: ftsmooth.c:416
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:405
VOID(WINAPI * PWDCHANGEPASSWORD)(LPCTSTR lpcRegkeyname, HWND hwnd, UINT uiReserved1, UINT uiReserved2)
Definition: password.c:10
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by wWinMain().

◆ Configure()

BOOL Configure ( HWND  hwndParent)

Definition at line 291 of file config.c.

292 {
294 
296  icc.dwSize = sizeof(icc);
297 
298  InitCommonControlsEx(&icc);
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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5662
#define IDD_CONFIG
Definition: resource.h:4
#define ICC_UPDOWN_CLASS
Definition: commctrl.h:62
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define GetModuleHandle
Definition: winbase.h:3651
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
INT_PTR CALLBACK ConfigDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: config.c:56

◆ 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 }
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned short WORD
Definition: ntddk_ex.h:93
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  unsigned long type = REG_DWORD, size = 1024;
63 
64  /* Restore last selected font */
65  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("Font"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
66  {
67  //Get combobox handle
69 
70  //Search for match and return index if match found
71  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
72  if(iItemIndex != CB_ERR)
73  {
74  ComboBox_SetCurSel(hWnd, iItemIndex);
76  }
77  }
78 
79  /* Restore last selected character set */
80  if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, _T("CodePage"), szBuffer, (sizeof(szBuffer)/sizeof(szBuffer[0]))) == ERROR_SUCCESS)
81  {
82  //Get combobox handle
84 
85  iItemIndex = ComboBox_FindStringExact(hWnd, -1, szBuffer);
86  if(iItemIndex != CB_ERR)
87  {
88  ComboBox_SetCurSel(hWnd, iItemIndex);
89  }
90  }
91 
92  RegQueryValueEx(hKey, _T("Advanced"), NULL, &type, (LPBYTE)&dwAdvancedChecked, &size);
93 
94  if(dwAdvancedChecked != FALSE)
96 
97  RegCloseKey(hKey);
98  }
99  else
100  {
101  /* Default font seems to be Arial */
103 
104  iItemIndex = ComboBox_FindStringExact(hWnd, -1, _T("Arial"));
105  if(iItemIndex != CB_ERR)
106  {
107  ComboBox_SetCurSel(hWnd, iItemIndex);
109  }
110  }
111 }
#define RegQueryValueEx
Definition: winreg.h:524
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_CHECK_ADVANCED
Definition: resource.h:26
#define KEY_READ
Definition: nt_native.h:1023
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define SendDlgItemMessage
Definition: winuser.h:5743
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ComboBox_FindStringExact(hwndCtl, indexStart, lpszFind)
Definition: windowsx.h:22
unsigned char * LPBYTE
Definition: typedefs.h:52
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
#define CB_ERR
Definition: winuser.h:2410
#define MF_CHECKED
Definition: winuser.h:132
char TCHAR
Definition: xmlstorage.h:189
#define BM_CLICK
Definition: winuser.h:1899
#define _T(x)
Definition: vfdio.h:22
GLsizeiptr size
Definition: glext.h:5919
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ComboBox_SetCurSel(hwndCtl, index)
Definition: windowsx.h:41
#define IDC_FONTCOMBO
Definition: resource.h:12
VOID ChangeMapFont(HWND hDlg)
Definition: charmap.c:113
LONG QueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTSTR pszBuffer, DWORD dwBufferLen)
Definition: settings.c:19
#define RegOpenKeyEx
Definition: winreg.h:520
HWND hCharmapDlg
Definition: charmap.c:22
#define REG_DWORD
Definition: sdbapi.c:596

◆ SaveSettings()

void SaveSettings ( )

Definition at line 113 of file settings.c.

114 {
115  HKEY hKey = NULL;
116 
118  {
119  TCHAR szBuffer[MAX_PATH];
120 
122  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
123 
124  if(*szBuffer != '\0')
125  RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
126 
128  ComboBox_GetText(hWnd, szBuffer, MAX_PATH);
129 
130  if(*szBuffer != '\0')
131  RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);
132 
133  RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));
134 
135  RegCloseKey(hKey);
136  }
137 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
#define ComboBox_GetText(hwndCtl, lpch, cchMax)
Definition: windowsx.h:33
SSSTARS Settings
Definition: settings.c:33
#define IDC_COMBO_CHARSET
Definition: resource.h:21
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
const TCHAR g_szGeneralRegKey[]
Definition: settings.c:16
smooth NULL
Definition: ftsmooth.c:416
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_FONTCOMBO
Definition: resource.h:12
HWND hCharmapDlg
Definition: charmap.c:22
#define REG_DWORD
Definition: sdbapi.c:596
#define RegSetValueEx
Definition: winreg.h:533
#define RegCreateKeyEx
Definition: winreg.h:501
#define REG_SZ
Definition: layer.c:22

◆ 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 DispatchMessage
Definition: winuser.h:5666
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define SystemParametersInfo
Definition: winuser.h:5759
& rect
Definition: startmenu.cpp:1413
BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, RECT *rcMonitor, LPARAM Param)
Definition: screensave.c:33
#define SM_CXSCREEN
Definition: winuser.h:949
smooth NULL
Definition: ftsmooth.c:416
static HWND hwndParent
Definition: cryptui.c:300
LONG_PTR LPARAM
Definition: windef.h:208
void * PVOID
Definition: retypes.h:9
#define SM_CYSCREEN
Definition: winuser.h:950
#define _T(x)
Definition: vfdio.h:22
int WINAPI GetSystemMetrics(_In_ int)
void InitScreenSaveClass(BOOL fPreview)
Definition: matrix.c:421
#define GetModuleHandle
Definition: winbase.h:3651
unsigned int UINT
Definition: ndis.h:50
#define GetMessage
Definition: winuser.h:5691
#define msg(x)
Definition: auth_time.c:54
#define GetProcAddress(x, y)
Definition: compat.h:410

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define LoadLibrary
Definition: winbase.h:3686
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:405
BOOL(WINAPI * VERIFYSCREENSAVEPWD)(HWND hwnd)
Definition: password.c:9
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by MatrixWndProc().

Variable Documentation

◆ g_fFontBold

BOOL g_fFontBold

◆ g_fRandomizeMessages

BOOL g_fRandomizeMessages

Definition at line 21 of file settings.c.

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

◆ g_fScreenSaving

BOOL g_fScreenSaving

Definition at line 23 of file settings.c.

◆ g_hFont

HFONT g_hFont

Definition at line 25 of file settings.c.

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

◆ g_nCurrentMessage

int g_nCurrentMessage

◆ g_nDensity

int g_nDensity

Definition at line 19 of file settings.c.

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

◆ g_nFontSize

int g_nFontSize

◆ g_nMatrixSpeed

int g_nMatrixSpeed

Definition at line 18 of file settings.c.

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

◆ g_nMessageSpeed

int g_nMessageSpeed

Definition at line 15 of file settings.c.

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

◆ g_nNumMessages

int g_nNumMessages

Definition at line 14 of file settings.c.

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

◆ g_szFontName

TCHAR g_szFontName[]

◆ g_szMessages