Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Findloc get the end offset

Featured Replies

  • Author
  • Localization

crushedice2000, posted Tue Nov 10, 2015 9:48 pm (9590)


When I use findloc I get the start offset of the found pattern, but, can I get the offset of the pattern end?

Example of input:

Code:
Magic Header 1.0


Example of code:

Code:
findloc OFFSET string "Magic Header "
goto OFFSET
get VERSION string
print "VERSION: %VERSION%"


Expected output:

Code:
1.0


Current output:

Code:
Magic Header 1.0
  • Author
  • Localization

aluigi, posted Tue Nov 10, 2015 10:05 pm (9592)


Just add the length of the searched string to OFFSET:
Code:
findloc OFFSET string "Magic Header "
math OFFSET 13
goto OFFSET
get VERSION string
print "VERSION: %VERSION%"
  • Author
  • Localization

crushedice2000, posted Wed Nov 11, 2015 9:24 am (9598)


Thank you! However I need to make you two questions more:

1. How can I get the string length to clarify the code (no need for anybody to guess what means 13):
Code:
set MAGIC string "Magic Header "
findloc OFFSET string MAGIC
math OFFSET len(MAGIC)
goto OFFSET
get VERSION string
print "VERSION: %VERSION%"


2. Is there any QuickBMS reference manual to avoid bother you with silly questions? :twisted:
  • Author
  • Localization

aluigi, posted Wed Nov 11, 2015 11:12 am (9600)


You can use the strlen command to get the length:
strlen MAGICSZ MAGIC
math OFFSET MAGICSZ

The main concept of the bms/mexscript language is that it's basic and uses just one command per line, that's why a "math OFFSET len(MAGIC)" is not possible because that would be like having 2 commands in the same line.


The reference manual of quickbms is just quickbms.txt, the file located in the quickbms package and mirrored here:
http://aluigi.org/papers/quickbms.txt

It contains the full list of commands and what their arguments do.
The language has been improved during the last years with some features that weren't planned and sometimes were difficult to "fit" inside the original syntax.
For example the operators of the String command are far from being intuitive but they cover all the operations encountered till now during the working on file formats.
  • Author
  • Localization

crushedice2000, posted Wed Nov 11, 2015 12:14 pm (9605)


Wow! I figured out that quickbms.txt was only for usage and not programming reference... :o Now I see that I have a complete BMS documentation.

Is a pity to be restricted to one command per line. However, this simplifies the program.

Thank you! I'm learning QuickBMS because it can help me a lot... Now I'm working with raw binary data files. :)
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.