![]() |
Re: Why Cant Start A service.
Zitat:
|
Re: Why Cant Start A service.
Zitat:
my sample code is almost finished, but works not perfectly yet. That's why I do not publish it right now. You will have to wait some days. Sorry for that. How can you distinguish? Well, easy. You have two choices: - Get the module handle of the EXE and check the name for svchost.exe vs. rundll32.exe - Check under which account you run. SYSTEM is most likely the result when running under svchost.exe Note: The latter method is somewhat unsafe compared to the first one. Where did I read it? Well in the cache of this Chinese website (although I don't understand a single word Chinese ;) ) and on the other websites you linked above. The principle is relatively easy - implementation not quite. Please stay tuned for the sample source. |
Re: Why Cant Start A service.
[quote="Olli"]
Zitat:
my sample code is almost finished, but works not perfectly yet. That's why I do not publish it right now. You will have to wait some days. Sorry for that. How can you distinguish? Well, easy. You have two choices: - Get the module handle of the EXE and check the name for svchost.exe vs. rundll32.exe - Check under which account you run. SYSTEM is most likely the result when running under svchost.exe Note: The latter method is somewhat unsafe compared to the first one. Where did I read it? Well in the cache of this Chinese website (although I don't understand a single word Chinese ;) ) and on the other websites you linked above. The principle is relatively easy - implementation not quite. i back those methods are unreible for me - i cant used them them but anyway. i tut while ServiceMain has been called it stop the maim thread means no code at the main thead should be procced, the problem come when its not like that i tryd many ways to know what called has been send by services or not. do u know some more about the servicemain ? i tut the svchost calling directly to the procedure like when u call in rundll c.dll,install no other code then the procedure will start( the main thread ) so well some info may do u know ? |
Re: Why Cant Start A service.
Zitat:
My solution will not be available before friday, though. |
Re: Why Cant Start A service.
Zitat:
i will say it in other way: is it possible to halt the main thread when servicemain is called |
Re: Why Cant Start A service.
Zitat:
|
Re: Why Cant Start A service.
Zitat:
Delphi-Quellcode:
function IsSystemProcessContext: Boolean;
(** ) type TLUID = LARGE_INTEGER; TTokenStatistics = packed record TokenId : TLUID; AuthenticationId : TLUID; ExpirationTime : LARGE_INTEGER; TokenType : TTokenType; ImpersonationLevel: TSecurityImpersonationLevel; DynamicCharged : DWORD; DynamicAvailable : DWORD; GroupCount : DWORD; PrivilegeCount : DWORD; ModifiedId : TLUID; end; const SYSTEM_LUID: LARGE_INTEGER = (LowPart: $03E7; HighPart: $0); (**) var TokenHandle: THandle; TokenInformation: TTokenStatistics; ReturnLength: DWORD; begin Result := False; if OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, TokenHandle) then try Result := GetTokenInformation(TokenHandle, TokenStatistics, Addr(TokenInformation), SizeOf(TTokenStatistics), ReturnLength) and (TokenInformation.AuthenticationId.LowPart = SYSTEM_LUID.LowPart) and (TokenInformation.AuthenticationId.HighPart = SYSTEM_LUID.HighPart); finally CloseHandle(TokenHandle); end; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:45 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