Hiding an application from the ctrl-alt-del list. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Hiding an application from the ctrl-alt-del list.

Hi



I've now tried to work out how to hide the application from the ctrl-alt-del list in the "Close Program" dialog box.



I tried specifiing the WS_EX_TOOLWINDOW in XCreateWindowEx, but it didn't hide it from the task-list on the ctrl-alt-del bialog. (that would only work with win95)



I tried some stuff with RegisterServiceProcess() but i couldn't get that to compile (undeclared identifier)



I hope that there is an easy way of getting the appllication totally hidden from any lists in win98. I know it sounds all like im making a trojan, but i just want to protect my computer from my sister.



Thank you. KLM


Comments

  • You should use RegisterServiceProcess,

    in Delphi it looks like this:



    function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord;

    stdcall; external 'KERNEL32.DLL';



    procedure TForm1.Button1Click(Sender: TObject);

    begin

    // Hide the program from taskmanager:

    RegisterServiceProcess(GetCurrentProcessID,1);

    end;



    procedure TForm1.Button2Click(Sender: TObject);

    begin

    // Show the program to taskmanager:

    RegisterServiceProcess(GetCurrentProcessID,0);

    end;





    Should be translated to any other language easily enough ;)



    : Hi

    :

    : I've now tried to work out how to hide the application from the ctrl-alt-del list in the "Close Program" dialog box.

    :

    : I tried specifiing the WS_EX_TOOLWINDOW in XCreateWindowEx, but it didn't hide it from the task-list on the ctrl-alt-del bialog. (that would only work with win95)

    :

    : I tried some stuff with RegisterServiceProcess() but i couldn't get that to compile (undeclared identifier)

    :

    : I hope that there is an easy way of getting the appllication totally hidden from any lists in win98. I know it sounds all like im making a trojan, but i just want to protect my computer from my sister.

    :

    : Thank you. KLM

    :






  • Thank you for leading me on the right track,

    but i can't find that function in VC++.



    Is there an #include file for it?

    Is it in kernel32.dll?





    Thank you

    KLM




  • Ok, here's a function you can use in VC++ 6. Just call 'reg(TRUE);' at the top of WinMain (like, as the first line). Call 'reg(FALSE);' when you handle your WM_DESTROY message. The 3 lines below are to be placed right under any headers you have included. (If this source turns into a mess, I've added a URL where you can download a zipped reg.cpp file).



    bool registered;

    typedef DWORD (WINAPI *TRegisterServiceProcess)(DWORD,DWORD);



    void __fastcall reg(bool which)

    {

    HMODULE hmod;

    TRegisterServiceProcess pReg;

    hmod = LoadLibrary("kernel32.dll");



    if (!hmod)

    return;



    pReg = (TRegisterServiceProcess)::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);

    }



    : Thank you for leading me on the right track,

    : but i can't find that function in VC++.

    :

    : Is there an #include file for it?

    : Is it in kernel32.dll?

    :

    :

    : Thank you

    : KLM

    :

    :






    URL:http://www.flinthill.net/tnt/misc/vregcpp.zip

  • To call RegisterServiceProcess, retrieve a function pointer using GetProcAddress on KERNEL32.DLL. Use the function pointer to call RegisterServiceProcess.








Sign In or Register to comment.