- Compile screensavers as UNICODE applications + minor fixes (Part 1/2)

svn path=/trunk/; revision=29965
This commit is contained in:
Marc Piulachs 2007-10-29 22:49:31 +00:00
parent 9c46f3877e
commit e985f75055
5 changed files with 371 additions and 375 deletions

View file

@ -53,12 +53,12 @@ GLvoid BuildFont(GLvoid) // Build Our Bitmap Font
FALSE, // Italic FALSE, // Italic
FALSE, // Underline FALSE, // Underline
FALSE, // Strikeout FALSE, // Strikeout
ANSI_CHARSET, // Character Set Identifier DEFAULT_CHARSET, // Character Set Identifier
OUT_TT_PRECIS, // Output Precision OUT_TT_PRECIS, // Output Precision
CLIP_DEFAULT_PRECIS, // Clipping Precision CLIP_DEFAULT_PRECIS, // Clipping Precision
ANTIALIASED_QUALITY, // Output Quality ANTIALIASED_QUALITY, // Output Quality
FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch
"Tahoma"); // Font Name _T("Tahoma")); // Font Name
SelectObject(hDC, font); // Selects The Font We Created SelectObject(hDC, font); // Selects The Font We Created
@ -77,14 +77,14 @@ GLvoid KillFont(GLvoid) // Delete The Font
glDeleteLists(base, 256); // Delete All 256 Characters glDeleteLists(base, 256); // Delete All 256 Characters
} }
GLvoid glPrint(char *text) // Custom GL "Print" Routine GLvoid glPrint(LPWSTR text) // Custom GL "Print" Routine
{ {
if (text == NULL) // If There's No Text if (text == NULL) // If There's No Text
return; // Do Nothing return; // Do Nothing
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
glListBase(base); // Sets The Base Character to 32 glListBase(base); // Sets The Base Character to 32
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text glCallLists(wcslen(text), GL_UNSIGNED_SHORT, text); // Draws The Display List Text
glPopAttrib(); // Pops The Display List Bits glPopAttrib(); // Pops The Display List Bits
} }
@ -185,14 +185,14 @@ LRESULT CALLBACK WndProc( HWND hWnd,
if (!PixelFormat) // No Matching Pixel Format? if (!PixelFormat) // No Matching Pixel Format?
{ {
MessageBox(0,"Can't Find A Suitable PixelFormat.","Error",MB_OK|MB_ICONERROR); MessageBox(0,_TEXT("Can't Find A Suitable PixelFormat."),_TEXT("Error"),MB_OK|MB_ICONERROR);
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
break; // Prevents The Rest Of The Code From Running break; // Prevents The Rest Of The Code From Running
} }
if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Can We Set The Pixel Mode? if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Can We Set The Pixel Mode?
{ {
MessageBox(0,"Can't Set The PixelFormat.","Error",MB_OK|MB_ICONERROR); MessageBox(0,_TEXT("Can't Set The PixelFormat."),_TEXT("Error"),MB_OK|MB_ICONERROR);
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
break; // Prevents The Rest Of The Code From Running break; // Prevents The Rest Of The Code From Running
} }
@ -200,14 +200,14 @@ LRESULT CALLBACK WndProc( HWND hWnd,
hRC = wglCreateContext(hDC); // Grab A Rendering Context hRC = wglCreateContext(hDC); // Grab A Rendering Context
if(!hRC) // Did We Get One? if(!hRC) // Did We Get One?
{ {
MessageBox(0,"Can't Create A GL Rendering Context.","Error",MB_OK|MB_ICONERROR); MessageBox(0,_TEXT("Can't Create A GL Rendering Context."),_TEXT("Error"),MB_OK|MB_ICONERROR);
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
break; // Prevents The Rest Of The Code From Running break; // Prevents The Rest Of The Code From Running
} }
if(!wglMakeCurrent(hDC, hRC)) // Can We Make The RC Active? if(!wglMakeCurrent(hDC, hRC)) // Can We Make The RC Active?
{ {
MessageBox(0,"Can't Activate GLRC.","Error",MB_OK|MB_ICONERROR); MessageBox(0,_TEXT("Can't Activate GLRC."),_TEXT("Error"),MB_OK|MB_ICONERROR);
PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit PostQuitMessage(0); // This Sends A 'Message' Telling The Program To Quit
break; // Prevents The Rest Of The Code From Running break; // Prevents The Rest Of The Code From Running
} }
@ -312,26 +312,25 @@ void InitSaver(HWND hwndParent)
} }
} }
void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent) //
// Look for any options Windows has passed to us:
//
// -a <hwnd> (set password)
// -s (screensave)
// -p <hwnd> (preview)
// -c <hwnd> (configure)
//
VOID ParseCommandLine(LPWSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
{ {
int ch; UCHAR ch = *szCmdLine++;
if (!strlen(szCmdLine))
return;
ch = *szCmdLine++;
if(ch == '-' || ch == '/') if(ch == '-' || ch == '/')
ch = *szCmdLine++; ch = *szCmdLine++;
if(ch >= 'A' && ch <= 'Z') if(ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A'; ch += 'a' - 'A'; //convert to lower case
*chOption = ch; *chOption = ch;
if (ch == 's' || ch == 'c')
return;
ch = *szCmdLine++; ch = *szCmdLine++;
if(ch == ':') if(ch == ':')
@ -342,11 +341,11 @@ void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
if(isdigit(ch)) if(isdigit(ch))
{ {
unsigned int i = atoi(szCmdLine - 1); unsigned int i = _wtoi(szCmdLine - 1);
*hwndParent = (HWND)i; *hwndParent = (HWND)i;
} }
else else
*hwndParent = 0; *hwndParent = NULL;
} }
// //
@ -387,13 +386,13 @@ void Configure(void)
DialogBox(hInstance, MAKEINTRESOURCE(IDD_CONFIG), NULL , (DLGPROC)ConfigDlgProc); DialogBox(hInstance, MAKEINTRESOURCE(IDD_CONFIG), NULL , (DLGPROC)ConfigDlgProc);
} }
int WINAPI WinMain (HINSTANCE hInst, int CALLBACK wWinMain (HINSTANCE hInst,
HINSTANCE hPrev, HINSTANCE hPrev,
LPSTR lpCmdLine, LPWSTR lpCmdLine,
int iCmdShow) int iCmdShow)
{ {
HWND hwndParent = 0; HWND hwndParent = 0;
int chOption = 0; UCHAR chOption;
MSG Message; MSG Message;
hInstance = hInst; hInstance = hInst;

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd"> <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="3dtext" type="win32scr" installbase="system32" installname="3dtext.scr"> <module name="3dtext" type="win32scr" installbase="system32" installname="3dtext.scr" unicode="true">
<define name="__USE_W32API" /> <define name="__USE_W32API" />
<library>kernel32</library> <library>kernel32</library>
<library>user32</library> <library>user32</library>

View file

@ -36,7 +36,7 @@ void LoadSettings()
if(RegQueryValueEx(hkey, _T("DisplayString"), 0, 0, (LPBYTE)m_Text, &len) != ERROR_SUCCESS) if(RegQueryValueEx(hkey, _T("DisplayString"), 0, 0, (LPBYTE)m_Text, &len) != ERROR_SUCCESS)
{ {
strcpy(m_Text , "ReactOS Rocks!"); _tcscpy(m_Text , _TEXT("ReactOS Rocks!"));
} }
RegCloseKey(hkey); RegCloseKey(hkey);

View file

@ -242,15 +242,15 @@ void InitSaver(HWND hwndParent)
} }
} }
void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent) VOID ParseCommandLine(LPWSTR szCmdLine, UCHAR *chOption, HWND *hwndParent)
{ {
int ch = *szCmdLine++; UCHAR ch = *szCmdLine++;
if(ch == '-' || ch == '/') if(ch == '-' || ch == '/')
ch = *szCmdLine++; ch = *szCmdLine++;
if(ch >= 'A' && ch <= 'Z') if(ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A'; ch += 'a' - 'A'; //convert to lower case
*chOption = ch; *chOption = ch;
ch = *szCmdLine++; ch = *szCmdLine++;
@ -263,11 +263,11 @@ void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
if(isdigit(ch)) if(isdigit(ch))
{ {
unsigned int i = atoi(szCmdLine - 1); unsigned int i = _wtoi(szCmdLine - 1);
*hwndParent = (HWND)i; *hwndParent = (HWND)i;
} }
else else
*hwndParent = 0; *hwndParent = NULL;
} }
void Configure(void) void Configure(void)
@ -291,14 +291,14 @@ void Configure(void)
MB_OK | MB_ICONWARNING); MB_OK | MB_ICONWARNING);
} }
int WINAPI WinMain (HINSTANCE hInst, int CALLBACK wWinMain (HINSTANCE hInst,
HINSTANCE hPrev, HINSTANCE hPrev,
LPSTR lpCmdLine, LPWSTR lpCmdLine,
int iCmdShow) int iCmdShow)
{ {
HWND hwndParent; HWND hwndParent;
UINT nPreviousState; UINT nPreviousState;
int chOption; UCHAR chOption;
MSG Message; MSG Message;
hInstance = hInst; hInstance = hInst;

View file

@ -1,10 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd"> <!DOCTYPE module SYSTEM "../../../../tools/rbuild/project.dtd">
<module name="logon" type="win32scr" installbase="system32" installname="logon.scr"> <module name="logon" type="win32scr" installbase="system32" installname="logon.scr" unicode="true">
<include base="logon">.</include> <include base="logon">.</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<library>kernel32</library> <library>kernel32</library>
<library>user32</library> <library>user32</library>
<library>gdi32</library> <library>gdi32</library>