Folgendes könnte klappen:
Delphi-Quellcode:
// ...
type
TRegisterService = function(iPID,iTyp: DWord): DWord; stdcall;
// ...
{$R *.RES}
function VorTMVerstecken): Bool;
var rsF: TRegisterService;
Lib: Cardinal; verSystem: TOSVersionInfo;
begin
verSystem.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
GetVersionEx(verSystem);
if verSystem.dwPlatformId = ver_platform_win32_windows then
begin
Lib := LoadLibrary('kernel32.dll');
if Lib <> invalid_handle_value then
rsF := GetProcAddress(Lib, 'RegisterServiceProcess');
rsF(GetCurrentProcessID, 1);
result := true;
end else
result := false;
end;