on 04-18-2013 4:06 AM
LibraryDirectory of PB 12.5 cannot read PB9 libraries anymore. That's why my application PBTools cannot read previous libraries. Any idea?
I wrote a .dll in C that reads the directory structure and extracts objects. I have tested it against every version from PB4 through PB12.5 as well as PocketBuilder and it is much faster than the built in LibraryDirectory function. It can also tell you what version of PB the library is from, get library comments and extract binary objects from a pbd, image files for example.
PB.Net is easier since it uses a xml formatted file to track library folder contents.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You always did something interesting for PB. We all spent a lot of time for this kind of things. I could not understand the reason, why PowerBuilder stay away from this kind of enhancement. Why we should find a solution to read PB9 Library?. PB12.5 should already read all pbl files. I don't understand this. Before unicode support, we were writing C dll for unicode functions, now we are writing C dll's for ansi function.
Can I use your dll in PBTools? I could not see that dll in your website..
Thanks
This has been true since PB10; the Unicode versions of the Library*() functions can't read ANSI PBLs.
What PBL Peeper does to get around this is to use a COM object that I created in PB9 that wraps the functions for ANSI PBLs that I want (LibraryDirectory() and LibraryExport(), IIRC). Yes, that means I have to deploy a couple of the PB9 DLLs too.
Then, there's figuring out whether to use the ANSI library or the native Unicode functions, i.e. whether the PBL is ANSI or Unicode. This is the function I use
long ll_FileHandle, ll_Return
blob lblb_ANSIHdr, lblb_UniHdr, lblb_FileRead, lblb_FileHdr, lblb_Value
// set PBL type (ANSI/DBCS or Unicode)
lblb_ANSIHdr = Blob ("HDR*PowerBuilder", EncodingANSI!)
lblb_UniHdr = Blob ("HDR*", EncodingANSI!) + Blob ("PowerB", EncodingUTF16LE!)
ll_FileHandle = FileOpen (as_PBLName, StreamMode!, Read!, Shared!)
IF ll_FileHandle > 0 THEN // no testing available if FileOpen fails
ll_Return = FileRead (ll_FileHandle, lblb_FileRead) // this fails: FileReadEx (ll_FileHandle, lblb_FileRead, 16) returns 16 nulls
lblb_FileHdr = BlobMid (lblb_FileRead, 1, 16)
IF lblb_FileHdr = lblb_UniHdr THEN
ii_PBLType = PBLTYPE_UNICODE
FileSeek (ll_FileHandle, 32, FromBeginning!)
FileReadEx (ll_FileHandle, lblb_Value, 😎
is_PBVersion = String (lblb_Value, EncodingUTF16LE!)
FileSeek (ll_FileHandle, 46, FromBeginning!)
FileReadEx (ll_FileHandle, lblb_Value, 214)
is_Comment = String (lblb_Value, EncodingUTF16LE!)
ELSEIF lblb_FileHdr = lblb_ANSIHdr THEN
ii_PBLType = PBLTYPE_ANSI
FileSeek (ll_FileHandle, 19, FromBeginning!)
FileReadEx (ll_FileHandle, lblb_Value, 3)
is_PBVersion = String (lblb_Value, EncodingANSI!)
FileSeek (ll_FileHandle, 28, FromBeginning!)
FileReadEx (ll_FileHandle, lblb_Value, 214)
is_Comment = String (lblb_Value, EncodingANSI!)
ELSE
ii_PBLType = PBLTYPE_UNKNOWN
END IF
FileClose (ll_FileHandle)
END IF
Alternatively, around the web I've seen documentation on the file format of the PBL. I've never seen this from a Sybase source, so I'm assuming that it was reverse engineered. While it's probably valid and can solve this problem as well, I've never felt confident in it enough to try to solve this problem with it.
Good luck,
Terry.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I noticed this a few months ago. I resorted to using PBLDump to get the contents of older PBL files.
I had not used the method in older versions of PB so I didn't note the change in functionality.
Matt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.