Merge branch 'initial-dump-3.0.8.9327'

This commit is contained in:
Bernd Lörwald
2018-03-14 21:05:43 +01:00
52 changed files with 404 additions and 46 deletions

View File

@@ -67,7 +67,7 @@ box_width
box_height
box_yaw
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
ContinentID<32>
x

View File

@@ -90,7 +90,7 @@ creatureGeosetData<32>
objectEffectPackageID<32>
animReplacementSetID<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
modelID<32>
soundID<32>

View File

@@ -49,7 +49,7 @@ petFoodMask<32>
name_lang
iconFile
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
minScale
minScaleLevel<32>

View File

@@ -135,7 +135,7 @@ missileCollisionRadius
missileCollisionPush
missileCollisionRaise
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
flags<32>
ModelName

View File

@@ -116,7 +116,7 @@ tauntSoundID<32>
soundFidget<32>[5]
customAttack<32>[4]
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
soundExertionID<32>
soundExertionCriticalID<32>

View File

@@ -8,7 +8,7 @@ $id$ID<32>
spells<32>[4]
availability<32>[4]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
spells<32>[4]
availability<32>[4]

View File

@@ -64,7 +64,7 @@ parentFactionCap<32>[2]
name_lang
description_lang
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
reputationIndex<32>
reputationRaceMask<32>[4]

View File

@@ -29,7 +29,7 @@ factionGroup<8>
friendGroup<8>
enemyGroup<8>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
faction<32>
flags<32>

View File

@@ -68,7 +68,7 @@ texture[8]
itemVisual<32>
particleColorID<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
modelName[2]
modelTexture[2]

View File

@@ -16,7 +16,7 @@ $noninlineid$ID<32>
name_lang
Enchantment<16>[5]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
Name
Enchantment<32>[5]

View File

@@ -19,7 +19,7 @@ name_lang
enchantment<16>[5]
allocationPct<16>[5]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
name_lang
internalName

View File

@@ -33,7 +33,7 @@ setThreshold<32>[8]
requiredSkill<32>
requiredSkillRank<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
name_lang
itemID<32>[17]

View File

@@ -6,6 +6,6 @@ BUILD 6.0.1.18179, 4.0.0.11792
$id$ID<32>
Model
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
Model

View File

@@ -12,6 +12,6 @@ BUILD 8.0.1.26095, 8.0.1.26175
$noninlineid$ID<32>
modelFileID<32>[5]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
Slot<32>[5]

View File

@@ -20,7 +20,7 @@ Skill<16>[8]
Type<8>[8]
Action<8>[8]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
Type<32>[8]
Index<32>[8]

View File

@@ -51,7 +51,7 @@ offsetY
offsetZ
objectEffectModifierID<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
name
objectEffectGroupID<32>

View File

@@ -6,6 +6,6 @@ BUILD 6.0.1.18179, 4.0.0.11792
$id$ID<32>
name
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
name

View File

@@ -20,7 +20,7 @@ inputType<8>
mapType<8>
outputType<8>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
inputType<32>
mapType<32>

View File

@@ -6,6 +6,6 @@ BUILD 6.0.1.18179, 4.0.0.11792
$id$ID<32>
name
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
name

View File

@@ -17,7 +17,7 @@ objectEffectPackageID<16>
objectEffectGroupID<16>
stateType<16>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
objectEffectPackageID<32>
objectEffectGroupID<32>

View File

@@ -17,6 +17,6 @@ Profession<16>
Type<8>
Modifiers<8>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
InfoName_lang

View File

@@ -13,6 +13,6 @@ $noninlineid$ID<32>
SortName_lang
uiOrderIndex<8>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
SortName_lang

View File

@@ -56,7 +56,7 @@ displayName_lang
description_lang
spellIconID<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
categoryID<32>
skillCostsID<32>

View File

@@ -85,7 +85,7 @@ trivialSkillLineRankLow<32>
abandonable<32>
characterPoints<32>[2]
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
skillLine<32>
spell<32>

View File

@@ -8,7 +8,7 @@ $id$ID<32>
name_lang
sortIndex<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
name_lang
sortIndex<32>

View File

@@ -40,7 +40,7 @@ minLevel<32>
skillTierID<32>
skillCostIndex<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
skillID<32>
raceMask<32>

View File

@@ -12,7 +12,7 @@ $id$ID<32>
cost<32>[16]
value<32>[16]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
cost<32>[16]
value<32>[16]

View File

@@ -60,7 +60,7 @@ soundEntriesID<32>
mapID<32>
name
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
$id$ID<32>
positionX
positionY

View File

@@ -54,7 +54,7 @@ distanceCutoff
EAXDef<32>
soundEntriesAdvancedID<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
soundType<32>
name

View File

