Folgende Warnungen sind aufgetreten:
Warning [2] preg_match_all(): The /e modifier is no longer supported, use preg_replace_callback instead - Line: 1007 - File: inc/highlighter.php PHP 7.4.33 (Linux)
File Line Function
[PHP]   errorHandler->error
/inc/highlighter.php 1007 preg_match_all
/inc/highlighter.php 112 generic_highlight
/inc/highlighter.php 48 generic_c_highlight
/inc/highlighter.php 53 cpp_highlight
/inc/plugins/coolcode.php 133 c_highlight
/inc/plugins/coolcode.php 61 coolcode_run
/inc/class_plugins.php 139 coolcode_end
/inc/class_parser.php 232 pluginSystem->run_hooks
/printthread.php 184 postParser->parse_message
Warning [2] Invalid argument supplied for foreach() - Line: 1008 - File: inc/highlighter.php PHP 7.4.33 (Linux)
File Line Function
/inc/highlighter.php 1008 errorHandler->error
/inc/highlighter.php 112 generic_highlight
/inc/highlighter.php 48 generic_c_highlight
/inc/highlighter.php 53 cpp_highlight
/inc/plugins/coolcode.php 133 c_highlight
/inc/plugins/coolcode.php 61 coolcode_run
/inc/class_plugins.php 139 coolcode_end
/inc/class_parser.php 232 pluginSystem->run_hooks
/printthread.php 184 postParser->parse_message



Home of Gamehacking - Archiv
[C++] WritePointer Funktion - Druckversion

+- Home of Gamehacking - Archiv (http://archiv-homeofgamehacking.de)
+-- Forum: Coding (http://archiv-homeofgamehacking.de/forumdisplay.php?fid=15)
+--- Forum: C, C#, C++, Visual C++ (http://archiv-homeofgamehacking.de/forumdisplay.php?fid=18)
+--- Thema: [C++] WritePointer Funktion (/showthread.php?tid=843)



[C++] WritePointer Funktion - Acubra - 13.01.2012

Hey,
hier meine Funktion um von einer BaseAdresse aus mit beliebig vielen Offsets in eine Adresse zu schreiben.

C Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//////////////////////////////////////////////////////////////////////////
//WritePointer
//This function will write a specific value to a multilevel pointer with x offsets.
//
//////////////////////////////////////////////////////////////////////////
int WritePointer(LPCWSTR szProcessName, LPCWSTR szModuleName, DWORD dwAddressOffset, DWORD dwOffsets[], int nOffsets, BYTE szCode[], int nCode)
{
 //First offset has to be zero
 HANDLE hProcess; //Process handle.
 int iCounter = 0;
 DWORD BytesRead, BaseAddress, lpAddress, dwOldProtect; 

 
 hProcess = GetProcessHandle(szProcessName);
 if (hProcess == 0 )
 {
 MessageBox(NULL, _T("Couldn't get process handle!"), szErrorTitle, NULL);
 return 0;
 }
 BaseAddress = GetModuleBaseAddress(szProcessName, szModuleName); //Get the base address of the specific module.
 if (BaseAddress == 0)
 {
 MessageBox(NULL, _T("Couldn't get module base address!"), szErrorTitle, NULL);
 return 0;
 }

 lpAddress = (DWORD)BaseAddress + dwAddressOffset; //Calculate real address.


 while (iCounter != nOffsets) //mod the code here!
 {
 lpAddress = lpAddress + dwOffsets[iCounter];
 if (ReadProcessMemory(hProcess, (LPVOID)lpAddress, &BytesRead, nCode, 0) == 0)
 {
 MessageBox(NULL, _T("ReadProcessMemory failed!"), szErrorTitle, NULL);
 return 0;
 }
 else
 {
 lpAddress = BytesRead;
 iCounter++;
 }
 }

 lpAddress = lpAddress + dwOffsets[iCounter];

 if ((WriteProcessMemory(hProcess, (LPVOID)lpAddress, (LPCVOID)szCode, nCode, 0)) == 0)
 {
 //Oh noes, WPM error.
 MessageBox(NULL, _T("Failed to write to process memory.."), szErrorTitle, NULL);
 return 0;
 }
 else //Everything went fine.
 {
 Beep(0x1000,200); //Activated sound.
 return 1;
 }
 return 0;
}