Jump to content
Sign in to follow this  
Nologic

Playing with 1gig+ binaries

Recommended Posts

Nologic

Anyone got any UDF's, links or code samples?

Right now I can do (split, trim, concatenate) thou slowly...so if someone has some fast code I'd love to see it as I'm doing things with 5mb packets right now.

Lastly I'm looking for a fast way to pad out a binary file with null bytes to a give size.

I did find APITailRW but for some reason it throws an exception on my system.

Thanks a head of time for any help with this. ^_^

Share this post


Link to post
Share on other sites
KaFu

Look at the winapi standard UDF, _WinAPI_CreateFile(), _WinAPI_SetFilePointer(), _WinAPI_ReadFile(), _WinAPI_WriteFile() and _WinAPI_CloseHandle() are the relevant functions. Just created a UDF yesterday to handle filepointers for files > 4 GB ^_^...

Func _WinAPI_SetFilePointerEx($hFile, $iPos, $iMethod = 0)
    ; Set filepointer for files > 4 GB
    ; by KaFu
    Local $aResult
    $aResult = DllCall("kernel32.dll", "dword", "SetFilePointerEx", "hwnd", $hFile, "uint64", $iPos, "uint64*", 0, "dword", $iMethod)
    If @error Then Return SetError(1, 0, -1)
    If $aResult[0] = $__WINAPCONSTANT_INVALID_SET_FILE_POINTER Then Return SetError(2, 0, -1)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_SetFilePointer
Edited by KaFu

Share this post


Link to post
Share on other sites
Nologic

sweet many thanks for the heads up.

Share this post


Link to post
Share on other sites
Ascend4nt

KaFu, this definitely should be submitted to be added to the standard UDF's. Who nowadays doesn't have >4GB files on their PC's?

Thanks for this UDF though - I missed it until I was looking at your superlong signature :) (which is cool though - I think everyone should include signatures with stuff they've done and useful links)

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  

×