Windows 10: Access Denied unexpectedly

Discus and support Access Denied unexpectedly in AntiVirus, Firewalls and System Security to solve the problem; This is more of a Windows issue than a C++, yet I'll mention C++ briefly. I get ACCESS DENIED when I try to open certain files for writing in a C++... Discussion in 'AntiVirus, Firewalls and System Security' started by Bannerdog, Mar 12, 2020.

  1. Bannerdog Win User

    Access Denied unexpectedly


    This is more of a Windows issue than a C++, yet I'll mention C++ briefly.

    I get ACCESS DENIED when I try to open certain files for writing in a C++ program.

    DETAILS

    Observation A

    1 I use File Explorer to create the text file "CreatedByFE.txt".

    2 My program written in C++ attempts to open "CreatedByFE.txt" for writing.
    I get ACCESS DENIED.

    [C++ note: this occurs whether I use std:Access Denied unexpectedly :eek:fstream, FILE*, or CreateFile.]

    Observation B

    1 I use MyProgram.exe to open a new file, "CreatedByMe.txt", for writing.
    This causes a zero-length file to be created.

    1a I exit and restart MyProgram.exe just to make each step 2 similar.

    2 My program written in C++ attempts to open "CreatedByMe.txt" for writing.
    It succeeds.

    ["CreatedByFE.txt" and "CreatedByMe.txt" reside in the same directory.]

    Summary:

    If I create a text file using File Explorer, subsequent attempts by my program to open it for write result in ACCESS DENIED.

    If I create a text file using my program, subsequent attempts by my program to open it for write succeed.

    Observation 3

    If I examine the properties of the two above text files "CreatedByFE.txt" and "CreatedByMe.txt", I find that they are identical: attributes, permissions, and ownership.

    Observation 4

    Although MyProgram.exe cannot open "CreatedByFE.txt" for writing, I can edit "CreatedByFE.txt" with a text editor. Clearly, the text editor can open it for writing.

    Observation 5

    I noted that MyProgram.exe was owned by myself the user, say "Me", and that TextEditor.exe was owned by "Administrators".

    I changed ownership of MyProgram.exe from "Me" to "Administrators".

    MyProgram.exe still got ACCESS DENIED when attempting to open "CreatedByFE.txt" for write.

    Observation 6

    MyProgram.exe gets ACCESS DENIED when opening "CreatedByFE.txt" for write, even if run as administrator.


    QUESTIONS

    1

    `Why is it that my program can open "CreatedByMe.txt", but not "CreatedByFE.txt", when they have the same properties, and reside in the same directory?

    SOMETHING about them must be different.

    It's not the filename that's the issue.
    I transposed filenames using a "temp" filename to perform the swap.

    I'm unable to open the file created by File Explorer, regardless of filename I just wanted to confirm that it wasn't some odd issue related to a filename in the registry.

    2

    Why can a text editor open a file or writing, that my program cannot, when the the editor and my program have the same owner?

    BOTTOM LINE

    The text files have identical properties and location.
    The exe files editor and my program have the same owner.

    How do the two text files differ?
    [So that I can open one, but not the other.]

    What is the difference between the text editor and my program, allowing the former to open files that mine cannot?

    What the heck is going on?

    I really dislike Windows security.

    :)
     
    Bannerdog, Mar 12, 2020
    #1
  2. EsMj Win User

    Change Folder Destination access Denied

    Thanks.

    After following the steps suggested, I get the message "Access denied" in command prompt.

    Please advise how to allow permission.
     
  3. Access denied

    Whenever I connect any pendrive or hard disk it says access denied for pen drive I googled got the solution for pendrive but I need to follow the steps everytime I connect give me the permanent solution and steps for hard drive access denied
     
    krishnamagaji, Mar 12, 2020
    #3
  4. Yolvi Ell Win User

    Access Denied unexpectedly

    net user administrator /active:no keeps saying access denied.

    Hi Rebekah,

    It's possible that you're not using an elevated command prompt, causing the Access Denied error. We suggest following these steps to properly disable the built-in administrator account:

    • Right-click the Start button.
    • Choose Command Prompt (Admin).
    • Copy and paste net user Administrator /active:no and press
      Enter
      . If the command isn't successful, please post a screenshot so that we can study it further.

    Let us know if you're able to hide the administrator account after following these steps.
     
    Yolvi Ell, Mar 12, 2020
    #4
Thema:

Access Denied unexpectedly

Loading...
  1. Access Denied unexpectedly - Similar Threads - Access Denied unexpectedly

  2. Access Denied

    in Windows 10 Software and Apps
    Access Denied: I receive this message. Access Denied You don't have permission to access "http://www.kingsoopers.com/" on this server.Reference #18.94bf2617.1662145515.2efa39f. The website address has "https:". I have tried different suggestions to fix this but they haven't helped....
  3. Access Denied

    in Windows 10 Gaming
    Access Denied: Hello. Why can't File explorer not access my external disk drive but computer detects it. Disk management shows that the drive is healthy, online and allocated. Chckdsk found no errors. Trouble shooter from disk management also can't find errors but when I want to access the...
  4. Access is denied

    in Windows 10 Software and Apps
    Access is denied: I try to get on Fox news website and I get a "access is denied" . how do I fix it? HP laptop w/win 10. https://answers.microsoft.com/en-us/windows/forum/all/access-is-denied/4cdbc5fa-1e6b-42a6-aa48-1a36f8945e67
  5. Access Denied

    in AntiVirus, Firewalls and System Security
    Access Denied: Access Denied You don't have permission to access "http://www.finishline.com/?" on this server. Reference #18.c5e33e17.1592853789.713d2201 https://answers.microsoft.com/en-us/windows/forum/all/access-denied/729e3550-6496-4431-b07b-9bef96bd1d4f
  6. Access Denied!

    in Windows 10 Network and Sharing
    Access Denied!: When I try to access lowes.com from my browser Google, I get the following error message. Access Denied You don't have permission to access "http://www.lowes.com/" on this server. Reference # 18.7e25d117.1587839593.2dd8e16d This only happens when I try to access Lowes...
  7. Access Denied

    in Windows 10 Customization
    Access Denied: I tried to turn on Windows Developer mode and it says "Access Denied". Can I get some help? https://answers.microsoft.com/en-us/windows/forum/all/access-denied/cb69b709-417b-4627-bf8b-c0afe456548a
  8. Access denied

    in Windows 10 Customization
    Access denied: Having originally getting a warning that my desk top was not available after getting some updates i followed the instructions and copy paste the desktop file but now when rebooting desktop does not come up with the warning access is denied Back to square one !!...
  9. Access Denied

    in Windows 10 Network and Sharing
    Access Denied: Until a week or so ago I was able to go to the Argos website, but now I am refused with an Access Denied message. https://answers.microsoft.com/en-us/windows/forum/all/access-denied/ca707c4d-a849-4099-8df1-dbd15ebbeb6d
  10. Access is denied

    in User Accounts and Family Safety
    Access is denied: I'm trying to free on space on Drive C: and cannot get into "Documents and Settings" or see what space it's using. Just "not accessible Access is Denied". It looks like it's a shortcut, not a folder. Guess it's a Win 10 thing ? Can I get around this anyhow ?...