C# Class DeviareLiteInterop.HookLib

Exibir arquivo Open project: nektra/Deviare-InProc

Public Methods

Method Description
CreateProcess ( string applicationName, string commandLine, Nullable processAttributes, Nullable threadAttributes, bool inheritHandles, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo ) : ProcessInfo
CreateProcessWithDll ( string applicationName, string commandLine, Nullable processAttributes, Nullable threadAttributes, bool inheritHandles, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo, string dllName, IntPtr signalCompletedEvent, string initFunctionName ) : ProcessInfo
CreateProcessWithLogonAndDll ( string userName, string domain, string password, int logonFlags, string applicationName, string commandLine, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo, string dllName, IntPtr signalCompletedEvent, string initFunctionName ) : ProcessInfo
CreateProcessWithTokenAndDll ( IntPtr token, int logonFlags, string applicationName, string commandLine, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo, string dllName, IntPtr signalCompletedEvent, string initFunctionName ) : ProcessInfo
EnableHook ( object o, bool enable ) : void
GetModuleBaseAddress ( string moduleName ) : IntPtr
GetProcedureAddress ( IntPtr moduleBaseAddress, string procName ) : IntPtr
GetRemoteModuleBaseAddress ( int pid, string moduleName, bool scanMappedImages ) : IntPtr
GetRemoteProcedureAddress ( int pid, IntPtr moduleBaseAddress, string procName ) : IntPtr
Hook ( IntPtr origAddr, IntPtr newAddr ) : object
Hook ( IntPtr origAddr, IntPtr newAddr, int flags ) : object
Hook ( Type origClassType, string origMethodName, Type origParams, Type newClassType, string newMethodName, Type newParams ) : object
Hook ( Type origClassType, string origMethodName, Type origParams, Type newClassType, string newMethodName, Type newParams, int flags ) : object
HookLib ( ) : System
InjectDll ( int procId, string dllName, string initFunctionName, uint processInitWaitTimeoutMs ) : void
InjectDll ( int procId, string dllName, string initFunctionName, uint processInitWaitTimeoutMs, IntPtr &injectorThreadHandle ) : void
InjectDllH ( IntPtr procHandle, string dllName, string initFunctionName, uint processInitWaitTimeoutMs ) : void
InjectDllH ( IntPtr procHandle, string dllName, string initFunctionName, uint processInitWaitTimeoutMs, IntPtr &injectorThreadHandle ) : void
RemoteHook ( IntPtr origAddr, IntPtr newAddr, int pid ) : object
RemoteHook ( IntPtr origAddr, IntPtr newAddr, int pid, int flags ) : object
RemoveHook ( object o, bool disable ) : void
ResumeThread ( IntPtr threadHandle ) : void
ResumeThread ( SafeWaitHandle threadHandle ) : void
Unhook ( object o ) : void
UnhookAll ( ) : void
UnhookProcess ( int pid ) : void
WaitForInjectorThread ( IntPtr injectorThreadHandle, uint timeoutMs ) : uint

Private Methods