@@ -87,7 +87,7 @@ outsideVolume
outerRadius2D
name
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
soundEntryID<32>
innerRadius2D

View File

@@ -367,7 +367,7 @@ schoolMask<32>
runeCostID<32>
spellMissileID<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
category<32>
dispelType<32>

View File

@@ -233,7 +233,7 @@ RenderLayer<32>
TextureLength
WavePhase
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
AvgSegLen
Width

View File

@@ -97,7 +97,7 @@ flags<32>
src_itemID<32>
condition_ID<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
charges<32>
effect<32>[3]

View File

@@ -47,7 +47,7 @@ rt_operand<32>[5]
logic<8>[5]
padding_371849722<8>[3]
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
lt_operandType<8>[5]
lt_operand<32>[5]

View File

@@ -92,7 +92,7 @@ defaultPitchMax
defaultSpeedMin
defaultSpeedMax
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
flags<32>
defaultPitchMin

View File

@@ -32,7 +32,7 @@ scriptBody
flags<32>
missileCount<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
name
scriptBody

View File

@@ -147,7 +147,7 @@ missileImpactOffsetX
missileImpactOffsetY
missileImpactOffsetZ
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
precastKit<32>
castKit<32>

View File

@@ -75,7 +75,7 @@ fileName
areaEffectSize
scale
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
name
fileName

View File

@@ -130,7 +130,7 @@ charParamTwo[4]
charParamThree[4]
flags<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
kitType<32>
startAnimID<32>

View File

@@ -42,7 +42,7 @@ Flags<8>
uiTextureKitID<32>
specialIconConditionID<32>
BUILD 3.0.1.8303, 3.0.2.8885, 4.0.0.11792
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328, 4.0.0.11792
$id$ID<32>
ContinentID<32>
X

View File

@@ -17,7 +17,7 @@ ToTaxiNode<16>
$id$ID<32>
Cost<32>
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
FromTaxiNode<32>
ToTaxiNode<32>

View File

@@ -35,7 +35,7 @@ delay<32>
arrivalEventID<16>
departureEventID<16>
BUILD 3.0.1.8303, 3.0.2.8885, 4.0.0.11792
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328, 4.0.0.11792
$id$ID<32>
PathID<32>
NodeIndex<32>

View File

@@ -128,7 +128,7 @@ pitchMin
pitchMax
seatID<32>[8]
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
flags<32>
turnSpeed

View File

@@ -295,7 +295,7 @@ exitAnimStart<32>
exitAnimLoop<32>
exitAnimEnd<32>
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
flags<32>
attachmentID<32>

View File

@@ -56,7 +56,7 @@ transitionSkyBox
effectColor[3]
effectTexture
BUILD 3.0.1.8303, 3.0.2.8885
BUILD 3.0.1.8303, 3.0.2.8885, 3.0.8.9328
ID<32>
ambienceID<32>
effectType<32>

View File

@@ -87,7 +87,7 @@ dynamicTooltip_lang
extendedUI
extendedUIStateVariable<32>[3]
BUILD 3.0.2.8885
BUILD 3.0.2.8885, 3.0.8.9328
ID<32>
mapID<32>
areaID<32>

View File

@@ -0,0 +1,36 @@
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
"Run as Administrator, or inject will fail"
exit
}
$ErrorActionPreference = "Stop"
$PSDefaultParameterValues['*:Encoding'] = 'utf8'
$script_dir = (split-path $MyInvocation.MyCommand.Path)
$msvcpp = "Visual Studio 15 2017"
$msvs_short = "vs2017"
if(!(Test-Path -Path $script_dir/initial_dump_from_binary-3.0.8.9328-build)) {
mkdir initial_dump_from_binary-3.0.8.9328-build
cd initial_dump_from_binary-3.0.8.9328-build
if(-not (Test-Path nuget.exe))
{
Invoke-WebRequest -Uri "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile nuget.exe
}
& "./nuget.exe" install EasyHookNativePackage
& cmake -DCMAKE_INSTALL_PREFIX="${script_dir}/initial_dump_from_binary-3.0.8.9328-install" -G"$msvcpp" ../initial_dump_from_binary-3.0.8.9328
cd ..
}
if(Test-Path -Path $script_dir/initial_dump_from_binary-3.0.8.9328-install) {
Remove-Item -Path "${script_dir}/initial_dump_from_binary-3.0.8.9328-install" -Confirm:$false -Force -Recurse
}
& cmake --build $script_dir/initial_dump_from_binary-3.0.8.9328-build --config Release --target install
& "${script_dir}/initial_dump_from_binary-3.0.8.9328-install/injector.exe" "${script_dir}/initial_dump_from_binary-3.0.8.9328-install/dump.dll" "WOW-9327patch3.0.8_PTR_WIN.exe" 2>&1
Start-Sleep -Seconds 2

View File

