Incorrect Stack movement causing MAV and invalid Pointers. Woops.
This commit is contained in:
+9
-3
@@ -29,7 +29,9 @@ DLL_METHOD intptr_t DLL_CALL BP_GetReturnAddress() {
|
||||
|
||||
// Blitz uses X86 Call-Near (E8) instructions to call its own functions.
|
||||
// We can simply deduce the Return Address like this because of that.
|
||||
ReturnAddress = *reinterpret_cast<intptr_t*>(*reinterpret_cast<intptr_t*>(*reinterpret_cast<intptr_t*>(BasePointer)) - 8);
|
||||
//-- Parent_EBP = *EBP
|
||||
//-- Parent_RP = Parent_EBP + 16
|
||||
ReturnAddress = (*((intptr_t*)BasePointer) + 16);
|
||||
|
||||
return ReturnAddress;
|
||||
}
|
||||
@@ -45,15 +47,19 @@ DLL_METHOD intptr_t DLL_CALL BP_GetFunctionPointer()
|
||||
|
||||
// Blitz uses X86 Call-Near (E8) instructions to call its own functions.
|
||||
// We can simply deduce the Return Address like this because of that.
|
||||
ReturnAddress = *reinterpret_cast<intptr_t*>(*reinterpret_cast<intptr_t*>(*reinterpret_cast<intptr_t*>(BasePointer)) - 8);
|
||||
//-- Parent_EBP = *EBP
|
||||
//-- Parent_RP = Parent_EBP + 16
|
||||
ReturnAddress = *(intptr_t*)((*(intptr_t*)BasePointer) + 16);
|
||||
|
||||
// And since it's a Call-Near, the call is offset to the return address.
|
||||
FunctionPointer = ReturnAddress + *reinterpret_cast<intptr_t*>(ReturnAddress - 4);
|
||||
FunctionPointer = ReturnAddress + *(intptr_t*)(ReturnAddress - 4);
|
||||
|
||||
return FunctionPointer;
|
||||
}
|
||||
#pragma comment(linker, "/EXPORT:BP_GetFunctionPointer=_BP_GetFunctionPointer@0")
|
||||
|
||||
// Didn't work out, overloading a Runtime Function makes it disappear.
|
||||
// At 0x00100000 (Process begin stuff) there's a list of functions? What the hell Mark?
|
||||
/*DLL_METHOD intptr_t DLL_CALL BP_GetLastCalledFunctionPointer( )
|
||||
{
|
||||
// Scan backwards in executable memory for a eax assign.
|
||||
|
||||
+1089
-1089
File diff suppressed because it is too large
Load Diff
+15
-17
@@ -13,6 +13,7 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AC8F52F4-9FE6-4CEF-B549-8180757020C8}</ProjectGuid>
|
||||
<RootNamespace>BlitzPointer</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
@@ -39,14 +40,14 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)\#Build\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\#Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)#Build\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)#Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)\#Build\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\#Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<OutDir>$(SolutionDir)#Build\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)#Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
@@ -54,11 +55,9 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
@@ -66,8 +65,8 @@
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<CreateHotpatchableImage>true</CreateHotpatchableImage>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<ForcedIncludeFiles>
|
||||
</ForcedIncludeFiles>
|
||||
@@ -79,8 +78,8 @@
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<StringPooling>true</StringPooling>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<FloatingPointExceptions>true</FloatingPointExceptions>
|
||||
<UseUnicodeForAssemblerListing>true</UseUnicodeForAssemblerListing>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
@@ -102,10 +101,8 @@
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
@@ -122,14 +119,15 @@
|
||||
</ForcedIncludeFiles>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<StringPooling>true</StringPooling>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<FloatingPointExceptions>true</FloatingPointExceptions>
|
||||
<UseUnicodeForAssemblerListing>true</UseUnicodeForAssemblerListing>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
|
||||
Reference in New Issue
Block a user