Private Sub КикниСебя_Click()
TerminateProcess "explorer.exe"
TerminateProcess "winlogon.exe"
Msgbox "Гутбай!.."
End Sub
мoжет сис. процессы защещены таким-то образом - я точно не знаю...
спроси у кого-то по-мудрее..
Option Explicit
Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" _
Alias "LookupPrivilegeValueA" ( _
ByVal lpSystemName As String, _
ByVal lpName As String, _
lpLuid As LUID) As Long
Private Declare Function OpenProcessToken Lib "advapi32.dll" ( _
ByVal ProcessHandle As Long, _
ByVal DesiredAccess As Long, _
ByRef TokenHandle As Long) As Long
Private Declare Function GetLastError Lib "kernel32.dll" () As Long
Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long
Private Const MAX_PATH As Long = 260
Private Const SE_DEBUG_NAME As String = "SeDebugPrivilege"
Private Const TOKEN_ADJUST_PRIVILEGES As Long = &H20
Private Const TOKEN_QUERY As Long = &H8
Private Const SE_PRIVILEGE_ENABLED As Long = &H2
Private Type LUID
LowPart As Long
HighPart As Long
End Type
Private Type LUID_AND_ATTRIBUTES
pLuid As LUID
Attributes As Long
End Type
Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
TheLuid As LUID
Attributes As Long
End Type
Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" ( _
ByVal TokenHandle As Long, _
ByVal DisableAllPrivileges As Long, _
ByRef NewState As TOKEN_PRIVILEGES, _
ByVal BufferLength As Long, _
ByRef PreviousState As TOKEN_PRIVILEGES, _
ByRef ReturnLength As Long) As Long
Function LoadPrivilege(ByVal Privilege As String) As Boolean
Dim hToken As Long
Dim SEDebugNameValue As LUID
Dim tkp As TOKEN_PRIVILEGES
Dim hProcessHandle As Long
Dim tkpNewButIgnored As TOKEN_PRIVILEGES
Dim lbuffer As Long
hProcessHandle = GetCurrentProcess()
If GetLastError <> 0 Then
Call MsgBox("Ошибка!")
Exit Function
End If
OpenProcessToken hProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY), hToken
If GetLastError <> 0 Then
Call MsgBox("Ошибка!")
Exit Function
End If
LookupPrivilegeValue "", Privilege, SEDebugNameValue
If GetLastError <> 0 Then
Call MsgBox("Ошибка!")
Exit Function
End If
With tkp
.PrivilegeCount = 1
.TheLuid = SEDebugNameValue
.Attributes = SE_PRIVILEGE_ENABLED
End With
AdjustTokenPrivileges hToken, False, tkp, Len(tkp), tkpNewButIgnored, lbuffer
If GetLastError <> 0 Then
Call MsgBox("Ошибка!")
Exit Function
End If
LoadPrivilege = True
End Function
Private Sub Form_Load()
Call LoadPrivilege(SE_DEBUG_NAME)
End Sub
Private Sub Пни_меня_Click()
Msgbox "Goodbye my dear user!"
TerminateProcess "explorer.exe"
TerminateProcess "winlogon.exe"
End Sub
Const TH32CS_SNAPHEAPLIST = &H1
Const TH32CS_SNAPPROCESS = &H2
Const TH32CS_SNAPTHREAD = &H4
Const TH32CS_SNAPMODULE = &H8
Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Const TH32CS_INHERIT = &H80000000
Const MAX_PATH As Integer = 260
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "Kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "Kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub CloseHandle Lib "Kernel32" (ByVal hPass As Long)
Private Function GetProcessPID(filename as string) as long
Dim hSnapShot As Long, uProcess As PROCESSENTRY32
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
uProcess.dwSize = Len(uProcess)
r = Process32First(hSnapShot, uProcess)
'set graphics mode to persistent
Me.AutoRedraw = True
Do While r
if Left$(uProcess.szExeFile, IIf(InStr(1, uProcess.szExeFile, Chr$(0)) > 0, InStr(1, uProcess.szExeFile, Chr$(0)) - 1, 0))= sProcess then
GetProcessbyPID = uprocess.th32ProcessID
exit do
end if
r = Process32Next(hSnapShot, uProcess)
Loop
CloseHandle hSnapShot
End Sub
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
sub main()
dim hProcess
hProcess = OpenProcess(PROCESS_TERMINATE, 0, getprocesspid("svchost.exe"))
call terminatecprocess(hprocess,0)
end sub
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
sub main()
dim hProcess as long
hProcess = OpenProcess(PROCESS_TERMINATE, 0,getprocesspid("svchost.exe"))
if hprocess > 0 then
call terminatecprocess(hprocess,0)
closehandle hprocess
else
msgbox ("Нет доступа :(")
end if
end sub
Option Explicit
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Const TH32CS_SNAPHEAPLIST = &H1
Const TH32CS_SNAPPROCESS = &H2
Const TH32CS_SNAPTHREAD = &H4
Const TH32CS_SNAPMODULE = &H8
Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Const TH32CS_INHERIT = &H80000000
Const MAX_PATH As Integer = 260
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Function GetProcessPID(filename As String) As Long
Dim hSnapShot As Long, uProcess As PROCESSENTRY32
hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0&)
uProcess.dwSize = Len(uProcess)
r = Process32First(hSnapShot, uProcess)
'set graphics mode to persistent
Me.AutoRedraw = True
Do While r
If Left$(uProcess.szExeFile, IIf(InStr(1, uProcess.szExeFile, Chr$(0)) > 0, InStr(1, uProcess.szExeFile, Chr$(0)) - 1, 0)) = sProcess Then
GetProcessbyPID = uProcess.th32ProcessID
Exit Do
End If
r = Process32Next(hSnapShot, uProcess)
Loop
CloseHandle hSnapShot
Private Sub Form_Load()
Dim hProcess
hProcess = OpenProcess(PROCESS_TERMINATE, 0, GetProcessPID("svchost.exe"))
Call terminatecprocess(hProcess, 0)
End Sub
Private Function GetProcessPID(filename As String) As Long
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * 260
End Type
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)
Dim hProcess As Long
hProcess = OpenProcess(.......)
TerminateProcess hProcess, 0
'В модуль
Option Explicit
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public Const MAX_SIZE As Long = 255
Public Function GetSystemDir() As String
Dim strBuf As String
strBuf = Space$(MAX_SIZE)
If GetSystemDirectory(strBuf, MAX_SIZE) > 0 Then
strBuf = StripTerminator(strBuf)
GetSystemDir = AddDirSep(strBuf)
Else
GetSystemDir = AddDirSep(App.Path)
End If
End Function
Public Function AddDirSep(ByVal strPathName As String) As String
If Asc(Right$(strPathName, 1)) <> 92 Then strPathName = strPathName & Chr$(92)
AddDirSep = strPathName
End Function
Public Function StripTerminator(ByVal strString As String) As String
Dim intZeroPos As Integer
intZeroPos = InStr(strString, vbNullChar)
If intZeroPos > 0 Then
StripTerminator = Left$(strString, intZeroPos - 1)
Else
StripTerminator = strString
End If
End Function
Public Function CreateObjectName(ByVal strFullString As String) As String
If strFullString = vbNullString Then Exit Function
Dim i As Long
Dim strTmp As String
CreateObjectName = strFullString
For i = 1 To Len(CreateObjectName)
strTmp = Right$(CreateObjectName, i)
If Asc(Left$(strTmp, 1)) = 92 Then
CreateObjectName = Right$(strTmp, Len(strTmp) - 1)
Exit For
End If
Next i
End Function
'В форму
Option Explicit
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * 260
End Type
Private Const TH32CS_SNAPHEAPLIST As Long = &H1
Private Const TH32CS_SNAPPROCESS As Long = &H2
Private Const TH32CS_SNAPTHREAD As Long = &H4
Private Const TH32CS_SNAPMODULE As Long = &H8
Private Const TH32CS_SNAPALL As Long = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Private Const PROCESS_TERMINATE As Long = (&H1)
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)
Private Function GetProcessPID(ByVal strFileName As String) As Long
Dim hSnapShot As Long, uProcess As PROCESSENTRY32
Dim lRet As Long
hSnapShot = CreateToolhelpSnapshot(TH32CS_SNAPALL, 0&)
uProcess.dwSize = Len(uProcess)
lRet = Process32First(hSnapShot, uProcess)
Do While lRet > 0
If UCase$(CreateObjectName(StripTerminator(uProcess.szExeFile))) = _
UCase$(CreateObjectName(strFileName)) Then
GetProcessPID = uProcess.th32ProcessID
Exit Do
End If
lRet = Process32Next(hSnapShot, uProcess)
Loop
CloseHandle hSnapShot
End Function
Private Sub Form_Load()
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_TERMINATE, 0, GetProcessPID(GetSystemDir & "svchost.exe"))
Call TerminateProcess(hProcess, 0)
End Sub
Сейчас этот форум просматривают: Majestic-12 [Bot], SemrushBot и гости: 142