NtInjectorThread.cpp
上传用户:jstlsd
上传日期:2007-01-13
资源大小:186k
文件大小:1k
源码类别:

钩子与API截获

开发平台:

Visual C++

  1. //---------------------------------------------------------------------------
  2. //
  3. // NtInjectorThread.cpp
  4. //
  5. // SUBSYSTEM: 
  6. // API Hooking system
  7. // MODULE:    
  8. // Implements a thread that uses an NT device driver
  9. //              for monitoring process creation
  10. //
  11. // DESCRIPTION:
  12. //
  13. // AUTHOR: Ivo Ivanov (ivopi@hotmail.com)
  14. //                                                                         
  15. //---------------------------------------------------------------------------
  16. #include "NtInjectorThread.h"
  17. #include "Injector.h"
  18. //---------------------------------------------------------------------------
  19. //
  20. // class CNtInjectorThread
  21. //
  22. //---------------------------------------------------------------------------
  23. CNtInjectorThread::CNtInjectorThread(CRemThreadInjector* pInjector):
  24. CNtProcessMonitor(),
  25. m_pInjector(pInjector)
  26. {
  27. }
  28. CNtInjectorThread::~CNtInjectorThread()
  29. {
  30. }
  31. void CNtInjectorThread::OnCreateProcess(DWORD dwProcessId)
  32. {
  33. m_pInjector->InjectModuleInto(dwProcessId);
  34. }
  35. void CNtInjectorThread::OnTerminateProcess(DWORD dwProcessId)
  36. {
  37. //
  38. // We shouldn't eject the module here, because the process
  39. // already has been terminated, meaning that the DLL probably
  40. // is unloaded or possibly the process is not running anymore.
  41. //
  42. }
  43. //----------------------------End of the file -------------------------------