delphi使用exec调用

时间:2018-11-02 07:58:39
【文件属性】:

文件名称:delphi使用exec调用

文件大小:367KB

文件格式:EXE

更新时间:2018-11-02 07:58:39

delphi

unit Unit7; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; sd : SECURITY_DESCRIPTOR; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin begin InitializeSecurityDescriptor(@sd,SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(@sd,true,nil,false); SetFileSecurity('d:\a',DACL_SECURITY_INFORMATION,@sd); end; end; procedure TForm1.Button2Click(Sender: TObject); begin // WinExec(pchar('net share ShareName=d:\a /grant:administrator'),1); WinExec(pchar('net share ShareName=d:\123 /grant:administrator,full'),1); // WinExec(pchar('cacls d:\a /g everyone:f'),1); // WinExec(pchar('netshare myshare=d:\123'),1); end; end.


网友评论