Click to See Complete Forum and Search --> : How to handle security in NT from Visual Basic
Guttorm A. Haaversen
03-09-2001, 04:41 AM
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
Michael Howard
03-09-2001, 09:27 PM
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
L.J. Johnson
03-10-2001, 10:03 PM
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.devx.com/gethelp>
Michael Howard
03-13-2001, 03:34 PM
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.devx.com/gethelp>
>
>
>
devx.com
Copyright WebMediaBrands Inc. All Rights Reserved