Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Error retrieving Security Information (SACL) of certain registry keys

by dt667 (Acolyte)
on Oct 01, 2014 at 18:11 UTC ( #1102569=perlquestion: print w/replies, xml ) Need Help??
dt667 has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone help me understand why certain Windows registry keys return an error when trying Win32::Security::Raw::GetNamedSecurityInfo is called? The below code was written to try and flesh out why my Win32::Security::NamedObject of type SE_Registry_Key is throwing the error 'GetNamedSecurityInfo: The system cannot find the file specified. at line 8.'

For my system, 'MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Console' throws a different error and works as expected in my larger program that this snippet was pulled from.

MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\CorruptedFileRecovery throws the error in question.

Both registry keys have the same permissions as far as I can tell.

use Win32::Security::ACL; use Win32::Security::Raw; my $objectType = "SE_REGISTRY_KEY"; my($psidOwner, $psidGroup, $pDacl, $pSacl, $pSecurityDescriptor) = Win32::Security::Raw::GetNamedSecurityInfo("MACHINE\\SOFTWARE\ +\Microsoft\\Windows NT\\CurrentVersion\\Console", $objectType, 'SACL_ +SECURITY_INFORMATION'); if ($pSacl) { my($AceCount, $AclBytesInUse, $AclBytesFree) = Win32::Security::Ra +w::GetAclInformation($pSacl, 'AclSizeInformation'); $sacl = "Win32::Security::ACL::$objectType"->new(Win32::Security:: +Raw::CopyMemory_Read($pSacl, $AclBytesInUse)); } else { $sacl = "Win32::Security::ACL::$objectType"->new(undef); } use Data::Dumper; print Dumper($sacl);
  • Comment on Error retrieving Security Information (SACL) of certain registry keys
  • Download Code

Replies are listed 'Best First'.
Re: Error retrieving Security Information (SACL) of certain registry keys
by Anonymous Monk on Oct 02, 2014 at 00:43 UTC
    Well, what authorization level do you have? Are you an Administrator?? (Or to put it another way: Are You a God?)
      Not sure how I missed your reply way back when, but this is still an issue. I may not be a god, but I am running as administrator.
Re: Error retrieving Security Information (SACL) of certain registry keys
by misterperl (Beadle) on Oct 02, 2014 at 13:37 UTC
    Replied by accident, and don't see any DELETE REPLY button.. oops

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1102569]
Approved by Corion
Discipulus glisses

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2018-03-23 11:46 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (291 votes). Check out past polls.