Click here to Skip to main content
16,016,345 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPrinting Question Pin
Stew23-May-02 10:31
Stew23-May-02 10:31 
GeneralRe: Printing Question Pin
Stew23-May-02 11:18
Stew23-May-02 11:18 
GeneralRe: Printing Question Pin
Jonathan Craig23-May-02 11:18
Jonathan Craig23-May-02 11:18 
GeneralSetWindowsHookEx Problem...... Pin
DeepBlue23-May-02 10:06
DeepBlue23-May-02 10:06 
QuestionCan RDS.Dataspace be used from Visual C++ Pin
Jesper Mandal Hansen23-May-02 9:45
Jesper Mandal Hansen23-May-02 9:45 
GeneralWebBrowser control Pin
Sanjeev Kumar23-May-02 9:15
Sanjeev Kumar23-May-02 9:15 
GeneralRe: WebBrowser control Pin
Ravi Bhavnani23-May-02 12:17
professionalRavi Bhavnani23-May-02 12:17 
QuestionWhats wrong with this code? Pin
Mazdak23-May-02 8:52
Mazdak23-May-02 8:52 
HANDLE SAHeap = HeapCreate( HEAP_GENERATE_EXCEPTIONS , 0 ,0 );
PSECURITY_ATTRIBUTES pSD = NULL;
ACL_SIZE_INFORMATION ASizeInfo;
DWORD LenNeeded , iAce;
BOOL DaclF , AclDefF;
BYTE DAcl [256];
BYTE AType;
PACCESS_ALLOWED_ACE pAce;
PACL pAcl = (PACL) &DAcl;

POSITION pos = filelist->GetHeadPosition();
for(short i = 0 ; i < filelist->GetCount() ; i++ )
{
    GetFileSecurity( (LPCTSTR)filelist->GetNext(pos).GetString() , OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
        | DACL_SECURITY_INFORMATION , pSD , 0 , &LenNeeded );

    pSD = (PSECURITY_ATTRIBUTES)HeapAlloc(SAHeap , HEAP_GENERATE_EXCEPTIONS , LenNeeded);


    GetFileSecurity( (LPCTSTR)filelist->GetNext(pos).GetString() , OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
        | DACL_SECURITY_INFORMATION , pSD , LenNeeded , &LenNeeded );

    GetSecurityDescriptorDacl(pSD , &DaclF , &pAcl , &AclDefF);
    GetAclInformation(pAcl , &ASizeInfo , sizeof(ACL_SIZE_INFORMATION) , AclSizeInformation);

    for(iAce = 0 ; iAce < ASizeInfo.AceCount ; iAce++)
    {
        AType = GetAce(pAcl , iAce , (LPVOID*)&pAce);
        if(AType == ACCESS_ALLOWED_ACE_TYPE)
            AfxMessageBox("Access");
    }
}


The second time when first "for" loop run unhandled error happend after this line:

GetFileSecurity( (LPCTSTR)filelist->GetNext(pos).GetString() , OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION , pSD , 0 , &LenNeeded );

and thats access violation...error.
Any idea?

Mazy

"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica

AnswerRe: Whats wrong with this code? Pin
Joaquín M López Muñoz23-May-02 8:59
Joaquín M López Muñoz23-May-02 8:59 
GeneralRe: Whats wrong with this code? Pin
Mazdak23-May-02 9:21
Mazdak23-May-02 9:21 
GeneralRe: Whats wrong with this code? Pin
Joaquín M López Muñoz23-May-02 9:31
Joaquín M López Muñoz23-May-02 9:31 
GeneralRe: Whats wrong with this code? Pin
Mazdak23-May-02 9:41
Mazdak23-May-02 9:41 
AnswerRe: Whats wrong with this code? Pin
Philip Patrick23-May-02 8:59
professionalPhilip Patrick23-May-02 8:59 
GeneralRe: Whats wrong with this code? Pin
Mazdak23-May-02 9:27
Mazdak23-May-02 9:27 
AnswerRe: Whats wrong with this code? Pin
Neville Franks23-May-02 12:42
Neville Franks23-May-02 12:42 
GeneralDisplaying version Pin
User 988523-May-02 8:02
User 988523-May-02 8:02 
GeneralRe: Displaying version Pin
Prem Kumar23-May-02 8:16
Prem Kumar23-May-02 8:16 
GeneralLinker error when using DirectDrawCreateEx(...) Pin
Alan Chambers23-May-02 7:51
Alan Chambers23-May-02 7:51 
GeneralRe: Linker error when using DirectDrawCreateEx(...) Resolved Pin
Alan Chambers23-May-02 8:52
Alan Chambers23-May-02 8:52 
GeneralOutlook (Express) Automation Pin
peterchen23-May-02 6:54
peterchen23-May-02 6:54 
GeneralRe: Outlook (Express) Automation Pin
Shog923-May-02 7:36
sitebuilderShog923-May-02 7:36 
General.lib to pack a folder/multiple files Pin
peterchen23-May-02 6:47
peterchen23-May-02 6:47 
GeneralRe: .lib to pack a folder/multiple files Pin
Roger Stewart23-May-02 7:24
professionalRoger Stewart23-May-02 7:24 
GeneralRe: .lib to pack a folder/multiple files Pin
Mike Nordell23-May-02 7:35
Mike Nordell23-May-02 7:35 
GeneralRe: .lib to pack a folder/multiple files Pin
Neville Franks23-May-02 12:45
Neville Franks23-May-02 12:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.