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. How to assign directory rights programmatically?

How to assign directory rights programmatically?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpdockersecuritytutorial
1 Posts 1 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.
  • C Offline
    C Offline
    Chintan
    wrote on last edited by
    #1

    Hi, I have developed an installer application in Visual C++ 6.0. It runs in admin login. While it creates program folder, I want to assign specific rights. The rights I want to assign are as under. Everybody should be allowed for Modify + Read & Execute + List folder content + Read + Write. On advance security tab, "Apply to" field for Everybody should be set to "This folder, subfolders and files". In addition "Apply these permissions to objects and/or containers within this container only" tick box shoud be checked. Right now, the code I have used for this is, -------------------------------------------------------------- SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&sd,TRUE,NULL,FALSE); SetSecurityDescriptorGroup(&sd,NULL, FALSE ); SetSecurityDescriptorSacl(&sd, FALSE, NULL, FALSE ); sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = &sd; sa.bInheritHandle = TRUE; CreateDirectory( m_strDestinationDir, &sa ); -------------------------------------------------------------- This gives full control to Everybody but does not have setting on Advance tab as I mentioned above. Due to that files created by one user in this folder becomes unaccessible for another user. I will be very much thankful if someone can help me out to resolve this problem. Thanks & Regards, Chintan.

    C.R.Naik

    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