Thema: Delphi Run As system

Einzelnen Beitrag anzeigen

sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

Run As system

  Alt 21. Nov 2012, 13:55
Hello i've this code to launch an external Application as a system :
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  StartupInfo: TStartupInfoW;
  ProcessInformation: TProcessInformation;
begin
  ZeroMemory(@StartupInfo, SizeOf(TStartupInfoW));
  FillChar(StartupInfo, SizeOf(TStartupInfoW), 0);
  StartupInfo.cb := SizeOf(TStartupInfoW);
  StartupInfo.lpDesktop := 'WinSta0\Default';
  if CreateProcessAsSystemW(
    PWideChar(WideString(Edit1.Text)),
    PWideChar(WideString(Edit1.Text + ' -hi')),
    NORMAL_PRIORITY_CLASS,
    nil,
    nil,
    StartupInfo,
    ProcessInformation,
    SystemIntegrityLevel) then
  begin
    CloseHandle(ProcessInformation.hThread);
    CloseHandle(ProcessInformation.hProcess);
  end;
end;
my question is : how can i launch my application as a system , that's to say how to launch the application itself as a system instead of launching an external application .

many thanks
  Mit Zitat antworten Zitat