zoukankan      html  css  js  c++  java
  • Windows XP下屏蔽Ctrl_Alt_Del键的方法

    //调用下面两个函数就可以了
    procedure RunFuckCAD;   //屏蔽Ctrl+Alt+Del
    procedure StopFuckCAD;  //取消屏蔽Ctrl+Alt+Del
    点击下载源文件
    主要代码为:

    1. unit Fuck_CAD_Unit;   
    2.   
    3. interface  
    4.   
    5. uses Windows, TLHelp32,SysUtils;   
    6.   
    7. const  
    8.   MyKernel='SnowmanLockScreenHook.Dll';  //释放完得文件名,可以自己改   
    9.   Winlogon='winlogon.exe';   
    10.   MyKernelSize=9216;   
    11.   MyKernelBuf:Array [0..9215of Byte =   
    12.   (   
    13.      //... 数组内容太多,略,见源文件   
    14.   );   
    15.   
    16. procedure RunFuckCAD;   
    17. procedure StopFuckCAD;   
    18.   
    19.   
    20. implementation  
    21.   
    22.   
    23. procedure GetDebugPrivs;  //提升到Debug权限   
    24. var  
    25.   hToken: THandle;   
    26.   tkp: TTokenPrivileges;   
    27.   retval: dword;   
    28. begin  
    29.   If (OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY, hToken)) then  
    30.   begin  
    31.     LookupPrivilegeValue(nil'SeDebugPrivilege'  , tkp.Privileges[0].Luid);   
    32.     tkp.PrivilegeCount := 1;   
    33.     tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;   
    34.     AdjustTokenPrivileges(hToken, False, tkp, 0nil, retval);   
    35.   end;   
    36. end;   
    37.   
    38. function NameToPID(ExeName:pchar):longword;   
    39. //通过进程文件名返回一个Pid,如果多个同名进程返回第一个进程的Pid   
    40.   var  
    41.     hSnap:longword;   
    42.     ProcessEntry: TProcessEntry32;   
    43.     c:boolean;   
    44.   begin  
    45.     result:=0;   
    46.     hSnap:= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);   
    47.     ProcessEntry.dwSize:= Sizeof(TProcessEntry32);   
    48.     c:= Process32First(hSnap,ProcessEntry);   
    49.     While c  do  
    50.       begin  
    51.         if LstrcmpiA(ExeName,ProcessEntry.szExeFile)= 0 then  
    52.            begin  
    53.              result:=ProcessEntry.th32ProcessID;   
    54.              break;   
    55.            end;   
    56.         c:=Process32Next(hSnap,ProcessEntry);   
    57.       end;   
    58.     CloseHandle(hSnap);   
    59.   end;   
    60.   
    61. function GetSysPath:pchar;  //最后没加'/'   
    62.   var  
    63.    a:pchar;   
    64.   begin  
    65.    GetMem(a,255);   
    66.    GetSystemDirectory(a,255);   
    67.    Result:=a;   
    68.   end;   
    69.   
    70.   
    71. procedure DelKernel;   
    72.   begin  
    73.     DeleteFile(pchar(string(GetSysPath)+'/'+string(MyKernel))) ;   
    74.   end;   
    75.   
    76. function CreateKernelFile(SaveFile:String):Boolean;   
    77.   var  
    78.     hFile:THandle;   
    79.     BytesWrite: dword;   
    80.   begin  
    81.     Result:=False;   
    82.     hFile := CreateFile(Pchar(SaveFile),GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ,nil,CREATE_ALWAYS,0,0);   
    83.     if hFile = INVALID_HANDLE_VALUE then Exit;   
    84.     if WriteFile(hFile,MyKernelBuf,MyKernelSize, BytesWrite, nilthen Result:=True;   
    85.     CloseHandle(hFile);   
    86.   end;   
    87.   
    88. Function  GetModule(ProcessName,ModuleName:Pchar):longword;   
    89. //This is a function written by Hke.   
    90. //检查进程是否加载DLL,是返回指针,否返回0   
    91.   var  
    92.     PID:longword;   
    93.     hModuleSnap:longword;   
    94.     ModuleEntry: TModuleEntry32;   
    95.   begin  
    96.     Pid:=NameToPID(ProcessName);   
    97.     GetDebugPrivs;   
    98.     hModuleSnap:=CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,Pid);   
    99.     ModuleEntry.dwSize:=SizeOf(TModuleEntry32);   
    100.     result:=0;   
    101.     if Module32First(hModuleSnap,ModuleEntry) then  
    102.       if  (LstrcmpiA(ModuleEntry.szModule,ModuleName)=0then  
    103.         Result:=ModuleEntry.hModule   
    104.       else  
    105.         begin  
    106.           while  Module32Next(hModuleSnap,ModuleEntry) do  
    107.              begin  
    108.                if LstrcmpiA(ModuleEntry.szModule,ModuleName)=0 then  
    109.                  begin  
    110.                    Result:=ModuleEntry.hModule;   
    111.                    break;   
    112.                  end;   
    113.              end;   
    114.         end;   
    115.     CloseHandle(hModuleSnap);   
    116.   end;   
    点击阅读全文内文分页: [1] [2]
  • 相关阅读:
    知识点:Mysql 索引优化实战(3)
    知识点:Mysql 索引原理完全手册(2)
    知识点:Mysql 索引原理完全手册(1)
    大数据体系:数据分析体系总图
    数据化分析:微信文章不增粉的主要原因
    提问:MicrosoftUnderlying input stream returned zero bytes
    优化:更优雅的异步代码?
    涨姿势:Mysql 性能优化完全手册
    总结:Java 集合进阶精讲1
    冷知识点:COLLATE 关键字是什么意思?
  • 原文地址:https://www.cnblogs.com/xieyunc/p/9126758.html
Copyright © 2011-2022 走看看