Using Conditional Mod offset in a script Log Out | Topics | Search
Moderators | Edit Profile

X-Ways Support Forum » Advanced Features » Using Conditional Mod offset in a script « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Ludwig Chin
Posted on Thursday, Mar 30, 2006 - 20:08:   

Hi,

I'm trying to find a hex string in a 300+MB file.
I want to search 1024 bytes at a time for this hex string. This string is sometimes written 64 bytes into the 1024 byte groups i'm logically dividing my file into. When I find this string, I want to copy from where it's found up to the end of the 1024 bytes into the clipboard. then move back to the beginning of my 1024 byte chunk, and write the clipboard contents there.
If i could search using the conditional modulo function, it would simpolify this script. Currently the script is not finding the hex string at 64bytes into the 1024byte chunk. HELP!
Here is the script

Block1 0x0
Block2 0x400
// If i could use this--> offset modulo 1024=64
{
find 0x46494c4530 Down Blockonly
IfEqual 0x40 CurrentPos // having problems here
Assign workblock1 currentpos
move +0x3bf
Assign workblock2 currentpos
Block workblock1 workblock2
copy
move -0x3ff
write clipboard
EndIf

move 0x400 //moving to the next 1kb byte chunk in the file
block1 currentpos
move 0x3ff
block2 currentpos
move -0x3ff
} [40000]
//MessageBox "Finished Searching"
Top of pagePrevious messageNext messageBottom of page Link to this message

Stefan Fleischmann (Admin)
Posted on Thursday, Mar 30, 2006 - 22:28:   

Assign Pos CurrentPos
IfEqual (Pos%1024) 64
...
EndIf


Or alternatively don't use the search function at all, simply read 5 bytes every 1024 bytes and compare them with the signature.
Top of pagePrevious messageNext messageBottom of page Link to this message

Ludwig Chin
Posted on Thursday, Mar 30, 2006 - 23:51:   

Thanks for the help, the modulo was all I needed. The script is running correctly now.

Add Your Message Here
Post:
Username: Posting Information:
Only registered users may post messages here, i.e. you need to have an account.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:
Forum operated by X-Ways Software Technology AG.