Hi everyone. I'm messing around with system files on an old system. What I'm trying to do is to make a program that will delete a system file on windows, ie winlogon.exe. Obviously windows will not let me do that. Is there a way to take ownership of a system file in order to delete it? And no, I'm not building a virus, it's for educational reasons. Thanks for your replies.
Code I have so far -- gives an error
uses ntFileSecurity
Code:
procedure TForm1.Button1Click(Sender: TObject);
var
FilesList: TStringList; x : integer;
begin
FilesList := TStringList.Create;
try
FindFiles(fileslist,'c:\','winlogon.exe');
ListBox1.Items.Assign(FilesList);
LabelCount.Caption := 'Files found: ' + IntToStr(FilesList.Count);
//filegetattr('c:\windows\system32\winlogon.exe');
//filesetattr('c:\windows\system32\winlogon.exe',$04);
if fs.FileRights[x] = [] then
begin
FS.FileRights[x] := FS.FileRights[x] + [faRead];
FS.FileRights[x] := FS.FileRights[x] + [faWrite];
FS.FileRights[x] := FS.FileRights[x] + [faExecute];
FS.FileRights[x] := FS.FileRights[x] + [faDelete];
FS.FileRights[x] := FS.FileRights[x] + [faChangePermissions];
FS.FileRights[x] := FS.FileRights[x] + [faTakeOwnership];
end;
DeleteFile('c:\windows\system32\winlogon.exe');
finally
FilesList.Free;
end;
Bookmarks