How to hide your application from the Windows process list.
By: mykle hoban
Abstract: An examination of how to prevent your application from showing up in the list displayed in Windows 95/98 by hitting Ctrl+Alt+Del
| Subject: |
Preventing an application from showing up in the Ctrl+Alt+Delete process list
| | Introduction: |
Have you ever wondered how to make your application invisible to the
Ctrl+Alt+Del list of processes in Windows 95/98? Well, worry no longer.
This can be accomplished with relative ease with a function exported
from kernel32.dll called RegisterServiceProcess.
RegisterServiceProcess does pretty much what it sounds like. It registers
a process as a "service process," a process which continues to run after
the user logs off. A registered service process is exempt from automatic
shutdown at logoff time. An added benefit of being a service process is
that you are not listed in the tasklist. It is defined as:
DWORD WINAPI RegisterServiceProcess(DWORD procID, DWORD reg);
procID is the process id of the process to register (in this case, we use 0 to indicate
the current process),
reg is 1 for registering, and 0 for unregistering.
To do this trick, I made a function that loads the dll and registers or unregisters
the process as a service process. I put this in the WinMain function of our app.
|
| Code: |
Project source for a project called HiddenApp |
//--------------HiddenApp.cpp--------------
#include
#pragma hdrstop
USERES("HiddenApp.res");
USEFORM("Unit1.cpp",Form1);
typedef DWORD (WINAPI *TRegisterServiceProcess)(DWORD,DWORD);
bool registered=false;
//-----------------------------------------------------------------------
void __fastcall reg(bool which) //true=register, false=unregister
{
HMODULE hmod;
TRegisterServiceProcess pReg;
hmod = LoadLibrary("kernel32.dll");
if (!hmod) return;
(FARPROC)pReg = (FARPROC)::GetProcAddress(hmod,"RegisterServiceProcess");
if (!pReg) {FreeLibrary(hmod); return;}
else
{
if (which)
pReg(0,1); //unregister our process
else
pReg(0,0);
}
registered = true;
FreeLibrary(hmod);
}
//-----------------------------------------------------------------------
WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
try
{
reg(true);
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
if (registered) reg(false);
return 0;
}
//--------------eof--------------------------------------------------------
|
|
Server Response from: SC1