gamehackingbook / gamehackingcode Goto Github PK
View Code? Open in Web Editor NEWExample code for the book http://www.nostarch.com/gamehacking . PLEASE READ THE README
License: GNU General Public License v2.0
Example code for the book http://www.nostarch.com/gamehacking . PLEASE READ THE README
License: GNU General Public License v2.0
When I try to run some of the binaries I get a message saying "error failed to initialize {something}!"
Virus detected in ZIP file when downloading.
After cloning I figured I'd skip trying to get dependencies straight and try to launch the precompiled binaries.
I am running Windows 10 Professional. At the moment I am continually getting "failed to initialized map" for Chapter1_BasicMemory.exe
. Am I missing a dependency here?
Additionally building them has proved difficult. I'm not familiar with Allegro, and using Visual Studio 2017 and the nuget version of Allegro to build it just results in even more errors. If I can figure it out I'll try to put up a PR, but it's really getting in the way of reading the book ๐ข.
Hi,
I am trying to compile chapter 1 project, but it seems to be missing something (I already installed Allegro though NuGet)
Severity Code Description Project File Line Suppression State
Error (active) identifier "BYTE" is undefined Chapter1_BasicMemory c:\Users\Tu Do\visual studio 2015\Projects\GameHackingExamples\Chapter1_BasicMemory\game-BasicMem.cpp 15
Error (active) identifier "ZeroMemory" is undefined Chapter1_BasicMemory c:\Users\Tu Do\visual studio 2015\Projects\GameHackingExamples\Chapter1_BasicMemory\game-BasicMem.cpp 103
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 15
Error C2146 syntax error: missing ';' before identifier 'map' Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 15
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 21
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 28
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 30
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 32
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 34
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 86
Error C3861 'ZeroMemory': identifier not found Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 103
Error C2065 'map': undeclared identifier Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 113
Warning C4996 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. Chapter1_BasicMemory c:\users\tu do\visual studio 2015\projects\gamehackingexamples\chapter1_basicmemory\game-basicmem.cpp 105
I have been working on Linux, so I'm really not familiar with Windows toolchain, like VS. I hope you could help me on this. Thanks.
I downloaded the rar file here: https://tuts4you.com/download.php?view.2063
but it requires a password. The site does not provide one. Do you know how we can get one?
I am not sure if this is due to an update to the std library but I found that the _vector struct is incorrect and that there is some unknown DWORD value as the first value to be accessed given vectorAddress. Does anyone know what this is? After adding this value then the rest of the original code works. I have attached an image of what I mean.
I have changed vectorData to reserve 3 values and have values 0x123456 and 0x654321
Memory 1: Memory view of the vectorData
Memory 2: Location of the first data value in vectorData
Hey, could it be that the structure of std::vector changed?
This function doesn't seem to work for me.
Am I doing something wrong? Maybe for this code to work I need to use some c++ version or sdk in particular?
TY
`void readVector(DWORD vectorAddress)
{
struct _vector
{
DWORD* begin;
DWORD* end;
DWORD* tail;
};
_vector* vec = (_vector*)vectorAddress;
DWORD count = ((DWORD)vec->end - (DWORD)vec->begin) / sizeof(DWORD);
DWORD capacity = ((DWORD)vec->tail - (DWORD)vec->begin) / sizeof(DWORD);
printf("Vector has %d items and %d capacity\n", count, capacity);
for (int i = 0; i < count; i++)
printf("\tValue at %d is %d\n", i, vec->begin[i]);
}`
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'allegro5/allegro.h': No such file or directory C:\Users\Admin\Desktop\GameHackingCode-master\GameHackingCode-master\Chapter1_BasicMemory\game-BasicMem.cpp 3
Severity Code Description Project File Line Suppression State
Warning D9035 option 'Gm' has been deprecated and will be removed in a future release C:\Users\Admin\Desktop\GameHackingCode-master\GameHackingCode-master\Chapter1_BasicMemory\cl 1
Hacker
Upon execution an error message is displayed:
error
failed to initialize map!
Running on win7
i couldn't find the "ball hidden.." in ollydbg from reference text or search by binary.
going off the book to do basic memory editing (page 11) when i go to the bin and run BasicMemory.exe I get a failed to initialize map error.
In "Chapter 1, Listing 1-1 pseudocode"
list<int> pointerScan(target, maxAdd, maxDepth) {
โ for address = BASE, 0x7FFFFFF, 4 {
ret = rScan(address, target, maxAdd, maxDepth, 1)
if (ret.len > 0) {
ret.pushFront(address)
return ret
}
}
return {}
}
list<int> rScan(address, target, maxAdd, maxDepth, curDepth) {
โ for offset = 0, maxAdd, 4 {
value = read(address + offset)
โ if (value == target)
return list<int>(offset)
}
โ if (curDepth < maxDepth) {
curDepth++
โ for offset = 0, maxAdd, 4 {
ret = rScan(address + offset, target, maxAdd, maxDepth, curDepth)
โ if (ret.len > 0) {
ret.pushFront(offset)
โ return ret
}
}
}
return {}
}
In the middle of line 5
and 6
, shouldn't the line correct to
ret = rScan(read(address + offset), target, maxAdd, maxDepth, curDepth)
by replacing address + offset
into read(address + offset)
Chapter 1 programs result in "error failed to initialize map!"
Chapter 2 and 3 programs result in "error failed to initialize font!"
Running the debug versions show "missing MSVCR100d.dll" for both errors; as expected.
Using the binaries for Allegro, I get the following errors when compiling:
C:\Users\user\Desktop\GameHackingCode\Chapter1_BasicMemory>g++ game-BasicMem
.cpp -o gamebasic.exe -IC:\MinGW\include
game-BasicMem.cpp: In function 'int main()':
game-BasicMem.cpp:95:16: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:108:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:119:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:124:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:130:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:135:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:140:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:145:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:150:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:155:12: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
game-BasicMem.cpp:211:68: warning: passing NULL to non-pointer argument 6 of 'in
t al_show_native_message_box(ALLEGRO_DISPLAY*, const char*, const char*, const c
har*, const char*, int)' [-Wconversion-null]
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x93):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xfb): undefined reference to
al_draw_filled_rectangle'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x144):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x1ac): undefined reference to
al_draw_filled_rectangle'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x1f5):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x25d): undefined reference to
al_draw_filled_rectangle'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x2a6):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x30e): undefined reference to
al_draw_filled_rectangle'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x362):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x3d6): undefined reference to
al_draw_filled_rectangle'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x3f3):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x445): undefined reference to
al_draw_filled_circle'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x475):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x4b9): undefined reference to
al_draw_text'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x4d6):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x51a): undefined reference to
al_draw_text'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x8fd):
undefined reference to al_install_system' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x923): undefined reference to
al_init_primitives_addon'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x949):
undefined reference to al_init_font_addon' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x94e): undefined reference to
al_init_ttf_addon'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x974):
undefined reference to al_install_keyboard' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x9ac): undefined reference to
al_load_ttf_font'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0x9f4):
undefined reference to al_create_timer' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xa33): undefined reference to
al_create_display'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xa68):
undefined reference to al_create_event_queue' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xaa7): undefined reference to
al_get_display_event_source'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xab9):
undefined reference to al_register_event_source' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xabe): undefined reference to
al_get_keyboard_event_source'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xad0):
undefined reference to al_register_event_source' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xadf): undefined reference to
al_get_timer_event_source'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xaf1):
undefined reference to al_register_event_source' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xb00): undefined reference to
al_start_timer'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xb1d):
undefined reference to al_wait_for_event' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xbc2): undefined reference to
al_is_event_queue_empty'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xbea):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xc0c): undefined reference to
al_clear_to_color'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xc3f):
undefined reference to al_map_rgb' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xc8c): undefined reference to
al_draw_text'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xc91):
undefined reference to al_flip_display' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xcb3): undefined reference to
al_flip_display'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xd06):
undefined reference to al_show_native_message_box' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xd23): undefined reference to
al_destroy_timer'
C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xd32):
undefined reference to al_destroy_display' C:\Users\user\AppData\Local\Temp\ccN7M3iA.o:game-BasicMem.cpp:(.text+0xd41): undefined reference to
al_destroy_event_queue'
collect2.exe: error: ld returned 1 exit status
downloading the repository and installing all the necessary requirements and following the instructions I noticed that in the 'bin' folder the executables: from chapter05 (AdvancedMemoryForensics.exe) to the executables of chapter11 do not work and the error appears: 0xc000007b.
what can be done to resolve the error?
does a forum or message board exist for help with some of the labs?
edit
I wanted clarify, help with solving them. Not running or compiling :P
Hi, hoping there's some support for this book as I recently purchased from No Starch Press. I believe I found the correct pointers for this exercise because I can close and restart Chapter1_MemoryPointers.exe and the pointers still affect the ball's X and Y values.
However, when I freeze the pointer values in Cheat Engine 6.7 and run the test (to win 50 times) the exe crashes. What am I doing wrong?
Let me know if you need any additional info.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.