I would like to build a plugin to export my source from my VBE to TFS.
Everything seam to work except for one thing, when I use the function ExportCustom from the swimapi.dll, it read data from dbo.Cutom2, not from dbo.CustomVBA.
Anyone know if there is a newer version or a way to export my source? I can't use the screen because I'm currently in the customization mode :)
*This post is locked for comments
We just implemented our CustomVBA - git pet project. In fact, due to the auditing firm commitments, we had to start right after the new year.
We named it "gitzer", trying to make a thing between git and Gezer, the ancient city that king Solomon rebuilt.
It's actually a perl script that dumps all the contents of the CustomVBA table into the file system. It has a lot of binary automaton, but it relies heavily in the OfficeMalScanner tool (http://www.reconstructer.org/) to do all the VBA actual work.
In the image above, you can see it generates a folder for each VBA adaptation, which in turn gets pushed to a git repository in VisualStudio cloud.
The reason I approach the problem this way is because I'm a compiler freak. Maybe working out over the 9150000 exporter screen might do a better job.
A step further is composing a Makefile definition in order to produce a valid CST file, but this is beyond our intender scope.
I've been scanning the format and I'd say you're right on the money on the vbaProject.bin thing.
So far, the picture is something like:
1. Any SL record has a limit of about 32K, so the Custom2.propdata field has 30000 bytes limit. So, a single SL VBA adaptation may span several Custom2.propdata sorted across different Custom2.RecordIndex values.
2. As I said before, the first two bytes of the propdata field are size specifiers. The rest is the data itself.
3. So, if you concatenate all the +02 offset binary data of all the records of a single adaptation, you get the original binary file.
4. The binary file has a preamble beginning with x06 00 01 and ending with x00 00 06 00 00. The preamble consist of all the form object declarations and properties encoded and it can be quite long. The property names are ANSI text (like "width" and "caption"), but the values are hex-coded or unicode if they are text.
5. After the x00 00 06 00 00 sequence comes 3 bytes (I can't figure them out yet) and then starts the vbaProject.bin contents. I was able to cut this part and dump the contents with a regular vba dumper (OfficeMalScanner).
As far as I can see, once converted in ANSI text, it really remind me of the "vbaProject.bin" that you can find in an Office file with macro. But I can't parse it with 7zip like I could with the other file, maybe it is just a bug in my function when I convert from the table to the file. I'll continue to work on that latter this week.
Great, I will try to get a look on that today :) I already implement a backup of my sources, every time that I save my custom, I have a trigger that take insert rows into another table so I can revert changes if I need but with that, I can't compare 2 sources to see changes.
It's nice to see that I'm not the only one thinking that it is missing a little something ;)
Wow! I was just going to work on an export script so the source could be pushed to a git repository. Our auditing firm made a formal complaint that the customization was hard to trace. I see you are a few steps ahead.
Indeed, the ExportCustom calls seems to be all focused in "ye ol style" Custom and Custom2 table.
I've done some work in the system tables. In general, the source is stored as and hex sequence:
1. The first byte is the least significant part of the content length, in bytes.
2. The second byte is the most significant part of the content length, in bytes.
3. The rest is the data itself.
I've done this with the Template table which contains just a byte representation of an ANSI text. The Custom2 is more complex.
I'll let you know how my script works, if it even does.
Regards.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156