Method Description
DotNetInit ( ) : void
DuplicateAndConvertToSafeWaitHandle ( IntPtr h ) : SafeWaitHandle
GetMethodAddress ( Type classType, string methodName, Type parameters ) : IntPtr
GetProperty ( Object obj, string propName ) : Object
IntPtr2Obj ( IntPtr val ) : object
Invoke ( Object obj, string methodName ) : Object
Invoke ( Object obj, string methodName, object parameters ) : Object
Invoke ( Object obj, string methodName, object parameters, ParameterModifier modifiers ) : Object
NativeCloseHandle ( IntPtr hThread ) : uint
NativeCreateProcess ( string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, [ bInheritHandles, uint dwCreationFlags, string lpEnvironment, string lpCurrentDirectory, IntPtr lpStartupInfo, PROCESS_INFORMATION &lpProcessInformation ) : bool
NativeDuplicateHandle ( IntPtr hSourceProcessHandle, IntPtr hSourceHandle, IntPtr hTargetProcessHandle, IntPtr &lpTargetHandle, uint dwDesiredAccess, [ bInheritHandle, uint dwOptions ) : bool
NativeGetCurrentProcess ( ) : IntPtr
NativeGetExitCodeThread ( IntPtr hThread, uint &lpExitCode ) : bool
NativeResumeThread ( IntPtr hThread ) : uint
NativeWaitForSingleObject ( IntPtr hHandle, UInt32 dwMilliseconds ) : UInt32
Obj2IntPtr ( object o ) : IntPtr
SetProperty ( Object obj, string propName, object propValue ) : void

Method Details

CreateProcess() public method

public CreateProcess ( string applicationName, string commandLine, Nullable processAttributes, Nullable threadAttributes, bool inheritHandles, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo ) : ProcessInfo
applicationName string
commandLine string
processAttributes Nullable
threadAttributes Nullable
inheritHandles bool
creationFlags ProcessCreationFlags
environment string
currentDirectory string
startupInfo Nullable
return ProcessInfo

CreateProcessWithDll() public method

public CreateProcessWithDll ( string applicationName, string commandLine, Nullable processAttributes, Nullable threadAttributes, bool inheritHandles, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo, string dllName, IntPtr signalCompletedEvent, string initFunctionName ) : ProcessInfo
applicationName string
commandLine string
processAttributes Nullable
threadAttributes Nullable
inheritHandles bool
creationFlags ProcessCreationFlags
environment string
currentDirectory string
startupInfo Nullable
dllName string
signalCompletedEvent System.IntPtr
initFunctionName string
return ProcessInfo

CreateProcessWithLogonAndDll() public method

public CreateProcessWithLogonAndDll ( string userName, string domain, string password, int logonFlags, string applicationName, string commandLine, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo, string dllName, IntPtr signalCompletedEvent, string initFunctionName ) : ProcessInfo
userName string
domain string
password string
logonFlags int
applicationName string
commandLine string
creationFlags ProcessCreationFlags
environment string
currentDirectory string
startupInfo Nullable
dllName string
signalCompletedEvent System.IntPtr
initFunctionName string
return ProcessInfo

CreateProcessWithTokenAndDll() public method

public CreateProcessWithTokenAndDll ( IntPtr token, int logonFlags, string applicationName, string commandLine, ProcessCreationFlags creationFlags, string environment, string currentDirectory, Nullable startupInfo, string dllName, IntPtr signalCompletedEvent, string initFunctionName ) : ProcessInfo
token System.IntPtr
logonFlags int
applicationName string
commandLine string
creationFlags ProcessCreationFlags
environment string
currentDirectory string
startupInfo Nullable
dllName string
signalCompletedEvent System.IntPtr
initFunctionName string
return ProcessInfo

EnableHook() public method

public EnableHook ( object o, bool enable ) : void
o object
enable bool
return void

GetModuleBaseAddress() public method

public GetModuleBaseAddress ( string moduleName ) : IntPtr
moduleName string
return System.IntPtr

GetProcedureAddress() public method

public GetProcedureAddress ( IntPtr moduleBaseAddress, string procName ) : IntPtr
moduleBaseAddress System.IntPtr
procName string
return System.IntPtr

GetRemoteModuleBaseAddress() public method

public GetRemoteModuleBaseAddress ( int pid, string moduleName, bool scanMappedImages ) : IntPtr
pid int
moduleName string
scanMappedImages bool
return System.IntPtr

GetRemoteProcedureAddress() public method

public GetRemoteProcedureAddress ( int pid, IntPtr moduleBaseAddress, string procName ) : IntPtr
pid int
moduleBaseAddress System.IntPtr
procName string
return System.IntPtr

Hook() public method

public Hook ( IntPtr origAddr, IntPtr newAddr ) : object
origAddr System.IntPtr
newAddr System.IntPtr
return object

Hook() public method

public Hook ( IntPtr origAddr, IntPtr newAddr, int flags ) : object
origAddr System.IntPtr
newAddr System.IntPtr
flags int
return object

Hook() public method

public Hook ( Type origClassType, string origMethodName, Type origParams, Type newClassType, string newMethodName, Type newParams ) : object
origClassType System.Type
origMethodName string
origParams System.Type
newClassType System.Type
newMethodName string
newParams System.Type
return object

Hook() public method

public Hook ( Type origClassType, string origMethodName, Type origParams, Type newClassType, string newMethodName, Type newParams, int flags ) : object
origClassType System.Type
origMethodName string
origParams System.Type
newClassType System.Type
newMethodName string
newParams System.Type
flags int
return object

HookLib() public method

public HookLib ( ) : System
return System

InjectDll() public method

public InjectDll ( int procId, string dllName, string initFunctionName, uint processInitWaitTimeoutMs ) : void
procId int
dllName string
initFunctionName string
processInitWaitTimeoutMs uint
return void

InjectDll() public method

public InjectDll ( int procId, string dllName, string initFunctionName, uint processInitWaitTimeoutMs, IntPtr &injectorThreadHandle ) : void
procId int
dllName string
initFunctionName string
processInitWaitTimeoutMs uint
injectorThreadHandle System.IntPtr
return void

InjectDllH() public method

public InjectDllH ( IntPtr procHandle, string dllName, string initFunctionName, uint processInitWaitTimeoutMs ) : void
procHandle System.IntPtr
dllName string
initFunctionName string
processInitWaitTimeoutMs uint
return void

InjectDllH() public method

public InjectDllH ( IntPtr procHandle, string dllName, string initFunctionName, uint processInitWaitTimeoutMs, IntPtr &injectorThreadHandle ) : void
procHandle System.IntPtr
dllName string
initFunctionName string
processInitWaitTimeoutMs uint
injectorThreadHandle System.IntPtr
return void

RemoteHook() public method

public RemoteHook ( IntPtr origAddr, IntPtr newAddr, int pid ) : object
origAddr System.IntPtr
newAddr System.IntPtr
pid int
return object

RemoteHook() public method

public RemoteHook ( IntPtr origAddr, IntPtr newAddr, int pid, int flags ) : object
origAddr System.IntPtr
newAddr System.IntPtr
pid int
flags int
return object

RemoveHook() public method

public RemoveHook ( object o, bool disable ) : void
o object
disable bool
return void

ResumeThread() public method

public ResumeThread ( IntPtr threadHandle ) : void
threadHandle System.IntPtr
return void

ResumeThread() public method

public ResumeThread ( SafeWaitHandle threadHandle ) : void
threadHandle Microsoft.Win32.SafeHandles.SafeWaitHandle
return void

Unhook() public method

public Unhook ( object o ) : void
o object
return void

UnhookAll() public method

public UnhookAll ( ) : void
return void

UnhookProcess() public method

public UnhookProcess ( int pid ) : void
pid int
return void

WaitForInjectorThread() public method

public WaitForInjectorThread ( IntPtr injectorThreadHandle, uint timeoutMs ) : uint
injectorThreadHandle System.IntPtr
timeoutMs uint
return uint