I'm trying to change a folder's permissions in Delphi 5 so that everyone can have modify access to it, however, every guide I find on the web uses TExplicitAccess
types and it comes out as undeclared identifier in Delphi 5. If anyone knows why, I'd love to know.
Upgrading to a new Delphi version is not an option by the way, I need to be able to do this in Delphi 5.
EDIT : As mentioned below, one must use EXPLICIT_ACCESS for it to work. Thanks!
Even the latest versions of Delphi don't have that type declared in the Windows header translations. Presumably your example code is using a third party header translation. Or perhaps the example code defines an alias for convenience. Consult the example code that you have for more details.
In Delphi 5, the type is declared in the AccCtrl
unit. Like this:
{ Definition: EXPLICIT_ACCESS }
{ This structure is used to pass access control entry information into and out }
{ of the system using the API defined in this document. }
{ grfAccessPermissions - This contains the access permissions to assign for the }
{ trustee. It is in the form of an NT access mask. }
{ grfAccessMode - This field defines how the permissions are to be applied for }
{ the trustee. }
{ grfInheritance - For containers, this field defines how the access control }
{ entry is/(is requested) to be inherited on }
{ objects/sub-containers created within the container. }
{ Trustee - This field contains the definition of the trustee account the }
{ explicit access applies to. }
PEXPLICIT_ACCESS_A = ^EXPLICIT_ACCESS_A;
{$EXTERNALSYM PEXPLICIT_ACCESS_A}
EXPLICIT_ACCESS_A = packed record
grfAccessPermissions: DWORD;
grfAccessMode: ACCESS_MODE;
grfInheritance: DWORD;
Trustee: TRUSTEE_A;
end;
{$EXTERNALSYM EXPLICIT_ACCESS_A}
PEXPLICIT_ACCESS_W = ^EXPLICIT_ACCESS_W;
{$EXTERNALSYM PEXPLICIT_ACCESS_W}
EXPLICIT_ACCESS_W = packed record
grfAccessPermissions: DWORD;
grfAccessMode: ACCESS_MODE;
grfInheritance: DWORD;
Trustee: TRUSTEE_W;
end;
{$EXTERNALSYM EXPLICIT_ACCESS_W}
PEXPLICIT_ACCESS_ = PEXPLICIT_ACCESS_A;
EXPLICIT_ACCESSA = EXPLICIT_ACCESS_A;
{$EXTERNALSYM EXPLICIT_ACCESSA}
EXPLICIT_ACCESSW = EXPLICIT_ACCESS_W;
{$EXTERNALSYM EXPLICIT_ACCESSW}
EXPLICIT_ACCESS = EXPLICIT_ACCESSA;
PEXPLICIT_ACCESSA = ^EXPLICIT_ACCESS_A;
{$EXTERNALSYM PEXPLICIT_ACCESSA}
PEXPLICIT_ACCESSW = ^EXPLICIT_ACCESS_W;
{$EXTERNALSYM PEXPLICIT_ACCESSW}
PEXPLICIT_ACCESS = PEXPLICIT_ACCESSA;
The relevant structures are EXPLICIT_ACCESS_A
and EXPLICIT_ACCESS_W
. If you wish to define a convenient alias you would do so like this:
type
TExplicitAccess = EXPLICIT_ACCESS_;
Then in the AclAPI
unit there are the various functions that use this type.
Remember that these are Windows API types and functions, and that the documentation for them is provided by Microsoft on MSDN.