ACL TRUSTEE_TYPE is always Unknown.

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 21
Reputation: bigbadowl is an unknown quantity at this point 
Solved Threads: 0
bigbadowl bigbadowl is offline Offline
Newbie Poster

ACL TRUSTEE_TYPE is always Unknown.

 
0
  #1
Jan 6th, 2009
Hi All

I am using the code below to get ACL information from files on Windows (in this case Vista). I need to know wether or not a trustee is a group or a user but when I loop through each trustee they all say "TRUSTEE_IS_UNKNOWN". Am I getting something horribly wrong?

dwError = GetExplicitEntriesFromAcl(pAcl, &cCountOfExplicitEntries, &pListOfExplicitEntries);
	if (dwError != ERROR_SUCCESS){
		printf("GetExplicitEntriesFromAcl failed with error : %u\n\n", dwError);
		return;
	}

	printf("cCountOfExplicitEntries : %d\n", cCountOfExplicitEntries);
	printf("******\n");

	for(ULONG i=0; i<cCountOfExplicitEntries;i++){
		printf("++++++\n");
		switch (pListOfExplicitEntries[i].Trustee.TrusteeForm){
			case TRUSTEE_IS_SID:
				printf("TRUSTEE_IS_SID\n");
				break;
			case TRUSTEE_IS_NAME:
				printf("TRUSTEE_IS_NAME\n");
				//printf("Name: %s\n", pListOfExplicitEntries[i].Trustee.ptstrName);
				break;
		}

		printf("++++++\n");
		switch (pListOfExplicitEntries[i].Trustee.TrusteeType){
			case TRUSTEE_IS_USER:
				printf("TRUSTEE_IS_USER\n");
				break;
			case TRUSTEE_IS_GROUP:
				printf("TRUSTEE_IS_GROUP\n");
				break;
			case TRUSTEE_IS_DOMAIN:
				printf("TRUSTEE_IS_DOMAIN\n");
				break;
			case TRUSTEE_IS_ALIAS:
				printf("TRUSTEE_IS_ALIAS\n");
				break;
			case TRUSTEE_IS_INVALID:
				printf("TRUSTEE_IS_INVALID\n");
				break;
			case TRUSTEE_IS_UNKNOWN:
				printf("TRUSTEE_IS_UNKNOWN\n");
				break;
		}

		TCHAR account[1000];	
		TCHAR domain[1000];
		DWORD AccountBufflength = 1000;
		DWORD DomainBufflength = 1000; 
		PSID_NAME_USE peUse = new SID_NAME_USE; 
		PSID Sid = pListOfExplicitEntries[i].Trustee.ptstrName;	
		LookupAccountSid(NULL, Sid, account, &AccountBufflength,domain,&DomainBufflength,peUse);
		_tprintf(TEXT("%s\\%s\n"), domain, account);
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 116
Reputation: marco93 is infamous around these parts marco93 is infamous around these parts marco93 is infamous around these parts 
Solved Threads: 12
marco93 marco93 is offline Offline
Junior Poster

Re: ACL TRUSTEE_TYPE is always Unknown.

 
0
  #2
Jan 8th, 2009
It's a wrong method.
Ask on Adv. Win32 api newsgroup
news://comp.os.ms-windows.programmer.win32
for the well-known right method...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC