Hi,
I'm relatively new to .NET and am developing an Application for Windows Vista. I'm running into a couple of issues with the Application when it's trying to do 2 things - Copy a file, or Set a Registry Key Value. When I'm running VS2005 both these 2 functions work no problem, but I would assume that this is because I run VS2005 as an Administrator. My Application won't be able to run as an Administrator I don't think, because I will be running the Application from boot up as a shell.
For the file copy, I'm using a straightforward File.Copy, e.g.:
Dim strPathFrom As String = "C:\FolderName\Filename.txt"
Dim strPathTo As String = "C:\Filename.txt"
File.Copy(strPathFrom, strPathTo, True)
This raises the following error:
Access to path "C:\Filename.txt" is denied
When I try to Set a Registry value, I was trying to look for the permission to do it with code, but it's not working:
Imports System.Security.Permissions
<Assembly: RegistryPermissionAttribute( _
SecurityAction.RequestMinimum, ViewAndModify:="HKEY_LOCAL_MACHINE")>
Public Class Reset
Private Sub SetRegistry
My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "Shell", "C:\MyProgram.exe")
End Sub
End Class
When I run this I get:
Attempted to perform an unauthorized operation

Help with permissions in Vista