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.

QuickBMS errors [programming, scripting, quickbms.exe tool... NOT games]

Featured Replies

  • Author
  • Localization

aluigi, posted Fri Dec 18, 2020 12:21 am (61173)


@Shokoniraya
Regarding the Encryption doubt, the problem is that KEY_CODE is read as a number ("byte") but it's used as a string as key of Encryption.
The correct way should be: getdstring KEY_CODE 1 MEMORY_FILE3
Indeed if you use 'print "%KEY_CODE%"' it will show 0 which is the key "0" (0x30).

While for the problem of the label, honestly I don't know what should I do because I see various cycles with labels outside them.
That feature is experimental and worked well in my tests but that script is too messy :D
  • Replies 671
  • Views 51
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Localization

Shokoniraya, posted Fri Dec 18, 2020 12:24 am (61174)


thank you sir aluigi, so i have to use getdstring for key
but sure there is problem with label and continue (mybe just lebel)

and thanks for your answering, spiritovod


so i downloaded beta version right now (just want to make sure that i'm using latest version)
there is some problems with EXECUTE and two idea

idea 1) adding QUICKBMS_FOLDER to get QuickBMS exe folder
idea 2) adding a option for findloc to find exact string (WoRd != word), it can be done with binary, but useful in some cases like making a string VAR (string MY_STRING = "my stirng") or you want to find same string that readed with getdstring



i attached a zip file in this comment
there is a unicode execute folder in zip, just extract zip file same as-is (files must be under unicode execute folder for this test)
and put quickbms_4gb_files.exe where the run.bat is

so we have a #FOLDERS directory that contain some folders and a .txt file that has unicode charcters in file path
and a _temp folder
the plan is making a copy of txt file in _temp folder, but there is some problems


problem 1)
file path is "C:\my_folder\tests\unicode execute"
if file path have space in current dictionary address (path of run.bat), this error happens
'""C:\my_folder\tests\unicode' is not recognized as an internal or external command,
operable program or batch file.


and after renaming "unicode execute" from the "C:\my_folder\tests\unicode execute" to this: "unicode_execute", problem not happens

problem 2)
after testing problem 1, click on run.bat again. and file can't be fount because unicode names not working in EXECUTE and this error happens

@"C:\my_folder\tests\unicode_execute\copy.exe" "C:\my_folder\tests\unicode_execute\#FOLDERS\??%e??C?E?\?'"????????.LSB_files\strings.txt" /s /e /f /y /q "C:\my_folder\tests\unicode_execute\_temp"
File not found - strings.txt
0 File(s) copied

unicode execute.zip

  • Author
  • Localization

aluigi, posted Sat Dec 19, 2020 11:31 pm (61196)


I can check if I can add QUICKBMS_FOLDER since I have to check first if there is any multiplatform solution, but I suppose that the other options like CURRENT_FOLDER, FILE_FOLDER, BMS_FOLDER and INPUT_FOLDER may be already useful and better than knowing where quickbms.exe is located.

Findloc is already case sensitive.
In fact I think I should handle the "string" type as insensitive and "binary" as sensitive.
I guess that what you experience is a sort of collision between constant strings.

I gave a look at your script and it seems ok.
I removed the various \" because they are automatically handled by quickbms (at least in the beta).
This is the output of a test:
Code:
- execute:
  @"Z:\unicode execute\unicode execute\mytest.exe" "z:\unicode execute\unicode execute\#FOLDERS\a?%e?zC?E?\a'"a?a??a??.LSB_files\strings.txt" /s /e /f /y /q z:\output_folder

argument: 0 Z:\unicode execute\unicode execute\mytest.exe
argument: 1 z:\unicode execute\unicode execute\#FOLDERS\a?%e?zC?E?\a'"a?a??a??.LSB_files\strings.txt
argument: 2 /s
argument: 3 /e
argument: 4 /f
argument: 5 /y
argument: 6 /q
argument: 7 z:\output_folder

