24-03-2014, 10:57 PM
PHP كود :
Procedure SetRunAsAdminFlag(PathToExe: String);
Var
Reg: TRegistry;
Begin
if ((GetOSInfo ='Windows 7 ')or (GetOSInfo ='Windows 8 ')or (GetOSInfo ='Windows Vista ')
or (GetOSInfo ='Windows Server 2008 ')or (GetOSInfo ='Windows Server 2008 R2 ')
or (GetOSInfo ='Windows Server 2012 '))
then begin
Reg := TRegistry.Create( KEY_WRITE );
with Reg do
try
try
RootKey := HKEY_CURRENT_USER;
if OpenKey('Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers', True) then
WriteString( PathToExe, 'RUNASADMIN' );
finally
CloseKey;
Free;
end;
except
Exit;
end;
end;
End;
PHP كود :
function regchanged(sProgTitle,sCmdLine:string): Boolean;
begin
with TRegIniFile.Create(KEY_READ OR KEY_WOW64_64KEY) do begin
try
RootKey := HKEY_LOCAL_MACHINE;
IF OpenKeyReadOnly('\Software\Microsoft\Windows\CurrentVersion\Run') THEN
if ReadString('Software\Microsoft\Windows\CurrentVersion\Run', sProgTitle, '')<>bWin(sCmdLine)+' /hide' then
result:=True else Result:=False;
finally
Free;
end;
end;
end;

