4

Back in my Delphi days, I wrote several screensavers - each was a single executable that was dropped into the System32 folder, where the Windows XP Display control panel saw it and made it available. All good.

I'm now writing a significantly more complex screensaver in C# that is necessarily spread across multiple assemblies (it's using a plug-in model: merging all the assemblies into a single executable isn't an option).

Dumping all the files into System32 doesn't seem to be very tidy - not to mention that it simply won't work on a 64-bit system.

Is there any other way to install a screensaver on a Windows system?

I'm willing to take a dependency on Vista/Win7 if necessary.

The only suggestion I've had made so far, is to install the bulk of the screensaver normally, under Program Files, and put a trigger/launcher into System32.

Bevan
  • 43,618
  • 10
  • 81
  • 133
  • What's up with the vote to close? If it doesn't belong here on SO, where does it belong? – Bevan Jan 09 '12 at 02:39
  • I didn't vote, but most likely it's because this is not strictly a programming question. It's more of a "how to configure a system properly/cleanly". Programming related, but not strictly programming. – Marc B Jan 09 '12 at 03:10
  • I guess I can see how someone might think that. In my case, since `System32` is on the PATH and I'm using some of popular libraries (e.g. Ninject), it becomes pretty important that I don't put them into that directory, else I risk breaking other peoples applications. Sigh, I guess this is where the GAC comes in. – Bevan Jan 09 '12 at 04:47

2 Answers2

5

I found more information ...

A screensaver does not have to be installed into System32 (or SysWoW64).

However, the control panel won't find it and won't list it for selection.

Unless it's configured as the current screensaver.

Let me explain ... the current screensaver is specified by the SCRNSAVE.EXE registry key found in HKEY_CURRENT_USER\Control Panel\Desktop. The value of this key is the complete path to a .SCR file.

The Display (XP) or Screen Saver (Win7) control panel scans System32 (and SysWow64 on 64 bit systems) for .SCR files. It also scans the folder containing the current screensaver, if that's different.

So, if you set the registry key directly, the screensaver will be listed by the control panel and available for selection. But, as soon as the user selects a different screensaver, the next invocation of the control panel won't list the new screensaver.

Bevan
  • 43,618
  • 10
  • 81
  • 133
  • Can you use a shortcut in System32 or SysWoW64 that links to a screensaver in the Program Files/ directory? – Dan May 14 '18 at 00:18
  • Shortcuts don't have the right file extension - it scans for `.scr` files only. – Bevan May 14 '18 at 04:30
  • Do you have any solution as to how to install screensaver into its own dir but have it show up in the Screensaver utility? I'm writing one now and almost finished but don't have this problem solved yet. – Dan May 14 '18 at 18:46
  • 1
    The only reliable approach I found was to write a shim executable - a small, single file, `.scr` file that launches the actual screensaver in turn. – Bevan May 16 '18 at 09:54
  • I believe that will work on Windows. I am writing a cross platform screensaver. I believe I already have a solution for Linux desktops so that just leaves me with Mac OS machines. I believe Mac OS uses a DLL style callback system for its screensavers. I'm wondering if I can create a launcher app the same way you suggest in Windows and have it work. Would you happen to know? Appreciate the tips! – Dan May 17 '18 at 14:35
3

32bit screensavers go into system32, while 64bit screensavers go into SysWoW64.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • Useful information, thanks. But, is there any way to avoid the file pollution problem? – Bevan Jan 09 '12 at 02:46
  • Not really. MS has gotten a bit better with moving things out of the \windows tree for installable stuff, but some things still have to go in there, regardless of how "dirty" it seems. Screensavers are one of those things. – Marc B Jan 09 '12 at 03:09
  • 2
    @MarcB `System32` is the 64 bit directory and `SysWow64` is the 32 on bit directory on 64 bit Windows. So 64 bit screensavers would go into the `System32` directory. http://technet.microsoft.com/en-us/magazine/ff955767.aspx, http://msdn.microsoft.com/en-us/library/aa384187%28v=vs.85%29.aspx – shf301 Jan 09 '12 at 03:14
  • @shf301: Leave it to MS to come up with completely back-asswards directory names. Next up, they'll finally rename the start button "shutdown" like it should've been all along. – Marc B Jan 09 '12 at 04:45
  • @MarcB then you also have the fun 64/32bit Registrykey ... Wow6432Node which is where 32bit HKLM/Software goes on 64bit windows – Paul Farry Jan 09 '12 at 06:43
  • Marc B: Leave it to incompetent developers which assume things on a system that never were guaranteed. At some point anything you do cannot change because too many idiots rely on it. You can read Raymond Chen's blog for quite many of those things :-) – Joey Jan 12 '12 at 07:41
  • @Joey: Yeah, kudos to microsoft for bending over so far for backwards compatibility, but as boo/hiss for having done so. At some point you just have to say "look, that's stone age, we're moving forwards, tough noogie". – Marc B Jan 12 '12 at 17:02