Jump to content
Sign in to follow this  

Trailing Zeros with Integer

Recommended Posts

Hi guys!

I tried lately to write some stuff at the end of a compiled .exe file (which is written in C if someone needs to know)

It's kind of a configuration GUI for the other programm, so I want to write a string and some integers behind the other stuff.


$handle=FileOpen("test.exe", 1)
Filewrite($handle, $SomeString)
Filewrite($handle, BinaryString(StringLen($SomeString)))
Filewrite($handle, $number1)

So far so good. Now If I open the .exe with a HEX-Editor like WinHex or XVI32 it shows me this:

Hex: 6D 79 73 74 72 69 6E 67 08 00 00 00 D2 04 00 00 00 00 00 00

Dec: m y s t r i n g 8 zeros 1234 and again zeros

Well, it writes the string, ok

it writes the length of it, ok

it also writes my testnumber 1234

nut it just ads some stupid zeros behind it...

btw: i tried to write $number 1 with Int() or BinaryString() and even Formatstring() it doesnt' work

Can anyone explain how I can get these numbers without any zeros into the file?

Thank you very much for every answer.

Greetz tannerli

Share this post

Link to post
Share on other sites

From back in the day -

Func RawWrite($File,$Hex)
    If IsInt(StringLen($Hex)/2)=0 Then Return (-1)
    Local $a
    For $a=1 To StringLen($Hex) Step 2

This was the function i used for writing binary, first arg is the filename or handle, second arg is a string of hex numbers ( "ED1AB6" or so). Remeber when you jus tsimply FileWrite() it does text.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...