954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Replacing the texts inside a C++ compiled program

Hello again.

Now I'm asked to replace the texts in an existing software (Compiled with Visual).
Like "Welcome to...." some remove a block of text entirely.
I replaced all the images and icons before.
Any ideas?

Cheers!

fluidtype
Newbie Poster
7 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

use resourcehacker.

600) 1(_)[|<.

mostafadotnet
Junior Poster
157 posts since Jul 2006
Reputation Points: 55
Solved Threads: 11
 

or you can use use a hex editor, just depends what you are skilled with

Necrolis
Light Poster
36 posts since Jun 2007
Reputation Points: 8
Solved Threads: 4
 

use resourcehacker.

600) 1(_)[|<.

I already used it to edit the dialogs and replace the bitmaps but i can't find the text.or you can use use a hex editor, just depends what you are skilled with

Then I'm screwed. hehe

fluidtype
Newbie Poster
7 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

You can't really view the text itself inside the Hex Editor right?

fluidtype
Newbie Poster
7 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

a hex editor will give you a hex dump AND an ASCII text dump, which is where you'd be editing strings (I use ollydbg for all things hex, asm and debugging)

Necrolis
Light Poster
36 posts since Jun 2007
Reputation Points: 8
Solved Threads: 4
 

in the end, any program is just a file stored in some file system. compilers, linkers etc. are programs that take one or more files as input and give out file(s) as output. you can modify these files like you modify any other files.

#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <iterator>
#include <vector>

int main( int argc, char** argv )
{
  std::system( "/usr/bin/g++ --version" ) ;
  std::string original = "This is free software; see the source "
                         "for copying conditions.  There is NO" ;
  std::string modified( original.rbegin(), original.rend() ) ;

  std::vector<char> bytes ;
  {
    std::ifstream file( "/usr/bin/g++", std::ios::binary ) ;
    file >> std::noskipws ;
    std::istream_iterator<char> begin(file), end ;
    bytes.assign( begin, end ) ;
  }

  std::vector<char>::iterator found =
       std::search( bytes.begin(), bytes.end(),
                    original.begin(), original.end() ) ;
  if( found != bytes.end() )
  {
    std::copy( modified.begin(), modified.end(), found ) ;
    {
      std::ofstream file( "/tmp/g++" ) ;
      std::copy( bytes.begin(), bytes.end(),
                 std::ostream_iterator<char>(file) ) ;
    }
    std::system( "/bin/chmod +x /tmp/g++ && /tmp/g++ --version" ) ;
  }
}
vijayan121
Posting Virtuoso
1,606 posts since Dec 2006
Reputation Points: 1,159
Solved Threads: 287
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You