views:

272

answers:

1

Scripts, registries, screen-savers, oh my!

I'm trying to use a screen-saver on a Windows XP 64 bit machine which uses a .NET app which makes an interop call which relies on some x86 Shockwave Dlls (some Shockwave animation). Everything should be in the %systemroot%\WINNT\SysWOW64 directory. When the timeout for the screensaver occurs, the process should looks like this:

Screensaver.scr -> .NET app -> shockwave animation.

During installation I want a vbscript to my screen-saver file to copy the Screensaver.scr to the SysWow64 directory and then set the proper registry key to this file for Windows to launch the screen-saver.

The code is something like this:

Dim sScreenSaver, tScreenSaver
sScreenSaver = "C:\SourceFiles\bin\ScreenSaver.scr"     'screensaver
tScreenSaver = "C:\winnt\SysWOW64\" 

Set WshShell = WScript.CreateObject("WScript.Shell")    'script shell to run objects
Set FSO = createobject("scripting.filesystemobject")    'file system object

'copy screensaver
FSO.CopyFile sScreenSaver, tScreenSaver, True

'set screen saver
Dim p1
p1 = "HKEY_CURRENT_USER\Control Panel\Desktop\"
WshShell.RegWrite p1 & "SCRNSAVE.EXE", (tScreenSaver & "ScreenSaver.scr")

After installation, I can verify the the Screensaver exists in the correct directory. (It actually seems to be in both the system32 and the sysWOW64 directories---whether that's the install script or something I did post-install I'm in the process of verifying.)

However, the registry entry is not correct. In both the 32 and 64 bit regedit I see the HKCU\ControlPanel\Desktop\SCRNSAVE.EX is set to:

 C:\WINNT\system32\Screensaver.scr

This isn't right. The screen-saver won't run from this directory. It only runs from SysWOW64. If I manually edit the registry with regedit to the correct SysWOW64 path everything works fine.

Is this a problem with using the script or is this a Windows registry redirection, or filesystem redirection problem? You'd think this would be simple...

A: 

After more testing we discovered other scripts that ran which overwrote the registry value we were trying to change. Two(!) scripts were doing the same thing and resided in totally different locations.

Don't we love legacy software!

Valentein