Hi guyz!
I will send a 50$ reward to the first one who sends a solution for one of these two problems
to this list:
Both are related to using SDL (1.2.2) as part of a screensaver before log on
under Windows NT.
Problem 1 (50$ reward,easy?):=============================
If I run an SDL program before log on (when there’s just the box saying "Press
Ctrl+Alt+Del to log on) , I cannot run it anymore after log on
without getting the following error message:
“Initialization of the dynamic link library C:\WINNT\system32\DDRAW.dll failed.
The process is terminating abnormally”.
To reproduce it, compile the simple logon.c program pasted at the end of
this message, replace the file c:\WINNT\system32\logon.scr with the executable
and log out. After ~15 minutes, Windows will run the screensaver logon.scr,
and thus our little SDL program, which in turn creates the file "message.txt"
in c:
If you now log on, verify that message.txt is present and run logon.scr manually -
you will get the above error message.
Obviously using the same DLL before and after log on doesn’t work.
I tried the following things already:
- Searching the Microsoft Knowledge Base with the error message. It suggests
to change a key in the registry, which has no effect at all. - Compiling the SDL library without DirectDraw support. This removes the
symptoms, but not the problem. The error message disappears, but I still
get the same message for other DLLs which are used by the SDL application.
P.S.: I cross-compiled everything under Linux, using the standard SDL-cross-
compilation tools.
Problem 2: (50$,harder)
If I run an SDL fullscreen program before log on, it sometimes disappears
from the screen but continues running in the background. When this has
happened, it is not possible any more to set an SDL_FULLSCREEN videomode.
This problem is non-reproducable and occurs on average once in five days.
I traced it down into the SDL library and will give you a detailed
description. My hope is that someone familiar with NT internals has
an idea of what might be going on:
-
I create a simple non-SDL program and save it as logon.scr in
C:\WINNT\system32\ This program is run by Windows NT
as a screensaver, and just checks if the main SDL application
is already running. If yes, it exits, otherwise it runs the
SDL application. Windows NT is known to occasionally run
a screensaver more than once, and this procedure makes sure
that no second SDL application is started while another one
is running. -
Within the main SDL application I set the videomode with
vga_surface=SDL_SetVideoMode(1024,768,16,SDL_FULLSCREEN|SDL_HWSURFACE);
Everything runs perfectly.
Then I wait for maximally 5 days (sometimes just hours),
and suddenly my SDL application is not
visible any more, instead the screen shows the standard
"Press Ctrl+Alt+Del" logon message. The SDL program is however
still running in the background, it just lost the connection
to the display.
As soon as this has happened, all further calls SDL_SetVideoMode
cannot bring the application up again. SDL_SetVideoMode does not
fail, but the SDL_FULLSCREEN flag is not set in the SDL_Surface
structure. I traced these SDL_SetVideoMode calls down to
/src/video/windib/SDL_dibvideo.c and found that the Windows API
call "ChangeDisplaySettings(&settings, CDS_FULLSCREEN)"
now fails and returns -1 instead of DISP_CHANGE_SUCCESSFUL.
Does anyone have an idea what might be the reason for this
complete failure of ChangeDisplaySettings?
I already tried to pass additional parameters:
ChangeDisplaySettings(&settings,CDS_FULLSCREEN|CDS_RESET|CDS_SET_PRIMARY);
but without result.
Thanks for your help,
Elmar
logon.c
#include “SDL.h” /* All SDL App’s need this */
#include <stdio.h>
int main(int argc,char **argv) {
FILE *fp;
fp=fopen("c:\\message.txt","w");
fprintf(fp,"Initializing SDL.\n");
/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf("Could not initialize SDL: %s.\n", SDL_GetError());
exit(-1);
}
fprintf(fp,"SDL initialized.\n");
fprintf(fp,"Quitting SDL.\n");
/* Shutdown all subsystems */
SDL_Quit();
fprintf(fp,"Exit....\n");
fclose(fp);
exit(0);