Skip to content

Commit

Permalink
Added WDGRemoveLoginAutoClose.
Browse files Browse the repository at this point in the history
  • Loading branch information
greenboxal committed Sep 23, 2012
1 parent 071dad3 commit 5d74843
Show file tree
Hide file tree
Showing 5 changed files with 374 additions and 0 deletions.
Binary file added PreBuilt/WDGRemoveLoginAutoClose.dll
Binary file not shown.
244 changes: 244 additions & 0 deletions WDGRemoveLoginAutoClose/WDGRemoveLoginAutoClose.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
#include <stdlib.h>
#include <crtdbg.h>

#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif // DEBUG_NEW
#endif // _DEBUG

#include "WDGRemoveLoginAutoClose.h"

WDGPlugin *g_SelfReference = NULL;

void WDGPlugin::Release()
{
m_diffdata.clear();
g_SelfReference = NULL;
delete this;
}

void WDGPlugin::Free(LPVOID memory)
{
delete memory;
memory = NULL;
}

LPWDGPLUGININFO WDGPlugin::GetPluginInfo()
{
static WDGPLUGININFO wpi =
{
TEXT("Remove Login Auto Close"),
TEXT("Prevents the client to close when the login is refused."),
TEXT("[Fix]"),
TEXT(""),
TEXT("GreenBox"),
1,
0,
{ 0x77c3dbda, 0xfd32, 0xac03, { 0x34, 0xef, 0x12, 0xac, 0xde, 0xfa, 0xce, 0xec } },
TEXT("Recommended")
};

return &wpi;
}

INT32 WDGPlugin::Enabled()
{
return 0;
}

INT32 WDGPlugin::Disabled()
{
return 0;
}

LPCTSTR WDGPlugin::GetInputValue()
{
return NULL;
}

bool WDGPlugin::GenerateNewPatch()
{
WeeDiffGenPlugin::FINDDATA sFindData = {0};
CHAR szMsg[256];

UINT32 uOffset = 0;

try
{
ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData =
"B9 '????'" // MOV ECX, g_modeMgr
"E8 '????'" // CALL CModeMgr::Quit
"C78424CC000000FFFFFFFF"; // MOV [ESP + D0h + var_4], -1
sFindData.uDataSize = 21;
sFindData.lpszSection = ".text";
sFindData.chWildCard = '?';
sFindData.uMask = WFD_PATTERN | WFD_SECTION | WFD_WILDCARD;

uOffset = m_dgc->Match(&sFindData);
}
catch (LPCSTR lpszMsg)
{
sprintf_s(szMsg, 256, "WDGRemoveLoginAutoClose :: Part 1 :: %s", lpszMsg);
m_dgc->LogMsg(szMsg);
return false;
}

try
{
ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData =
"\x8B\x4C\x24\x14" // MOV ECX, [ESP+14h]
"\xC7\x41\x0C\x03\x00\x00\x00" // MOV [ECX+C], 3
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"; // NOPs
sFindData.uDataSize = 21;

m_dgc->Replace(CBAddDiffData, uOffset, &sFindData);
}
catch (LPCSTR lpszMsg)
{
sprintf_s(szMsg, 256, "WDGRemoveLoginAutoClose :: Part 2 :: %s", lpszMsg);
m_dgc->LogMsg(szMsg);
return false;
}

return true;
}

DiffData *WDGPlugin::GeneratePatch()
{
WeeDiffGenPlugin::FINDDATA sFindData = {0};
CHAR szMsg[256];
m_diffdata.clear();

UINT32 uOffset = 0;

if (!GenerateNewPatch())
{
try
{
ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData = "'readfolder'";
sFindData.uMask = WFD_PATTERN;
UINT32 uOffsetA = m_dgc->FindStr(&sFindData, true);

ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData = "'loading'";
sFindData.uMask = WFD_PATTERN;
UINT32 uOffsetB = m_dgc->FindStr(&sFindData, true);

ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData = new CHAR[28];
sFindData.uDataSize = 28;
sFindData.lpszSection = ".text";
sFindData.chWildCard = '\xAB';
sFindData.uMask = WFD_SECTION | WFD_WILDCARD;

memcpy(sFindData.lpData, "\x68\x00\x00\x00\x00\x8B\xAB\xE8\xAB\xAB\xAB\xAB\x85\xC0\x74\x07\xC6\x05\xAB\xAB\xAB\xAB\x01\x68\x00\x00\x00\x00", 28);
memcpy(sFindData.lpData + 1, (CHAR *)&uOffsetA, 4);
memcpy(sFindData.lpData + 24, (CHAR *)&uOffsetB, 4);

uOffset = m_dgc->Match(&sFindData);

delete[] sFindData.lpData;
}
catch (LPCSTR lpszMsg)
{
sprintf_s(szMsg, 256, "WDGReadDataFolderFirst :: Part 1 :: %s", lpszMsg);
m_dgc->LogMsg(szMsg);
return NULL;
}

try
{
ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData = "\x90\x90";
sFindData.uDataSize = 2;

m_dgc->Replace(CBAddDiffData, uOffset + 14, &sFindData);
}
catch (LPCSTR lpszMsg)
{
sprintf_s(szMsg, 256, "WDGReadDataFolderFirst :: Part 2 :: %s", lpszMsg);
m_dgc->LogMsg(szMsg);
return NULL;
}

try
{
UINT32 uOffsetC = m_dgc->GetDWORD32(uOffset + 18);

ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData = new CHAR[16];
sFindData.uDataSize = 16;
sFindData.lpszSection = ".text";
sFindData.chWildCard = '\xAB';
sFindData.uMask = WFD_SECTION | WFD_WILDCARD;

memcpy(sFindData.lpData, "\x80\x3D\x00\x00\x00\x00\x00\x57\xB9\xAB\xAB\xAB\x00\x56\x74\x23", 16);
memcpy(sFindData.lpData + 2, (CHAR *)&uOffsetC, 4);

uOffset = m_dgc->Match(&sFindData);

delete[] sFindData.lpData;
}
catch (LPCSTR lpszMsg)
{
sprintf_s(szMsg, 256, "WDGReadDataFolderFirst :: Part 3 :: %s", lpszMsg);
m_dgc->LogMsg(szMsg);
return NULL;
}

try
{
ZeroMemory(&sFindData, sizeof(sFindData));
sFindData.lpData = "\x90\x90";
sFindData.uDataSize = 2;

m_dgc->Replace(CBAddDiffData, uOffset + 14, &sFindData);
}
catch (LPCSTR lpszMsg)
{
sprintf_s(szMsg, 256, "WDGReadDataFolderFirst :: Part 4 :: %s", lpszMsg);
m_dgc->LogMsg(szMsg);
return NULL;
}
}

return &m_diffdata;
}

