none
Extract String from EXE

Answers

  • Quote>I have to remove and display the strings.
    Quote>the file to be searched is a compiled CPP file.

    Well, some obvious unanswered questions:

    Why?

    If you don't want the strings in the compiled exe, why have them in the source file in
    the first place?

    Quote>I should be able to extract(remove) all the strings present in this file

    If you forcibly remove the strings from the compiled exe, what do think will happen when
    you run the exe and the program tries to access the now non-existent strings?

    If you compact the exe by removing a string and shifting the remaining file data up to
    where the string used to be, you will corrupt the exe by invalidating internal addresses.

    You need to clarify your actual objectives - what are you trying to achieve by removing
    these strings from the exe?

    - Wayne
    • Marked as answer by Nixter_leo Tuesday, September 08, 2009 6:45 AM
    Saturday, September 05, 2009 8:12 PM

All replies

  • Do you mean extract using a programmer's tool, or extract with code?  Are the strings in the exe resource section or in its code?  Is the exe native or managed?  Explain your problem in detail.
    Friday, September 04, 2009 5:42 PM
  • If these are resource strings just open the .exe in Visual Studio with File + Open File.  If these are arbitrary strings, use any hex viewer or Sysinternals' Strings.exe utility.  Please make a minimal effort documenting your needs the next time.

    Hans Passant.
    Friday, September 04, 2009 8:06 PM
  • Hi,
    Thanks for the reply
    I have to extract using a code. The strings are in the code.
    Basically i have to extract all the strings present in an .exe file i.e. Complied CPP file and the exe present in the Debug folder

    Saturday, September 05, 2009 9:24 AM
  • Quote>The strings are in the code.

    You mean the target strings you're going to try to find in some other file?

    Quote>i have to extract all the strings present in an .exe file

    Define "extract" - do you mean simply report on which of the target strings were found?

    Or do you mean *remove* them from the exe file being searched?

    Will these strings be recorded as Unicode, MBCS, SBCS, other?

    Is it known how big the file to be searched may be? This impacts the search algorithm
    as extremely large files may not be able to be loaded into memory in their entirety,
    with the result that a "string" may be broken across blocks of data. If the entire file
    can fit into memory, it simplifies the search.

    - Wayne

    P.S. - Note that you should always provide details such as this without being asked.

    Saturday, September 05, 2009 2:40 PM
  • Thanks for the reply. This is my first post here so will surely take care next time

    I have to remove and display the strings. I need to take a .EXE file which i get after building a CPP file and present in the Debug folder. I should be able to extract(remove) all the strings present in this file and display them. 
    So the file to be searched is a compiled CPP file.
    Saturday, September 05, 2009 4:06 PM
  • Quote>I have to remove and display the strings.
    Quote>the file to be searched is a compiled CPP file.

    Well, some obvious unanswered questions:

    Why?

    If you don't want the strings in the compiled exe, why have them in the source file in
    the first place?

    Quote>I should be able to extract(remove) all the strings present in this file

    If you forcibly remove the strings from the compiled exe, what do think will happen when
    you run the exe and the program tries to access the now non-existent strings?

    If you compact the exe by removing a string and shifting the remaining file data up to
    where the string used to be, you will corrupt the exe by invalidating internal addresses.

    You need to clarify your actual objectives - what are you trying to achieve by removing
    these strings from the exe?

    - Wayne
    • Marked as answer by Nixter_leo Tuesday, September 08, 2009 6:45 AM
    Saturday, September 05, 2009 8:12 PM