CrazyDebug just got crazier!
authorScott Ehlert <ds@alliedmods.net>
Fri May 09 08:04:27 2008 +0000 (2008-05-09)
changeset 2040a2738afc53a1
parent 2039 cdf621aae4a9
child 2041 1ba9eb0f85c7
CrazyDebug just got crazier!
1) Now works with SrcDS -console + DEP on Windows
2) Updated vcproj files for OB, Episode 1, etc
core/CrazyDebugger.cpp
core/msvc8/sourcemod_mm.sln
core/msvc8/sourcemod_mm.vcproj
     1.1 --- a/core/CrazyDebugger.cpp	Thu May 08 23:43:02 2008 +0000
     1.2 +++ b/core/CrazyDebugger.cpp	Fri May 09 08:04:27 2008 +0000
     1.3 @@ -29,12 +29,74 @@
     1.4   * Version: $Id$
     1.5   */
     1.6  
     1.7 -#if 0
     1.8  #include "sm_globals.h"
     1.9  #include "sourcemm_api.h"
    1.10  #include "Tlhelp32.h"
    1.11  #include "LibrarySys.h"
    1.12  #include "minidump.h"
    1.13 +#include "sm_stringutil.h"
    1.14 +
    1.15 +bool HookImportAddrTable(BYTE *base, const char *func, DWORD hookfunc, char *err, size_t maxlength)
    1.16 +{
    1.17 +	IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)base;
    1.18 +	if (dos->e_magic != IMAGE_DOS_SIGNATURE)
    1.19 +	{
    1.20 +		UTIL_Format(err, maxlength, "%s", "Could not detect valid DOS signature");
    1.21 +		return (err == NULL) ? true : false;
    1.22 +	}
    1.23 +
    1.24 +	IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(base + dos->e_lfanew);
    1.25 +	if (nt->Signature != IMAGE_NT_SIGNATURE)
    1.26 +	{
    1.27 +		UTIL_Format(err, maxlength, "%s", "Could not detect valid NT signature");
    1.28 +		return false;
    1.29 +	}
    1.30 +
    1.31 +	IMAGE_IMPORT_DESCRIPTOR *desc = 
    1.32 +		(IMAGE_IMPORT_DESCRIPTOR *)
    1.33 +		(base + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
    1.34 +	if (base == (BYTE *)desc)
    1.35 +	{
    1.36 +		UTIL_Format(err, maxlength, "%s", "Could not find IAT");
    1.37 +		return false;
    1.38 +	}
    1.39 +
    1.40 +	bool entryFound = false;
    1.41 +	while (desc->Name)
    1.42 +	{
    1.43 +		if (desc->FirstThunk != 0)
    1.44 +		{
    1.45 +			IMAGE_THUNK_DATA *data = (IMAGE_THUNK_DATA *)(base + desc->OriginalFirstThunk);
    1.46 +			DWORD *iat = (DWORD *)(base + desc->FirstThunk);
    1.47 +			while (data->u1.Function)
    1.48 +			{
    1.49 +				if ((data->u1.Ordinal & IMAGE_ORDINAL_FLAG32) != IMAGE_ORDINAL_FLAG32)
    1.50 +				{
    1.51 +					IMAGE_IMPORT_BY_NAME *import = (IMAGE_IMPORT_BY_NAME *)(base + data->u1.AddressOfData);
    1.52 +					if (strcmp((char *)import->Name, func) == 0)
    1.53 +					{
    1.54 +						DWORD oldprot, oldprot2;
    1.55 +						VirtualProtect(iat, 4, PAGE_READWRITE, &oldprot);
    1.56 +						*iat = hookfunc;
    1.57 +						VirtualProtect(iat, 4, oldprot, &oldprot2);
    1.58 +						entryFound = true;
    1.59 +					}
    1.60 +				}
    1.61 +				data++;
    1.62 +				iat++;
    1.63 +			}
    1.64 +		}
    1.65 +		desc++;
    1.66 +	}
    1.67 +
    1.68 +	if (!entryFound)
    1.69 +	{
    1.70 +		UTIL_Format(err, maxlength, "Could not find IAT entry for %s", func);
    1.71 +		return false;
    1.72 +	}
    1.73 +
    1.74 +	return true;
    1.75 +}
    1.76  
    1.77  BOOL
    1.78  WINAPI
    1.79 @@ -62,6 +124,24 @@
    1.80  	return GetProcAddress(hModule, lpProcName);
    1.81  }
    1.82  
    1.83 +HMODULE WINAPI LoadLibraryEx2(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags)
    1.84 +{
    1.85 +	HMODULE lib = LoadLibraryEx(lpFileName, hFile, dwFlags);
    1.86 +
    1.87 +	/* Steam.dll seems to get loaded using an abs path, thus the use of stristr() */
    1.88 +	if (stristr(lpFileName, "steam.dll"))
    1.89 +	{
    1.90 +		char err[64];
    1.91 +		if (!HookImportAddrTable((BYTE *)lib, "GetProcAddress", (DWORD)GetProcAddress2, err, sizeof(err)))
    1.92 +		{
    1.93 +			Error("[SM] %s in steam.dll\n", err);
    1.94 +			return NULL;
    1.95 +		}
    1.96 +	}
    1.97 +
    1.98 +	return lib;
    1.99 +}
   1.100 +
   1.101  class CrazyWindowsDebugger : public SMGlobalClass
   1.102  {
   1.103  public:
   1.104 @@ -69,6 +149,9 @@
   1.105  	{
   1.106  		HANDLE hModuleList = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
   1.107  		MODULEENTRY32 me32;
   1.108 +		BYTE *engine = NULL;
   1.109 +		BYTE *steam = NULL;
   1.110 +		char err[64];
   1.111  
   1.112  		me32.dwSize = sizeof(MODULEENTRY32);
   1.113  
   1.114 @@ -77,69 +160,42 @@
   1.115  			Error("Could not initialize crazy debugger!");
   1.116  		}
   1.117  
   1.118 -		bool found = false;
   1.119 -
   1.120  		do
   1.121  		{
   1.122 -			if (strcasecmp(me32.szModule, "steam.dll") == 0)
   1.123 +			if (strcasecmp(me32.szModule, "engine.dll") == 0)
   1.124  			{
   1.125 -				IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)me32.modBaseAddr;
   1.126 -				if (dos->e_magic != IMAGE_DOS_SIGNATURE)
   1.127 -				{
   1.128 -					Error("[SM] Could not detect steam.dll with valid DOS signature");
   1.129 -				}
   1.130 -				char *base = (char *)dos;
   1.131 -				IMAGE_NT_HEADERS *nt = (IMAGE_NT_HEADERS *)(base + dos->e_lfanew);
   1.132 -				if (nt->Signature != IMAGE_NT_SIGNATURE)
   1.133 -				{
   1.134 -					Error("[SM] Could not detect steam.dll with valid NT signature");
   1.135 -				}
   1.136 -				IMAGE_IMPORT_DESCRIPTOR *desc = 
   1.137 -					(IMAGE_IMPORT_DESCRIPTOR *)
   1.138 -					(base + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
   1.139 -				if (base == (char *)desc)
   1.140 -				{
   1.141 -					Error("[SM] Could not find the steam.dll IAT");
   1.142 -				}
   1.143 -				while (desc->Name)
   1.144 -				{
   1.145 -					if (desc->FirstThunk != 0)
   1.146 -					{
   1.147 -						IMAGE_THUNK_DATA *data = (IMAGE_THUNK_DATA *)(base + desc->OriginalFirstThunk);
   1.148 -						DWORD *iat = (DWORD *)(base + desc->FirstThunk);
   1.149 -						while (data->u1.Function)
   1.150 -						{
   1.151 -							if ((data->u1.Ordinal & IMAGE_ORDINAL_FLAG32) != IMAGE_ORDINAL_FLAG32)
   1.152 -							{
   1.153 -								IMAGE_IMPORT_BY_NAME *import = (IMAGE_IMPORT_BY_NAME *)(base + data->u1.AddressOfData);
   1.154 -								if (strcmp((char *)import->Name, "GetProcAddress") == 0)
   1.155 -								{
   1.156 -									DWORD oldprot, oldprot2;
   1.157 -									VirtualProtect(iat, 4, PAGE_READWRITE, &oldprot);
   1.158 -									*iat = (DWORD)GetProcAddress2;
   1.159 -									VirtualProtect(iat, 4, oldprot, &oldprot2);
   1.160 -									found = true;
   1.161 -									goto _end;
   1.162 -								}
   1.163 -							}
   1.164 -							data++;
   1.165 -							iat++;
   1.166 -						}
   1.167 -					}
   1.168 -					desc++;
   1.169 -				}
   1.170 +				engine = me32.modBaseAddr;
   1.171 +			}
   1.172 +			else if (strcasecmp(me32.szModule, "steam.dll") == 0)
   1.173 +			{
   1.174 +				/* Steam.dll is loaded by engine.dll, so we can exit the loop here */
   1.175 +				steam = me32.modBaseAddr;
   1.176  				break;
   1.177  			}
   1.178  		} while  (Module32Next(hModuleList, &me32));
   1.179  
   1.180 -_end:
   1.181 +		CloseHandle(hModuleList);
   1.182  
   1.183 -		if (!found)
   1.184 +		/* This really should not happen, but ... */
   1.185 +		if (!engine)
   1.186  		{
   1.187 -			Error("Could not find steam.dll's GetProcAddress IAT entry");
   1.188 +			Error("[SM] Could not find engine.dll\n");
   1.189  		}
   1.190  
   1.191 -		CloseHandle(hModuleList);
   1.192 +		/* Steam.dll isn't loaded yet */
   1.193 +		if (!steam)
   1.194 +		{
   1.195 +			if (!HookImportAddrTable(engine, "LoadLibraryExA", (DWORD)LoadLibraryEx2, err, sizeof(err)))
   1.196 +			{
   1.197 +				Error("[SM] %s in engine.dll)\n", err);
   1.198 +			}
   1.199 +		}
   1.200 +		else
   1.201 +		{
   1.202 +			if (!HookImportAddrTable(steam, "GetProcAddress", (DWORD)GetProcAddress2, err, sizeof(err)))
   1.203 +			{
   1.204 +				Error("[SM] %s in steam.dll)\n", err);
   1.205 +			}
   1.206 +		}
   1.207  	}
   1.208  } s_CrazyDebugger;
   1.209 -#endif
     2.1 --- a/core/msvc8/sourcemod_mm.sln	Thu May 08 23:43:02 2008 +0000
     2.2 +++ b/core/msvc8/sourcemod_mm.sln	Fri May 09 08:04:27 2008 +0000
     2.3 @@ -5,7 +5,9 @@
     2.4  EndProject
     2.5  Global
     2.6  	GlobalSection(SolutionConfigurationPlatforms) = preSolution
     2.7 -		CrazyDebug|Win32 = CrazyDebug|Win32
     2.8 +		CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
     2.9 +		CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
    2.10 +		CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
    2.11  		Debug - Episode 1|Win32 = Debug - Episode 1|Win32
    2.12  		Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
    2.13  		Debug - Orange Box|Win32 = Debug - Orange Box|Win32
    2.14 @@ -14,8 +16,12 @@
    2.15  		Release - Orange Box|Win32 = Release - Orange Box|Win32
    2.16  	EndGlobalSection
    2.17  	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    2.18 -		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug|Win32.ActiveCfg = CrazyDebug|Win32
    2.19 -		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug|Win32.Build.0 = CrazyDebug|Win32
    2.20 +		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
    2.21 +		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
    2.22 +		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
    2.23 +		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
    2.24 +		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
    2.25 +		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
    2.26  		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
    2.27  		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
    2.28  		{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
     3.1 --- a/core/msvc8/sourcemod_mm.vcproj	Thu May 08 23:43:02 2008 +0000
     3.2 +++ b/core/msvc8/sourcemod_mm.vcproj	Fri May 09 08:04:27 2008 +0000
     3.3 @@ -16,6 +16,88 @@
     3.4  	</ToolFiles>
     3.5  	<Configurations>
     3.6  		<Configuration
     3.7 +			Name="CrazyDebug - Old Metamod|Win32"
     3.8 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
     3.9 +			IntermediateDirectory="$(ConfigurationName)"
    3.10 +			ConfigurationType="2"
    3.11 +			CharacterSet="2"
    3.12 +			>
    3.13 +			<Tool
    3.14 +				Name="VCPreBuildEventTool"
    3.15 +			/>
    3.16 +			<Tool
    3.17 +				Name="VCCustomBuildTool"
    3.18 +			/>
    3.19 +			<Tool
    3.20 +				Name="VCXMLDataGeneratorTool"
    3.21 +			/>
    3.22 +			<Tool
    3.23 +				Name="VCWebServiceProxyGeneratorTool"
    3.24 +			/>
    3.25 +			<Tool
    3.26 +				Name="VCMIDLTool"
    3.27 +			/>
    3.28 +			<Tool
    3.29 +				Name="VCCLCompilerTool"
    3.30 +				AdditionalOptions="/MP"
    3.31 +				Optimization="0"
    3.32 +				AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM14)&quot;;&quot;$(SOURCEMM14)\sourcemm&quot;;&quot;$(SOURCEMM14)\sourcehook&quot;"
    3.33 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
    3.34 +				MinimalRebuild="true"
    3.35 +				BasicRuntimeChecks="3"
    3.36 +				RuntimeLibrary="1"
    3.37 +				EnableEnhancedInstructionSet="0"
    3.38 +				RuntimeTypeInfo="false"
    3.39 +				UsePrecompiledHeader="0"
    3.40 +				WarningLevel="3"
    3.41 +				Detect64BitPortabilityProblems="false"
    3.42 +				DebugInformationFormat="4"
    3.43 +			/>
    3.44 +			<Tool
    3.45 +				Name="VCManagedResourceCompilerTool"
    3.46 +			/>
    3.47 +			<Tool
    3.48 +				Name="VCResourceCompilerTool"
    3.49 +			/>
    3.50 +			<Tool
    3.51 +				Name="VCPreLinkEventTool"
    3.52 +			/>
    3.53 +			<Tool
    3.54 +				Name="VCLinkerTool"
    3.55 +				AdditionalDependencies="&quot;$(HL2SDK)\lib\public\tier0.lib&quot; &quot;$(HL2SDK)\lib\public\tier1.lib&quot; &quot;$(HL2SDK)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDK)\lib\public\mathlib.lib&quot; dbghelp.lib"
    3.56 +				OutputFile="$(OutDir)\sourcemod.1.ep1.dll"
    3.57 +				LinkIncremental="2"
    3.58 +				IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
    3.59 +				GenerateDebugInformation="true"
    3.60 +				SubSystem="2"
    3.61 +				TargetMachine="1"
    3.62 +			/>
    3.63 +			<Tool
    3.64 +				Name="VCALinkTool"
    3.65 +			/>
    3.66 +			<Tool
    3.67 +				Name="VCManifestTool"
    3.68 +			/>
    3.69 +			<Tool
    3.70 +				Name="VCXDCMakeTool"
    3.71 +			/>
    3.72 +			<Tool
    3.73 +				Name="VCBscMakeTool"
    3.74 +			/>
    3.75 +			<Tool
    3.76 +				Name="VCFxCopTool"
    3.77 +			/>
    3.78 +			<Tool
    3.79 +				Name="VCAppVerifierTool"
    3.80 +			/>
    3.81 +			<Tool
    3.82 +				Name="VCWebDeploymentTool"
    3.83 +			/>
    3.84 +			<Tool
    3.85 +				Name="VCPostBuildEventTool"
    3.86 +			/>
    3.87 +		</Configuration>
    3.88 +		<Configuration
    3.89  			Name="Debug - Old Metamod|Win32"
    3.90  			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
    3.91  			IntermediateDirectory="$(ConfigurationName)"
    3.92 @@ -181,6 +263,88 @@
    3.93  			/>
    3.94  		</Configuration>
    3.95  		<Configuration
    3.96 +			Name="CrazyDebug - Orange Box|Win32"
    3.97 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
    3.98 +			IntermediateDirectory="$(ConfigurationName)"
    3.99 +			ConfigurationType="2"
   3.100 +			CharacterSet="2"
   3.101 +			>
   3.102 +			<Tool
   3.103 +				Name="VCPreBuildEventTool"
   3.104 +			/>
   3.105 +			<Tool
   3.106 +				Name="VCCustomBuildTool"
   3.107 +			/>
   3.108 +			<Tool
   3.109 +				Name="VCXMLDataGeneratorTool"
   3.110 +			/>
   3.111 +			<Tool
   3.112 +				Name="VCWebServiceProxyGeneratorTool"
   3.113 +			/>
   3.114 +			<Tool
   3.115 +				Name="VCMIDLTool"
   3.116 +			/>
   3.117 +			<Tool
   3.118 +				Name="VCCLCompilerTool"
   3.119 +				AdditionalOptions="/MP"
   3.120 +				Optimization="0"
   3.121 +				AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(HL2SDKOB)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
   3.122 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
   3.123 +				MinimalRebuild="true"
   3.124 +				BasicRuntimeChecks="3"
   3.125 +				RuntimeLibrary="1"
   3.126 +				EnableEnhancedInstructionSet="0"
   3.127 +				RuntimeTypeInfo="false"
   3.128 +				UsePrecompiledHeader="0"
   3.129 +				WarningLevel="3"
   3.130 +				Detect64BitPortabilityProblems="false"
   3.131 +				DebugInformationFormat="4"
   3.132 +			/>
   3.133 +			<Tool
   3.134 +				Name="VCManagedResourceCompilerTool"
   3.135 +			/>
   3.136 +			<Tool
   3.137 +				Name="VCResourceCompilerTool"
   3.138 +			/>
   3.139 +			<Tool
   3.140 +				Name="VCPreLinkEventTool"
   3.141 +			/>
   3.142 +			<Tool
   3.143 +				Name="VCLinkerTool"
   3.144 +				AdditionalDependencies="&quot;$(HL2SDKOB)\lib\public\tier0.lib&quot; &quot;$(HL2SDKOB)\lib\public\tier1.lib&quot; &quot;$(HL2SDKOB)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDKOB)\lib\public\mathlib.lib&quot; dbghelp.lib"
   3.145 +				OutputFile="$(OutDir)\sourcemod.2.ep2.dll"
   3.146 +				LinkIncremental="2"
   3.147 +				IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
   3.148 +				GenerateDebugInformation="true"
   3.149 +				SubSystem="2"
   3.150 +				TargetMachine="1"
   3.151 +			/>
   3.152 +			<Tool
   3.153 +				Name="VCALinkTool"
   3.154 +			/>
   3.155 +			<Tool
   3.156 +				Name="VCManifestTool"
   3.157 +			/>
   3.158 +			<Tool
   3.159 +				Name="VCXDCMakeTool"
   3.160 +			/>
   3.161 +			<Tool
   3.162 +				Name="VCBscMakeTool"
   3.163 +			/>
   3.164 +			<Tool
   3.165 +				Name="VCFxCopTool"
   3.166 +			/>
   3.167 +			<Tool
   3.168 +				Name="VCAppVerifierTool"
   3.169 +			/>
   3.170 +			<Tool
   3.171 +				Name="VCWebDeploymentTool"
   3.172 +			/>
   3.173 +			<Tool
   3.174 +				Name="VCPostBuildEventTool"
   3.175 +			/>
   3.176 +		</Configuration>
   3.177 +		<Configuration
   3.178  			Name="Debug - Orange Box|Win32"
   3.179  			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   3.180  			IntermediateDirectory="$(ConfigurationName)"
   3.181 @@ -346,6 +510,88 @@
   3.182  			/>
   3.183  		</Configuration>
   3.184  		<Configuration
   3.185 +			Name="CrazyDebug - Episode 1|Win32"
   3.186 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   3.187 +			IntermediateDirectory="$(ConfigurationName)"
   3.188 +			ConfigurationType="2"
   3.189 +			CharacterSet="2"
   3.190 +			>
   3.191 +			<Tool
   3.192 +				Name="VCPreBuildEventTool"
   3.193 +			/>
   3.194 +			<Tool
   3.195 +				Name="VCCustomBuildTool"
   3.196 +			/>
   3.197 +			<Tool
   3.198 +				Name="VCXMLDataGeneratorTool"
   3.199 +			/>
   3.200 +			<Tool
   3.201 +				Name="VCWebServiceProxyGeneratorTool"
   3.202 +			/>
   3.203 +			<Tool
   3.204 +				Name="VCMIDLTool"
   3.205 +			/>
   3.206 +			<Tool
   3.207 +				Name="VCCLCompilerTool"
   3.208 +				AdditionalOptions="/MP"
   3.209 +				Optimization="0"
   3.210 +				AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
   3.211 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
   3.212 +				MinimalRebuild="true"
   3.213 +				BasicRuntimeChecks="3"
   3.214 +				RuntimeLibrary="1"
   3.215 +				EnableEnhancedInstructionSet="0"
   3.216 +				RuntimeTypeInfo="false"
   3.217 +				UsePrecompiledHeader="0"
   3.218 +				WarningLevel="3"
   3.219 +				Detect64BitPortabilityProblems="false"
   3.220 +				DebugInformationFormat="4"
   3.221 +			/>
   3.222 +			<Tool
   3.223 +				Name="VCManagedResourceCompilerTool"
   3.224 +			/>
   3.225 +			<Tool
   3.226 +				Name="VCResourceCompilerTool"
   3.227 +			/>
   3.228 +			<Tool
   3.229 +				Name="VCPreLinkEventTool"
   3.230 +			/>
   3.231 +			<Tool
   3.232 +				Name="VCLinkerTool"
   3.233 +				AdditionalDependencies="&quot;$(HL2SDK)\lib\public\tier0.lib&quot; &quot;$(HL2SDK)\lib\public\tier1.lib&quot; &quot;$(HL2SDK)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDK)\lib\public\mathlib.lib&quot; dbghelp.lib"
   3.234 +				OutputFile="$(OutDir)\sourcemod.2.ep1.dll"
   3.235 +				LinkIncremental="2"
   3.236 +				IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
   3.237 +				GenerateDebugInformation="true"
   3.238 +				SubSystem="2"
   3.239 +				TargetMachine="1"
   3.240 +			/>
   3.241 +			<Tool
   3.242 +				Name="VCALinkTool"
   3.243 +			/>
   3.244 +			<Tool
   3.245 +				Name="VCManifestTool"
   3.246 +			/>
   3.247 +			<Tool
   3.248 +				Name="VCXDCMakeTool"
   3.249 +			/>
   3.250 +			<Tool
   3.251 +				Name="VCBscMakeTool"
   3.252 +			/>
   3.253 +			<Tool
   3.254 +				Name="VCFxCopTool"
   3.255 +			/>
   3.256 +			<Tool
   3.257 +				Name="VCAppVerifierTool"
   3.258 +			/>
   3.259 +			<Tool
   3.260 +				Name="VCWebDeploymentTool"
   3.261 +			/>
   3.262 +			<Tool
   3.263 +				Name="VCPostBuildEventTool"
   3.264 +			/>
   3.265 +		</Configuration>
   3.266 +		<Configuration
   3.267  			Name="Debug - Episode 1|Win32"
   3.268  			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   3.269  			IntermediateDirectory="$(ConfigurationName)"
   3.270 @@ -510,85 +756,6 @@
   3.271  				Name="VCPostBuildEventTool"
   3.272  			/>
   3.273  		</Configuration>
   3.274 -		<Configuration
   3.275 -			Name="CrazyDebug|Win32"
   3.276 -			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   3.277 -			IntermediateDirectory="$(ConfigurationName)"
   3.278 -			ConfigurationType="2"
   3.279 -			CharacterSet="2"
   3.280 -			>
   3.281 -			<Tool
   3.282 -				Name="VCPreBuildEventTool"
   3.283 -			/>
   3.284 -			<Tool
   3.285 -				Name="VCCustomBuildTool"
   3.286 -			/>
   3.287 -			<Tool
   3.288 -				Name="VCXMLDataGeneratorTool"
   3.289 -			/>
   3.290 -			<Tool
   3.291 -				Name="VCWebServiceProxyGeneratorTool"
   3.292 -			/>
   3.293 -			<Tool
   3.294 -				Name="VCMIDLTool"
   3.295 -			/>
   3.296 -			<Tool
   3.297 -				Name="VCCLCompilerTool"
   3.298 -				Optimization="0"
   3.299 -				AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn"
   3.300 -				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;CRAZY_DEBUG"
   3.301 -				MinimalRebuild="true"
   3.302 -				BasicRuntimeChecks="3"
   3.303 -				RuntimeLibrary="1"
   3.304 -				RuntimeTypeInfo="false"
   3.305 -				UsePrecompiledHeader="0"
   3.306 -				WarningLevel="3"
   3.307 -				Detect64BitPortabilityProblems="false"
   3.308 -				DebugInformationFormat="4"
   3.309 -			/>
   3.310 -			<Tool
   3.311 -				Name="VCManagedResourceCompilerTool"
   3.312 -			/>
   3.313 -			<Tool
   3.314 -				Name="VCResourceCompilerTool"
   3.315 -			/>
   3.316 -			<Tool
   3.317 -				Name="VCPreLinkEventTool"
   3.318 -			/>
   3.319 -			<Tool
   3.320 -				Name="VCLinkerTool"
   3.321 -				AdditionalDependencies="tier0.lib tier1.lib vstdlib.lib mathlib.lib dbghelp.lib"
   3.322 -				LinkIncremental="2"
   3.323 -				IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
   3.324 -				GenerateDebugInformation="true"
   3.325 -				SubSystem="2"
   3.326 -				TargetMachine="1"
   3.327 -			/>
   3.328 -			<Tool
   3.329 -				Name="VCALinkTool"
   3.330 -			/>
   3.331 -			<Tool
   3.332 -				Name="VCManifestTool"
   3.333 -			/>
   3.334 -			<Tool
   3.335 -				Name="VCXDCMakeTool"
   3.336 -			/>
   3.337 -			<Tool
   3.338 -				Name="VCBscMakeTool"
   3.339 -			/>
   3.340 -			<Tool
   3.341 -				Name="VCFxCopTool"
   3.342 -			/>
   3.343 -			<Tool
   3.344 -				Name="VCAppVerifierTool"
   3.345 -			/>
   3.346 -			<Tool
   3.347 -				Name="VCWebDeploymentTool"
   3.348 -			/>
   3.349 -			<Tool
   3.350 -				Name="VCPostBuildEventTool"
   3.351 -			/>
   3.352 -		</Configuration>
   3.353  	</Configurations>
   3.354  	<References>
   3.355  	</References>
   3.356 @@ -633,46 +800,58 @@
   3.357  			<File
   3.358  				RelativePath="..\CrazyDebugger.cpp"
   3.359  				>
   3.360 -			</File>
   3.361 -			<File
   3.362 -				RelativePath="..\Database.cpp"
   3.363 -				>
   3.364  				<FileConfiguration
   3.365 -					Name="Release - Old Metamod|Win32"
   3.366 +					Name="Debug - Old Metamod|Win32"
   3.367 +					ExcludedFromBuild="true"
   3.368  					>
   3.369  					<Tool
   3.370  						Name="VCCLCompilerTool"
   3.371 -						ExpandAttributedSource="true"
   3.372 -						AssemblerOutput="4"
   3.373 +					/>
   3.374 +				</FileConfiguration>
   3.375 +				<FileConfiguration
   3.376 +					Name="Release - Old Metamod|Win32"
   3.377 +					ExcludedFromBuild="true"
   3.378 +					>
   3.379 +					<Tool
   3.380 +						Name="VCCLCompilerTool"
   3.381 +					/>
   3.382 +				</FileConfiguration>
   3.383 +				<FileConfiguration
   3.384 +					Name="Debug - Orange Box|Win32"
   3.385 +					ExcludedFromBuild="true"
   3.386 +					>
   3.387 +					<Tool
   3.388 +						Name="VCCLCompilerTool"
   3.389  					/>
   3.390  				</FileConfiguration>
   3.391  				<FileConfiguration
   3.392  					Name="Release - Orange Box|Win32"
   3.393 +					ExcludedFromBuild="true"
   3.394  					>
   3.395  					<Tool
   3.396  						Name="VCCLCompilerTool"
   3.397 -						ExpandAttributedSource="true"
   3.398 -						AssemblerOutput="4"
   3.399 +					/>
   3.400 +				</FileConfiguration>
   3.401 +				<FileConfiguration
   3.402 +					Name="Debug - Episode 1|Win32"
   3.403 +					ExcludedFromBuild="true"
   3.404 +					>
   3.405 +					<Tool
   3.406 +						Name="VCCLCompilerTool"
   3.407  					/>
   3.408  				</FileConfiguration>
   3.409  				<FileConfiguration
   3.410  					Name="Release - Episode 1|Win32"
   3.411 +					ExcludedFromBuild="true"
   3.412  					>
   3.413  					<Tool
   3.414  						Name="VCCLCompilerTool"
   3.415 -						ExpandAttributedSource="true"
   3.416 -						AssemblerOutput="4"
   3.417  					/>
   3.418  				</FileConfiguration>
   3.419 -				<FileConfiguration
   3.420 -					Name="CrazyDebug|Win32"
   3.421 -					>
   3.422 -					<Tool
   3.423 -						Name="VCCLCompilerTool"
   3.424 -						ExpandAttributedSource="false"
   3.425 -						AssemblerOutput="0"
   3.426 -					/>
   3.427 -				</FileConfiguration>
   3.428 +			</File>
   3.429 +			<File
   3.430 +				RelativePath="..\Database.cpp"
   3.431 +				>
   3.432  			</File>
   3.433  			<File
   3.434  				RelativePath="..\DebugReporter.cpp"
   3.435 @@ -1166,6 +1345,14 @@
   3.436  					RelativePath="..\vm\sp_vm_engine.cpp"
   3.437  					>
   3.438  					<FileConfiguration
   3.439 +						Name="CrazyDebug - Old Metamod|Win32"
   3.440 +						>
   3.441 +						<Tool
   3.442 +							Name="VCCLCompilerTool"
   3.443 +							AdditionalIncludeDirectories="&quot;$(SOURCEMM16)\sourcehook&quot;"
   3.444 +						/>
   3.445 +					</FileConfiguration>
   3.446 +					<FileConfiguration
   3.447  						Name="Debug - Old Metamod|Win32"
   3.448  						>
   3.449  						<Tool