Hello guys,
I'm trying to make a little bit of code to create a folder and allow everyone modify access to the folder and its sub-directories. So far I have this code here :Code:
I'm using Delphi 5 (I know it's old as crap, no I can't just upgrade to a newer Delphi). When I run it tells me "Project ModifyPermissions.exe raised exception class EAccessViolation with message 'Access violation at address 00000001. Read of address 00000001'. Process stopped. Use Step or Run to continue.
I tried running the program in admin mode, it doesn't change anything. I'm confused since I got this code from someone who's program was working... Any help would be appreciated, thanks in advance!
I'm trying to make a little bit of code to create a folder and allow everyone modify access to the folder and its sub-directories. So far I have this code here :Code:
PHP Code:
unit ModifyPerms;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, AccCtrl, perms;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
NewDacl, OldDacl: PACl;
SD: PSECURITY_DESCRIPTOR;
EA: PEXPLICIT_ACCESS_A;
begin
GetNamedSecurityInfo(PChar('c:\test'), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION, nil, nil, @OldDacl, nil, SD);
BuildExplicitAccessWithName(@EA, PChar('Everyone'), GENERIC_ALL,
GRANT_ACCESS, SUB_CONTAINERS_AND_OBJECTS_INHERIT);
SetEntriesInAcl(1, @EA, OldDacl, NewDacl);
SetNamedSecurityInfo(PChar('c:\test'), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION, nil, nil, NewDacl, nil);
end;
end.
I tried running the program in admin mode, it doesn't change anything. I'm confused since I got this code from someone who's program was working... Any help would be appreciated, thanks in advance!