DiffData *WDGPlugin::GetDiffData()
{
if(m_diffdata.size() <= 0)
{
return NULL;
}

return &m_diffdata;
}

extern "C" __declspec(dllexport) WeeDiffGenPlugin::IWDGPlugin *InitPlugin(LPVOID lpData, USHORT unWeeDiffMajorVersion, USHORT unWeeDiffMinorVersion)
{
#ifndef _DEBUG
// Enable functions to track down memory leaks.
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif

if(g_SelfReference == NULL)
{
g_SelfReference = new WDGPlugin(lpData);
}

return g_SelfReference;
}

void WDGPlugin::CBAddDiffData(WeeDiffGenPlugin::LPDIFFDATA lpDiffData)
{
if(g_SelfReference != NULL)
{
g_SelfReference->m_diffdata.push_back(*lpDiffData);
}
}
34 changes: 34 additions & 0 deletions WDGRemoveLoginAutoClose/WDGRemoveLoginAutoClose.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef _WDG_REMOVE_LOGIN_AUTO_CLOSE_H
#define _WDG_REMOVE_LOGIN_AUTO_CLOSE_H

#define _CRTDBG_MAP_ALLOC

#include "..\Include\WeeDiffGenPlugin.h"
#include <tchar.h>
#include <string>

using namespace WeeDiffGenPlugin;

class WDGPlugin : public IWDGPlugin
{
public:
WDGPlugin(LPVOID lpData) : IWDGPlugin(lpData) {}

virtual void Release();
virtual void Free(LPVOID memory);
virtual LPWDGPLUGININFO GetPluginInfo();
virtual INT32 Enabled();
virtual INT32 Disabled();
virtual LPCTSTR GetInputValue();
virtual DiffData *GeneratePatch();
virtual bool GenerateNewPatch();
virtual DiffData *GetDiffData();

protected:
static void __stdcall CBAddDiffData(WeeDiffGenPlugin::LPDIFFDATA lpDiffData);

protected:
DiffData m_diffdata;
};

#endif // _WDG_REMOVE_LOGIN_AUTO_CLOSE_H
90 changes: 90 additions & 0 deletions WDGRemoveLoginAutoClose/WDGRemoveLoginAutoClose.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2E5F2986-99C5-4567-A6C6-3A9546647177}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>WDGRemoveLoginAutoClose</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\plugins\WeeDiffGen\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\plugins\WeeDiffGen\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WDGRemoveLoginAutoClose_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WDGRemoveLoginAutoClose_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsCpp</CompileAs>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="WDGRemoveLoginAutoClose.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="WDGRemoveLoginAutoClose.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
6 changes: 6 additions & 0 deletions WeeTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WDGReadDataFolderFirst", "W
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WDGForceClientHashPacket", "WDGForceClientHashPacket\WDGForceClientHashPacket.vcxproj", "{F9770F51-0B6B-4C78-B756-53298667D3D1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WDGRemoveLoginAutoClose", "WDGRemoveLoginAutoClose\WDGRemoveLoginAutoClose.vcxproj", "{2E5F2986-99C5-4567-A6C6-3A9546647177}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand All @@ -19,6 +21,10 @@ Global
{F9770F51-0B6B-4C78-B756-53298667D3D1}.Debug|Win32.Build.0 = Debug|Win32
{F9770F51-0B6B-4C78-B756-53298667D3D1}.Release|Win32.ActiveCfg = Release|Win32
{F9770F51-0B6B-4C78-B756-53298667D3D1}.Release|Win32.Build.0 = Release|Win32
{2E5F2986-99C5-4567-A6C6-3A9546647177}.Debug|Win32.ActiveCfg = Debug|Win32
{2E5F2986-99C5-4567-A6C6-3A9546647177}.Debug|Win32.Build.0 = Debug|Win32
{2E5F2986-99C5-4567-A6C6-3A9546647177}.Release|Win32.ActiveCfg = Release|Win32
{2E5F2986-99C5-4567-A6C6-3A9546647177}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 5d74843

Please sign in to comment.