Don't expect good results when using unicode with the console, probably you can run "chcp 65001" in the console before running quickbms but who knows.
  • Author
  • Localization

aluigi, posted Sun Dec 20, 2020 12:10 am (61197)


I found that quickbms already has an EXE_FOLDER but it was available only as variable quickbms_exe_folder when running with -v and -V (debugging).
In next beta I will add EXE_FOLDER as type for get.
  • Author
  • Localization

Shokoniraya, posted Sun Dec 20, 2020 12:39 am (61198)


sir aluigi, i found out that i can use batch scripts in EXECUTE command
but isn't better to add a shell command in QuickBMS?
like this example
Code:
get FILES long
get NAME string
shell "copy.exe file.bin folder"


it could be very useful to have a shell command, becuase EXECUTE working with cmd.exe and not useful for such cases
  • Author
  • Localization

aluigi, posted Sun Dec 20, 2020 12:49 am (61199)


In theory the EXECUTE command should not even exist :)
It's dangerous to have something like that in scripts used by users but at least it works well.
  • Author
  • Localization

aluigi, posted Sun Dec 20, 2020 12:50 am (61200)


Ah and I guess that what you want is "cmd.exe /c copy arguments"
  • Author
  • Localization

Shokoniraya, posted Sun Dec 20, 2020 1:18 am (61201)


danger? i understand

and just one more thing, can you please do something about MEMOEY_FILE names?
it's really messy for scripts that contain a lot of memory file
i know that i can use comment, but it's not make anything clearer for me
  • Author
  • Localization

spiritovod, posted Sun Dec 20, 2020 1:33 pm (61207)


Took the time and tested, how exactly continue and break works with labels at the moment. Outside conditions and cycles they work as expected. In do and for cycles (where continue and break are expected) "continue/break label" works like simple "continue/break", that means something like this will create infinite loop in both 0.10.1 and latest beta:
Code:
math COUNT = 2
do
print "%COUNT%"
continue NEXT1
math COUNT - 1
while COUNT > 0
label NEXT1

As for if condition (where continue and break are not expected), "continue label" works as expected in 0.10.1 and creates infinite loop in latest beta:
Code:
math CHECK = 1
if CHECK = 1
   continue NEXT1
endif
print "Here"
label NEXT1
print "There"

Despite the feature is being experimental, I think it's clearly a bug somewhere and current behavior doesn't match with explained in papers when cycles are considered.

