Skip to content

Commit

Permalink
Support XP
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Jan 10, 2025
1 parent 8a002b1 commit 352f25e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,4 @@ __pycache__/
*.map
*.log
/Signing
MinHook/libMinHook.x86.lib
3 changes: 2 additions & 1 deletion DotAAllstarsHelperFinal/DotAAllstarsHelper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</EnableParallelCodeGeneration>
<FloatingPointModel>
</FloatingPointModel>
<PreprocessorDefinitions>SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;NDEBUG;_WIN32_WINNT=0x0600;WINVER=0x0600;NTDDI_VERSION=0x06000000;PSAPI_VERSION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;NDEBUG;;NOMINMAX;WIN32;NDEBUG;_CONSOLE;XP_BUILD;E_BOUNDS=_HRESULT_TYPEDEF_(0x8000000BL);__FILENAME__="*******************";_WIN32_WINNT=0x0501;WINVER=0x0501;NTDDI_VERSION=0x05010000;;VC_EXTRALEAN;_ATL_XP_TARGETING;WIN32_LEAN_AND_MEAN;PSAPI_VERSION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WholeProgramOptimization>
</WholeProgramOptimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
Expand Down Expand Up @@ -167,6 +167,7 @@
<ClCompile Include="DotaViewAllySkill.cpp" />
<ClCompile Include="DotaWebHelper.cpp" />
<ClCompile Include="hash_64.cpp" />
<ClCompile Include="httplib.cpp" />
<ClCompile Include="IniReader.cpp" />
<ClCompile Include="IniWriter.cpp" />
<ClCompile Include="MegaPacketHandler.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions DotAAllstarsHelperFinal/DotAAllstarsHelper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@
<ClCompile Include="StackWalker.cpp">
<Filter>Src</Filter>
</ClCompile>
<ClCompile Include="httplib.cpp">
<Filter>Src</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="base64.h">
Expand Down
2 changes: 1 addition & 1 deletion DotAAllstarsHelperFinal/DotaFilesHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void ApplyIconFilter(std::string filename, unsigned char** OutDataPointer, size_
for (int y = 4; y < 60; y++)
{
int id = x * 64 + y;
int ave = (min(min(OutImage[id].R, OutImage[id].G), OutImage[id].B) + max(max(OutImage[id].R, OutImage[id].G), OutImage[id].B)) / 2;
int ave = (std::min(std::min(OutImage[id].R, OutImage[id].G), OutImage[id].B) + std::max(std::max(OutImage[id].R, OutImage[id].G), OutImage[id].B)) / 2;
OutImage[id].R = FixBounds((ave + OutImage[id].R) / 4);
OutImage[id].G = FixBounds((ave + OutImage[id].G) / 4);
OutImage[id].B = FixBounds((ave + OutImage[id].B) / 4);
Expand Down
9 changes: 5 additions & 4 deletions DotAAllstarsHelperFinal/StackWalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
#pragma warning(disable : 4091) // For fix unnamed enums from DbgHelp.h
#endif

#include "Main.h"

// If VC7 and later, then use the shipped 'dbghelp.h'-file
#pragma pack(push, 8)
Expand Down Expand Up @@ -1138,7 +1139,7 @@ void monitorFunc()
break;
}

const DWORD threadId = GetThreadId(threadToSuspend);
const DWORD threadId = GetGameDllThread;

// Suspend thread
DWORD previousSuspendCtr = SuspendThread(threadToSuspend);
Expand All @@ -1156,7 +1157,7 @@ void monitorFunc()
}

std::cerr << "Error trying to suspend thread " << threadId << " : previous suspend ctr should have been 0 but was " << previousSuspendCtr << std::endl;
const DWORD currentThreadId = GetThreadId(threadToSuspend);
const DWORD currentThreadId = GetGameDllThread;
if (currentThreadId != threadId)
{
std::cerr << "Thread ID has changed to " << currentThreadId << std::endl;
Expand Down Expand Up @@ -1189,7 +1190,7 @@ void monitorFunc()
if (previousSuspendCtr != 1)
{
std::cerr << "Error trying to resume thread " << threadId << " : previous suspend ctr should have been 1 but was " << previousSuspendCtr << std::endl;
const DWORD currentThreadId = GetThreadId(threadToSuspend);
const DWORD currentThreadId = GetGameDllThread;
if (currentThreadId != threadId)
{
std::cerr << "Thread ID has changed to " << currentThreadId << std::endl;
Expand Down Expand Up @@ -1266,7 +1267,7 @@ BOOL StackWalker::ShowCallstack(HANDLE hThread, const CONTEXT* context, PReadPro
}
else
{
const bool isMonitorThread = GetThreadId(hThread) == monitorThreadId;
const bool isMonitorThread = GetGameDllThread == monitorThreadId;

if (monitorThreadPtr == nullptr)
{
Expand Down
30 changes: 30 additions & 0 deletions DotAAllstarsHelperFinal/httplib.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

#include <io.h>
#include <winsock2.h>
#include <ws2tcpip.h>

#ifdef XP_BUILD
int inet_pton(int af, const char* src, void* dst)
{
struct sockaddr_storage ss;
int size = sizeof(ss);
char src_copy[INET6_ADDRSTRLEN + 1];

memset(&ss, 0, sizeof(ss));
/* stupid non-const API */
strncpy(src_copy, src, INET6_ADDRSTRLEN + 1);
src_copy[INET6_ADDRSTRLEN] = 0;

if (WSAStringToAddressA(src_copy, af, NULL, (struct sockaddr*)&ss, &size) == 0) {
switch (af) {
case AF_INET:
*(struct in_addr*)dst = ((struct sockaddr_in*)&ss)->sin_addr;
return 1;
case AF_INET6:
*(struct in6_addr*)dst = ((struct sockaddr_in6*)&ss)->sin6_addr;
return 1;
}
}
return 0;
}
#endif
Binary file removed MinHook/libMinHook.x86.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion minhook_for_build/build/VC17/libMinHook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;STRICT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;STRICT;;NOMINMAX;WIN32;NDEBUG;_CONSOLE;XP_BUILD;E_BOUNDS=_HRESULT_TYPEDEF_(0x8000000BL);__FILENAME__="*******************";_WIN32_WINNT=0x0501;WINVER=0x0501;NTDDI_VERSION=0x05010000;;VC_EXTRALEAN;_ATL_XP_TARGETING;WIN32_LEAN_AND_MEAN;PSAPI_VERSION=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
Expand Down

0 comments on commit 352f25e

Please sign in to comment.