Jump to content

Recommended Posts

Posted (edited)

Today I'm overcome my laziness :lmao:, found stupid mistake with which I stuck before and finished dll for reading/writing binary data. Dll allow reading given number bytes at given offset into hex string and writing hex data back, also at given offset. Although reading can be done only with Autoit, this method should be faster.

Source included, so if you inetersting and know how to improve this, suggestions and comments are welcome.

binary_dll.zip

Edited by Lazycat
Posted (edited)

:lmao: looks great :Dim starting to feel a little more confident in C++ for making my own dll... maybe mine will be done in 2 weeks and it will be shorter then yours :)

good work o:)

EDIT i think you should also post this on the developers section where the Dll Examples are wanted.. btw: what compiler/IDE did you use for this?

Edited by layer
FootbaG
  • 3 months later...
Posted

It's great. It's that what I was so looking for. :(

I want to suggest two functions, that will simplify using of this dll:

1. for reading from binary files:

FUNC _FileReadBin ($file, $offset, $bytes )
    DIM $ret[2]
    $word = DllCall(@ScriptDir & "\binary.dll", "int", "FileReadBinary", "str", $file, "int", $offset, "int", $bytes, "str", "")
    $ret[0] = $word[0]
    $ret[1] = $word[4]
    Return $ret
ENDFUNC

ussage is following:

_FileReadBin ( "file", "offset", "bytes" )

Parameters:

file - name of file to be read;

offset - number of bytes to scip;

bytes - number of bytes to read.

Returnes an array, wich nas elements:

[0] - return value ( 1 - success, 0 - failure)

[1] - result string

2. For writing to binary files:

FUNC _FileWriteBin ($file, $offset, $string )
    DIM $ret
    $word = DllCall(@ScriptDir & "\binary.dll", "int", "FileWriteBinary", "str", $file, "str", $string, "int", $offset)
    $ret = $word[0]
    Return $ret
ENDFUNC

ussage is following:

_FileWriteBin ( "file", "offset", "string" )

Parameters:

file - name of destination file;

offset - number of bytes to scip

string - string to write.

Return value: 1 - success, 0 - failure

I hope, that it will be helpful for users.

PS - happy birthday to you, LAZYCAT.

Posted

Hmm, I think with DllStruct* functions this dll is become useless :( Now we can read/write binary data without this dll. So one of my dreams is come true, and now I prefer to make new UDF with the native Autoit functions for working with binary data. When time allow, though...

PS - happy birthday to you, LAZYCAT.

It's only coming, but thanks! :(

Posted

DllStruct.au3 which can be found at the link in my sig, has a UDF for reading binary files, but it means using DllStruct* functions.

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...