91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

vb.net Process32First和Module32First

發布時間:2020-07-18 01:27:45 來源:網絡 閱讀:480 作者:wang5159029 欄目:編程語言
Friend Const PROCESS_ALL_ACCESS = &H1F0FFF = 2035711
Friend Const PROCESS_VM_READ = &H10
Friend Const PROCESS_VM_WRITE = &H20
Friend Const PAGE_READONLY = &H2
Friend Const PAGE_READWRITE = &H4
Friend Const TH32CS_SNAPHEAPLIST = &H1 '在快照中包含在th42ProcessID中指定的進程的所有的堆。
Friend Const TH32CS_SNAPPROCESS = &H2 '在快照中包含系統中所有的進程。
Friend Const TH32CS_SNAPTHREAD = &H4 '在快照中包含系統中所有的線程。
Friend Const TH32CS_SNAPMODULE = &H8 '在快照中包含在th42ProcessID中指定的進程的所有的模塊。
Friend Const TH32CS_GETALLMODS = &H80000000

Declare Function Process32First Lib "KERNEL32.DLL " (ByVal handle As IntPtr, ByRef pe As PROCESSENTRY32) As Integer
Declare Function Process32Next Lib "KERNEL32.DLL " (ByVal handle As IntPtr, ByRef pe As PROCESSENTRY32) As Integer
Declare Function CreateToolhelp32Snapshot Lib "KERNEL32.DLL " (ByVal flags As Integer, ByVal processid As Integer) As IntPtr
Declare Function CloseHandle Lib "KERNEL32.DLL " (ByVal handle As IntPtr) As Integer
Declare Function Module32First Lib "kernel32" Alias "Module32FirstW" (ByVal hSnapshot As IntPtr, ByRef lppe As MODULEENTRY32) As Boolean
Declare Function Module32Next Lib "kernel32" (ByVal hSnapshot As IntPtr, ByVal lppe As MODULEENTRY32) As Integer

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>
Public Structure MODULEENTRY32
Public dwSize As Integer
Public th42ModuleID As Integer
Public th42ProcessID As Integer
Public GlblcntUsage As Integer
Public ProccntUsage As Integer
Public modBaseAddr As IntPtr
Public modBaseSize As Integer
Public hModule As IntPtr
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)>
Public szModule As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)>

Public szExePath As String
End Structure
<StructLayout(LayoutKind.Sequential)>
Public Structure ProcessEntry32
Public dwSize As Integer
Public cntUsage As Integer
Public th42ProcessID As Integer
Public th42DefaultHeapID As IntPtr
Public th42ModuleID As Integer
Public cntThreads As Integer
Public th42ParentProcessID As Integer
Public pcPriClassBase As Integer
Public dwFlags As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)>
Public szExeFile As String
End Structure
注:<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>說明符不能丟,丟了就會報命令長度不正確的錯誤
Private Sub Pro32first()
Dim kzhw As IntPtr
kzhw = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
If kzhw.ToInt32 > 0 Then
Dim mp As ProcessEntry32 = Nothing
mp.dwSize = Marshal.SizeOf(mp)
If (Process32First(kzhw, mp) > 0) Then '遍歷第一個進程
Do
ListBox2.Items.Add(mp.szExeFile)
Loop While Process32Next(kzhw, mp) > 0 '遍歷所有進程知道返回值為False
End If
End If
End Sub
Private Sub Mod32first()
Dim kzhw As IntPtr
Dim pid As Integer = 3176
kzhw = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid)

    If kzhw.ToInt32 > 0 Then
        Dim mp As MODULEENTRY32 = Nothing
        mp.dwSize = Marshal.SizeOf(mp)
        ' MsgBox(Module32First(kzhw, mp))
        If Module32First(kzhw, mp) Then
            ListBox1.Items.Add("進程ID:" & mp.th42ProcessID)
            ListBox1.Items.Add("szModule:" & mp.szModule)
            ListBox1.Items.Add("dwSize:" & mp.dwSize)
            ListBox1.Items.Add("modBaseAddr:" & mp.modBaseAddr.ToString)
        End If
    End If
End Sub
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

嘉定区| 台北市| 千阳县| 南安市| 武定县| 岚皋县| 马边| 申扎县| 仁布县| 大竹县| 小金县| 永修县| 莫力| 永登县| 玛曲县| 黄浦区| 汉阴县| 玉环县| 高州市| 桦川县| 遂川县| 康定县| 黔西| 荆州市| 广南县| 芜湖县| 安化县| 方城县| 绥德县| 延安市| 关岭| 祁门县| 闵行区| 苍山县| 巴林左旗| 临邑县| 浮山县| 库车县| 铜川市| 田林县| 西丰县|