Switch build system to CMake

This commit is contained in:
Daniel S. 2019-09-01 22:45:07 +02:00
parent aa1c8171b2
commit 7784f97820
24 changed files with 655 additions and 1084 deletions

View File

@ -1,263 +1,265 @@
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
*.userosscache *.userosscache
*.sln.docstates *.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio) # User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs *.userprefs
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
[Dd]ebugPublic/ [Dd]ebugPublic/
[Rr]elease/ [Rr]elease/
[Rr]eleases/ [Rr]eleases/
x64/ x64/
x86/ x86/
bld/ bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/
[Ll]og/ [Ll]og/
# Visual Studio 2015 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/
# Uncomment if you have tasks that create the project's static files in wwwroot # Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/ #wwwroot/
# MSTest test Results # MSTest test Results
[Tt]est[Rr]esult*/ [Tt]est[Rr]esult*/
[Bb]uild[Ll]og.* [Bb]uild[Ll]og.*
# NUNIT # NUNIT
*.VisualState.xml *.VisualState.xml
TestResult.xml TestResult.xml
# Build Results of an ATL Project # Build Results of an ATL Project
[Dd]ebugPS/ [Dd]ebugPS/
[Rr]eleasePS/ [Rr]eleasePS/
dlldata.c dlldata.c
# DNX # DNX
project.lock.json project.lock.json
project.fragment.lock.json project.fragment.lock.json
artifacts/ artifacts/
*_i.c *_i.c
*_p.c *_p.c
*_i.h *_i.h
*.ilk *.ilk
*.meta *.meta
*.obj *.obj
*.pch *.pch
*.pdb *.pdb
*.pgc *.pgc
*.pgd *.pgd
*.rsp *.rsp
*.sbr *.sbr
*.tlb *.tlb
*.tli *.tli
*.tlh *.tlh
*.tmp *.tmp
*.tmp_proj *.tmp_proj
*.log *.log
*.vspscc *.vspscc
*.vssscc *.vssscc
.builds .builds
*.pidb *.pidb
*.svclog *.svclog
*.scc *.scc
# Chutzpah Test files # Chutzpah Test files
_Chutzpah* _Chutzpah*
# Visual C++ cache files # Visual C++ cache files
ipch/ ipch/
*.aps *.aps
*.ncb *.ncb
*.opendb *.opendb
*.opensdf *.opensdf
*.sdf *.sdf
*.cachefile *.cachefile
*.VC.db *.VC.db
*.VC.VC.opendb *.VC.VC.opendb
# Visual Studio profiler # Visual Studio profiler
*.psess *.psess
*.vsp *.vsp
*.vspx *.vspx
*.sap *.sap
# TFS 2012 Local Workspace # TFS 2012 Local Workspace
$tf/ $tf/
# Guidance Automation Toolkit # Guidance Automation Toolkit
*.gpState *.gpState
# ReSharper is a .NET coding add-in # ReSharper is a .NET coding add-in
_ReSharper*/ _ReSharper*/
*.[Rr]e[Ss]harper *.[Rr]e[Ss]harper
*.DotSettings.user *.DotSettings.user
# JustCode is a .NET coding add-in # JustCode is a .NET coding add-in
.JustCode .JustCode
# TeamCity is a build add-in # TeamCity is a build add-in
_TeamCity* _TeamCity*
# DotCover is a Code Coverage Tool # DotCover is a Code Coverage Tool
*.dotCover *.dotCover
# NCrunch # NCrunch
_NCrunch_* _NCrunch_*
.*crunch*.local.xml .*crunch*.local.xml
nCrunchTemp_* nCrunchTemp_*
# MightyMoose # MightyMoose
*.mm.* *.mm.*
AutoTest.Net/ AutoTest.Net/
# Web workbench (sass) # Web workbench (sass)
.sass-cache/ .sass-cache/
# Installshield output folder # Installshield output folder
[Ee]xpress/ [Ee]xpress/
# DocProject is a documentation generator add-in # DocProject is a documentation generator add-in
DocProject/buildhelp/ DocProject/buildhelp/
DocProject/Help/*.HxT DocProject/Help/*.HxT
DocProject/Help/*.HxC DocProject/Help/*.HxC
DocProject/Help/*.hhc DocProject/Help/*.hhc
DocProject/Help/*.hhk DocProject/Help/*.hhk
DocProject/Help/*.hhp DocProject/Help/*.hhp
DocProject/Help/Html2 DocProject/Help/Html2
DocProject/Help/html DocProject/Help/html
# Click-Once directory # Click-Once directory
publish/ publish/
# Publish Web Output # Publish Web Output
*.[Pp]ublish.xml *.[Pp]ublish.xml
*.azurePubxml *.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings # TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted # but database connection strings (with potential passwords) will be unencrypted
#*.pubxml #*.pubxml
*.publishproj *.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to # Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained # checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted # in these scripts will be unencrypted
PublishScripts/ PublishScripts/
# NuGet Packages # NuGet Packages
*.nupkg *.nupkg
# The packages folder can be ignored because of Package Restore # The packages folder can be ignored because of Package Restore
**/packages/* **/packages/*
# except build/, which is used as an MSBuild target. # except build/, which is used as an MSBuild target.
!**/packages/build/ !**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed # Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config #!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files # NuGet v3's project.json files produces more ignoreable files
*.nuget.props *.nuget.props
*.nuget.targets *.nuget.targets
# Microsoft Azure Build Output # Microsoft Azure Build Output
csx/ csx/
*.build.csdef *.build.csdef
# Microsoft Azure Emulator # Microsoft Azure Emulator
ecf/ ecf/
rcf/ rcf/
# Windows Store app package directories and files # Windows Store app package directories and files
AppPackages/ AppPackages/
BundleArtifacts/ BundleArtifacts/
Package.StoreAssociation.xml Package.StoreAssociation.xml
_pkginfo.txt _pkginfo.txt
# Visual Studio cache files # Visual Studio cache files
# files ending in .cache can be ignored # files ending in .cache can be ignored
*.[Cc]ache *.[Cc]ache
# but keep track of directories ending in .cache # but keep track of directories ending in .cache
!*.[Cc]ache/ !*.[Cc]ache/
# Others # Others
ClientBin/ ClientBin/
~$* ~$*
*~ *~
*.dbmdl *.dbmdl
*.dbproj.schemaview *.dbproj.schemaview
*.jfm *.jfm
*.pfx *.pfx
*.publishsettings *.publishsettings
node_modules/ node_modules/
orleans.codegen.cs orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components # Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/ #bower_components/
# RIA/Silverlight projects # RIA/Silverlight projects
Generated_Code/ Generated_Code/
# Backup & report files from converting an old project file # Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed, # to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-) # because we have git ;-)
_UpgradeReport_Files/ _UpgradeReport_Files/
Backup*/ Backup*/
UpgradeLog*.XML UpgradeLog*.XML
UpgradeLog*.htm UpgradeLog*.htm
# SQL Server files # SQL Server files
*.mdf *.mdf
*.ldf *.ldf
# Business Intelligence projects # Business Intelligence projects
*.rdl.data *.rdl.data
*.bim.layout *.bim.layout
*.bim_*.settings *.bim_*.settings
# Microsoft Fakes # Microsoft Fakes
FakesAssemblies/ FakesAssemblies/
# GhostDoc plugin setting file # GhostDoc plugin setting file
*.GhostDoc.xml *.GhostDoc.xml
# Node.js Tools for Visual Studio # Node.js Tools for Visual Studio
.ntvs_analysis.dat .ntvs_analysis.dat
# Visual Studio 6 build log # Visual Studio 6 build log
*.plg *.plg
# Visual Studio 6 workspace options file # Visual Studio 6 workspace options file
*.opt *.opt
# Visual Studio LightSwitch build output # Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts **/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts **/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml **/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts **/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml **/*.Server/ModelManifest.xml
_Pvt_Extensions _Pvt_Extensions
# Paket dependency manager # Paket dependency manager
.paket/paket.exe .paket/paket.exe
paket-files/ paket-files/
# FAKE - F# Make # FAKE - F# Make
.fake/ .fake/
# JetBrains Rider # JetBrains Rider
.idea/ .idea/
*.sln.iml *.sln.iml
# CodeRush # CodeRush
.cr/ .cr/
# Python Tools for Visual Studio (PTVS) # Python Tools for Visual Studio (PTVS)
__pycache__/ __pycache__/
*.pyc *.pyc
ScrapHack/dx8/ .history
ScrapHacks/build/*

View File

@ -46,8 +46,10 @@
- m3d.ini loader @ 0x5f7000 - m3d.ini loader @ 0x5f7000
- SM3 Scene Loader @ 0x650f80 (?) - SM3 Scene Loader @ 0x650f80 (?)
- M3D Model Loader @ 0x6665a0 (??) - M3D Model Loader @ 0x6665a0 (??)
- World_Init @ 0x479b20 (???) - World_Constructor @ 0x479b20 (???)
- World_Init @ 0x479b40
- World_DeInit @ 0x402510 - World_DeInit @ 0x402510
- Make_World @ 0x479870
# Data Structures # Data Structures
@ -55,31 +57,31 @@
Points to World struct Points to World struct
| Offset | Type | Description | | Offset | Type | Description |
|--------|------------|----------------------------------| | ------ | ------------------------ | -------------------------------------- |
| 0x0000 | `void**` | Virtual Method Table | | 0x0000 | `void**` | Virtual Method Table |
| 0x0004 | `uint32_t` | Size of Entity Hashtable | | 0x0004 | `uint32_t` | Size of Entity Hashtable |
| 0x0008 | `void**` | Pointer to Entity Hashtable | | 0x0008 | `void**` | Pointer to Entity Hashtable |
| 0x02B8 | `uint32_t` | Number of entity lists | | 0x02B8 | `uint32_t` | Number of entity lists |
| 0x02BC | `void**` | Pointer to entity list Hashtable | | 0x02BC | `void**` | Pointer to entity list Hashtable |
| 0x0330 | `float[3]` | Time (why 3 times?) | | 0x0330 | `float[3]` | Time (why 3 times?) |
| 0x1C6C | `float` | Alarm level | | 0x1C6C | `float` | Alarm level |
| 0x1C68 | `float` | Alarm Grow Level | | 0x1C68 | `float` | Alarm Grow Level |
| 0x2158 | `???` | Used in `World_Init` | | 0x2158 | `float` | Used in `World_Init` |
| 0x2170 | `???` | Used in `World_Init` | | 0x2170 | `???` | Used in `World_Init` |
| 0x2180 | `???` | Used in `World_Init` | | 0x2180 | `float` | Used in `World_Init` |
| 0x2188 | `???` | Used in `World_Init` | | 0x2188 | `void*` | Used in `World_Init` |
| 0x218C | `???` | Used in `World_Init` | | 0x218C | `void*` | Used in `World_Init` |
| 0x2190 | `???` | Used in `World_Init` | | 0x2190 | `float` | Used in `World_Init` |
| 0x2198 | `???` | Used in `World_Init` | | 0x2198 | `void*` | Used in `World_Init` |
| 0x219C | `???` | Used in `World_Init` | | 0x219C | `void*` | Used in `World_Init` |
| 0x21A0 | `???` | Used in `World_Init` | | 0x21A0 | `void**` | Used in `World_Init` (VTable pointer?) |
| 0x21B4 | `???` | Used in `World_Init` | | 0x21B4 | `void**` | Used in `World_Init` (VTable pointer?) |
| 0x21C8 | `???` | Used in `World_Init` | | 0x21C8 | `???` | Used in `World_Init` |
| 0x2204 | `???` | Used in `World_Init` | | 0x2204 | `uint32_t` or `uint16_t` | Used in `World_Init` |
| 0x2230 | `???` | Used in `World_Init` | | 0x2230 | `float` | Used in `World_Init` |
| 0x2238 | `???` | Used in `World_Init` | | 0x2238 | `???` | Used in `World_Init` |
| 0x2254 | `???` | Used in `World_Init` | | 0x2254 | `float` | Used in `World_Init` |
## Entity Hash Table ## Entity Hash Table
@ -89,7 +91,7 @@ Hash-function used: [PJW](https://en.wikipedia.org/wiki/PJW_hash_function) (Same
Entry format: Entry format:
| Offset | Type | Description | | Offset | Type | Description |
|--------|---------------|--------------------------------| | ------ | ------------- | ------------------------------ |
| 0x0 | `void*` | Pointer to data | | 0x0 | `void*` | Pointer to data |
| 0x4 | `const char*` | key as `char*` | | 0x4 | `const char*` | key as `char*` |
| 0x8 | `void*` | Pointer to next entry in chain | | 0x8 | `void*` | Pointer to next entry in chain |
@ -97,7 +99,7 @@ Entry format:
Data format: Data format:
| Offset | Type | Description | | Offset | Type | Description |
|--------|---------------|--------------------------| | ------ | ------------- | ------------------------ |
| 0x0 | `void**` | Virtual Method Table (?) | | 0x0 | `void**` | Virtual Method Table (?) |
| 0x4 | `const char*` | name as string | | 0x4 | `const char*` | name as string |
| 0x14 | `void*` | pointer to self (why?) | | 0x14 | `void*` | pointer to self (why?) |
@ -106,12 +108,13 @@ Data format:
## Game Window Object (?) Pointer @ `0x7fa380` ## Game Window Object (?) Pointer @ `0x7fa380`
| Offset | Type | Description | | Offset | Type | Description |
|--------|---------------|----------------------| | ------ | ------------- | -------------------- |
| 0x0000 | `void**` | Virtual Method Table | | 0x0000 | `void**` | Virtual Method Table |
| 0x0004 | `const char*` | Some Model Name (?) | | 0x0004 | `const char*` | Some Model Name (?) |
| 0x0008 | `void*` | Pointer to something | | 0x0008 | `void*` | Pointer to something |
| 0x000C | `void*` | Ditto | | 0x000C | `void*` | Ditto |
# File Formats # File Formats
## .packed File Format: ## .packed File Format:

View File

@ -1,11 +0,0 @@
{
"spellright.language": [
"de",
"en"
],
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext"
]
}

19
ScrapHacks/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required (VERSION 2.6)
project(ScrapHacks)
SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}")
if(WIN32)
if(MSVC)
# ensure we use minimal "windows.h" lib without the crazy min max macros
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"WIN32_LEAN_AND_MEAN\"")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"NOMINMAX\"")
# disable SAFESEH - to avoid "LNK2026: module unsafe"
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"SAFESEH:NO\"")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
endif(MSVC)
endif(WIN32)
add_subdirectory(Injector)
add_subdirectory(ScrapHack)

View File

@ -0,0 +1,2 @@
add_executable(Injector Injector.cpp)
install(TARGETS Injector DESTINATION bin)

View File

@ -27,6 +27,11 @@ string GetLastErrorAsString()
return message; return message;
} }
void fail(char* msg) {
cerr << "[!] "<<msg<<": "<<GetLastErrorAsString()<<endl;
exit(1);
}
string fromhex(string input) string fromhex(string input)
{ {
transform(input.begin(), input.end(), input.begin(), ::toupper); transform(input.begin(), input.end(), input.begin(), ::toupper);
@ -113,7 +118,6 @@ bool HasModule(int PID, const char *modname)
bool ProcRunning(DWORD PID) bool ProcRunning(DWORD PID)
{ {
bool ret = false;
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, PID); HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, PID);
if (hSnap == INVALID_HANDLE_VALUE) if (hSnap == INVALID_HANDLE_VALUE)
{ {
@ -130,14 +134,12 @@ bool adjustPrivs(HANDLE hProc)
TOKEN_PRIVILEGES tkprivs; TOKEN_PRIVILEGES tkprivs;
if (!OpenProcessToken(hProc, (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY), &hToken)) if (!OpenProcessToken(hProc, (TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY), &hToken))
{ {
cout << "[!] Could not Open Process Token: " << GetLastErrorAsString() << endl; fail("Could not open process token:");
return 0;
} }
if (!LookupPrivilegeValue(0, SE_DEBUG_NAME, &luid)) if (!LookupPrivilegeValue(0, SE_DEBUG_NAME, &luid))
{ {
CloseHandle(hToken); CloseHandle(hToken);
cout << "[!] Error Looking up Privilege Value: " << GetLastErrorAsString() << endl; fail("Error looking up privilege value for SE_DEBUG_NAME");
return 0;
} }
tkprivs.PrivilegeCount = 1; tkprivs.PrivilegeCount = 1;
tkprivs.Privileges[0].Luid = luid; tkprivs.Privileges[0].Luid = luid;
@ -146,7 +148,7 @@ bool adjustPrivs(HANDLE hProc)
CloseHandle(hToken); CloseHandle(hToken);
if (!bRet) if (!bRet)
{ {
cout << "[!] Could Not Adjust Privileges: " << GetLastErrorAsString() << endl; fail("Could not adjust privileges");
} }
return bRet; return bRet;
} }
@ -161,31 +163,32 @@ void InjectDll(DWORD PID)
HANDLE hRemThread, hProc; HANDLE hRemThread, hProc;
const char *dll_name = DLL_NAME; const char *dll_name = DLL_NAME;
char dll_full_path[MAX_PATH]; char dll_full_path[MAX_PATH];
char executable_dir[MAX_PATH];
GetModuleFileNameA(NULL,executable_dir,MAX_PATH);
if (!fexists(dll_name)) if (!fexists(dll_name))
{ {
cout << "[!] DLL not found!" << endl; fail("DLL not found");
return; return;
} }
cout << "[*] Injecting DLL " << dll_name << " into PID " << PID << endl; cout << "[*] Injecting DLL " << dll_name << " into PID " << PID << endl;
cout << "[*] Opening Process Handle" << endl; cout << "[*] Opening process handle" << endl;
hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, PID); hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, PID);
GetFullPathNameA(dll_name, MAX_PATH, dll_full_path, 0); GetFullPathNameA(dll_name, MAX_PATH, dll_full_path, 0);
cout << "[*] Adjusting Privileges of Process" << endl; cout << "[*] Adjusting privileges of process" << endl;
adjustPrivs(hProc); adjustPrivs(hProc);
if (HasModule(PID, dll_name)) if (HasModule(PID, dll_name))
{ {
cout << "[*] DLL already Loaded" << endl; cout << "[*] DLL already loaded" << endl;
CloseHandle(hProc); CloseHandle(hProc);
return; return;
}; };
if (!fexists(dll_full_path)) if (!fexists(dll_full_path))
{ {
cout << "[!] DLL file not found!" << endl;
CloseHandle(hProc); CloseHandle(hProc);
return; fail("DLL file not found");
} }
HINSTANCE hK32 = LoadLibraryA("kernel32"); HINSTANCE hK32 = LoadLibraryA("kernel32");
cout << "[*] Getting Address of LoadLibrary" << endl; cout << "[*] Getting address of LoadLibrary" << endl;
LPVOID LoadLibrary_Address = (LPVOID)GetProcAddress(hK32, "LoadLibraryA"); LPVOID LoadLibrary_Address = (LPVOID)GetProcAddress(hK32, "LoadLibraryA");
FreeLibrary(hK32); FreeLibrary(hK32);
cout << "[+] LoadLibrary is at " << LoadLibrary_Address << endl; cout << "[+] LoadLibrary is at " << LoadLibrary_Address << endl;
@ -193,7 +196,7 @@ void InjectDll(DWORD PID)
LPVOID mem = VirtualAllocEx(hProc, NULL, strlen(dll_full_path), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); LPVOID mem = VirtualAllocEx(hProc, NULL, strlen(dll_full_path), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (mem == NULL) if (mem == NULL)
{ {
cout << "[!] Could not Allocate Memory: " << GetLastErrorAsString() << endl; fail("Could not allocate memory");
return; return;
} }
cout << "[*] Writing DLL Name to Process Memory at " << mem << endl; cout << "[*] Writing DLL Name to Process Memory at " << mem << endl;
@ -228,37 +231,26 @@ int main(int argc, char *argv[])
DWORD PID = 0; DWORD PID = 0;
char s_PID[MAX_PATH]; char s_PID[MAX_PATH];
snprintf(s_PID, MAX_PATH, "%d", GetCurrentProcessId()); snprintf(s_PID, MAX_PATH, "%d", GetCurrentProcessId());
SetEnvironmentVariable("Inj_PID", s_PID); SetEnvironmentVariableA("Inj_PID", s_PID);
cout << "[*] Injector PID: " << GetCurrentProcessId() << endl;
if ((argc>1)&&fexists(argv[1])) { if ((argc>1)&&fexists(argv[1])) {
cout << "[*] Injector PID: " << GetCurrentProcessId() << endl;
cout << "[*] Spawning process for \"" << argv[1] << "\"" << endl; cout << "[*] Spawning process for \"" << argv[1] << "\"" << endl;
vector<HANDLE> handles = spawn(argv[1]); vector<HANDLE> handles = spawn(argv[1]);
if (handles.empty()) { if (handles.empty()) {
cout << "[!] Error: " << GetLastErrorAsString() << endl; fail("Failed to spawn process");
return -1;
} }
hProc = handles[0]; hProc = handles[0];
hThread = handles[1]; hThread = handles[1];
PID = GetProcessId(hProc); PID = GetProcessId(hProc);
cout << "[+] Got PID: " << PID << endl;
} else { } else {
GetWindowThreadProcessId(FindWindowA("ScrapClass", NULL), &PID); cerr<<"Usage: " << argv[0] << " <Path to Scrap.exe>"<<endl;
if (PID == 0) return 1;
{
cout << "[*] Waiting for Scrapland to Launch..." << endl;
}
while (PID == 0)
{
Sleep(100);
GetWindowThreadProcessId(FindWindowA("ScrapClass", NULL), &PID);
}
cout << "[+] Found PID: " << PID << endl;
} }
InjectDll(PID); InjectDll(PID);
if (hThread != INVALID_HANDLE_VALUE) { if (hThread != INVALID_HANDLE_VALUE) {
while (ResumeThread(hThread)); while (ResumeThread(hThread));
} }
SetEnvironmentVariable("Inj_PID", NULL); SetEnvironmentVariableA("Inj_PID", NULL);
cout << "[*] Done!" << endl; cout << "[*] Done!" << endl;
return 0; return 0;
} }

View File

@ -1,31 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Injector", "Injector\Injector.vcxproj", "{7C91C225-D95C-4B7A-9251-0CE358BAF556}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.ActiveCfg = Debug|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.Build.0 = Debug|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.ActiveCfg = Debug|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.Build.0 = Debug|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.ActiveCfg = Release|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.Build.0 = Release|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.ActiveCfg = Release|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8AE8D706-DEB4-42C3-AA4F-CEF2EB636A39}
EndGlobalSection
EndGlobal

View File

@ -1,164 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{7C91C225-D95C-4B7A-9251-0CE358BAF556}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Injector</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Injector.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Quelldateien">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Headerdateien">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Ressourcendateien">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="Injector.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,20 +1,11 @@
![Screenshot](img/Screenshot_1.png) Open VS 2017 32-bit command prompt (`vcvars32.bat`)
## Usage
0. Download `DirectX.8.0a.SDK.zip` from [here](https://archive.org/download/DirectX.8.0a.SDK_includes_libs_only)
1. Extract `DirectX.SDK/8.0/include` and `DirectX.SDK/8.0/lib` to `ScrapHacks/ScrapHack/dx8/include` and `ScrapHacks/ScrapHack/dx8/lib`
2. Add include and library dirs to project
3. Build Project
4. Run Injector `.\Injector.exe <Path to Scrap.exe>`
5. Wait for game to crash
6. Comment out `hook_d3d8()` call in `ScrapHack.cpp:DllPreInit()`
7. Rebuild and run Injector again
```batch
mkdir build
cd build
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="" ..
cmake --build .
cmake --install .
``` ```
[F3 ] Unload ScrapHacks
[F7 ] Set Money to 0x7fffffff this will drop the compiled files into `./build/bin`
[F8 ] Dump python modules to console
[F10] Enable python tracing
[ F ] "Handbrake" (*Will* crash the game after some time!)
```

View File

@ -0,0 +1,17 @@
include(ExternalProject)
ExternalProject_Add(DirectX
PREFIX ${CMAKE_CURRENT_BINARY_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
URL https://archive.org/download/DirectX.8.0a.SDK_includes_libs_only/DirectX.8.0a.SDK.zip
URL_HASH SHA1=39f168336d0df92ff14d62d5e3aef1b9e3191312
)
ExternalProject_Get_Property(DirectX SOURCE_DIR)
include_directories(AFTER ${SOURCE_DIR}/8.0/include/)
link_directories(AFTER ${SOURCE_DIR}/8.0/lib/)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(POINTER_64=__ptr64)
add_library(ScrapHack SHARED ScrapHack.cpp dllmain.cpp)
target_link_libraries(ScrapHack d3d8 d3dx8 legacy_stdio_definitions)
install(TARGETS ScrapHack DESTINATION bin)

View File

@ -13,12 +13,23 @@ D3DCOLOR color = D3DCOLOR_ARGB(255,255, 0, 0);
RECT Rect = { 0,0,0,0 }; RECT Rect = { 0,0,0,0 };
D3DRECT panel; D3DRECT panel;
size_t size_ht(HashTable<EntityList>* ht);
size_t size_ht(HashTable<Entity>* ht);
LPDIRECT3DDEVICE8 Render(LPDIRECT3DDEVICE8 dev) { LPDIRECT3DDEVICE8 Render(LPDIRECT3DDEVICE8 dev) {
if (!overlay) { if (!overlay) {
return dev; return dev;
} }
char text[1024]; char text[4096];
snprintf(text, 1024, "ScrapHack v0.1\nFrame: [%lld]", ++frame); int32_t money = 0;
size_t num_ents = 0;
size_t num_ent_lst = 0;
if (ptr<void>(P_WORLD, 0)!=nullptr) {
money = ptr<int32_t>(P_WORLD, O_MONEY)[0];
num_ents= size_ht(ptr<HashTable<Entity>>(P_WORLD, O_ENTS));
num_ent_lst = size_ht(ptr<HashTable<EntityList>>(P_WORLD, O_ENTLISTS));
}
snprintf(text, 4096, "ScrapHack v0.1\nFrame: [%lld]\nMoney: [%d]\nEntities: [%ld]\nEntity Lists: [%ld]", ++frame, money, num_ents,num_ent_lst);
if (m_pFont == nullptr) { if (m_pFont == nullptr) {
D3DXCreateFont(dev, hFont, &m_pFont); D3DXCreateFont(dev, hFont, &m_pFont);
CloseHandle(hFont); CloseHandle(hFont);

View File

@ -1,4 +1,3 @@
#define WIN32_LEAN_AND_MEAN
#include "stdafx.h" #include "stdafx.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -11,10 +10,6 @@
#include <Windows.h> #include <Windows.h>
#include <TlHelp32.h> #include <TlHelp32.h>
#pragma comment(lib, "d3d8.lib")
#pragma comment(lib, "d3dx8.lib")
#pragma comment(lib, "legacy_stdio_definitions.lib")
using namespace std; using namespace std;
#include "Scrapland.h" #include "Scrapland.h"
@ -34,230 +29,292 @@ HMODULE mod = 0;
void DllUnload(HMODULE); void DllUnload(HMODULE);
void hook_exit(); void hook_exit();
size_t dump_ht(HashTable<EntityList>* ht) { size_t size_ht(HashTable<EntityList> *ht)
size_t cnt = 0; {
for (size_t i = 0; i < ht->size; ++i) { size_t cnt = 0;
HashTableEntry<EntityList>* ent = ht->chains[i]; for (size_t i = 0; i < ht->size; ++i)
if (ent) { {
cout << i << ": "; HashTableEntry<EntityList> *ent = ht->chains[i];
while (ent) { if (ent)
++cnt; {
cout << "[ " << ent->name << ": " << ent->data << "]"; while (ent)
if (ent->next) { {
cout << " -> "; ++cnt;
}; ent = ent->next;
ent = ent->next; }
} }
cout << endl; }
} return cnt;
}
cout << cnt << " Entries" << endl;
return cnt;
} }
size_t dump_ht(HashTable<Entity>* ht) { size_t size_ht(HashTable<Entity> *ht)
size_t cnt = 0; {
for (size_t i = 0; i < ht->size; ++i) { size_t cnt = 0;
HashTableEntry<Entity>* ent = ht->chains[i]; for (size_t i = 0; i < ht->size; ++i)
if (ent) { {
cout << i << ": "; HashTableEntry<Entity> *ent = ht->chains[i];
while (ent) { if (ent)
++cnt; {
cout << "[ " << ent->name << ": " << ent->data<<"]"; while (ent)
if (ent->next) { {
cout << " -> "; ++cnt;
}; ent = ent->next;
ent = ent->next; }
} }
cout << endl; }
} return cnt;
} }
cout << cnt << " Entries" << endl;
return cnt; size_t dump_ht(HashTable<EntityList> *ht)
{
size_t cnt = 0;
for (size_t i = 0; i < ht->size; ++i)
{
HashTableEntry<EntityList> *ent = ht->chains[i];
if (ent)
{
cout << i << ": ";
while (ent)
{
++cnt;
cout << "[ " << ent->name << ": " << ent->data << "]";
if (ent->next)
{
cout << " -> ";
};
ent = ent->next;
}
cout << endl;
}
}
cout << cnt << " Entries" << endl;
return cnt;
}
size_t dump_ht(HashTable<Entity> *ht)
{
size_t cnt = 0;
for (size_t i = 0; i < ht->size; ++i)
{
HashTableEntry<Entity> *ent = ht->chains[i];
if (ent)
{
cout << i << ": ";
while (ent)
{
++cnt;
cout << "[ " << ent->name << ": " << ent->data << "]";
if (ent->next)
{
cout << " -> ";
};
ent = ent->next;
}
cout << endl;
}
}
cout << cnt << " Entries" << endl;
return cnt;
} }
void MainLoop(HMODULE mod) void MainLoop(HMODULE mod)
{ {
Sleep(100); Sleep(100);
hook_exit(); hook_exit();
cout << "[*] Starting main Loop" << endl; cout << "[*] Starting main Loop" << endl;
cout << endl; cout << endl;
cout << "[F3 ] Unload ScrapHacks" << endl; cout << "[F3 ] Unload ScrapHacks" << endl;
cout << "[F5 ] Show Overlay" << endl; cout << "[F5 ] Show Overlay" << endl;
cout << "[F6 ] Show Alarm status" << endl; cout << "[F6 ] Show Alarm status" << endl;
cout << "[F7 ] Set Money to 0x7fffffff" << endl; cout << "[F7 ] Set Money to 0x7fffffff" << endl;
cout << "[F8 ] Dump python modules" << endl; cout << "[F8 ] Dump python modules" << endl;
cout << "[F9 ] Dump Entity hashtable" << endl; cout << "[F9 ] Dump Entity hashtable" << endl;
cout << "[F10] Enable python tracing" << endl; cout << "[F10] Enable python tracing" << endl;
cout << "[ F ] \"Handbrake\" (*Will* crash the game after some time!)" << endl; cout << "[ F ] \"Handbrake\" (*Will* crash the game after some time!)" << endl;
while (running) while (running)
{ {
Sleep(100); Sleep(100);
while (key_down('F')) while (key_down('F'))
{ {
scrap_exec("dbg.brake()"); scrap_exec("dbg.brake()");
} }
if (key_down_norepeat(VK_F3)) if (key_down_norepeat(VK_F3))
{ {
break; break;
} }
if (key_down_norepeat(VK_F5)) if (key_down_norepeat(VK_F5))
{ {
overlay = !overlay; overlay = !overlay;
} }
if (key_down_norepeat(VK_F6)) if (key_down_norepeat(VK_F6))
{ {
float* alarm = ptr<float>(P_WORLD, O_ALARM);
float* alarm_grow = ptr<float>(P_WORLD, O_ALARM_GROW);
cout << "Alarm: " << alarm[0] << " + " << alarm_grow[0] << endl;
}
if (key_down_norepeat(VK_F7))
{
int32_t *money = ptr<int32_t>(P_WORLD,O_MONEY);
*money = 0x7fffffff;
}
if (key_down_norepeat(VK_F8))
{
for (auto mod : Py)
{
for (auto meth : mod.second.methods)
{
cout << mod.first << "." << meth.first << " @ " << meth.second->ml_meth << endl;
}
}
}
if (key_down_norepeat(VK_F9)) { float *alarm = ptr<float>(P_WORLD, O_ALARM);
cout << "Entities:" << endl; float *alarm_grow = ptr<float>(P_WORLD, O_ALARM_GROW);
dump_ht(ptr<HashTable<Entity>>(P_WORLD, O_ENTS)); cout << "Alarm: " << alarm[0] << " + " << alarm_grow[0] << endl;
cout << "Entity Lists:" << endl; }
dump_ht(ptr<HashTable<EntityList>>(P_WORLD, O_ENTLISTS)); if (key_down_norepeat(VK_F7))
} {
if (key_down_norepeat(VK_F10)) int32_t *money = ptr<int32_t>(P_WORLD, O_MONEY);
{ *money = 0x7fffffff;
scrap_exec("dbg.settrace()"); }
} if (key_down_norepeat(VK_F8))
} {
FreeLibraryAndExitThread(mod, 0); for (auto mod : Py)
{
for (auto meth : mod.second.methods)
{
cout << mod.first << "." << meth.first << " @ " << meth.second->ml_meth << endl;
}
}
}
if (key_down_norepeat(VK_F9))
{
cout << "Entities:" << endl;
dump_ht(ptr<HashTable<Entity>>(P_WORLD, O_ENTS));
cout << "Entity Lists:" << endl;
dump_ht(ptr<HashTable<EntityList>>(P_WORLD, O_ENTLISTS));
}
if (key_down_norepeat(VK_F10))
{
scrap_exec("dbg.settrace()");
}
}
FreeLibraryAndExitThread(mod, 0);
} }
void InitConsole() void InitConsole()
{ {
char me[1024]; char me[1024];
GetModuleFileName(mod, me, 1024); GetModuleFileName(mod, me, 1024);
SetupConsole(me); SetupConsole(me);
} }
void handle_command(const char* cmd) { void handle_command(const char *cmd)
cout << "CMD: " << cmd << endl; {
scrap_log(0x00ff00, "HAXX: "); cout << "CMD: " << cmd << endl;
scrap_log(0x00ff00,cmd); scrap_log(0x00ff00, "HAXX: ");
scrap_log(0x00ff00,"\n"); scrap_log(0x00ff00, cmd);
return; scrap_log(0x00ff00, "\n");
return;
} }
int hooked_console(const char* cmd) { int hooked_console(const char *cmd)
typedef int(_cdecl *t_func)(const char*); {
shared_ptr<Hook> hook = Hook::get(hooked_console); typedef int(_cdecl * t_func)(const char *);
if (cmd[0] == '$') { shared_ptr<Hook> hook = Hook::get(hooked_console);
handle_command(++cmd); if (cmd[0] == '$')
return 0; {
} handle_command(++cmd);
int ret= hook->func<t_func>(cmd); return 0;
return ret; }
int ret = hook->func<t_func>(cmd);
return ret;
} }
void hook_console() { void hook_console()
Hook::addr(reinterpret_cast<void*>(P_CON_HANDLER) , hooked_console); {
Hook::addr(reinterpret_cast<void *>(P_CON_HANDLER), hooked_console);
} }
void H_Exit(){ void H_Exit()
typedef void(_cdecl *t_func)(void); {
shared_ptr<Hook> hook = Hook::get(H_Exit); typedef void(_cdecl * t_func)(void);
DllUnload(mod); shared_ptr<Hook> hook = Hook::get(H_Exit);
HWND hMainWindow = ptr<HWND>(0x7FA830, 0x7c)[0]; DllUnload(mod);
SendMessage(hMainWindow, WM_CLOSE, 0, 0); HWND hMainWindow = ptr<HWND>(0x7FA830, 0x7c)[0];
return; SendMessage(hMainWindow, WM_CLOSE, 0, 0);
return;
} }
void hook_exit() { void hook_exit()
Hook::addr(reinterpret_cast<void*>(0x4010c0), H_Exit); {
Hook::addr(reinterpret_cast<void *>(P_SCRAP_EXIT), H_Exit);
} }
DWORD PPID() { DWORD PPID()
DWORD PID = GetCurrentProcessId(); {
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); DWORD PID = GetCurrentProcessId();
PROCESSENTRY32 procentry; HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapShot == INVALID_HANDLE_VALUE) { PROCESSENTRY32 procentry;
cout << GetLastErrorAsString() << endl; if (hSnapShot == INVALID_HANDLE_VALUE)
return -1; {
} cout << GetLastErrorAsString() << endl;
if (Process32First(hSnapShot, &procentry)) { return -1;
do { }
if (procentry.th32ProcessID == PID) { if (Process32First(hSnapShot, &procentry))
CloseHandle(hSnapShot); {
return procentry.th32ParentProcessID; do
} {
procentry.dwSize = sizeof(PROCESSENTRY32); if (procentry.th32ProcessID == PID)
} while (Process32Next(hSnapShot, &procentry)); {
} CloseHandle(hSnapShot);
CloseHandle(hSnapShot); return procentry.th32ParentProcessID;
return -1; }
procentry.dwSize = sizeof(PROCESSENTRY32);
} while (Process32Next(hSnapShot, &procentry));
}
CloseHandle(hSnapShot);
return -1;
} }
void DllPreInit(HMODULE _mod) { void DllPreInit(HMODULE _mod)
char mfn[1024]; {
char inj[MAX_PATH]; char mfn[1024];
DWORD INJ_PID=0; char inj[MAX_PATH];
InitConsole(); DWORD INJ_PID = 0;
GetModuleFileName(0, mfn, 1024); InitConsole();
Py = get_modules(P_PY_MODS); GetModuleFileNameA(0, mfn, 1024);
cout << "[+] ScrapHacks v0.1 Loaded in " << mfn << " (PID: " << std::hex << GetCurrentProcessId() <<std::dec << ")" << endl; Py = get_modules(P_PY_MODS);
GetEnvironmentVariable("Inj_PID", inj, MAX_PATH); cout << "[+] ScrapHacks v0.1 Loaded in " << mfn << " (PID: " << std::hex << GetCurrentProcessId() << std::dec << ")" << endl;
SetEnvironmentVariable("Inj_PID", NULL); GetEnvironmentVariableA("Inj_PID", inj, MAX_PATH);
hook_console(); SetEnvironmentVariableA("Inj_PID", NULL);
sscanf(inj, "%d", &INJ_PID); hook_console();
cout << INJ_PID << "," << PPID() << endl; sscanf_s(inj, "%d", &INJ_PID);
if (PPID() == INJ_PID) { cout << INJ_PID << "," << PPID() << endl;
hook_d3d8(); if (PPID() == INJ_PID)
overlay = true; {
} hook_d3d8();
else { overlay = true;
cout << "[-] No launched by Injector, not hooking DX8" << endl; }
} else
{
cout << "[-] No launched by Injector, not hooking DX8" << endl;
}
} }
void DllInit(HMODULE _mod) void DllInit(HMODULE _mod)
{ {
initialized = true; initialized = true;
mod = _mod; mod = _mod;
Sleep(3000); Sleep(3000);
cout << "[*] World: " << ptr<void>(P_WORLD, 0) << endl; cout << "[*] World: " << ptr<void>(P_WORLD, 0) << endl;
cout << "[*] Importing python dbg module" << endl; cout << "[*] Importing python dbg module" << endl;
scrap_exec("import dbg"); scrap_exec("import dbg");
scrap_log(0xff0000, "ScrapHacks loaded!\n"); scrap_log(0xff0000, "ScrapHacks loaded!\n");
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)MainLoop, mod, 0, 0); CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)MainLoop, mod, 0, 0);
cout << "[*] Starting message pump" << endl; cout << "[*] Starting message pump" << endl;
MSG msg; MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) while (GetMessage(&msg, NULL, 0, 0))
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
return; return;
} }
void DllUnload(HMODULE _mod) { void DllUnload(HMODULE _mod)
SetConsoleCtrlHandler(NULL, false); {
unhook_d3d8(); SetConsoleCtrlHandler(NULL, false);
Hook::clear(); unhook_d3d8();
scrap_log(0xff0000, "ScrapHacks unloaded!\n"); Hook::clear();
cout << "[+] ScrapHacks unloaded, you can now close the console!" << endl; scrap_log(0xff0000, "ScrapHacks unloaded!\n");
FreeConsole(); cout << "[+] ScrapHacks unloaded, you can now close the console!" << endl;
DestroyWindow(GetConsoleWindow()); FreeConsole();
return; DestroyWindow(GetConsoleWindow());
return;
} }

View File

@ -1,178 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ScrapHack</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<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>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)dx8\include;$(SolutionDir)include</IncludePath>
<LibraryPath>$(ProjectDir)dx8\lib;$(SolutionDir)lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)dx8\include;$(SolutionDir)include</IncludePath>
<LibraryPath>$(ProjectDir)dx8\lib;$(SolutionDir)lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;_DEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_DEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS ;WIN32;NDEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;SCRAPHACK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="D3D8_Hook.h" />
<ClInclude Include="VMT_Hook.h" />
<ClInclude Include="Hook.h" />
<ClInclude Include="Py_Utils.h" />
<ClInclude Include="Structures.h" />
<ClInclude Include="Scrapland.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Util.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="ScrapHack.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Quelldateien">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Headerdateien">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Ressourcendateien">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Scrapland.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Util.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Structures.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Py_Utils.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Hook.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="D3D8_Hook.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="VMT_Hook.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="ScrapHack.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -13,6 +13,7 @@
#define P_CON_HANDLER 0x402190 #define P_CON_HANDLER 0x402190
#define P_SCRAP_LOG 0x4134C0 #define P_SCRAP_LOG 0x4134C0
#define P_SCRAP_EXEC 0x5a8390 #define P_SCRAP_EXEC 0x5a8390
#define P_SCRAP_EXIT 0x4010c0
//FUNCTION TYPES //FUNCTION TYPES
#define T_SCRAP_LOG int(_cdecl*)(unsigned int, const char*) #define T_SCRAP_LOG int(_cdecl*)(unsigned int, const char*)

View File

@ -134,9 +134,9 @@ T* __ptr(uintptr_t addr)
template<typename T> template<typename T>
T* __ptr(uintptr_t addr, ptrdiff_t offset) T* __ptr(uintptr_t addr, ptrdiff_t offset)
{ {
cout << "[" << (void*)addr << "] + " << (void*)offset << " = "; //cout << "[" << (void*)addr << "] + " << (void*)offset << " = ";
addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset; addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset;
cout << (void*)addr << endl;; //cout << (void*)addr << endl;;
auto ret = __ptr<T>(addr); auto ret = __ptr<T>(addr);
return ret; return ret;
} }
@ -144,9 +144,9 @@ T* __ptr(uintptr_t addr, ptrdiff_t offset)
template<typename T, typename... Offsets> template<typename T, typename... Offsets>
T* __ptr(uintptr_t addr, ptrdiff_t offset, Offsets... offsets) { T* __ptr(uintptr_t addr, ptrdiff_t offset, Offsets... offsets) {
cout << "[" << (void*)addr << "] + " << (void*)offset << " = "; //cout << "[" << (void*)addr << "] + " << (void*)offset << " = ";
addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset; addr = reinterpret_cast<uintptr_t*>(addr)[0] + offset;
cout << (void*)addr << endl;; //cout << (void*)addr << endl;;
auto ret = __ptr<T>(addr, offsets...); auto ret = __ptr<T>(addr, offsets...);
return ret; return ret;
} }

View File

@ -4,25 +4,24 @@ void DllInit(HMODULE);
void DllPreInit(HMODULE); void DllPreInit(HMODULE);
void DllUnload(HMODULE); void DllUnload(HMODULE);
BOOL APIENTRY DllMain(HMODULE hModule, BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call, DWORD ul_reason_for_call,
LPVOID lpReserved) LPVOID lpReserved)
{ {
HANDLE hThread = INVALID_HANDLE_VALUE; HANDLE hThread = INVALID_HANDLE_VALUE;
switch (ul_reason_for_call) switch (ul_reason_for_call)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule); DisableThreadLibraryCalls(hModule);
DllPreInit(hModule); DllPreInit(hModule);
hThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)DllInit, hModule, 0, 0); hThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)DllInit, hModule, 0, 0);
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
DllUnload(hModule); DllUnload(hModule);
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
break; break;
} }
return TRUE; return TRUE;
} }

View File

@ -7,8 +7,6 @@
#include "targetver.h" #include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Selten verwendete Komponenten aus Windows-Headern ausschließen
// Windows-Headerdateien:
#include <windows.h> #include <windows.h>
// TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen. // TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen.

View File

@ -1,47 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ScrapHack", "ScrapHack\ScrapHack.vcxproj", "{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Injector", "Injector\Injector\Injector.vcxproj", "{7C91C225-D95C-4B7A-9251-0CE358BAF556}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|Any CPU.ActiveCfg = Debug|Win32
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x64.ActiveCfg = Debug|x64
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x64.Build.0 = Debug|x64
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x86.ActiveCfg = Debug|Win32
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Debug|x86.Build.0 = Debug|Win32
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|Any CPU.ActiveCfg = Release|Win32
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x64.ActiveCfg = Release|x64
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x64.Build.0 = Release|x64
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x86.ActiveCfg = Release|Win32
{72CB1B9E-50C7-4010-BEAD-82FACF87A87A}.Release|x86.Build.0 = Release|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|Any CPU.ActiveCfg = Debug|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.ActiveCfg = Debug|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x64.Build.0 = Debug|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.ActiveCfg = Debug|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Debug|x86.Build.0 = Debug|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|Any CPU.ActiveCfg = Release|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.ActiveCfg = Release|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x64.Build.0 = Release|x64
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.ActiveCfg = Release|Win32
{7C91C225-D95C-4B7A-9251-0CE358BAF556}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {663B3F14-E592-447F-8F03-3210FE04AA89}
EndGlobalSection
EndGlobal

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 KiB