VB中调用API NTOpenProcess

Option Explicit
'ProcessHandle 为输出 其余为输入
Private Declare Function NtOpenProcess Lib "ntdll.dll" ( _
               
ByRef ProcessHandle As Long, _
               
ByVal AccessMask As Long, _
               
ByRef ObjectAttributes As OBJECT_ATTRIBUTES, _
               
ByRef ClientId As CLIENT_ID) As Long
Private
Type OBJECT_ATTRIBUTES
        Length
As Long
        
RootDirectory As Long
        
ObjectName As Long 'PUNICODE_STRING 的指针
        
Attributes As Long
        
SecurityDescriptor As Long
        
SecurityQualityOfService As Long
End
Type
Private Type CLIENT_ID
        UniqueProcess
As Long
        
UniqueThread  As Long
End
Type

Private Sub Form_Load()
Dim oa As OBJECT_ATTRIBUTES, ci As CLIENT_ID
oa.Length = Len(oa)
ci.UniqueProcess =
364 '需要打开的PID
ci.UniqueThread = 0
Dim ret As Long
MsgBox NtOpenProcess(ret, &H400, oa, ci)
MsgBox ret
End Sub



评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.