@@ -0,0 +1,42 @@
cmake_minimum_required(VERSION 3.2)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif()
set (CMAKE_LIBRARY_ARCHITECTURE "Win32/v140/${CMAKE_BUILD_TYPE}")
set (easyhook_version "2.7.6578.1")
set (CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/EasyHookNativePackage.redist.${easyhook_version}/build/native"
"${CMAKE_CURRENT_BINARY_DIR}/EasyHookNativePackage.${easyhook_version}/build/native"
)
message (STATUS "${CMAKE_INSTALL_PREFIX}")
find_library (easyhook_lib NAMES EasyHook32.lib)
find_file (easyhook_redist NAMES EasyHook32.dll PATH_SUFFIXES "bin/${CMAKE_LIBRARY_ARCHITECTURE}")
find_path (easyhook_include NAMES easyhook.h)
if(NOT easyhook_lib)
message (FATAL_ERROR "${easyhook_lib}")
endif()
if(NOT easyhook_redist)
message (FATAL_ERROR "${easyhook_redist}")
endif()
if(NOT easyhook_include)
message (FATAL_ERROR "${easyhook_include}")
endif()
add_executable (injector "injector.cpp")
add_library (dump SHARED "dump.cpp")
find_package (Boost REQUIRED)
target_include_directories (injector SYSTEM PRIVATE "${easyhook_include}")
target_include_directories (dump SYSTEM PRIVATE "${easyhook_include}")
target_link_libraries (injector ${easyhook_lib})
target_link_libraries (dump Psapi ${easyhook_lib} Boost::boost)
install (TARGETS injector dump DESTINATION ".")
install (FILES "${easyhook_redist}" DESTINATION ".")

View File

@@ -0,0 +1,106 @@
#include <Windows.h>
BOOL APIENTRY DllMain (HMODULE, DWORD, LPVOID) { return TRUE; }
#include <easyhook.h>
#include <string>
#include <iostream>
#include <Psapi.h>
#include <thread>
#include <chrono>
#include <unordered_map>
#include <fstream>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <boost/optional.hpp>
#include "patching.hpp"
using _UNKNOWN = void;
fun<void (int, const char *, const char **, _UNKNOWN *, char, _UNKNOWN *, _UNKNOWN *, unsigned int , unsigned int *, unsigned int *, char *, _UNKNOWN *)> sub_5B08F0
= 0x5DEAD0;
fun<int()> sub_5B1AD0 = 0x5DF1D0;
fun<void()> sub_405AA0 = 0x406000;
void on_inject()
{
//! This function is _not_ dbmeta but db update registration. the fields in here are in memory, not in file!
hook (sub_5B08F0
, [] ( int fieldCount, const char *structName, const char **fieldNames
, _UNKNOWN *, char, _UNKNOWN *, _UNKNOWN *
, unsigned int recordSize
, unsigned int *fieldOffsets, unsigned int *fieldSizes, char *fieldTypesIsh
, _UNKNOWN *someFunc
)
{
std::ofstream(std::string (structName) + ".dbd");
std::ofstream of(std::string (structName) + ".dbd", std::ios_base::app);
of << "COLUMNS\n";
for (int f = 0; f < fieldCount; ++f) {
std::string type;
switch(fieldTypesIsh[f]) {
case 0:
//! HACK: these are actually either int or float.
type = "int";
break;
case 1:
if (std::string(fieldNames[f]).find("_lang") == std::string::npos)
type = "string";
else
//! HACK: these only work since in dbd we don't care for splitting them either
type = "locstring";
break;
default:
throw std::logic_error ("unknown typeish");
}
of << type << " " << (fieldNames[f] + 2) << "\n";
}
of << "\n";
of << "BUILD 3.0.8.9328\n";
for (int f = 0; f < fieldCount; ++f) {
std::string suff;
switch(fieldTypesIsh[f]) {
case 0:
if (fieldSizes[f] % 4 != 0) {
suff = "<8>";
if (fieldSizes[f] > 1) {
suff += "[" + std::to_string (fieldSizes[f]) + "]";
}
} else {
suff = "<32>";
if (fieldSizes[f] / 4 > 1) {
suff += "[" + std::to_string (fieldSizes[f] / 4) + "]";
}
}
break;
case 1:
if (fieldSizes[f] % 4 != 0) throw std::logic_error ("non-4-byte-stringref");
if (fieldSizes[f] / 4 > 1) {
suff += "[" + std::to_string (fieldSizes[f] / 4) + "]";
}
break;
default:
throw std::logic_error ("unknown typeish");
}
of << (fieldNames[f] + 2) << suff << "\n";
}
}
, false
);
hook (sub_405AA0, [] { sub_5B1AD0(); exit (0); });
}
extern "C" void __declspec(dllexport) __stdcall NativeInjectionEntryPoint(REMOTE_ENTRY_INFO* inRemoteInfo)
{
on_inject();
RhWakeUpProcess();
}

