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

  • SEARCH
  • Home
  • 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 7994025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:01:35+00:00 2026-06-04T14:01:35+00:00

I am trying to write a program to collect security information about a file

  • 0

I am trying to write a program to collect security information about a file and convert it to human readable information. However, I am facing a problem with initializing a pointer to structure:

#include <stdio.h>
#include <aclapi.h>
#pragma comment(lib, "advapi32.lib")
struct file_perms {
    char user_domain[2050];
    unsigned long user_mask;
};
static myfunc (){

PSECURITY_DESCRIPTOR pSD = NULL;
PACL pDACL = NULL;
char *file = "D:/code/test.c";
ACL_SIZE_INFORMATION aclSize;

ULONG result = GetNamedSecurityInfo(file,SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &pDACL, NULL, &pSD);
if (ERROR_SUCCESS != result) {
    printf( "GetNamedSecurityInfo Error %u\n", result );
}
if(pDACL != NULL){printf ("2\n");}
//ACL_SIZE_INFORMATION aclSize = {0};
ZeroMemory(&aclSize, sizeof(ACL_SIZE_INFORMATION));
    if(pDACL != NULL){   
        if(!GetAclInformation(pDACL, &aclSize, sizeof(aclSize),
            AclSizeInformation)){
            printf("GetAclInformation Error \n");
            return 0;
        }
        printf("AceCount %d\n",aclSize.AceCount);
    }
file_perms *fp = new file_perms[aclSize.AceCount];

}

While compiling, I am getting the following error.
getnamed.c

getnamed.c(34) : error C2065: 'file_perms' : undeclared identifier
getnamed.c(34) : error C2065: 'fp' : undeclared identifier
getnamed.c(34) : error C2065: 'new' : undeclared identifier
getnamed.c(34) : error C2106: '=' : left operand must be l-value
getnamed.c(34) : error C2146: syntax error : missing ';' before identifier 'file
_perms'
getnamed.c(34) : error C2065: 'file_perms' : undeclared identifier
getnamed.c(34) : error C2109: subscript requires array or pointer type

Can someone help me understand why is file_perms marked as undeclared identifier? While it is declared as a structure already?

Thank you for your help.

  • 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-04T14:01:36+00:00Added an answer on June 4, 2026 at 2:01 pm

    You should have

    struct file_perms *fp = new file_perms[aclSize.AceCount];
    

    or create type at begining:

    typedef struct file_perms {
        char user_domain[2050];
        unsigned long user_mask;
    }file_perm;
    

    and later you can use it like

    file_perms *fp;
    fp = (file_perms*)malloc(aclSize.AceCount * sizeof(file_perms));
    

    BTW : operator new is c++ syntax, not pure C, you are most probably trying to compile C++ code as C

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

Sidebar

Related Questions

I'm trying to write a program that takes a large file (of any type)
I trying to write a program that navigates the local file system using a
Im trying to write a program to read a text file through args but
I was trying to write a program for the problem I mentioned above, the
I'm trying to write a program to process the BSD-style process accounting file under
i ma trying to write a program where about the payments of employees and
I am trying to write a simple program that writes to a file that
I'm trying to write a program that reads in entries from a file into
I'm trying to write a program that takes in a plaintext file as it's
Im trying to write a program that takes a txt file as input, and

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.