Skip to content

Commit 1d7926f

Browse files
Changes for v1.0.0.3
1 parent 70beabe commit 1d7926f

31 files changed

Lines changed: 1701 additions & 293 deletions

ConquerHook/CFlashFix.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* This fix has been created by Ultimation from Elitepvpers :]
3+
* From: https://www.elitepvpers.com/forum/co2-pserver-guides-releases/4858019-release-flash-fix-old-clients.html
4+
*/
5+
#include "stdafx.h"
6+
#include "CFlashFix.h"
7+
#include <tchar.h>
8+
9+
CFlashFix::HookLoadLibrary CFlashFix::pLoadLibrary;
10+
void CFlashFix::Hook()
11+
{
12+
auto m = GetModuleHandleA("kernelbase.dll");
13+
auto proc = GetProcAddress(m, "LoadLibraryExW");
14+
pLoadLibrary = reinterpret_cast<CFlashFix::HookLoadLibrary>(proc);
15+
DetourTransactionBegin();
16+
DetourUpdateThread(GetCurrentThread());
17+
DetourAttach(&reinterpret_cast<PVOID&>(pLoadLibrary), LoadLibraryDetour);
18+
DetourTransactionCommit();
19+
}
20+
21+
HMODULE _stdcall CFlashFix::LoadLibraryDetour(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
22+
{
23+
24+
size_t i;
25+
char* pMBBuffer = (char*)malloc(256);
26+
wcstombs_s(&i, pMBBuffer, (size_t)256,
27+
lpLibFileName, (size_t)256);
28+
auto s1 = std::string(pMBBuffer);
29+
auto s2 = std::string("Flash.ocx");
30+
if (strstr(s1.c_str(), s2.c_str()))
31+
{
32+
lpLibFileName = L"./Flash.ocx";
33+
}
34+
return pLoadLibrary(lpLibFileName, hFile, dwFlags);;
35+
}

ConquerHook/CFlashFix.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* This fix has been created by Ultimation from Elitepvpers :]
3+
* From: https://www.elitepvpers.com/forum/co2-pserver-guides-releases/4858019-release-flash-fix-old-clients.html
4+
*/
5+
6+
#include "stdafx.h"
7+
#include <windows.h>
8+
#include "detours.h"
9+
#include <iostream>
10+
#pragma once
11+
12+
class CFlashFix
13+
{
14+
typedef HMODULE(_stdcall* HookLoadLibrary)(_In_ LPCWSTR lpLibFileName,
15+
_Reserved_ HANDLE hFile,
16+
_In_ DWORD dwFlags);
17+
public:
18+
static void Hook();
19+
static HookLoadLibrary pLoadLibrary;
20+
static HMODULE _stdcall LoadLibraryDetour(_In_ LPCWSTR lpLibFileName,
21+
_Reserved_ HANDLE hFile,
22+
_In_ DWORD dwFlags);
23+
};

ConquerHook/CSV3Hook.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <cstdio>
1616
#include <windows.h>
1717
#include <tlhelp32.h>
18+
#include "CFlashFix.h"
1819
#pragma comment(lib, "ws2_32.lib")
1920
#pragma comment(lib, "user32.lib")
2021

