![]() |
Run As system
Hello i've this code to launch an external Application as a system :
Delphi-Quellcode:
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 .
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; many thanks |
AW: Run As system
:gruebel:
By putting your application executable in as command instead of Edit1.Text? (
Delphi-Quellcode:
)
ParamStr(0)
|
AW: Run As system
Zitat:
Delphi-Quellcode:
thank you again
Application.Initialize
|
AW: Run As system
You can not give your running executable system access rights. You can only start a new instance of your executeble with those rights. And you could do so inside your project file if you want to.
But if you need to run in system context, why don't you just write a service application? |
AW: Run As system
Zitat:
|
AW: Run As system
The first instance can be closed, so only the second remains. But yes, your second instance will have a new PID and will be running separately from the first.
There is no other possibility. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:59 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz