PDA

View Full Version : Distributed Folding Screensaver v2.0 Bug Reports



runestar
01-07-2003, 05:53 PM
I took the liberty of starting a thread for bug reports for the new screensaver.

Part of that is I wanted to ask Howard if the auto-update throught the screensaver will work with the beta? So far it seems it okay, but I haven't logged off this account and back to test it yet.
On that, why is it necessary to restart the system to update the screensaver??? I never understood that since I though the screensaver is entirely self-contained.

Best,

RuneStar
One of the beta testers... ;)

runestar
01-10-2003, 07:15 AM
P.S. Just a note that it worked beautifully on the update both from the old version and the beta. Just hate having to exit out of windows so the screensaver can install. :(

RS½

Brian the Fist
01-10-2003, 11:09 AM
Technically you don't have to restart the computer, it is more for neophytes to avoid a file locking issue. If you look, a key is added to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
so if you want you can just manually execute that command and then erase the key...

Does anyone know a better way to do this? I just want to avoid telling the user 'OK, now type this...'

The problem is the screensaver executable (foldsaver.scr) calls distrib-update.bat, the batch file to begin the update, but the OS keeps foldsaver.scr 'locked' at this point and so it cannot then update the executable until the OS releases the lock!
If I recall, this problem was only on certain versions of Windows (Win98 I think?). I am simply using the standard _execlp functions to start the batch file so I don't know why it refuses to release the lock, must be a bug in the OS.
When we discontinue support for Win98 this won't be an issue :p

runestar
01-15-2003, 02:58 PM
I know that the cleaning utility for the W32.klez worm from Symantec can actually shut down all non-essential programs and services. I'm not a programmer so I can't tell you how this is implemented. I imagine it makes you of certain Windows system calls.

If you could somehow make the installer do a shutdown of either the specific or all services, I think that might do the trick.

RuneStar

runestar
01-15-2003, 05:08 PM
Howard,

Talked to a programmer friend of mine and he offered the following thoughts:

He doesn't know if there is a way to kill the screensaver process from a batch or script, but the MSDN site has documentation on api calls. He offer these particular tidbits of information he found on the subject:

MS KB article Q178893

The FindWindow Windows SDK call (to get the hwnd)

The SendMessage SDK call (send WM_CLOSE to the hwnd found by FindWindow)

"Actually, the SDK calls are available in MFC, too, but it's often better to use SDK if going out-of-process).

Perhaps he can create an update prog that looks up the screensaver's hwnd, closes it and then updates the file."

Be believes anyone can get into the MS libraries at msdn.microsoft.com without a subscription and only asks for a subscription id if you try to download something. If you need to know all the gory details beyond that, he's not sure what i'd be able to do without actually having phsycial code to look at, understandly.

(Incidentally, he asks me to note even if the code were available for viewing, there may be a potential conflict-of-interest in him viewing the code because of the company he is working with. However, if there are specific questions about the information he referenced, feel free to post them (I would relay them over) and he would be willing to see if he could respond to the questions.)


Best,
RuneStar

bwkaz
01-15-2003, 08:55 PM
pfft, RuneStar, I've written a program that actually does that. ;) Well, not quite, but darn close -- it uses EnumWindows, a callback, GetWindowText, strcmp, and SendMessage. It was written for Borland C++Builder 3, but should work with any compiler with a couple of minor changes.

I can even attach source, too, no problems with that. Here ya go:


#include <windows.h>

BOOL CALLBACK EnumProc(HWND hWnd, LPARAM lParam)
{
char str[128];

GetWindowText(hWnd, str, 127);

if(strcmp(str, "Put the window's title in this string")==0) {
SendMessage(hWnd, WM_CLOSE, 0, 0);
return(0);
}

return(1);
}

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
EnumWindows((WNDENUMPROC)EnumProc, 0);

return 0;
}Like I said, a couple of modifications might be necessary -- I'm worried about CALLBACK and WINAPI, specifically.

Brian the Fist
01-15-2003, 10:17 PM
I appreciate your help runestar but I am afraid you (or your friend) do not understand the problem. the problem appears to be a bug in the execlp function on Win98. I need to launch a new process (a batch process) and NOT return to the calling process (which is foldtraj.scr). On Win2000/XP, the 'lock' on the foldtraj.scr (preventing it from being deleted while the program is actually running) is released as soon as the batch file begins and foldtraj.scr terminates, allowing the batch file to delete/replace it.

However on Win98, it does NOT release the lock on foldtraj.scr until the child process (the batch file) terminates as well. Thus the batch file can NOT replace/remove foldtraj.scr. If this batch file calls other sub-batch files, the problem persists. Win98 hangs on to the lock on foldtraj.scr until all child processes are complete even though it CANNOT return to foldtraj.scr. This is an OS issue and is a 'feature' of Win98 as far as I can tell. As I said, if anyone knows a way around this I'd welcome their info but please read carefully and make sure you understand what I'm talking about.