News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A new tool to convert any file into an SLL.

Started by hutch--, April 14, 2022, 08:41:12 PM

Previous topic - Next topic

hutch--

This tool will convert any file into an SLL that returns the file as a basic dynamic string. An SLL of this type can be used for many things, installations and loading any type of data from text to binary that an application may need to use.

It uses a system of naming that is designed for keeping track of what files contain what data. A file named "myfile.exe" when converted produces an SLL named "myfile_exe.sll" so it is always easy to find.

When you link the SLL into an application, the string variable name is "myfile_exe" which can be use in the normal manner with basic dynamic string. Write it to disk, use the data for internal purposes in the calling app, any task where you need a basic dynamic string that can contain either text or binary data.

A small example is contained in the attached zip file. Note that the capacity is easy enough to use, nothing exotic, just a readily available basic string.

#IF 0  ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    Any2SLL.exe is a tool to convert any file into an SLL module. It uses the original file name
    as part of the SLL name so that the file in the SLL is easily recognised. The period "." is
    replaced with an underscore "_" and the extension ".sll" is added to the output SLL.

    To call the SLL once linked, the string function name is the SLL name minus the ".sll".
    You can use the basic dynamic string returned by the function in the normal manner.

    The intermediate basic file is deleted after the SLL is built. With this 24 meg source file,
    the intermediate basic file is about 85 megabytes in size.

#ENDIF ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    #compile exe "tstsll.exe"
    #compiler PBWIN

    #link "win32_hlp.sll"               ' you would have to create this SLL
                                        ' first to use the following code

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

FUNCTION PBmain as LONG

    Open "win32.hlp" for output as #1
      Print #1, win32_hlp;              ' this string value is returned
    Close #1                            ' by the SLL of the same name

    msgbox "Done"

End FUNCTION

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

About the only limitation is the absolute file size that can be converted which is about 27 megabytes. Above that the compiler displays an "out of memory" error that follows from the limitations of 32 bit memory.

hutch--

I should also note, for files larger than the top limit using this tool, you can embed larger files as an RCDATA resource in the resource section of the exe file. Special thanks to Adam Drake for this technology and code design.