@@ -38,13 +39,13 @@ CLegacyCipher* legacy;
3839
int ClientVersion = 0, EnableHostName = 0, UpdatedIPS = 0;
3940
BYTE patternDynamic = 0x4F;
4041
char HostName[32] = "";
41-
LPCSTR HeaderConfig = "OpenConquerHook";
42+
LPCSTR HeaderConfig = "CLHook";
4243
// Variables of Settings from .ini file
4344
char ServerName[16] = "ConquerOnline";
44-
DWORD ServerNameMemoryAddress = 0x005726DC;
45+
int ServerNameMemoryAddress = 0x005726DC;
4546
// Patterns for working connection
46-
BYTE pattern_66XX[] = { 0x85, 0xC0, 0x75, 0x2F, 0x8B, 0x4F, 0x14, 0xE8, 0x0D, 0xF1, 0xFF, 0xFF, 0x83, 0x4D, 0xFC, 0xFF, 0x8B, 0x4D, 0xF4 }; // Version = 66XX
47-
BYTE pattern2_66XX[] = { 0x85, 0xC9, 0x74, 0x0C, 0xFF, 0x75, 0x0C, 0x57, 0xE8, 0x53, 0xF2, 0xFF, 0xFF, 0x89, 0x45 }; // Version = 66XX
47+
BYTE pattern_6617[] = { 0x85, 0xC0, 0x75, 0x2F, 0x8B, 0x4F, 0x14, 0xE8, 0x0D, 0xF1, 0xFF, 0xFF, 0x83, 0x4D, 0xFC, 0xFF, 0x8B, 0x4D, 0xF4 }; // Version = 6617
48+
BYTE pattern2_6617[] = { 0x85, 0xC9, 0x74, 0x0C, 0xFF, 0x75, 0x0C, 0x57, 0xE8, 0x53, 0xF2, 0xFF, 0xFF, 0x89, 0x45 }; // Version = 6617
4849
BYTE pattern_60XX[] = { 0x85, 0xC0, 0x75, 0x00, 0x8B, 0x4F, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x83, 0x4D, 0x00, 0x00, 0x8B, 0x00, 0x00 }; // Version = 60XX
4950
BYTE pattern2_60XX[] = { 0x85, 0xC9, 0x00, 0x00, 0xFF, 0x75, 0x00, 0x57, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x89, 0x45 }; // Version = 60XX
5051
BYTE pattern_OLD[] = { 0x85, 0xC0, 0x75, 0x00, 0x8B, 0x4E, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x83, 0x4D, 0x00, 0x00, 0x8B, 0x00, 0x00 }; // Version = Old Clients
@@ -137,7 +138,7 @@ int __stdcall csv3_connect(SOCKET s, sockaddr_in* name, int len)
137138
char buffer[16];
138139
if (ServerNameMemoryAddress != 0) {
139140
//Input Servername
140-
WriteProcessMemory(GetCurrentProcess(), (LPVOID)ServerNameMemoryAddress, ServerName, sizeof(buffer), NULL);
141+
WriteProcessMemory(GetCurrentProcess(), (void*)ServerNameMemoryAddress, ServerName, sizeof(buffer), 0);
141142
}
142143
//END Servername Changer
143144

@@ -222,7 +223,7 @@ void csv3_init(HMODULE hModule)
222223
break;
223224
}
224225
}
225-
strcat(szConfig, "OpenConquerHook.ini");
226+
strcat(szConfig, "CLHook.ini");
226227

227228
// Find the correct version of client based in user config
228229
char szVersionValue[5];
@@ -233,6 +234,12 @@ void csv3_init(HMODULE hModule)
233234
GetPrivateProfileStringA(HeaderConfig, "SERVERNAME", "ConquerOnline", ServerName, 16, szConfig);
234235
ServerNameMemoryAddress = GetPrivateProfileIntA(HeaderConfig, "SERVERNAME_MEMORYADDRESS", 0, szConfig);
235236

