Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Please Help me...How to find if a file is read only or not

Please Help me...How to find if a file is read only or not

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gnanakkumaran D
    wrote on last edited by
    #1

    Hi, I am trying to find whether file is read only or not on NT system. The file permission is set using NT explorer, right mouse click on file->properties->Security and EveryOne just Read Only. But the Read only attribure is not set. When I use the standard C function "access(filename, 02)" or CFileFind::IsReadOnly it returns the file is writable (since the read only attribute is not set). But in reality this file is not writable, since EveryOne has Read Only access. How do I access this windows NT specific access permission to determine the file is read only or not. I would appreciate any help regarding this. Any sample code.... Thanks Kumar :confused:

    H 1 Reply Last reply
    0
    • G Gnanakkumaran D

      Hi, I am trying to find whether file is read only or not on NT system. The file permission is set using NT explorer, right mouse click on file->properties->Security and EveryOne just Read Only. But the Read only attribure is not set. When I use the standard C function "access(filename, 02)" or CFileFind::IsReadOnly it returns the file is writable (since the read only attribute is not set). But in reality this file is not writable, since EveryOne has Read Only access. How do I access this windows NT specific access permission to determine the file is read only or not. I would appreciate any help regarding this. Any sample code.... Thanks Kumar :confused:

      H Offline
      H Offline
      Hadi Rezaee
      wrote on last edited by
      #2

      Hi, See CFileStatus in MSDN. :) Hadi Rezaie

      G 1 Reply Last reply
      0
      • H Hadi Rezaee

        Hi, See CFileStatus in MSDN. :) Hadi Rezaie

        G Offline
        G Offline
        Gnanakkumaran D
        wrote on last edited by
        #3

        Hi, I appreciate your prompt response, I already tried this one too. This will return read only if a file "attribute" is flagged "Read Only". CFileFind also work based on "Read Only" attribute set on the file, if the file is "not flagged" "Read Only", it does not look at the Windows-NT ACL security settings. In my situation, the file is not marked read only (i.e is the read only attribute is not set)... but I used file->properties->security and Removed the existing settings and added EveryOne -> Read. This makes the file read only even though the the attribute is not set to Read Only. What happens here is file itself is not read only, but it is made read only for certain users using NT security settings. If I add one more setting for individual user and give "FULL Control" that user can write to the file. But the Standard C functions access() and CFileFind::IsReadOnly() looks at the attribute setting not at the security level settings. So what happens is, these functions return the file is writeable, even though we can not write to it. I have no clue how to get actual file permissions based on the Security settings Any info regarding this will be highly appreciated. Thanks Kumar

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups