mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 12:23:31 +00:00
- convert the screensaver to tchar and build as unicode.
- gets around the ANSI bug in the config dialog svn path=/trunk/; revision=21776
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <tchar.h>
|
||||
#include "resource.h"
|
||||
#include "globals.h"
|
||||
#include "message.h"
|
||||
@@ -32,7 +33,7 @@ void AddFonts(HWND hwndCombo)
|
||||
|
||||
lf.lfCharSet = ANSI_CHARSET;
|
||||
lf.lfPitchAndFamily = 0;
|
||||
lf.lfFaceName[0] = '\0';
|
||||
lf.lfFaceName[0] = _T('\0');
|
||||
|
||||
hdc = GetDC(0);
|
||||
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontProc, (LONG)hwndCombo, 0);
|
||||
@@ -54,7 +55,7 @@ void UpdatePreview(HWND hwnd)
|
||||
//
|
||||
BOOL CALLBACK ConfigDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static char buf[256];
|
||||
static TCHAR buf[256];
|
||||
HWND hwndCombo, hwndCtrl;
|
||||
int index, items, val;
|
||||
RECT rect;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define APPNAME "MATRIX ScreenSaver 2.0"
|
||||
#define APPNAME _T("MATRIX ScreenSaver 2.0")
|
||||
|
||||
#define DENSITY 24
|
||||
#define DENSITY_MAX 50
|
||||
@@ -32,9 +32,9 @@ extern "C" {
|
||||
#define FONT_MIN 8
|
||||
#define FONT_MAX 30
|
||||
|
||||
extern char g_szMessages[MAX_MESSAGES][MAXMSG_LENGTH];
|
||||
extern TCHAR g_szMessages[MAX_MESSAGES][MAXMSG_LENGTH];
|
||||
extern int g_nFontSize;
|
||||
extern char g_szFontName[];
|
||||
extern TCHAR g_szFontName[];
|
||||
extern BOOL g_fFontBold;
|
||||
extern int g_nNumMessages;
|
||||
extern int g_nCurrentMessage;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
//
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <tchar.h>
|
||||
#include "globals.h"
|
||||
#include "message.h"
|
||||
#include "matrix.h"
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<define name="__REACTOS__" />
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
|
||||
@@ -35,7 +35,7 @@ WORD crc_msgrand(WORD reg)
|
||||
//
|
||||
// Set a new message based on font and text
|
||||
//
|
||||
void SetMatrixMessage(MATRIX_MESSAGE *msg, HFONT hFont, char *text)
|
||||
void SetMatrixMessage(MATRIX_MESSAGE *msg, HFONT hFont, TCHAR *text)
|
||||
{
|
||||
HDC hdc;
|
||||
RECT rect;
|
||||
@@ -198,7 +198,7 @@ void DoMatrixMessage(HDC hdc, MATRIX *matrix)
|
||||
//
|
||||
// Set current font used for messages
|
||||
//
|
||||
void SetMessageFont(HWND hwnd, char *szFontName, int nPointSize, BOOL fBold)
|
||||
void SetMessageFont(HWND hwnd, TCHAR *szFontName, int nPointSize, BOOL fBold)
|
||||
{
|
||||
int lfHeight;
|
||||
HDC hdc;
|
||||
|
||||
@@ -22,7 +22,7 @@ typedef struct
|
||||
|
||||
} MATRIX_MESSAGE;
|
||||
|
||||
void SetMessageFont(HWND hwnd, char *szFontName, int nPointSize, BOOL fBold);
|
||||
void SetMessageFont(HWND hwnd, TCHAR *szFontName, int nPointSize, BOOL fBold);
|
||||
MATRIX_MESSAGE *InitMatrixMessage(HWND hwnd, int width, int height);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
// Password support for Win9x
|
||||
//
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
typedef BOOL (WINAPI *VERIFYSCREENSAVEPWD)(HWND hwnd);
|
||||
typedef VOID (WINAPI *PWDCHANGEPASSWORD)(LPCSTR lpcRegkeyname, HWND hwnd,UINT uiReserved1,UINT uiReserved2);
|
||||
typedef VOID (WINAPI *PWDCHANGEPASSWORD)(LPCTSTR lpcRegkeyname, HWND hwnd,UINT uiReserved1,UINT uiReserved2);
|
||||
|
||||
BOOL VerifyPassword(HWND hwnd)
|
||||
{
|
||||
@@ -22,7 +23,7 @@ BOOL VerifyPassword(HWND hwnd)
|
||||
if(GetVersion() < 0x80000000)
|
||||
return TRUE;
|
||||
|
||||
hpwdcpl = LoadLibrary("PASSWORD.CPL");
|
||||
hpwdcpl = LoadLibrary(_T("PASSWORD.CPL"));
|
||||
|
||||
if(hpwdcpl == NULL)
|
||||
{
|
||||
@@ -47,7 +48,7 @@ BOOL VerifyPassword(HWND hwnd)
|
||||
BOOL ChangePassword(HWND hwnd)
|
||||
{
|
||||
// This only ever gets called under '95, when started with the /a option.
|
||||
HINSTANCE hmpr = LoadLibrary("MPR.DLL");
|
||||
HINSTANCE hmpr = LoadLibrary(_T("MPR.DLL"));
|
||||
PWDCHANGEPASSWORD PwdChangePassword;
|
||||
|
||||
if(hmpr == NULL)
|
||||
@@ -61,7 +62,7 @@ BOOL ChangePassword(HWND hwnd)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PwdChangePassword("SCRSAVE", hwnd, 0, 0);
|
||||
PwdChangePassword(_T("SCRSAVE"), hwnd, 0, 0);
|
||||
FreeLibrary(hmpr);
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
//
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <tchar.h>
|
||||
#include "globals.h"
|
||||
#include "message.h"
|
||||
#include "matrix.h"
|
||||
@@ -58,7 +59,7 @@ BOOL ScreenSaver(HWND hwndParent)
|
||||
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
|
||||
|
||||
// Dynamically locate API call from USER32 - not present in all versions
|
||||
hUser32 = GetModuleHandle("USER32.DLL");
|
||||
hUser32 = GetModuleHandle(_T("USER32.DLL"));
|
||||
pfnEnumDisplayMonitors = (PVOID)GetProcAddress(hUser32, "EnumDisplayMonitors");
|
||||
|
||||
// If we're running Win2k+ then the API is available...so call it!
|
||||
@@ -99,7 +100,7 @@ BOOL ScreenSaver(HWND hwndParent)
|
||||
// -p <hwnd> (preview)
|
||||
// -c <hwnd> (configure)
|
||||
//
|
||||
BOOL ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
|
||||
BOOL ParseCommandLine(LPSTR szCmdLine, int *chOption, HWND *hwndParent)
|
||||
{
|
||||
int ch = *szCmdLine++;
|
||||
|
||||
@@ -150,10 +151,10 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int iCmdS
|
||||
|
||||
switch(chOption)
|
||||
{
|
||||
case 's': return ScreenSaver(NULL); // screen save
|
||||
case 'p': return ScreenSaver(hwndParent); // preview in small window
|
||||
case 'a': return ChangePassword(hwndParent); // ask for password
|
||||
case 'c': return Configure(hwndParent); // configuration dialog
|
||||
case _T('s'): return ScreenSaver(NULL); // screen save
|
||||
case _T('p'): return ScreenSaver(hwndParent); // preview in small window
|
||||
case _T('a'): return ChangePassword(hwndParent); // ask for password
|
||||
case _T('c'): return Configure(hwndParent); // configuration dialog
|
||||
default: return Configure(hwndParent); // configuration dialog
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
// Load/Save settings from registry
|
||||
//
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include "globals.h"
|
||||
#include "message.h"
|
||||
#include "matrix.h"
|
||||
|
||||
char g_szMessages[MAX_MESSAGES][MAXMSG_LENGTH];
|
||||
TCHAR g_szMessages[MAX_MESSAGES][MAXMSG_LENGTH];
|
||||
int g_nNumMessages = 0;
|
||||
int g_nMessageSpeed = 5;
|
||||
char g_szFontName[512] = "Arial";
|
||||
TCHAR g_szFontName[512] = _T("Arial");
|
||||
|
||||
int g_nMatrixSpeed = 150;
|
||||
int g_nDensity = 32;
|
||||
@@ -27,61 +28,61 @@ void LoadSettings()
|
||||
HKEY hkey;
|
||||
LONG value;
|
||||
ULONG len;
|
||||
char *hugechar = malloc(4096);
|
||||
char *hptr = hugechar;
|
||||
TCHAR *hugechar = malloc(4096);
|
||||
TCHAR *hptr = hugechar;
|
||||
|
||||
if(hugechar == 0)
|
||||
return;
|
||||
|
||||
hugechar[0] = '\0';
|
||||
hugechar[0] = _T('\0');
|
||||
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Catch22\\Matrix Screen Saver", 0,
|
||||
"", 0, KEY_READ, NULL, &hkey, NULL);
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Catch22\\Matrix Screen Saver"), 0,
|
||||
_T(""), 0, KEY_READ, NULL, &hkey, NULL);
|
||||
|
||||
len = sizeof value;
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "MessageSpeed", 0, 0, (BYTE *)&value, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("MessageSpeed"), 0, 0, (BYTE *)&value, &len))
|
||||
{
|
||||
if(value >= MSGSPEED_MIN && value <= MSGSPEED_MAX)
|
||||
g_nMessageSpeed = value;
|
||||
}
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "MatrixSpeed", 0, 0, (BYTE *)&value, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("MatrixSpeed"), 0, 0, (BYTE *)&value, &len))
|
||||
{
|
||||
if(value >= SPEED_MIN && value <= SPEED_MAX)
|
||||
g_nMatrixSpeed = value;
|
||||
}
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "Density", 0, 0, (BYTE *)&value, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("Density"), 0, 0, (BYTE *)&value, &len))
|
||||
{
|
||||
if(value >= DENSITY_MIN && value <= DENSITY_MAX)
|
||||
g_nDensity = value;
|
||||
}
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "FontSize", 0, 0, (BYTE *)&value, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("FontSize"), 0, 0, (BYTE *)&value, &len))
|
||||
{
|
||||
if(value >= FONT_MIN && value <= FONT_MAX)
|
||||
g_nFontSize = value;
|
||||
}
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "FontBold", 0, 0, (BYTE *)&value, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("FontBold"), 0, 0, (BYTE *)&value, &len))
|
||||
g_fFontBold = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "Randomize", 0, 0, (BYTE *)&value, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("Randomize"), 0, 0, (BYTE *)&value, &len))
|
||||
g_fRandomizeMessages = (value == 0 ? FALSE : TRUE);
|
||||
|
||||
len = 4096;
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "FontName", 0, 0, (BYTE *)hugechar, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("FontName"), 0, 0, (BYTE *)hugechar, &len))
|
||||
{
|
||||
if(len > 0)
|
||||
lstrcpy(g_szFontName, hugechar);
|
||||
else
|
||||
lstrcpy(g_szFontName, "Arial");
|
||||
lstrcpy(g_szFontName, _T("Arial"));
|
||||
|
||||
}
|
||||
|
||||
len = 4096;
|
||||
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, "Messages", 0, 0 , (BYTE *)hugechar, &len))
|
||||
if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("Messages"), 0, 0 , (BYTE *)hugechar, &len))
|
||||
{
|
||||
while(len > 0 && *hptr && isascii(*hptr))
|
||||
{
|
||||
@@ -96,7 +97,7 @@ void LoadSettings()
|
||||
else
|
||||
{
|
||||
/* built-in coded message for first run */
|
||||
lstrcpyn(g_szMessages[0], "ReactOS", MAXMSG_LENGTH);
|
||||
lstrcpyn(g_szMessages[0], _T("ReactOS"), MAXMSG_LENGTH);
|
||||
}
|
||||
|
||||
RegCloseKey(hkey);
|
||||
@@ -106,8 +107,8 @@ void LoadSettings()
|
||||
void SaveSettings()
|
||||
{
|
||||
HKEY hkey;
|
||||
char *hugechar = malloc(4096);
|
||||
char *msgptr = hugechar;
|
||||
TCHAR *hugechar = malloc(4096);
|
||||
TCHAR *msgptr = hugechar;
|
||||
int totallen = 0;
|
||||
int i,len;
|
||||
LONG value;
|
||||
@@ -115,31 +116,31 @@ void SaveSettings()
|
||||
if(hugechar == 0)
|
||||
return;
|
||||
|
||||
hugechar[0] = '\0';
|
||||
hugechar[0] = _T('\0');
|
||||
msgptr = hugechar;
|
||||
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Catch22\\Matrix Screen Saver", 0,
|
||||
"", 0, KEY_WRITE, NULL, &hkey, NULL);
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Catch22\\Matrix Screen Saver"), 0,
|
||||
_T(""), 0, KEY_WRITE, NULL, &hkey, NULL);
|
||||
|
||||
value = g_nMessageSpeed;
|
||||
RegSetValueEx(hkey, "MessageSpeed", 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
RegSetValueEx(hkey, _T("MessageSpeed"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
value = g_nMatrixSpeed;
|
||||
RegSetValueEx(hkey, "MatrixSpeed", 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
RegSetValueEx(hkey, _T("MatrixSpeed"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
value = g_nDensity;
|
||||
RegSetValueEx(hkey, "Density", 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
RegSetValueEx(hkey, _T("Density"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
value = g_nFontSize;
|
||||
RegSetValueEx(hkey, "FontSize", 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
RegSetValueEx(hkey, _T("FontSize"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
value = g_fRandomizeMessages;
|
||||
RegSetValueEx(hkey, "Randomize", 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
RegSetValueEx(hkey, _T("Randomize"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
value = g_fFontBold;
|
||||
RegSetValueEx(hkey, "FontBold", 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
RegSetValueEx(hkey, _T("FontBold"), 0, REG_DWORD, (BYTE *)&value, sizeof value);
|
||||
|
||||
RegSetValueEx(hkey, "FontName", 0, REG_SZ, (BYTE *)g_szFontName, lstrlen(g_szFontName));
|
||||
RegSetValueEx(hkey, _T("FontName"), 0, REG_SZ, (BYTE *)g_szFontName, lstrlen(g_szFontName));
|
||||
|
||||
for(i = 0; i < g_nNumMessages; i++)
|
||||
{
|
||||
@@ -153,10 +154,10 @@ void SaveSettings()
|
||||
}
|
||||
}
|
||||
|
||||
*msgptr = '\0';
|
||||
*msgptr = _T('\0');
|
||||
totallen++;
|
||||
|
||||
RegSetValueEx(hkey, "Messages", 0, REG_MULTI_SZ, (BYTE *)hugechar, totallen);
|
||||
RegSetValueEx(hkey, _T("Messages"), 0, REG_MULTI_SZ, (BYTE *)hugechar, totallen);
|
||||
RegCloseKey(hkey);
|
||||
|
||||
free(hugechar);
|
||||
|
||||
Reference in New Issue
Block a user