The MASM Forum

General => The Workshop => Topic started by: Vortex on December 11, 2018, 05:47:34 AM

Title: Binary to MS COFF object file converter
Post by: Vortex on December 11, 2018, 05:47:34 AM
This tool converts any binary file to a linkable MS COFF object file. The new version can create 64-bit MS COFF object modules.

Usage :
   bin2coff srcfile.ext output.obj label architecture

srcfile.ext :   Any kind of binary file

output.obj :   The name of the object file
label :   A label name presenting the embedded binary data to the linker
                            Notice that the label should be prefixed with an underscore depending
                            on the calling convention of your development tools.

        architecture    :   32 or 64 depending on the target platform


Asmc, Poasm and Uasm are providing the INCBIN statement to embed binary files into object modules. Since Masm does not provide any command like INCBIN for this purpose, I decided to code this small tool.
Title: Re: Binary to MS COFF object file converter
Post by: felipe on December 11, 2018, 01:07:30 PM
Looks like a great work, thanks  :t
Title: Re: Binary to MS COFF object file converter
Post by: sinsi on December 11, 2018, 03:56:14 PM
Thanks for the source (I'm looking into obj and lib files at the moment).
One problem, CreateFile returns -1, not 0 on error.
Title: Re: Binary to MS COFF object file converter
Post by: hutch-- on December 11, 2018, 08:49:19 PM
Thanks for these Erol, there is some interesting code here.
Title: Re: Binary to MS COFF object file converter
Post by: aw27 on December 12, 2018, 01:08:11 AM
Great work.  :t
Title: Re: Binary to MS COFF object file converter
Post by: Siekmanski on December 12, 2018, 01:34:45 AM
Beautiful example.  :t
Title: Re: Binary to MS COFF object file converter
Post by: TimoVJL on December 12, 2018, 05:39:03 AM
Nice examples 8)
Title: Re: Binary to MS COFF object file converter
Post by: Vortex on December 12, 2018, 05:55:34 AM
Hello,

Many thanks. The CreateFile issue is fixed. New upload at the top.