Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Structure of QLB files ?
#1
Hi!
Does anybody now location of documents about srtucture of QLB files?
I am intrested in how to get addresses of sub's entrypoints.
If somebody have any information, please post it.
Thanks.
url=http://zerodivide.h15.ru/cyclone.html]Cyclone v2.5.2 GUI For QBasic 4.5/7.1[/url]
Explorer For DOS
Reply
#2
this site may help.
http://www.wotsit.org/
url]http://fbide.sourceforge.net/[/url]
Reply
#3
They're like EXE's with little difference.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#4
QLB files looks more like LIB files.
And all sites i loked through dont contain any usefull information.
Unfortunately.
url=http://zerodivide.h15.ru/cyclone.html]Cyclone v2.5.2 GUI For QBasic 4.5/7.1[/url]
Explorer For DOS
Reply
#5
QLB files are *.EXE (look with Volkov or Norton, first bytes are MZ, after them there is valid EXE header) files with special export block data at end which contains far pointers to exported functions/subs and pointers (not sure of type) to shared vairables and COMMON blocks and various info about them. Basic symbol names are case unsensitive, UPPERCASE. There are some internal C _funcs too. However function parameter info is not stored there that's why you need *.BI with correct DECLARE, otherwise you'll crash IDE.

Only one QLB can be loaded at time. IDE loads QLB thorugh DOS exec function, debug_mode subfunction, that loads EXE into memory as child process but avoids code execution, just like normal EXE. Then QLB entry point is found propably from export block. When IDE interprets your code, before starting program it calls QLB entry point to initialize library. Then it interprets your prog as normal but when it finds an call into the QLB, it pushes all params onto the stack according to BIs DECLARE
and jumps directly into to QLB using entry point for current DECLARED function obtained from export block. If there is some error in QLB function (for exapmle you coded it in asm, with error) it may crash your IDE simply, as no checks are done. After function/sub is done it returns through normal call stack back. If it was function with INTEGER result AX register contains it, AXBig GrinX pair is for LONG result, for other types DS:AX is adress of result (in case of array, string etc).

QLB is not pure EXE, it's much more similar to compiled Qbasic code (standalone option unchecked) which requires runtime BRUN45.EXE (which in fact hooks special interrupt your exe invokes in case of calling QBs rtfuncs) and implents all QBs rtlib code. In case of QLB of course BRUN45 is not loaded (to conserve memory) but QBIDE istself implements runtime interface just like BRUN45 does. QBIDE in fact converts your interpreted code into same rtlib INT calls.

I think that with QB PDS 7.1 Pro there was simple BAS file to get pointer to that export block at end of QLB to get info about symbols exported.

Besides there is somewhere leaked QBasic 1.1 source on the net, which contains many interesting header files. I'll bet QLB export block .h or .inc file will be there. QBasic1.1 and QB45 both use same rtlib intterupt engine.

Why do you need this?

EDIT:
Link is on this forum http://forum.qbasicnews.com/viewtopic.php?t=6538 Big Grin , It's QBasic1.1 source code but rtlib is highly similar
Reply
#6
Thank you!!
My thoughts were to create some program what would be able
to cut binary procedure code from library and run it like its own.
It could give a possibility of creating overload type programms or any things you want up to "plugins".

I hope you have some exact info about this.
But thank you anyway. Smile
url=http://zerodivide.h15.ru/cyclone.html]Cyclone v2.5.2 GUI For QBasic 4.5/7.1[/url]
Explorer For DOS
Reply
#7
I was planning to call simple funcs from QLB but never got it actually right, but now I'm interested to try it again, just for the retro feel Smile.

Anyway I don't think that cutting out or overloading compiled funcs will be possible. You would need info where funcs code begins and where it ends and that's hard, if not impossible to get from already linked program like QLB is. Theoreticaly, through assembly, you could hijack the function entry point in already made lib but there will propably be many nasty problems. The resulting classic EXE, BRUN EXE and QBIDERTLIB are quite diffrent in some aspects, each one. To get it right you must sucesfully implement it for every case, three times more deep hacking work.

But you can implement plugins on your own. Simplest way is to have plugins made in assembler under 64KB accesing vars only through DS. If you implement them like COM or BIN files they can be loaded at specific
part of segment (offset 100h in case of COM) or directly at beginning of segment (offset 0h for BIN) and then you can call them from QB and even switch between them using custom stub funcs.

Back in times I was temting to reimplement, fully compiled runtime library, I have leaked sources etc. I'm not too good asm programmer, but can do some simple things. Isn't here someone interested in doing so Smile Victor Smile ?
Reply
#8
FreeBasic's runtime library is open-source, found here:
http://prdownloads.sourceforge.net/fbc/l...p?download

QB's runtime-library is not, but it's old, nasty, 8086 c+asm code. I took a peek at that leaked QB1.1 source once, and it looked like disassembly.
Reply
#9
I had used some of QB rt functions according the leak. That leak is no dissasembly it's fully original M$ assembly Wink. There are all comments etc. I know about FB runtime lib but that one is quite different. I'm talking about QB mess Smile. 16 bit DOS + Old QB seemed to some still sexy platform Smile.
Reply
#10
I supposed. I think the QBasic 1.1 runtime called itself "BRUN50" or something, rumored to be the mysterious missing QB 5.

I'm talking the very loose definitions of 'rumor' here Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)