I've written a screen saver in C# and Windows Forms. For testing I've been lazy and just used the config file for all my settings (no settings dialog yet), but the program seems to be unable to find or read the config file when windows runs the screensaver.
It works when I use the preview button or run it manually in any way, its only when it hits the screensaver timeout that it is unable to find the config file.
Having it log AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
It returns the short name: C:\Windows\System32\MYSCRE~1.config
Where it should be C:\Windows\System32\MyScreenSaverName.scr.Config
So I'm guessing the problem is that it can't find the config file with the short name path.
Not sure if its due to the system account which Windows 7 runs screen savers under, or something else about how it gets run. Any information would be helpful, thanks.
Edit: Trying to find any differences:
Environment.CommandLine
returns C:\Windows\system32\MYSCRE~1.SCR /s
when Windows runs the screen saver, but has the normal path when I run itProcess.GetCurrentProcess().StartInfo
is the sameWindowsIdentity.GetCurrent().Name
is my account nameLooking at other questions, it seems that User32 is what starts the screensavers, so I'm figuring it has to be something about how that starts up the scr process.
Work Around: Renaming my .scr file to have 8 characters or less allows it to work correctly. So that works for now, would still love to know why this problem exists.
edit: ouch... I noticed too late that it's a 1 year old question.... well maybe someone can find this usefull anyway.
Are you sure the filesystem isn't fat/fat32 instead of ntfs?
Maybe it's a Win7 upgraded from an old fat/fat32 formatted system? (and so fs were not upgraded)?
Maybe I'm wrong, it's just my guess to see short names in place. I recently worked on a screensaver project in c# and I encountered no problems at all... I don't see short names since ages to be honest...
You should see the fs type from Disk management. Doing some research i also got this, check if FUTIL.EXE can help, there is a curious "disable8dot3" option right there:
http://commandwindows.com/fsutil.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With