cancel
Showing results for 
Search instead for 
Did you mean: 

LibraryDirectory of PB 12.5 cannot read PB9 libraries

Former Member
0 Kudos

LibraryDirectory of PB 12.5 cannot read PB9 libraries anymore. That's why my application PBTools cannot read previous libraries. Any idea?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Is it available on your website? (so through some other means?)

Matt

Former Member
0 Kudos

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

Former Member
0 Kudos

No it is not. I started on a total rewrite of my PBSearch tool and it will be used by that. I haven't worked on it much lately due to WizSource enhancements. I might be willing to license it for a fee but it would depend on what they wanted to use it for.

former_member1333806
Active Participant
0 Kudos

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.

Former Member
0 Kudos

Hi Guys;

  Terry is correct .. since PB 10 because my "DW Changer" and "SQLXTract" applications that read PBL's were affected at that time. That is why I have an ANSI (<= PB9) and Unicode (>= PB10) version of those.

Regards ... Chris

Former Member
0 Kudos

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