Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:31:14+00:00 2026-06-04T16:31:14+00:00

My utility extracts ACL from a directory & adds it to another. My issue

  • 0

My utility extracts ACL from a directory & adds it to another. My issue is this –

While iterating through ACEs, I found that for ACEs with AceFlags value = 0, inherit flags (Applied To) is “Folder, subfolders & directories”. When I apply the same ACL to another directory, in Windows 7 it works fine. However, in Windows XP, the inherit flags changes to “Folder only”. Here is the code –

BOOL SetNonInheritedAceToTarget(LPWSTR pszSource, LPWSTR pszDestination)
{
BOOL bRetVal = FALSE;

DWORD dwRes = 0;
PSECURITY_DESCRIPTOR pSD = NULL;
PACL pacl = NULL;

if( ERROR_SUCCESS == GetNamedSecurityInfo(pszSource, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pacl, NULL, &pSD) )
{
    if(pacl)
    {
        for (USHORT i = 0; i < pacl->AceCount; i++)
        {
            ACCESS_DENIED_ACE * PACE = NULL;

            if (!GetAce(pacl, i,(LPVOID*) &PACE))
                continue;

            if(PACE->Header.AceFlags & INHERIT_ONLY_ACE || PACE->Header.AceFlags & INHERITED_ACE)
            {
                // Delete the ACE
                if(!DeleteAce(pacl, i))
                {
                    TCHAR szErrorMsg[300] = {0};
                    wsprintf(szErrorMsg, L"Unable to delete ACE from DACL of = %ls", pszSource);
                    OutputDebugString(szErrorMsg);
                }
            }
        }
    }
}

if(ERROR_SUCCESS == SetNamedSecurityInfo(pszDestination, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, pacl, NULL))
    bRetVal = TRUE;

return bRetVal;
}

I don’t know if I am messing up with the code or is it really OS related issue. Help!!!. Again, if it is OS related issue, what do recommend, should I assign AceFlag manually?

—
Varun

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:31:15+00:00Added an answer on June 4, 2026 at 4:31 pm

    Oh… Silly me. I was checking INHERIT_ONLY_ACE to see it the ACE is inhereted… Any ways, as Mox pointed out, with vista (and above), new ACEs have been added to enhance integrity check in windows based objects. However, this does not change the way ACEs are interpreted. My code is fine, I was just checking an extra flag.

    Thanks Mox for educating me.

    —
    Varun

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a simple utility that extracts passwords from a Firefox password
We use this small utility method. But we don't like it. Since it's not
I am creating a utility which depends on libassuan aside other depends. While these
I need a patch utility which generates an exe file from the differences of
I have a small utility that I use to download an MP3 file from
I'm trying to improve upon a utility that basically scan through all our reports
I have a utility that compares a source and destination file date/time. This works
The Cassandra command-line utility sstablekeys can be used to extract all defined row keys
Utility: NMake Platform : Windows 7 I have the following Makefile FILE = $(shell)
I'm building a utility application that synchronizes files across two systems for Mac OSX.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.