Any one give me an idea of the usage of incBin.
I assume it's some way of loading graphics music etc.. in away someone else cant pinch your underlying code?
See the documentation. (https://blitzmax.org/docs/en/tutorials/beginners_guide/#save-images-in-your-exe)
Essentially, it is a way of packing external assets [any kind of filetype] into your executable.
Of course, it will inflate the size of exe and you can only have hardcoded static paths to those files.
It can mitigate the end users' ability to examine/steal/edit those assets, but if they're particularly shrewd wityh the right tools, they might still be able to grab the binary data and recreate the individual files - it will be very labour intensive for them, so may be enough of a deterrent for all but the most peristent - depends on the potential for rewards I guess...
_
To use IncBin it really is a s simple as:
Incbin "C:\Program Files\BlitzMax\samples\aaronkoolen\AStar\mountain.png"
Local I:TImage=LoadImage("Incbin::C:\Program Files\BlitzMax\samples\aaronkoolen\AStar\mountain.png")
QuoteIt can mitigate the end users' ability to examine/steal/edit those assets, but if they're particularly shrewd wityh the right tools, they might still be able to grab the binary data and recreate the individual files - it will be very labour intensive for them
:o
Are saying even just an .exe could be stripped for internal working code :-X
Baggey
Quote from: Baggey on Jul 12, 2025, 07:28 AMAre saying even just an .exe could be stripped for internal working code :-X
Baggey
Anything is decrypotable/decompilable - it's jsut a matter of effort & time (and maybe tools too)
:o
UPDATE! Possibly Important!
I thought I'd mention this here. Just identified an issue with using IncBin in a program compiled for Windows
Althoyugh everything works fine during testing and running the executable from its development locaiton - once this is installed to the %PROGRAMFILES% or %PROGRAMFILES(x86)% as a "registered software installaiton" The executable will exit immediately.
I suspect this si some "security measure" by Windows ( Smart Screen or somesuch ? ) but even disabling the Windows Defender stuff did not prevent the crash.
As soon as I removed the IncBin, instead using actual paths to actual file and installed the executable along with the dependency files everything worked.
I cannot confirm this statement. Since years I use INCBIN and never had problems with installations on customers computers.
Can you send us an example code how you used INCBIN, and describe how you use the files? What was the runtime error message?
Did you try to execute a file, which is INCBINed? Something like:
OpenURL "incbin::manual.pdf"
This will not work!
I have a suspicion:
Count your INCBIN statements in the code and the count the files, which you now install with the installer.
I guess it points to a file you forgot to INCBIN. And as long as you start the app from the development dir, the forgotten file was still next to the EXE and found...
Quote from: Midimaster on Oct 13, 2025, 09:53 PMI cannot confirm this statement. Since years I use INCBIN and never had problems with installations on customers computers.
Can you send us an example code how you used INCBIN, and describe how you use the files? What was the runtime error message?
This is a very recent development. Previously it worked without issue and nothing from the BlitzMax code side of things has changed, nor had the number of files / their location. [ I have upodated BMax NG source and other areas of the program but have not touched this IncBin part in many months ]
There was no error message, instead the entire program just exited to desktop when running as a compiled installation.
When testing, however, it worked just fine.
I was using the incbin command in combination with the language.ini files for MaxGUI localisation
the relevant snippets are:
These files are correctly matched in the development environment
' Package files into executable binary
Incbin "F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini"
Incbin "F:\bb\BMax64\WIP\Project\Localisation\English.ini"
Incbin "F:\bb\BMax64\WIP\Project\Localisation\Francais.ini"
Incbin "F:\bb\BMax64\WIP\Project\Localisation\Svenska.ini"
Function GetLocalisationRoot:String()
Local Path:String=APP_ROOT+APPLOCALISATION_DIR+"/"
Return Path
End Function
APP_ROOT is defined earrlier and essentially the installation location with slash suffix "/"
APPLOCALISATION_DIR is "Localisation"
Here is the snippet for when the incbinned files are actually used.
Function LoadLocalisations()
'LANG_ENGLISH=LoadLanguage(LOCALISATION_ROOT+"English.ini")
LANG_ENGLISH=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"English.ini")
SetLanguageName(LANG_ENGLISH,"English")
LANG_FRENCH=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"Francais.ini")
SetLanguageName(LANG_FRENCH,"French")
LANG_GERMAN=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"Deutsch.ini")
SetLanguageName(LANG_GERMAN,"German")
LANG_SWEDISH=LoadLanguage("Incbin::"+LOCALISATION_ROOT+"Svenska.ini")
SetLanguageName(LANG_SWEDISH,"Swedish")
'KNOWN ISSUE: Panel Name remains unchanged until redrawn - this is low prio.
End Function
Removing ther IncBin and Reverting to distributing the files with the executable and loading them as 'normal' resovled the issue.
I simulated your example (also with the TMaxGuiLanguage stuff) and the EXE works on C: and D: and also in the windows PROGRAMS folder as expected
Please test this on C: and F: and also in the PROGRAMS folder:
SuperStrict
Import MaxGUI.Drivers
' files are in F:\bb\BMax64\WIP\Project\Localisation\
Graphics 300,200
Incbin "F:\bb\BMax64\WIP\Project\Localisation\English.ini"
Local Path:String = "Daten\"
Path = "incbin::F:\bb\BMax64\WIP\Project\Localisation\"
Global Language:TMaxGuiLanguage = LoadLanguage:TMaxGuiLanguage(path + "English.ini")
If Language=Null RuntimeError "no language loaded"
Repeat
Cls
DrawText "Hello", 100,100
Flip
Until AppTerminate()
And I can also tell you, that I often used INCBIN together with TMaxGuiLanguage in apps I gave to customers and we never had problems.
Do you know, that INCBIN handles strings CASE sensitive? Maybe you have one capital letter anywhere in your file names or paths and somewhere else you used it without this capital letter?
next idea:
you write:
' Package files into executable binary
Incbin "F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini"
and then...
Function GetLocalisationRoot:String()
Local Path:String=APP_ROOT+APPLOCALISATION_DIR+"/"
two questions here:
Can you post the code two lines where you defined APP_ROOT and APPLOCALISATION_DIR?
for INCBIN reading you need to use the exact same string, which you used in the INCBIN code line:
F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini
even when the EXE is now in PROGRAMS, the loading path still needs to be:
LANG_GERMAN=LoadLanguage("Incbin::"+ F:\bb\BMax64\WIP\Project\Localisation\Deutsch.ini")
Add a simple PRINT...
Function GetLocalisationRoot:String()
Local Path:String=APP_ROOT+APPLOCALISATION_DIR+"/"
Print Path
... to your code and compare if the strings are really identic.