How to handle security in NT from Visual Basic
Hi.
I am trying to use the WIN32 API function GetFileSecurity
in order to determine access permissions on folders/files.
The Microsoft Knowledge Base article Q218965 contains
an example of using this function.
The example uses the constant OWNER_SECURITY_INFORMATION=1.
I tried the example in the above KB article with success.
But when I tried to replace OWNER_SECURITY_INFORMATION
with first DACL_SECURITY_INFORMATION=4
and then SACL_SECURITY_INFORMATION=8
Visual Basic crashed (terminated) without any warning.
Any clues would be greatly appreciated.
Regards
Guttorm Haaversen
# 1 Re: How to handle security in NT from Visual Basic
at which point does the code crash? any chance you could call GetLastError().
Do you have the right permissions to read the SACL/DACL?
Finally, as a guess - handling DACLs/SACLs is more complex than a SID. i
wonder if it blew up because it cannot handle the more complex ACL format?
"Guttorm A. Haaversen" <Guttorm-Andreas.Haaversen@TietoEnator.com> wrote:
>
>Hi.
>
>I am trying to use the WIN32 API function GetFileSecurity
>in order to determine access permissions on folders/files.
>
>The Microsoft Knowledge Base article Q218965 contains
>an example of using this function.
>
>The example uses the constant OWNER_SECURITY_INFORMATION=1.
>
>I tried the example in the above KB article with success.
>
>But when I tried to replace OWNER_SECURITY_INFORMATION
>
>with first DACL_SECURITY_INFORMATION=4
>
>and then SACL_SECURITY_INFORMATION=8
>
>Visual Basic crashed (terminated) without any warning.
>
>Any clues would be greatly appreciated.
>
>Regards
>
>Guttorm Haaversen
# 2 Re: How to handle security in NT from Visual Basic
Guttorm,
> I am trying to use the WIN32 API function GetFileSecurity
> in order to determine access permissions on folders/files.
If you will look on my web site below, there is a complete VBPJ project I
wrote to handle file security. It doesn't do directory security, but that
shouldn't be too hard to add...
--
L.J. Johnson, Slightly Tilted Software
Microsoft MVP (Visual Basic)
LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
<http://www.SlightlyTiltedSoftware.com>
Ask The NT Pro at <http://www.dev-archive.com/gethelp>
# 3 Re: How to handle security in NT from Visual Basic
out of interest - do you handle the inherited and non-inherited DACLs/SACLs
with this code?
"L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote:
>Guttorm,
>
>> I am trying to use the WIN32 API function GetFileSecurity
>> in order to determine access permissions on folders/files.
>
>If you will look on my web site below, there is a complete VBPJ project
I
>wrote to handle file security. It doesn't do directory security, but that
>shouldn't be too hard to add...
>
>--
>L.J. Johnson, Slightly Tilted Software
>Microsoft MVP (Visual Basic)
>LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
><http://www.SlightlyTiltedSoftware.com>
>Ask The NT Pro at <http://www.dev-archive.com/gethelp>
>
>
>