Hi Guys,
I can extract DataWindows from machine code compiled PB libraries despite LibraryDirectory/LibraryDirectoryEx can't read .DLL files.
However => I can still extract DataWindow syntax from the .DLL files if I find the DataWindow name some other way (e.g. brute force attempt or someone tells me)
PB Library Type |
LibraryDirectory/ LibraryDirectoryEx |
Extract DW Syntax Describe("DataWindow.Syntax")
|
.PBD |
Success |
Success |
.DLL |
Failure (empty) |
Success |
.EXE |
Success |
Success |
FOLLOW-UP
I linked the DataWindow objects via .PBR file into all three types of .EXE (32/64-bit P-code + 32-bit machine code). In all cases any of my DW extractor builds could read the .EXE as if it were a .PBD.
Conclusion: Linking DataWindow objects into the .EXE file in a machine code build makes the DataWindows more vulnerable than if they were included in the .DLL files!
Another finding: I can mix and match 32-bit P-code, 64-bit P-code, and 32-bit machine code.
My extractor in machine code reads .PBD files. - and - my extractor in P-code reads .DLL files.
EXE Type |
DW in 32.PBD |
DW in 32.DLL |
DW in 64.PBD |
DW in any .EXE (via .PBR)
|
32-bit P-code |
Success |
Success |
Success |
Success |
32-bit Machine code |
Success |
Success |
Success |
Success |
64-bit P-code |
Success |
Success |
Success |
Success |
Amazing what a few lines of code can do when you set out a target and go for it.
And scary since I care about secure systems.
/Michael
"Since PowerBuilder does not have a datatype corresponding to the C++ pointer type, and there are no pointer operations in PowerBuilder, longptr is not a full-fledged PowerBuilder datatype. You can use it to hold/pass window handles, database handles, and other objects that are essentially memory addresses. Doing complex operations on longptr type might not work. If you want to represent/compute 8-byte long integers, use longlong."
Longptr is only for calling API functions, so storing a fixed 64bit value in the compiled object may not work. I suspect the 64bit VM allocates a larger variable at runtime and uses that instead of the 32bit long that is in the compiled code.