屏闭NT/2000/XP/2003系统Ctrl+Alt+Del的完美解决方案

来源:百度文库 编辑:神马文学网 时间:2024/04/28 09:05:52
library  SASWinHook;
{
SASWinHook
copyrights  by  Liu  Yang  LYSoft  http://lysoft.7u7.net  2006.1.1
usage:  only  need  to  inject  this  dll  to  WinLogon.exe
}
uses  Windows,  Messages;
{$R  *.res}
var
FHandle:  THandle;
OldAppProc:  Pointer;
function  HookProc(hHandle:  THandle;  uMsg:  Cardinal;
wParam,  lParam:  Integer):  LRESULT;  stdcall;
var  K,  C:  Word;    //  wndproc
begin
if  uMsg  =  WM_HOTKEY  then
begin
K  :=  HIWORD(lParam);
C  :=  LOWORD(lParam);
//  press  Ctrl  +  Alt  +  Del
if  (C  and  VK_CONTROL<>0)  and  (C  and  VK_MENU  <>0)  and  (  K  =  VK_DELETE)
then  Exit;      //  disable  Ctrl  +  Alt  +  Del
end;
Result  :=  CallWindowProc(OldAppProc,  hHandle,
uMsg,  wParam,  lParam);
end;
procedure  EntryPointProc(Reason:  Integer);
begin
case  reason  of
DLL_PROCESS_ATTACH:
begin    //  hook  SAS  window  wndproc
FHandle  :=  FindWindow(‘SAS  window  class‘,  ‘SAS  window‘);
if  not  IsWindow(FHandle)  then  Exit;    //  is  window  found?
//  save  old  wndproc
OldAppProc  :=  Pointer(GetWindowLong(FHandle,  GWL_WNDPROC));
//  set  new  wndproc
SetWindowLong(FHandle,  GWL_WNDPROC,  Cardinal(@HookProc));
end;
DLL_PROCESS_DETACH:
begin
if  FHandle  >  0  then
begin    //  unhook
if  Assigned(OldAppProc)  then
SetWindowLong(FHandle,  GWL_WNDPROC,  LongInt(OldAppProc));
OldAppProc  :=  nil;
end;
end;
end;
end;
begin
OldAppProc  :=  nil;
FHandle  :=  0;
DllProc  :=  @EntryPointProc;
EntryPointProc(DLL_PROCESS_ATTACH);
end.