 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
educofu Expert Cheater
Reputation: 3
Joined: 21 Aug 2009 Posts: 171 Location: Brazil,MG,OP
|
Posted: Fri Jan 21, 2011 12:17 pm Post subject: [C++] My very useful HACKING HEADER! |
|
|
hello guys,
i developed this to help me creating my C++ projects: a header!
this is my first one, and till now it works fine.
it already include <windows.h> , <iostream> and <psapi.h> (must to it works)
so u can create very tiny codes like this:
Code: |
#include <hack.h>
using namespace std;
int main()
{
int value;
int address;
while (AttachToProcess("MSACCESS.EXE"))
{
cout << "Enter address to modify (decimal): ";
cin >> address;
cout << "Enter value: ";
cin >> value;
Write(address,value);
system("PAUSE");
}
}
|
the header have the functions:
Code: |
void Clean () {system("CLS");} // To clean the screen ^^
int P (int address,int offset); // For pointer addresses, using read(), eg.: P(P(pointer,offset1),offset2) = [[pointer]+offset1]+offeset2
bool AttachToWindow (char* name); // Attach to the desired window name, return TRUE if sucess else FALSE
bool AttachToPID (int PIDtoLook); // Attach to the desired PID, return TRUE if sucess else FALSE
bool AttachToProcess (char* pName); // Attach to the desired process, return TRUE if sucess else FALSE
void ShowProcessList (); // Show a list of running processes
void Write (int address,int value); // Change the value in address to value
int Read (int address,int size); // Return the value in address; size = 1,2,4 bytes value
void ReadString (int address,int size); // will store a string present in address to ReadStringValue
char ReadStringValue[512]; //
void ExitProcess (); // Exit the opened process
|
as u can see theres still allot of things to work on, thats why its on ALPHA version.
remember if u are using any IDE thats not MSVC: link libpsapi.a so it works fine.
as aways:
comments, suggestions, bugs, etc are welcome!
edit----
removed the search function, since it wasnt working as it should.
im studying caching to improve it.
THE HEADER : http://ifile.it/w7s8vxp
note: as the file was too small to upload i add a small useless file on it.
_________________
"I finally started thinking outside of the box, only to find myself in a larger box."
Last edited by educofu on Mon Mar 14, 2011 1:26 pm; edited 7 times in total |
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Jan 21, 2011 1:01 pm Post subject: |
|
|
don't allocate such a giant chunk on the stack, you are cruising towards trouble:
Code: | int FoundAddress[1024];
char ReadStringValue[512]; |
allocate the memory yourself.
and what's the difference between the Read() and ReadString() functions? their prototype is the same. Why is it not just one function?
|
|
Back to top |
|
 |
educofu Expert Cheater
Reputation: 3
Joined: 21 Aug 2009 Posts: 171 Location: Brazil,MG,OP
|
Posted: Fri Jan 21, 2011 1:30 pm Post subject: |
|
|
Read() returns an number of 1,2 or 4 bytes.
ReadString() saves the string of desired size on ReadStringValue
_________________
"I finally started thinking outside of the box, only to find myself in a larger box." |
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Fri Jan 21, 2011 1:52 pm Post subject: |
|
|
what if i want to read 60 bytes or write just as much?
like reading / writing a struct.
|
|
Back to top |
|
 |
educofu Expert Cheater
Reputation: 3
Joined: 21 Aug 2009 Posts: 171 Location: Brazil,MG,OP
|
Posted: Sun Jan 23, 2011 10:22 pm Post subject: |
|
|
well, i gave the functions, i bet u can do what u want to using loops etc.
ofc it would be nice to implement a byte to byte writter/reader to/from an array.
ty for idea. going to release it in next ver.
more ideas are welcome^^
_________________
"I finally started thinking outside of the box, only to find myself in a larger box." |
|
Back to top |
|
 |