237+
// Fix Flash for old clients
238+
if (ClientVersion <= 6000) {
239+
CFlashFix flash;
240+
flash.Hook();
241+
}
242+
236243
if (ClientVersion >= 5600) {
237244
//
238245
// hook packet processor
@@ -247,9 +254,8 @@ void csv3_init(HMODULE hModule)
247254
if (ClientVersion >= 6000) {
248255
match = (PBYTE)FindMemoryPattern(pattern_60XX, wildcards, 19);
249256
}
250-
if (ClientVersion >= 6600) {
251-
match = (PBYTE)FindMemoryPattern(pattern_66XX, wildcards, 19);
252-
257+
if (ClientVersion >= 6617) {
258+
match = (PBYTE)FindMemoryPattern(pattern_6617, wildcards, 19);
253259
}
254260

255261
if (match == NULL)
@@ -275,8 +281,8 @@ void csv3_init(HMODULE hModule)
275281
if (ClientVersion >= 6000) {
276282
match = (PBYTE)FindMemoryPattern(pattern2_60XX, wildcards2, 15);
277283
}
278-
if (ClientVersion >= 6600) {
279-
match = (PBYTE)FindMemoryPattern(pattern2_66XX, wildcards2, 15);
284+
if (ClientVersion >= 6617) {
285+
match = (PBYTE)FindMemoryPattern(pattern2_6617, wildcards2, 15);
280286
}
281287

282288
if (match == NULL)

ConquerHook/CSV3Hook.vcxproj

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
<ProjectGuid>{01358812-493C-4A24-8630-F71DF28D47D8}</ProjectGuid>
1515
<Keyword>Win32Proj</Keyword>
1616
<RootNamespace>OpenConquerHook</RootNamespace>
17-
<ProjectName>OpenConquerHook</ProjectName>
18-
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
17+
<ProjectName>CLHook</ProjectName>
18+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1919
</PropertyGroup>
2020
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2121
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
2222
<ConfigurationType>DynamicLibrary</ConfigurationType>
2323
<UseDebugLibraries>true</UseDebugLibraries>
2424
<CharacterSet>Unicode</CharacterSet>
25-
<UseOfMfc>Dynamic</UseOfMfc>
26-
<PlatformToolset>v141</PlatformToolset>
25+
<UseOfMfc>Static</UseOfMfc>
26+
<PlatformToolset>v142</PlatformToolset>
2727
</PropertyGroup>
2828
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
2929
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -85,6 +85,8 @@
8585
<ClInclude Include="targetver.h" />
8686
</ItemGroup>
8787
<ItemGroup>
88+
<ClCompile Include="CFlashFix.cpp" />
89+
<ClCompile Include="CFlashFix.h" />
8890
<ClCompile Include="CSV3Hook.cpp" />
8991
<ClCompile Include="dllmain.cpp">
9092
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
@@ -102,7 +104,17 @@
102104
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
103105
</ClCompile>
104106
</ItemGroup>
107+
<ItemGroup>
108+
<None Include="packages.config" />
109+
</ItemGroup>
105110
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
106111
<ImportGroup Label="ExtensionTargets">
112+
<Import Project="..\ConquerLoader\packages\Detours.4.0.1\build\native\Detours.targets" Condition="Exists('..\ConquerLoader\packages\Detours.4.0.1\build\native\Detours.targets')" />
107113
</ImportGroup>
114+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
115+
<PropertyGroup>
116+
<ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
117+
</PropertyGroup>
118+
<Error Condition="!Exists('..\ConquerLoader\packages\Detours.4.0.1\build\native\Detours.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\ConquerLoader\packages\Detours.4.0.1\build\native\Detours.targets'))" />
119+
</Target>
108120
</Project>

ConquerHook/CSV3Hook.vcxproj.filters

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,14 @@
4747
<ClCompile Include="Scan.cpp">
4848
<Filter>Source Files</Filter>
4949
</ClCompile>
50+
<ClCompile Include="CFlashFix.cpp">
51+
<Filter>Source Files</Filter>
52+
</ClCompile>
53+
<ClCompile Include="CFlashFix.h">
54+
<Filter>Header Files</Filter>
55+
</ClCompile>
56+
</ItemGroup>
57+
<ItemGroup>
58+
<None Include="packages.config" />
5059
</ItemGroup>
5160
</Project>

ConquerHook/packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Detours" version="4.0.1" targetFramework="native" developmentDependency="true" />
4+
</packages>

ConquerLoader/CLCore/CLCore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
</ItemGroup>
5656
<ItemGroup>
5757
<Compile Include="Constants.cs" />
58+
<Compile Include="LoaderEvents.cs" />
5859
<Compile Include="Models\IniManager.cs" />
5960
<Compile Include="Models\LoaderConfig.cs" />
6061
<Compile Include="Models\ServerConfiguration.cs" />
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using ConquerLoader.CLCore;
2+
using System.Collections.Generic;
3+
4+
namespace CLCore
5+
{
6+
public class LoaderEvents
7+
{
8+
public delegate void OnLauncherLoaded();
9+
public delegate void OnLauncherExit(List<Parameter> parameters);
10+
public delegate void OnConquerLaunched(List<Parameter> parameters);
11+
public static event OnLauncherLoaded LauncherLoaded;
12+
public static event OnConquerLaunched ConquerLaunched;
13+
public static event OnLauncherExit LauncherExit;
14+
15+
public static void LauncherLoadedStartEvent()
16+
{
17+
LauncherLoaded?.Invoke();
18+
}
19+
20+
public static void ConquerLaunchedStartEvent(List<Parameter> parameters)
21+
{
22+
ConquerLaunched?.Invoke(parameters);
23+
}
24+
25+
public static void LauncherExitStartEvent(List<Parameter> parameters)
26+
{
27+
LauncherExit?.Invoke(parameters);
28+
}
29+
}
30+
}

ConquerLoader/CLCore/PluginSystem/IPlugin.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@ public interface IPlugin
66
{
77
string Name { get; }
88
string Explanation { get; }
9-
LoadType LoadType { get; }
109
void Run();
11-
12-
List<Parameter> Parameters { get; set; }
13-
}
14-
15-
public enum LoadType
16-
{
17-
LOADER_EXECUTION,
18-
ON_FORM_LOAD,
19-
ON_GAME_START
2010
}
2111
}

ConquerLoader/CLCore/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
3333
// utilizando el carácter "*", como se muestra a continuación:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.2")]
36-
[assembly: AssemblyFileVersion("1.0.0.2")]
35+
[assembly: AssemblyVersion("1.0.0.3")]
36+
[assembly: AssemblyFileVersion("1.0.0.3")]

0 commit comments

Comments
 (0)