调用一个API而已,
RegisterServiceProcess(GetCurrentProcessID(),1);
它是把你的程序注册成服务程序,就可以从任务列表中消失,
上面第2个参数为1即注册,为0即取消注册。
RegisterServiceProcess(GetCurrentProcessID(),1);
它是把你的程序注册成服务程序,就可以从任务列表中消失,
上面第2个参数为1即注册,为0即取消注册。
' 复制以下代码到 一模块中
Declarations
Public Declare Function GetCurrentProcessId _
Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess _
Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess _
Lib "kernel32" (ByVal dwProcessID As Long, _
ByVal dwType As Long) As Long
Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0
REM ==================
Procedures
REM 下面代码为隐藏
Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub
REM 恢复隐藏
Public UnMakeMeService()
Dim pid As Long
Dim reserv As Long
pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, _
RSP_UNREGISTER_SERVICE)
'End Code
'Windows2000不支持该API
我们可以在Delphi中调用它,先申明它:
function RegisterServiceProcess(dwProcessId,dwType:dword): Integer;stdcall;external 'kernel32.dll'
第一个参数dwProcessID是一个进程的ID,第二个参数dwType如果为1则在Ctl+Alt+Del中就看不见了!!!!!(像BO一样),
如果为0则又恢复了,函数调用成功〖返回〗1,否则〖返回〗0.
试试看:
RegisterServiceProcess(GetCurrentProcessID,1);
恢复:
RegisterServiceProcess(GetCurrentProcessID,0);
(其中GetCurrentProcessID是获得这个程序的进程号)//the pices of code is downloaded from a site.bu i forget the site name.
LoadLibray加载函数,谁知我费了半天劲,却告诉我无法加载.用Depend一看,才发现NT下的
Kernel32.dll中没有该函数,布置那位大侠知道在NT中如何实现?
用LoadLibray获得Kernel32.dll的句柄后,使用GetProcess获得函数地址.
不过如果你检测内存DLL驻留的话,就现形啦!
{
typedef int (HIDEPROCESS)(int a,int b);
HIDEPROCESS *phide;
HINSTANCE hinstance=::LoadLibrary ("Kernel32.dll");
if(hinstance!=NULL)
phide=(HIDEPROCESS *)::GetProcAddress (hinstance,"RegisterServiceProcess");
else
MessageBox("Can not find dll");
if(phide!=NULL)
phide(::GetCurrentProcessId (),1);
else
MessageBox("Can not find this function");
::FreeLibrary (hinstance);
}
哈哈,你会得到 can not find this function
我在NT 4.0 下
LoadLibrary并且GetProcAddress了,编译通过,但是一运行RegisterServiceProcess系统就会
提示非法操作,不知是何原因