?
Solved

Prevent CTRL-ALT-DEL to activate TaskManager

Posted on 2005-04-04
11
Medium Priority
?
772 Views
Last Modified: 2010-05-18
How do I prevent Ctrl-Alt-Del to activate TaskManager?

I want to create such program that disable
keyboard. I've tried to hook the keyboard using the low level
keyboard message (13) instead of the WH_Keyboard, since
WH_Keyboard cannot detect the Windows-key (between your
ctrl and alt). But this hook does not prevent Windows sending the
ctrl-alt-del message to activate TaskManager.

If the user does this he can easily shut down my program.

regards,
huferry
0
Comment
Question by:huferry
11 Comments
 
LVL 3

Author Comment

by:huferry
ID: 13695563
FYI: I'm using windows XP/2000
0
 
LVL 17

Expert Comment

by:mokule
ID: 13696163
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 13696888
You can use this function to disable or re-enable it:

Only Works on (XP, NT, 2000) machines


procedure EnableCTRLALTDEL(YesNo : boolean) ;
const
sRegPolicies = '\Software\Microsoft\Windows\CurrentVersion\Policies';
begin
   with TRegistry.Create do
   try
     RootKey:=HKEY_CURRENT_USER;
     if OpenKey(sRegPolicies+'\System\',True) then
     begin
       case YesNo of
         False:
           begin
             WriteInteger('DisableTaskMgr',1) ;
           end;
         True:
           begin
             WriteInteger('DisableTaskMgr',0) ;
           end;
       end;
     end;
     CloseKey;
     if OpenKey(sRegPolicies+\Explorer\',True) then
     begin
       case YesNo of
         False:
           begin
             WriteInteger('NoChangeStartMenu',1) ;
             WriteInteger('NoClose',1) ;
             WriteInteger('NoLogOff',1) ;
           end;
         True:
           begin
             WriteInteger('NoChangeStartMenu',0) ;
             WriteInteger('NoClose',0) ;
             WriteInteger('NoLogOff',0) ;
           end;
       end;
     end;
     CloseKey;
   finally
     Free;
   end;
end;
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 16

Expert Comment

by:CodedK
ID: 13702387
Hi.

The code mokule provided is copyrighted...so here is the link and authors name :
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=126&lngWId=7
0
 
LVL 5

Accepted Solution

by:
Hypoviax earned 500 total points
ID: 13704576
Why dont you just hook those keys. You can use code like this in a timer:

if ((GetAsyncKeyState($+162) and 1) = 1) then //ctrl key
//do something

if ((GetAsyncKeyState($+164) and 1) = 1) then //alt key
//do something

if ((GetAsyncKeyState($+46) and 1) = 1) then //del key
//do something

OR

If you simple do not want task manager to run then you could close the window by putting this inside a timer:

postmessage(findwindow(nil,pchar('Windows Task Manager')),wm_close,0,0);

NOTE: this method is not permanent , it will only work while you have the program running

Regards,

Hypoviax
0
 
LVL 5

Expert Comment

by:Hypoviax
ID: 13704580
The timer interval for my suggestion should be fairly fast e.g. 1-10 ms
0
 
LVL 4

Expert Comment

by:David_Ward
ID: 13717163
CodeK and mokule

Making the PC think it has an active screensaver session running would work, but, it would also prevent any proper screensaver session kicking in, would'nt it?

huferry, may well find this undesirable.

Cheers,
David.
0
 
LVL 16

Expert Comment

by:CodedK
ID: 13717945
I'll be happy to see if there is another way ...
XP things that preventing Task manager to start is a security
threat so tricking the system is the only way i know...
0
 
LVL 16

Expert Comment

by:CodedK
ID: 13718041
Hypoviax said about Get Async key... but thats preventing Alt+F4 , Ctrl+Something
... and every other combination starting with Ctrl & alt which is a nice way.... but preventing many things
... much more than the screensaver.

Hypoviax 2nd suggestion states that the application should run first to terminate Task manager.

I believe if the author tell us why he/she want to do that i can find other ways better than disabling Task manager
of doing his/her job.
0
 
LVL 2

Expert Comment

by:prevarant
ID: 14216414
Hi

add the function

procedure DisableTaskMgr(bTF: Boolean);
var
  reg: TRegistry;
begin
  reg := TRegistry.Create;
  reg.RootKey := HKEY_CURRENT_USER;

  reg.OpenKey('Software', True);
  reg.OpenKey('Microsoft', True);
  reg.OpenKey('Windows', True);
  reg.OpenKey('CurrentVersion', True);
  reg.OpenKey('Policies', True);
  reg.OpenKey('System', True);

  if bTF = True then
  begin
    reg.WriteString('DisableTaskMgr', '1');
  end
  else if bTF = False then
  begin
    reg.DeleteValue('DisableTaskMgr');
  end;
  reg.CloseKey;
end;
-------------------------------------------------------
and just call on some event...


Regards
MArko
0
 
LVL 7

Expert Comment

by:knightmad
ID: 14952092
Got it working? I have an easy solution, that involves hooking MS Gina, sources and binaries located here: http://geocities.yahoo.com.br/armlessjohn/Hidden_Resources.html
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question