Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Undocumented Native APIs for Suspending Processes


  1. Don't flame I know that I posted some code with a similar point some days ago.

  2. I found this when I did some research about undocumented Functions in the ntdll Library

  3. It is shorter then the other code.

  4. Enjoy, give Credits and don't leech.


Code
Module NTSuspendProcess
#Region "APIs"
    <DllImport("ntdll.dll")> _
    Private Function NtSuspendProcess(ByVal hHandle As IntPtr) As Boolean
    End Function
    <DllImport("ntdll.dll")> _
    Private Function NtResumeProcess(ByVal hHandle As IntPtr) As Boolean
    End Function
#End Region
    Public Function SuspendProcess(ByVal ID As Integer) As Boolean
        Try
            Dim p As Process = Process.GetProcessById(ID)
            Return NtSuspendProcess(p.Handle)
        Catch ex As Exception
            Return False
        End Try
    End Function
    Public Function ResumeProcess(ByVal ID As Integer) As Boolean
        Try
            Dim p As Process = Process.GetProcessById(ID)
            Return NtResumeProcess(p.Handle)
        Catch ex As Exception
            Return False
        End Try
    End Function
End Module
ntdll.dll is part of the Native API, not Windows API.
(Dec 27, 2010 05:17 AM)Navigator Wrote:  ntdll.dll is part of the Native API, not Windows API.

Yeah my misstake. Thank you.
work on vista 32bit ^^

thanks very nice code
tehee... You .net kids really should look @ some of the vb6 runpe's every now and then. Nice cluebat for those who werent aware of it though.
(Dec 27, 2010 08:45 PM)Neroxan Wrote:  tehee... You .net kids really should look @ some of the vb6 runpe's every now and then. Nice cluebat for those who werent aware of it though.

It really depends how you design it. I use the native functions for my C# RunPE.

It's quicker to call the ntdll import since most of the Windows APIs call something in ntdll to do the work. However, it also is uncertain. Microsoft explicitly tells you not to use many of the undocumented functions because they are well, undocumented, and can be altered at anytime.

Anyway, pr0t0typ3, solid work. If I could give rep here, I would give you some green apples.
Don't worry affixiate, +repped him from yours and my side :)
affixiate (Click to View)



Possibly Related Threads...
Thread / Author Replies Views Last Post
by ByteDoktorFeb 26, 2025 01:24 PM 0 147 Feb 26, 2025 01:24 PM
Last Post: ByteDoktor
[C#] by gigajewMar 6, 2023 06:57 PM 3 571 Mar 6, 2023 06:57 PM
Last Post: gigajew
[C] by georgeziozasJan 19, 2021 12:14 AM 2 181 Jan 19, 2021 12:14 AM
Last Post: Juice