And about string operators descriptions, I can now explain, why latest one is more confusing. Let's take "& strchr" - in old version there is description for it "first occurrence" and clear example with operands and result. In the new version it's just result1, result2, result3 - that means you should scroll up to see operands - and no description, that means you should guess, what current operator is actually doing.
For example, if I put something like this in a documentation, would you understand, how # operator works:
[# - convertstr
"CD" # "FF" = "FFAB"]
  • Author
  • Localization

Shokoniraya, posted Mon Dec 21, 2020 3:08 am (61210)


there is a weird problem, can't get any variable from inside a function

Code:
math FIEL_NUMBER = 0
print "%FIEL_NUMBER%"
callfunction GET_NUMBER
print "%FIEL_NUMBER%"

startfunction GET_NUMBER
math FIEL_NUMBER = 1
endfunction GET_NUMBER
  • Author
  • Localization

spiritovod, posted Mon Dec 21, 2020 2:00 pm (61213)


@Shokoniraya: You didn't preserve the variable, it should be "callfunction GET_NUMBER 1" in your case.
And also about memory files - I think aluigi already explained somewhere that you can create aliases after initializing them, since they can be addressed simply by numbers. Like this:
Code:
log MEMORY_FILE2 0 SIZE
math NAME2 = -2
get BIN_SIZE long NAME2
findloc FOUND long BIN_SIZE NAME2 ""
  • Author
  • Localization

Shokoniraya, posted Mon Dec 21, 2020 8:58 pm (61225)


i know about MEMORY_FILE numbers, but it will be a mess if i use too much MEMORY_FILE since thety doesn't have any name
so negative file numbers specificed for MEMORY_FILE numbers, i didn't knew it at all!
Code:
math NUMBER_BOX = -1
set MEMORY_FILE1 binary "\x01\x00\x00\x00"
get MY_NUMBER long NUMBER_BOX
print "%MY_NUMBER%"



and thank you so much about callfunction GET_NUMBER 1, thanks to sir aluigi
  • Author
  • Localization

Shokoniraya, posted Tue Dec 22, 2020 3:51 am (61231)


putdstring works fine to putting a binary, but still there is limitation (null terminate) if we want to findout that two string or binary is same or not same

Code:
set MEMORY_FILE1 binary "\x00\x00\x00\x00\x00\x00\x01"
set MEMORY_FILE2 binary "\x00\x00\x00\x00\x00\x00\x02"

getdstring BINARY_1 3 MEMORY_FILE1
getdstring BINARY_2 3 MEMORY_FILE2

if BINARY_1 = BINARY_2
print "equal!"
else
print "not equal!"
endif



maybe above example is just a childish for it, that is why we need a getbinary for such times, if we want to use it for such times
Code:
set MEMORY_FILE1 binary "A\x00\x00\x00\x00\x00\x00\x01"
set MEMORY_FILE2 binary "a\x00\x00\x00\x00\x00\x00\x02"

getdstring BINARY_1 3 MEMORY_FILE1
getdstring BINARY_2 3 MEMORY_FILE2

if BINARY_1 = BINARY_2
print "equal!"
else
print "not equal!"
endif


this could be solved with below code, but good to have such thing to make the process faster and binary sensitive if var is a binary (readed as getbinary)
Code:
set MEMORY_FILE1 binary "a\x00\x00\x00\x00\x00\x00\x01"
set MEMORY_FILE2 binary "A\x00\x00\x00\x00\x00\x00\x02"

get MEM_SIZE1 asize MEMORY_FILE1
get MEM_SIZE2 asize MEMORY_FILE2
math EQUAL_MODE = 1
if MEM_SIZE1 = MEM_SIZE2
for memory = 0 < MEM_SIZE1
get MEMORY_BYTE_1 byte MEMORY_FILE1
get MEMORY_BYTE_2 byte MEMORY_FILE2
if MEMORY_BYTE_1 != MEMORY_BYTE_2
math EQUAL_MODE = 0
endif
next memory
endif



if EQUAL_MODE = 1
print "equal!"
else
print "not equal!"
endif
  • Author
  • Localization

aluigi, posted Mon Jan 04, 2021 10:07 am (61462)


The new beta has now full support for the labels.

The links are ever the same:
http://aluigi.org/beta/quickbms_exe.zip (exe)
http://aluigi.org/beta/quickbms_beta.zip (exe source)

I used this script for testing the feature and it worked with all the NEXT* labels:
Code:
label NEXT0

math COUNT = 1
do
    print "----------"
    print "0 %COUNT|x%"

    label NEXT1
    math COUNT 1
    print "1 %COUNT|x%"

    label NEXT2
    math COUNT 0x200
    print "2 %COUNT|x%"

    break NEXT2 # edit here

    math COUNT - 1
    print "SKIP_ME"

    label NEXT3
    math COUNT 0x30000
    print "3 %COUNT|x%"

while COUNT > 0

print "END_OF_LOOP"

label NEXT4
print "NEXT4"

label NEXT5
print "NEXT5"


@Shokoniraya
I forgot about mentioning the solution of using variables as file number (with any name you desire), good that spiritovod remembered it :)

Regarding the other question about the comparison try using a 0 prefix for using the binary comparison.
It's a new feature of the beta introduced a coupld of months ago:
Code:
if BINARY_1 0= BINARY_2


@spiritovod
I will check what I can do for the String examples, those in quickbms.txt are automatically generated by a script.
  • Author
  • Localization

