Game Accessibility Library logo SourceForge.net Logo
Game Accessibility Suite: CAT/CATInjectionPropagate.h Source File

CATInjectionPropagate.h

Go to the documentation of this file.
00001 /// \file  CATInjectionPropagate.h
00002 /// \brief Interception of new process creation with injected dll propagation.
00003 /// \ingroup CAT
00004 ///
00005 /// Copyright (c) 2008 by Michael Ellison.
00006 /// See COPYING.txt for the \ref gaslicense License (MIT License).
00007 ///
00008 // $Author: mikeellison $
00009 // $Date: 2008-01-27 01:25:54 -0600 (Sun, 27 Jan 2008) $
00010 // $Revision:   $
00011 // $NoKeywords: $
00012 
00013 #ifndef CATInjectionPropagate_H_
00014 #define CATInjectionPropagate_H_
00015 
00016 #include "CATIntercept.h"
00017 #ifdef CAT_CONFIG_WIN32
00018 
00019 #include "CATString.h"
00020 
00021 /// \class CATInjectionPropagate
00022 /// \brief Interception of new process creation with injected dll propagation.
00023 /// \ingroup CAT
00024 ///
00025 /// This interception class handles a common and annoying problem with DLL injection - 
00026 /// the application we've injected our DLL goes off and executes something else.
00027 ///
00028 /// A lot of games have launchers that must be used to properly start the game. This
00029 /// class helps make sure that when the launcher executes the game itself, our injected
00030 /// DLL will get bounced into the real game as well.
00031 ///
00032 /// \todo
00033 /// Currently just handling CreateProcessW().  Add others when we get a chance.
00034 class CATInjectionPropagate : public CATIntercept
00035 {
00036     public:
00037         CATInjectionPropagate(const CATString& dllPath);
00038         virtual ~CATInjectionPropagate();
00039 
00040         /// Hooks all functions.
00041         ///
00042         /// \return CAT_SUCCESS on success.
00043         CATResult       HookFunctions();
00044 
00045 
00046     protected:
00047         /// Hook function - CreateProcess hook
00048         static void     OnCreateProcessW( CATHOOK*              hookInst,
00049                                           LPCWSTR               lpApplicationName,
00050                                           LPWSTR                lpCommandLine,
00051                                           LPSECURITY_ATTRIBUTES lpProcessAttributes,
00052                                           LPSECURITY_ATTRIBUTES lpThreadAttributes,
00053                                           BOOL                  bInheritHandles,
00054                                           DWORD                 dwCreationFlags,
00055                                           LPVOID                lpEnvironment,
00056                                           LPCWSTR               lpCurrentDirectory,
00057                                           LPSTARTUPINFO         lpStartupInfo,
00058                                           LPPROCESS_INFORMATION lpProcessInformation);
00059 
00060         
00061         /// Handler for process creation
00062         static void ProcessFix(CATHOOK*              hookInst, 
00063                                LPPROCESS_INFORMATION procInf);
00064 
00065         static CATINTERCEPT_DLL_TABLE_ENTRY kKernel32Funcs[];    ///< Kernel32 functions to hook
00066 
00067     protected:
00068         HMODULE     fKernelDLL;
00069         CATString   fDLLPath;
00070 };
00071 
00072 #endif // CAT_CONFIG_WIN32
00073 #endif // CATExecutionIntercept_H_

Generated on Mon Feb 11 04:09:44 2008 for Game Accessibility Suite by doxygen 1.5.4