+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Banned
    Points: 22,963, Level: 36

    Join Date
    May 2007
    Location
    USA & Canada
    Posts
    437
    Helped
    50 / 50
    Points
    22,963
    Level
    36

    How to embedded a hex file into a exe file with Visual C++?

    With Visual C++ 6.0, There must be a quick way to embed a small hex file into a project and generate a exe file which includes all hex file data. And the exe file can manipulate this embedded hex file, at least read the embedded hex data.

    Anyone happen to know and please give a hint.

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 5
    Points: 16,636, Level: 31

    Join Date
    Jul 2001
    Location
    Oberon
    Posts
    1,897
    Helped
    442 / 442
    Points
    16,636
    Level
    31

    Re: How to embedded a hex file into a exe file with Visual C

    I dont know if this helps, but hex files are quite easy to parse. Here is the format

    Intel Hex 32 Format

    The extended 32-bit address hex format is similar to the hex 8 format,
    except that the extended linear address record is output also to establish
    the upper 16 bits of the data address. This is mainly used for 16-bit core
    devices since their addressable program memory exceeds 64 kbytes.

    Each data record begins with a 9-character prefix and ends with a
    2-character checksum. Each record has the following format:

    :BBAAAATTHHHH....HHHCC
    where:

    BB A two digit hexadecimal byte count representing the number of data bytes
    that will appear on the line.

    AAAA A four digit hexadecimal address representing the starting address of
    the data record.

    TT A two digit record type:

    00 - Data record
    01 - End of File record
    02 - Segment address record
    04 - Linear address record

    HH A two digit hexadecimal data byte, presented in low byte/high byte
    combinations.

    CC A two digit hexadecimal checksum that is the two's complement of
    the sum of all preceding bytes in the record.



    •   AltAdvertisement

        
       

  3. #3
    Banned
    Points: 22,963, Level: 36

    Join Date
    May 2007
    Location
    USA & Canada
    Posts
    437
    Helped
    50 / 50
    Points
    22,963
    Level
    36

    Re: How to embedded a hex file into a exe file with Visual C

    Thanks for the reply. These are useful information.
    Also I want to know if possible to embed a hex file into a exe file with Visual C++.



    •   AltAdvertisement

        
       

  4. #4
    Member level 2
    Points: 753, Level: 6

    Join Date
    May 2010
    Location
    NO HIDDEN LINKS
    Posts
    47
    Helped
    12 / 12
    Points
    753
    Level
    6

    Re: How to embedded a hex file into a exe file with Visual C

    This is a very old post, but this information could help someone.

    There are two ways to do this.

    1. Define the content of the hex file (decoded to binary or as it is) as a C array and use that array in the program.

    2. Add the hex file as a resource in the project and use FindResource() and associated functions to extract it.


    1 members found this post helpful.

  5. #5
    Full Member level 1
    Points: 2,103, Level: 10

    Join Date
    Nov 2004
    Posts
    101
    Helped
    15 / 15
    Points
    2,103
    Level
    10

    Re: How to embedded a hex file into a exe file with Visual C++?

    include the hex file as a binary resource in the resource editor ( easiest way) and read it during run time and use it



--[[ ]]--