I think its not possible to copy the Font file to the font-folder with out adminstrator status. so i decided to use an application manifest to run my program as a adminstrator on startup.
Okultist
Posts
-
Installing fonts on a Vista Pc -
Installing fonts on a Vista PcYeah, the problem is that i am using vista and a few things changed there. There are new security rules and i tried to do it the "good" way by asking the system for permissions.
-
Installing fonts on a Vista PcIs there a fast way to have a look on the privileges an user has for a folder? the windows explorer should have a way look them up.
-
Installing fonts on a Vista PcI want to copy a font file to the fonts directory on windows vista, but currently i fail to get the right permissions. Everytime I try to copy the font from its current folder to the font-directory (c:\windows\fonts) I get an "UnauthorisedAccessException" My code looks like this at the moment:
if (System.IO.File.Exists(fontPath)) { FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, "C:\\\\Windows\\\\Fonts\\\\"); f2.AddPathList(FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, fontPath); if (SecurityManager.IsGranted(f2) == true) MessageBox.Show("Its fine!!"); else MessageBox.Show("No Permissions"); try { f2.Demand(); MessageBox.Show(fontPath); System.IO.File.Copy(fontPath, destination); //AddFontResource(fontPath); //SendMessage(HWND\_BROADCAST, WM\_FONTCHANGE, (IntPtr)0, (IntPtr)0); } catch (SecurityException se) { MessageBox.Show(se.ToString()); } catch (UnauthorizedAccessException ex) { MessageBox.Show(ex.ToString()); } }
Thanks for your help
-
install windows fontsI think i have the same problem. I want to copy the a font file by using my program, but the only thing i managed until now is to register the font file vie AddFontResoucre so openoffice can use it until my pc reboots. I tried to get write permissions by using FileIoPermission for the font-Directory but when my program actually copies the file to the directory it says i dont have the permission to do so. My code looks like this:
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read, fontPath);
try
{
f2.Demand();
System.IO.File.Copy(fontPath, destination);
}
catch (SecurityException se)
{
MessageBox.Show(se.ToString());
}
catch (UnauthorizedAccessException ex)
{
MessageBox.Show(ex.ToString());
} -
FileIOPermission ProblemCan someone give me some help on this please, since i dont know what i am doing wrong? I used a messagebox to have a quick look at the permmission i requested and it says i asked for write permission for C:\Windows\Fonts and read permission for the folder in "origin". Is there something else I have to do?
-
FileIOPermission ProblemGood Evening, currently I am doing a small program which copies a file from one folder to another folder. The destination folder is the "Fonts" folder which holds all fonts of my system. Currently my code looks like this:
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read , origin);try { System.IO.File.Copy(origin, destination); } catch (UnauthorizedAccessException ex) { MessageBox.Show(ex.ToString()); }
When I start debugging, the debugger tells me that I dont have permission for C:\Windows\Fonts\"filename". Which confuses me a bit since I thought I already got write permission to "C:\Windows\Fonts\". What am i doing wrong? P.S.: I am using Windows Vista SP1 64-Bit Thanks for your help and advices