spiritovod, posted Tue Jan 05, 2021 2:10 pm (61486)


Great, thanks for the update. All labels and simple continue/break works fine in all combinations of encapsulated cycles now.
  • Author
  • Localization

aluigi, posted Thu Jan 07, 2021 6:28 pm (61522)


Please report any other issue, improvement, new feature you spot.
If you think the beta is ok I can release it publicly, my list of things to do/fix with quickbms is now empty.
  • Author
  • Localization

Shokoniraya, posted Fri Jan 08, 2021 9:03 am (61533)


sir aluigi, everything works fine in QuickBMS (at least i can't see any problem in current beta until now)
i think updating userDefineLang.xml of Notepad is needed
and i am pretty sure there is many useful things in QuickBMS that not included in quickbms.txt
i hope you have good time, thank you
  • Author
  • Localization

Shokoniraya, posted Tue Feb 02, 2021 3:03 pm (61972)


one of the things that QuickBMS can do is handling c strings and replacing forbidden characters and good handling of output file name

two things really needed
1)make an option to dissable all c-string errors (for example: when we want to use a wrong escape. and that option should replace 0x0D and 0x0A with a tag like if we want to disable c-string error and use single line string)
2) using open FDSE NAME 2 not working if NAME have a forbidden chatacter (in this case, NAME string is "star*file.bin", but "*" replaced to "_" in exporting, and problem is that can't open exported file with open command based on exported NAME string)
open FDSE NAME 2
but it just trying to open "star*file.bin" instead of "star_file.bin"
  • Author
  • Localization

aluigi, posted Sun Feb 07, 2021 10:20 pm (62064)


1) I don't think I can implement any alternative encoding/method because it would take time and effort. And the lack of standards doesn't help. I'm sure we already discussed about it.

2) You can't use the * character on most filesystems. It's used as wildcard interpreted by console and terminals.
https://en.wikipedia.org/wiki/Filename# ... imitations
  • Author
  • Localization

Shokoniraya, posted Sat Feb 13, 2021 3:09 am (62161)


1) then i will keep to the current standard, thank you. but if you get free time, please think about xml slog, sir aluigi. because xml is easy to detecting errors, and it can be multi line and people can add id and label to their localization strings

2) i attached a open_naming.zip, and there is a file.bms in it that checks if a file exist or not before extraction
real file name is *my_file*.star in file.bin, and since it has forbidden character, then QuickBMS turn it to "_", but when i want to try open a forbidden named file with OPEN command, it's trying to open it with real forbidden name instead of fixed name with "_" chars

open_naming.zip

  • Author
  • Localization

aluigi, posted Mon Feb 15, 2021 12:46 am (62222)


2) Interesting, I will check it.
  • Author
  • Localization

aluigi, posted Mon Feb 15, 2021 1:03 am (62223)


ok I double checked.
The filename is passed as-is to the _wfopen and fopen API.
I also checked the unicode name and it's just intact.

The different behavior between input and output is due to security and "cleaning" reasons, the former needs maximum freedom for which no filters are applied while the latter must be filtered and limited.

So it's all ok.
  • Author
  • Localization

aluigi, posted Sat Feb 27, 2021 12:52 pm (62527)


New beta out.
There was a lame bug recently introduced in unzip_dynamic/zlib_noerror/deflate_noerror that returned an error.
I also added support for the dictionary in that same code since it costed me nothing.
Now tcc supports 64bit (long long) variables.
  • Author
  • Localization

Shokoniraya, posted Sat Feb 27, 2021 6:47 pm (62535)


i found a problem
Code:
string MY_SCRIPT_NAME = "script.bms"
include MY_SCRIPT_NAME


problem is that can't use a variable as a string for include command
  • Author
  • Localization

aluigi, posted Sun Feb 28, 2021 10:49 am (62549)


"include" only works with constant filenames because they get immediately loaded while parsing the script.
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.