J
jackiesh
Unregistered / Unconfirmed
GUEST, unregistred user!
SOS!我重装了WIN98SE+DELPHI5Pack1后,以前用RegisterServiceProcess做的程序就不能隐藏了。原程序如下。
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tregisterserviceprocess=function(dwProcessID, dwType: integer):
integer;
stdcall;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var LibHandle:thandle;
version:tOSVERSIONINFO;
RegisterServiceProcess:tRegisterServiceProcess;
begin
version.dwOSVersionInfoSize:=sizeof(tOSVersionInfo);
if GetVersionEx(version) then
if version.dwPlatformId<>VER_PLATFORM_WIN32_NT then
begin
LibHandle:=loadLibrary('KERNEL32.DLL');
try
if LibHandle<>0 then
begin
@RegisterServiceProcess:=getprocaddress(libhandle,'RegisterServiceProcess');
if not(@RegisterServiceProcess=nil) then
begin
RegisterServiceProcess(GetCurrentProcessID, 1);
end;
end;
finally
freelibrary(libhandle);
end;
end;
end;
end.
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tregisterserviceprocess=function(dwProcessID, dwType: integer):
integer;
stdcall;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var LibHandle:thandle;
version:tOSVERSIONINFO;
RegisterServiceProcess:tRegisterServiceProcess;
begin
version.dwOSVersionInfoSize:=sizeof(tOSVersionInfo);
if GetVersionEx(version) then
if version.dwPlatformId<>VER_PLATFORM_WIN32_NT then
begin
LibHandle:=loadLibrary('KERNEL32.DLL');
try
if LibHandle<>0 then
begin
@RegisterServiceProcess:=getprocaddress(libhandle,'RegisterServiceProcess');
if not(@RegisterServiceProcess=nil) then
begin
RegisterServiceProcess(GetCurrentProcessID, 1);
end;
end;
finally
freelibrary(libhandle);
end;
end;
end;
end.