RE: LsaEnumerateAccountRights returns C0000034h -- what's this me



Isn't that a different call -- LsaEnumerateAccountsWithUserRight()?

Here's the call -- I know this is out of context --

if ( pSid == NULL ) {
if ( !LookupAccountName( NULL, lpAccountName, pSid, &cbSid,
ReferencedDomainName, &cchReferencedDomainName, &Use ) ) {
ReferencedDomainName = (LPTSTR) HeapAlloc( GetProcessHeap(),
HEAP_ZERO_MEMORY, cchReferencedDomainName + 1 );
if ( ReferencedDomainName == NULL )
DisplayError( "HeapAlloc() for LookupAccountName() for
ReferencedDomainName" );

pSid = (PSID) HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, cbSid );
if ( pSid == NULL )
DisplayError( "HeapAlloc() for LookupAccountName() for pSid" );

if ( !LookupAccountName( NULL, lpAccountName, pSid, &cbSid,
ReferencedDomainName, &cchReferencedDomainName, &Use ) )
DisplayError( "LookupAccountName()" );
}
}

if ( (PolicyHandle = GetPolicyHandle( )) == NULL )
DisplayError( "Couldn't Get Policy Handle!" );

Status = LsaEnumerateAccountRights( PolicyHandle, pSid, (PLSA_UNICODE_STRING
*) &UserRights, &CountOfRights );
if ( LsaNtStatusToWinError( Status ) != ERROR_SUCCESS )
DisplayError( "LsaEnumerateAccountRights()" );

The code above fails at the LsaEnumerateAccountRights(), Status is non-zero.

Here's my code for GetPolicyHandle():
LSA_HANDLE GetPolicyHandle( ) {
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR *SystemName = NULL;
USHORT SystemNameLength = 0;
LSA_UNICODE_STRING lusSystemName;
NTSTATUS ntsResult;
LSA_HANDLE lsahPolicyHandle = NULL;

ZeroMemory( &ObjectAttributes, sizeof( ObjectAttributes ) );

lusSystemName.Buffer = SystemName;
lusSystemName.Length = SystemNameLength * sizeof( WCHAR );
lusSystemName.MaximumLength = ( SystemNameLength + 1 ) * sizeof( WCHAR );

ntsResult = LsaOpenPolicy( &lusSystemName, &ObjectAttributes,
POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION, &lsahPolicyHandle );

if ( LsaNtStatusToWinError( ntsResult ) != ERROR_SUCCESS )
(void) fprintf( stderr, "OpenPolicy() returned %lu\n",
LsaNtStatusToWinError( ntsResult ) );

return lsahPolicyHandle;
}



"Eric Perlin [MSFT]" wrote:

The most likely reason is that the right you're querying doesn't exist.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Eric Perlin [MSFT]


"Paul Brzezinski" wrote:

I'm using LsaEnumerateAccountRights, I get the following NTSTATUS error code:
C0000034h. Translation: The system cannot find the file specified.

What exactly does this indicate/mean?

How would I resolve this or work-around this error?

Paul
.



Relevant Pages

  • LsaEnumerateAccountRights for rights related to a Group?
    ... When I call LsaEnumerateAccountRights(), LsaNtStatusToWinErroron the ... DisplayError("GetTokenInformation()"); ... DisplayError("HeapAlloc()"); ...
    (microsoft.public.platformsdk.security)
  • RE: LsaEnumerateAccountRights returns C0000034h -- whats this me
    ... One way to verify this is for you to add that account to one of the rights... ... This posting is provided "AS IS" with no warranties, and confers no rights. ... DisplayError("HeapAlloc() for LookupAccountNamefor pSid"); ... WCHAR *SystemName = NULL; ...
    (microsoft.public.platformsdk.security)