View File

@@ -0,0 +1,45 @@
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <thread>
#include <chrono>
#include <windows.h>
#include <tlhelp32.h>
#include <easyhook.h>
#include <tchar.h>
int wmain(int argc, WCHAR* argv[])
{
if (argc < 3) {
std::wcout << argv[0] << " dll command_line\n";
return 1;
}
std::wstring dllToInject (argv[1]);
std::wstring exe (argv[2]);
exe = exe.substr (0, exe.find (' '));
std::wstring command_line (argv[2]);
command_line = command_line.substr (command_line.find (' ') + 1);
ULONG pid;
NTSTATUS nt = RhCreateAndInject
( const_cast<WCHAR*> (exe.c_str())
, const_cast<WCHAR*> (command_line.c_str())
, 0
, EASYHOOK_INJECT_DEFAULT
, const_cast<WCHAR*> (dllToInject.c_str())
, nullptr
, nullptr
, 0
, &pid
);
if (nt != 0)
{
std::wcout << "RhCreateAndInject failed with error code = " << nt << "\n " << RtlGetLastErrorString() << "\n";
return 1;
}
return 0;
}

View File

@@ -0,0 +1,14 @@
#pragma once
template<typename T, bool unprotect>
struct var;
template<typename Fun>
struct fun;
template<typename Fun>
void hook (Fun& fun, typename Fun::signature* replacement, bool exclude_this_thread = true);
void* rebase (size_t);
size_t unrebase (void const*);
#include "patching.ipp"

View File

@@ -0,0 +1,115 @@
namespace
{
template<bool, typename> struct maybe_unprotect;
template<typename T> struct maybe_unprotect<true, T>
{
static void apply(void* p, DWORD* old)
{
VirtualProtect(p, sizeof (T), PAGE_EXECUTE_READWRITE, old);
}
static void remove(void* p, DWORD old)
{
DWORD ignored;
VirtualProtect(p, sizeof (T), old, &ignored);
}
};
template<typename T> struct maybe_unprotect<false, T>
{
static void apply(void* p, DWORD* old)
{
}
static void remove(void* p, DWORD old)
{
}
};
}
namespace
{
char* module_base()
{
MODULEINFO info;
GetModuleInformation(GetCurrentProcess(), GetModuleHandle (nullptr), &info, sizeof (info));
return static_cast<char*> (info.lpBaseOfDll);
}
constexpr std::intptr_t const rebase_base(0x400000);
}
inline void* rebase (std::size_t offset)
{
return static_cast<void*> (module_base() + offset - rebase_base);
}
inline std::size_t unrebase (void const* pointer)
{
return static_cast<char const*> (pointer) - module_base() + rebase_base;
}
template<typename T, bool unprotect = true>
struct var
{
size_t const _offset;
constexpr var (size_t offset) : _offset (offset) {}
T* _x = nullptr;
DWORD old = 0;
operator void*() { maybe_rebase(); return _x; }
T& operator*() { maybe_rebase(); return *_x; }
T* operator->() { maybe_rebase(); return _x; }
void maybe_rebase()
{
if (_x) return;
_x = static_cast<T*> (rebase (_offset));
maybe_unprotect<unprotect, T>::apply(_x, &old);
}
~var()
{
if (_x) maybe_unprotect<unprotect, T>::remove(_x, old);
}
};
template<typename Ret, typename... Args>
struct fun<Ret(Args...)> : var<Ret(Args...), false>
{
using signature = Ret(Args...);
using var<Ret(Args...), false>::var;
using var<Ret(Args...), false>::operator void *;
Ret operator() (Args... args)
{
maybe_rebase();
return (*_x)(args...);
}
};
template<typename Ret, typename T, typename... Args>
struct fun<Ret (T::*) (Args...)> : var<Ret(T*, Args...), false>
{
using var<Ret(T*, Args...), false>::var;
using var<Ret(T*, Args...), false>::operator void *;
Ret operator() (T* t, Args... args)
{
maybe_rebase();
return (*_x)(t, args...);
}
};
template<typename Fun>
void hook (Fun& fun, typename Fun::signature* replacement, bool exclude_this_thread)
{
#define FORCE(what_,...) \
if (FAILED (__VA_ARGS__)) {\
std::wcerr << "Failed to " << what_ << ": " << RtlGetLastErrorString() << "\n";\
abort();\
}
HOOK_TRACE_INFO hHook {0};
FORCE ("install hook", LhInstallHook(fun, replacement, nullptr, &hHook));
ULONG ACLEntries {0};
FORCE("set hook acl", LhSetExclusiveACL(&ACLEntries, exclude_this_thread ? 1 : 0, &hHook));
}