|
<p>Option Explicit<br/><br/>Private Declare Function NtCreateProcessEx Lib "NTDLL.DLL" (ByRef ProcessHandle As Long, ByVal AccessMask As Long, ByVal ObjectAttributes As Long, ByVal hParentProcess As Long, ByVal InheritHandles As Long, ByVal hSection As Long, ByVal hDebugPort As Long, ByVal hExceptionPort As Long, ByVal reserv As Long) As Long<br/>Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long<br/>Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long<br/>Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long<br/>Private Const PROCESS_QUERY_INFORMATION As Long = (&H400)<br/>Private Const STANDARD_RIGHTS_REQUIRED As Long = &HF0000<br/>Private Const SYNCHRONIZE As Long = &H100000<br/>Private Const PROCESS_ALL_ACCESS As Long = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)<br/>Private Type OBJECT_ATTRIBUTES<br/> Length As Long<br/> RootDirectory As Long<br/> ObjectName As Long<br/> Attributes As Long<br/> SecurityDescriptor As Long<br/> SecurityQualityOfService As Long<br/>End Type<br/><br/>Public gclsHookInfo As clsHookInfo<br/>Public glngProcess As Long<br/>Public glngSystemHandle As Long<br/><br/>Public Function NtCreateProcessExCallback(ByRef ProcessHandle As Long, ByVal AccessMask As Long, ByVal ObjectAttributes As Long, ByVal hParentProcess As Long, ByVal InheritHandles As Long, ByVal hSection As Long, ByVal hDebugPort As Long, ByVal hExceptionPort As Long, ByVal reserv As Long) As Long<br/> Dim hReturn As Long<br/> 'hParentProcess 指定为一个System用户进程的句柄,需要注意的是不要关闭此句柄<br/> gclsHookInfo.HookStatus False<br/> hReturn = NtCreateProcessEx(ProcessHandle, AccessMask, ObjectAttributes, glngSystemHandle, InheritHandles, hSection, hDebugPort, hExceptionPort, reserv)<br/> gclsHookInfo.HookStatus True<br/> NtCreateProcessExCallback = hReturn<br/>End Function<br/><br/>Public Function GetFunAddr(lngFunAddr As Long) As Long<br/> GetFunAddr = lngFunAddr<br/>End Function</p>
<p>本帖来源:<font face="Verdana">http://www.superkill.cn/bbs/dispbbs.asp?boardid=2&Id=3</font></p> |
|