0

I ran into a problem after creating a screensaver that requires writing to a file located in Program Files. When the screensaver becomes active it can successfully read a file from there but fails to write to a file.

I noticed that when I use and elevated command prompt to run the screensaver, with /s, the screensaver successfully writes the file. So I assumed this was a permission problem.

To see if it was a permission problem I went in and changed Program Files and the subfolders permissions so that anyone and system could read and write, but it still didn't help.

Any idea what I should do? Is there a way to force a screensaver to run as admin? Or did I miss some important permissions?

  • 1
    Having a screen saver display the UAC elevation prompt makes very little sense of course. Just don't write to folders you can't get write access to, write to AppData. – Hans Passant Feb 22 '12 at 14:23
  • Why would a screensaver be writing files anyway? – icabod Feb 22 '12 at 14:57
  • 1
    @icabod [My last problem](http://stackoverflow.com/questions/9220133/windows-service-find-out-when-the-last-user-action-was) – flippidippi Feb 22 '12 at 15:34

1 Answers1

3

You can't get the system to start screensavers with elevated rights. If that were possible then it would be a truly bone-headed security and design flaw. Screensavers should simply not be writing to Program Files or other restricted areas. You will have to find a different location to write this file.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • This is what I thought. I just wanted to get some input to be sure I couldn't do it. I'll just have it write to files outside Program Files like AppData. Thanks a bunch. – flippidippi Feb 22 '12 at 15:35