From: <ma...@us...> - 2003-05-13 07:31:56
|
Update of /cvsroot/decaldev/source/LobbyHook In directory sc8-pr-cvs1:/tmp/cvs-serv26493/LobbyHook Added Files: LobbyHook.cpp LobbyHook.vcproj ReadMe.txt stdafx.cpp stdafx.h Log Message: Update everything for VC7.1, add project files, solution files, installer. --- NEW FILE: LobbyHook.cpp --- // LobbyHook.cpp : Defines the entry point for the DLL application. // #include "stdafx.h" #include "forcelib.h" #include "apihook.h" bool bInject; BOOL __stdcall Replacement_CreateProcessA( LPCSTR a0, LPSTR a1, LPSECURITY_ATTRIBUTES a2, LPSECURITY_ATTRIBUTES a3, BOOL a4, DWORD a5, LPVOID a6, LPCSTR a7, LPSTARTUPINFO a8, LPPROCESS_INFORMATION a9 ); static cHookDescriptor _hooks[] = { { eByName, _T( "kernel32.dll" ), _T( "CreateProcessA" ), 93, reinterpret_cast< DWORD >( Replacement_CreateProcessA ), 0 }, }; BOOL __stdcall Replacement_CreateProcessA( LPCSTR a0, LPSTR a1, LPSECURITY_ATTRIBUTES a2, LPSECURITY_ATTRIBUTES a3, BOOL a4, DWORD a5,LPVOID a6, LPCSTR a7, LPSTARTUPINFO a8, LPPROCESS_INFORMATION a9 ) { static long s_recursion = 0; bInject = strstr( a1, "client.exe" ) ? true : false; BOOL bResult; if( s_recursion++ == 0 && bInject) { HKEY key = NULL; char szDllPath[ MAX_PATH ]; memset( szDllPath, 0, sizeof( szDllPath ) ); HRESULT hr = RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\Decal\\Agent"), 0, KEY_READ, &key ); if( hr == ERROR_SUCCESS ) { DWORD dwChars = MAX_PATH - 1; if( RegQueryValueEx( key, "AgentPath", NULL, NULL, (LPBYTE) szDllPath, &dwChars ) == ERROR_SUCCESS ) strcat( szDllPath, "\\Inject.dll" ); RegCloseKey (key); } if( FindWindow( NULL, "Decal Agent" ) == NULL ) MessageBox( NULL, "Can't find DenAgent", "!", MB_OK ); PROCESS_INFORMATION ProcInfo; memset( &ProcInfo, 0, sizeof( PROCESS_INFORMATION ) ); bResult = CreateProcess( const_cast< char * >( a0 ), a1, a2, a3, a4, CREATE_SUSPENDED, /* a5 - Creation Flags */ a6, const_cast< char * >( a7 ), a8, &ProcInfo /* a9 - Proc Info */ ); ForceLibrary( szDllPath, &ProcInfo ); ResumeThread( ProcInfo.hThread ); } else bResult = CreateProcess( a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 ); s_recursion--; return bResult; } BOOL APIENTRY DllMain( HANDLE hModule, DWORD dwCallReason, LPVOID lpReserved ) { switch( dwCallReason ) { case DLL_PROCESS_ATTACH: { // Alright, we're loaded into the lobby process. // Hook CreateProcessA and bail. hookFunctionsByExport( "AsheronsCall.dll", _hooks, 1, true ); break; } case DLL_PROCESS_DETACH: { // Detaching // Unhook CreateProcessA and bail. hookFunctionsByExport( "AsheronsCall.dll", _hooks, 1, false ); break; } } return TRUE; } --- NEW FILE: LobbyHook.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="LobbyHook" ProjectGUID="{47B0C7F7-102E-4EBD-83CD-B317D991FDE7}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="2" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\Include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LOBBYHOOK_EXPORTS" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="1" UsePrecompiledHeader="3" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="4"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="forcelibrary.lib" OutputFile="..\Debug\LobbyHook.dll" LinkIncremental="2" AdditionalLibraryDirectories="..\Include" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/LobbyHook.pdb" SubSystem="2" ImportLibrary="$(OutDir)/LobbyHook.lib" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="2" CharacterSet="2"> <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="..\Include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LOBBYHOOK_EXPORTS" RuntimeLibrary="0" UsePrecompiledHeader="3" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="forcelibrary.lib" OutputFile="..\Release\LobbyHook.dll" LinkIncremental="1" AdditionalLibraryDirectories="..\Include" GenerateDebugInformation="TRUE" SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" ImportLibrary="$(OutDir)/LobbyHook.lib" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> <File RelativePath=".\LobbyHook.cpp"> </File> <File RelativePath=".\stdafx.cpp"> <FileConfiguration Name="Debug|Win32"> <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1"/> </FileConfiguration> <FileConfiguration Name="Release|Win32"> <Tool Name="VCCLCompilerTool" UsePrecompiledHeader="1"/> </FileConfiguration> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> <File RelativePath=".\stdafx.h"> </File> </Filter> <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> </Filter> <File RelativePath=".\ReadMe.txt"> </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: ReadMe.txt --- ======================================================================== DYNAMIC LINK LIBRARY : LobbyHook Project Overview ======================================================================== AppWizard has created this LobbyHook DLL for you. This file contains a summary of what you will find in each of the files that make up your LobbyHook application. LobbyHook.vcproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and information about the platforms, configurations, and project features selected with the Application Wizard. LobbyHook.cpp This is the main DLL source file. When created, this DLL does not export any symbols. As a result, it will not produce a .lib file when it is built. If you wish this project to be a project dependency of some other project, you will either need to add code to export some symbols from the DLL so that an export library will be produced, or you can set the Ignore Input Library property to Yes on the General propert page of the Linker folder in the project's Property Pages dialog box. ///////////////////////////////////////////////////////////////////////////// Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file named LobbyHook.pch and a precompiled types file named StdAfx.obj. ///////////////////////////////////////////////////////////////////////////// Other notes: AppWizard uses "TODO:" comments to indicate parts of the source code you should add to or customize. ///////////////////////////////////////////////////////////////////////////// --- NEW FILE: stdafx.cpp --- // stdafx.cpp : source file that includes just the standard includes // LobbyHook.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file --- NEW FILE: stdafx.h --- // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include <windows.h> #include <tchar.h> #include <atlbase.h> |