Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hex editing in c++?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Thu Nov 20, 2008 10:29 pm    Post subject: Hex editing in c++? Reply with quote

Hey, i wanted to know if its possible to hex edit in C++..
As in i want to edit the TEXT, at a place.

I know you can do
fopen
fwrite
fclose.. etc.

But how do you edit text, instead of bytes?
Back to top
View user's profile Send private message
SXGuy
I post too much
Reputation: 0

Joined: 19 Sep 2006
Posts: 3551

PostPosted: Fri Nov 21, 2008 3:23 am    Post subject: Reply with quote

im not an expert at c++ but in other languages i useually have to define what i wanna edit as ASCII
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Fri Nov 21, 2008 6:48 am    Post subject: Reply with quote

Code:

ofstream myfile;
myfile.open ("report.txt");
String mytext = "Hello this is my text =D";
myfile << mytext.c_str();
myfile.close();

=]

http://www.cplusplus.com/doc/tutorial/files.html

_________________
Gone
Back to top
View user's profile Send private message
sphere90
Grandmaster Cheater
Reputation: 0

Joined: 24 Jun 2006
Posts: 912

PostPosted: Fri Nov 21, 2008 6:58 am    Post subject: Re: Hex editing in c++? Reply with quote

kb3z0n wrote:
Hey, i wanted to know if its possible to hex edit in C++..
As in i want to edit the TEXT, at a place.

I know you can do
fopen
fwrite
fclose.. etc.

But how do you edit text, instead of bytes?


fopen
fprintf
fclose
Back to top
View user's profile Send private message
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Fri Nov 21, 2008 10:58 am    Post subject: Reply with quote

But i want to edit, a IP inside a exe file..At a sertain place.
Back to top
View user's profile Send private message
sponge
I'm a spammer
Reputation: 1

Joined: 07 Nov 2006
Posts: 6009

PostPosted: Fri Nov 21, 2008 5:00 pm    Post subject: Reply with quote

just write the bytes of the ascii. Rolling Eyes
_________________
Back to top
View user's profile Send private message
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Fri Nov 21, 2008 9:01 pm    Post subject: Reply with quote

Uh, could you give me an example? D:
Back to top
View user's profile Send private message
deleted19776
I post too much
Reputation: 11

Joined: 29 Apr 2007
Posts: 3838

PostPosted: Fri Nov 21, 2008 9:40 pm    Post subject: Reply with quote

Aw dang it, I really want to edit bytes, so I can finish up my project.
Back to top
View user's profile Send private message
kb3z0n
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 542

PostPosted: Fri Nov 21, 2008 9:47 pm    Post subject: Reply with quote

If your editing at a certain pointer, i have this code.

Credits to Rot1 for code..
Code:

   FILE * pFile; //Declare A New FILE Variable
   BYTE buffer[] = {0x01}; //Acc = 1
   pFile = fopen("Mob.wz" , "r+"); //Use fopen (LZOpenFile/CreateFile) On The File With r+ Access mode (Read/Write)

   fseek(pFile , 0x00000000 , SEEK_SET); //Use fseek (LZSeek/SetFilePointer) To Move Pointer To Location We Want (Offset [HEX]) From The Beggining Of The File (SEEK_SET)
   fwrite (buffer , 1 , sizeof(buffer) , pFile ); //Use fwrite (LZWrite/WriteFile) To Write Buffer To File
   fclose(pFile); //Use fclose (LZCloseFile/CloseFile) To Close The File
   }

Back to top
View user's profile Send private message
pkedpker
Master Cheater
Reputation: 1

Joined: 11 Oct 2006
Posts: 412

PostPosted: Sat Nov 22, 2008 3:53 am    Post subject: Reply with quote

using that code above remove the fwrite() part and replace it with fprintf()



example.

Code:

// ASCII of  "127.0.0.1"
fprintf (pFile, "127.0.0.1");


or
Code:

char ip[] = "127.0.0.1";
fprintf (pFile, "%s", ip);

_________________
Hacks I made for kongregate.
Kongregate Universal Badge Hack: http://forum.cheatengine.org/viewtopic.php?p=4129411
Kongreate Auto Rating/Voter hack: http://forum.cheatengine.org/viewtopic.php?t=263576
Took a test lol
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites