Results 1 to 2 of 2

Thread: Access Denied When Attempting To Edit A File ProgramFiles

  1. #1

    Thread Starter
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Access Denied When Attempting To Edit A File ProgramFiles

    • I can't change the location of the file to be edited

    • UAC is OFF

    • Just in case, the app.manifest has been edited so it runs as admin


    Here's the code:

    Code:
    public void UpdateDNSNameInConfigFile(string v, ConfigFileOption cf)
            {
                string ConfigFilePath = Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) + @"\<redacted>\<redacted>";
                string ConfigFileContents = string.Empty;
                string DNSName = v.Replace("/ucf:", ""); //Remove the command line arg from the value
    
                switch (cf)
                {
                    case ConfigFileOption.CobanSystem:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.<redacted>System";
                        break;
                    case ConfigFileOption.Agent_AVL:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.Agent.AVL";
                        break;
                    case ConfigFileOption.Agent_DB:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.Agent.DB";
                        break;
                    case ConfigFileOption.Agent_DVD:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.Agent.DVD";
                        break;
                    case ConfigFileOption.Agent_FileAgent:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.Agent.FileAgent";
                        break;
                    case ConfigFileOption.Agent_Log:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.Agent.Log";
                        break;
                    case ConfigFileOption.Agent_Streaming:
                        ConfigFilePath = ConfigFilePath + @"\<redacted>.Agent.Streaming";
                        break;
                    case ConfigFileOption.Agent_Listener:
                        throw new NotImplementedException();
                    case ConfigFileOption.Agent_InCar:
                        throw new NotImplementedException();
                    case ConfigFileOption.Agent_Tape:
                        throw new NotImplementedException();
                }
    
                ConfigFileContents = File.ReadAllText(ConfigFilePath);
                ConfigFileContents = ConfigFileContents.Replace("<redacted>", v);
                File.WriteAllText(ConfigFilePath, ConfigFileContents);
            }
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Access Denied When Attempting To Edit A File ProgramFiles

    Are able able to modify the same file without using your program, do you receive the "Access Denied" error?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width