Eddie12390 Expert Cheater
Reputation: 0
Joined: 06 Oct 2007 Posts: 131 Location: Pittsburgh, PA
|
Posted: Wed Feb 02, 2011 7:24 pm Post subject: |
|
|
Just a few quick tips, both of the following are horrible programming practices. System() is "system specific" and therefore drops the portability of the program. There are better ways to do the same thing.
----------------------------------------------------
Code: | void Clean () {system("CLS");} // To clean the screen ^^ |
Replace that with something like this:
Code: | void Clean() {
for(int i = 0; i <= 50; i++) {
cout << "\n";
}
} |
-------------------------------------------------------------
and a replacement for this:
Code: | cout << "Press enter to continue";
cin.get();
|
--------------------------------------------------------------
All in all, use system(); as little as possible. Something that works well on Windows may not work elsewhere if you go that route. There are alternatives for what you want to do using system() and they are typically easy enough to do. The "cleaning" method will throw out a whole bunch of lines and push your text to the very bottom of the screen and get rid of all of the lines before it, the pause method will wait until the user presses enter and as soon as they do it will continue on.
TL;DR: Copy and paste the codes, they are better programming practice.
_________________
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8586 Location: 127.0.0.1
|
|
Back to top |
|
 |
TrYk How do I cheat?
Reputation: 0
Joined: 06 Feb 2011 Posts: 1
|
Posted: Sun Feb 06, 2011 10:05 am Post subject: |
|
|
I getting error on windows 7, microsoft visual studio ( C++ )
I create simple program like this:
Code: | #include <hack.h>
using namespace std;
int main()
{
int value;
while (AttachToProcess("Minesweeper.exe"))
{
cout << "Enter value to search: ";
cin >> value;
Search(value, 4, 1, 0x10112600, 0x1013E800);
system("PAUSE");
}
} |
And getting errors:
Code: |
1>------ Build started: Project: blablabla, Configuration: Debug Win32 ------
1>Build started 2011.02.06 07:48:38.
1>PrepareForBuild:
1> Creating directory "c:\users\admin\documents\visual studio 2010\Projects\blablabla\Debug\".
1>InitializeBuildStatus:
1> Creating "Debug\blablabla.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> asdasd.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\hack.h(44): warning C4101: 'doRescan' : unreferenced local variable
1>c:\program files\microsoft visual studio 10.0\vc\include\hack.h(155): error C2679: binary '==' : no operator found which takes a right-hand operand of type 'std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> could be 'built-in C++ operator==(char *, char *)'
1> c:\program files\microsoft visual studio 10.0\vc\include\exception(470): or 'bool std::operator ==(const std::_Exception_ptr &,const std::_Exception_ptr &)'
1> c:\program files\microsoft visual studio 10.0\vc\include\exception(475): or 'bool std::operator ==(std::_Null_type,const std::_Exception_ptr &)'
1> c:\program files\microsoft visual studio 10.0\vc\include\exception(481): or 'bool std::operator ==(const std::_Exception_ptr &,std::_Null_type)'
1> c:\program files\microsoft visual studio 10.0\vc\include\system_error(408): or 'bool std::operator ==(const std::error_code &,const std::error_condition &)'
1> c:\program files\microsoft visual studio 10.0\vc\include\system_error(416): or 'bool std::operator ==(const std::error_condition &,const std::error_code &)'
1> c:\program files\microsoft sdks\windows\v7.0a\include\guiddef.h(192): or 'int operator ==(const GUID &,const GUID &)'
1> while trying to match the argument list '(char *, std::basic_string<_Elem,_Traits,_Ax>)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.46
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
Back to top |
|
 |
educofu Expert Cheater
Reputation: 3
Joined: 21 Aug 2009 Posts: 171 Location: Brazil,MG,OP
|
Posted: Fri Mar 11, 2011 12:19 pm Post subject: |
|
|
im going to remove the search function until i get it fully working. im studying caching for faster scans.
_________________
"I finally started thinking outside of the box, only to find myself in a larger box." |
|
Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Mon Mar 14, 2011 8:13 am Post subject: |
|
|
Since you use common names for functions (read, write, search,etc), it would probably be a good idea to wrap your header in a namespace.
You can ignore the advice to avoid stack allocation. A few K on the stack is no big deal.
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Mon Mar 14, 2011 1:53 pm Post subject: |
|
|
justa_dude wrote: | Since you use common names for functions (read, write, search,etc), it would probably be a good idea to wrap your header in a namespace.
You can ignore the advice to avoid stack allocation. A few K on the stack is no big deal. |
So exactly why do you think stack probes are necessary for stack allocations over the page size again ?
|
|
Back to top |
|
 |
AhMunRa Grandmaster Cheater Supreme
Reputation: 27
Joined: 06 Aug 2010 Posts: 1117
|
Posted: Mon Mar 14, 2011 2:20 pm Post subject: |
|
|
@educofu
File has expired from that link.
_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.> |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|