Hello wine-devel,
I'm still investigating that file format that I mentioned some time ago (see https:// www.winehq.org/pipermail/wine-devel/2017-July/118544.html), but I'm progressing. In short, to implement uiribbon, we need to be able to parse a binary blob that specifies how the ribbon looks like and how it behaves.
I'm currently at a state where my understanding is at least partially usable, and I wanted to start writing tests to cement my progress. However, I'd like to write it in a format that would be acceptable for wine upstream from the start.
Most problematic is the parser for the binary blob, IMHO. Is there already something similar where I could take some hints regarding style? For example how to best handle the whole error checking thing, add debug logging or how to handle memory allocation/freeing.
Regards, Fabian Maurer
On Fri, Dec 21, 2018 at 12:29:37AM +0100, Fabian Maurer wrote:
I'm still investigating that file format that I mentioned some time ago (see https://www.winehq.org/pipermail/wine-devel/2017-July/118544.html), but I'm progressing. In short, to implement uiribbon, we need to be able to parse a binary blob that specifies how the ribbon looks like and how it behaves.
I'm currently at a state where my understanding is at least partially usable, and I wanted to start writing tests to cement my progress. However, I'd like to write it in a format that would be acceptable for wine upstream from the start.
Most problematic is the parser for the binary blob, IMHO. Is there already something similar where I could take some hints regarding style? For example how to best handle the whole error checking thing, add debug logging or how to handle memory allocation/freeing.
Hi Fabian,
This a great!
I suspect how you write the parser will depend to some extent on the format of the binary blob itself, so I'd suggest getting a good understanding of that before you attack the coding. Yes, writing tests for this will help a lot. If it turns out to basically be a binary representation of xml, then it may be appropriate to look at an xml parser (e.g. dlls/ntdll/actct.x).
Once you start coding, you could send the outline parser or tests to wine-devel as an RFC. The good news is that figuring out the format of the blob is likely to take much longer than actually coding, so any false steps that you might make are not going to affect the overall effort too much.
Huw.
On 12/21/18 12:17 PM, Huw Davies wrote:
On Fri, Dec 21, 2018 at 12:29:37AM +0100, Fabian Maurer wrote:
I'm still investigating that file format that I mentioned some time ago (see https://www.winehq.org/pipermail/wine-devel/2017-July/118544.html), but I'm progressing. In short, to implement uiribbon, we need to be able to parse a binary blob that specifies how the ribbon looks like and how it behaves.
I'm currently at a state where my understanding is at least partially usable, and I wanted to start writing tests to cement my progress. However, I'd like to write it in a format that would be acceptable for wine upstream from the start.
Most problematic is the parser for the binary blob, IMHO. Is there already something similar where I could take some hints regarding style? For example how to best handle the whole error checking thing, add debug logging or how to handle memory allocation/freeing.
Hi Fabian,
This a great!
I suspect how you write the parser will depend to some extent on the format of the binary blob itself, so I'd suggest getting a good understanding of that before you attack the coding. Yes, writing tests for this will help a lot. If it turns out to basically be a binary representation of xml, then it may be appropriate to look at an xml parser (e.g. dlls/ntdll/actct.x).
Once you start coding, you could send the outline parser or tests to wine-devel as an RFC. The good news is that figuring out the format of the blob is likely to take much longer than actually coding, so any false steps that you might make are not going to affect the overall effort too much.
Another approach could be to implement the tool that creates such blobs, MS build tools must have something for that. This way you can start with minimal possible ribbon description, then tickle input and see what comes up in the blob.
I don't know if activation context code is useful for that, it does not use binary xml representation, your case could be closer xaml/baml.Maybe you can check WPF opensource project for that, it supposed to provide Xaml implementation. (WPF has its own Ribbon control by the way, probably separate from win32 one).
Huw.
Hi Huw, Hi Nikolay,
thanks for the quick response!
I suspect how you write the parser will depend to some extent on the format of the binary blob itself, so I'd suggest getting a good understanding of that before you attack the coding.
Actually, I can do both at the same time. I'm working with a tool called Kaitai Struct, basically I'm writing the specification and generate a parser from that. Though I needed to roll my own C-generator, for better or worse.
If it turns out to basically be a binary representation of xml, then it may be appropriate to look at an xml parser (e.g. dlls/ntdll/actct.x).
I'm afraid it's most likely not that simple. The compiler does a lot of rearranging the data, it's not much like the original XML anymore.
Once you start coding, you could send the outline parser or tests to wine-devel as an RFC. The good news is that figuring out the format of the blob is likely to take much longer than actually coding, so any false steps that you might make are not going to affect the overall effort too much.
That's probably very true.
FWIW, I have the complete project on github. The parser is here: https://github.com/ DarkShadow44/UIRibbon-Reversing/blob/master/test/tests/UIRibbon/parser_uiribbon.c Would that code style be okay? As said, this is generated from the file definition format I'm creating. And since I generate this with a small C# program (also part of this repo), I can adjust the code as needed.
Another approach could be to implement the tool that creates such blobs, MS build tools must have something for that. This way you can start with minimal possible ribbon description, then tickle input and see what comes up in the blob.
Yes, there is UICC.exe to turn a xml into a blob. I use that to reverse engineer the format - change the xml, see how the blob changes. Is that what you mean? I don't quite understand why I would want to implement the tools that creates the blob though, that needs to do a lot of validation that isn't really needed to 'just' decode the blob.
I don't know if activation context code is useful for that, it does not use binary xml representation, your case could be closer xaml/baml.Maybe you can check WPF opensource project for that, it supposed to provide Xaml implementation. (WPF has its own Ribbon control by the way, probably separate from win32 one).
Yeah, I looked into baml - but to me it looks completely different. A shame really, would have made it a lot easier.
Regards, Fabian Maurer
On 12/22/18 7:42 PM, Fabian Maurer wrote:
Hi Huw, Hi Nikolay,
thanks for the quick response!
I suspect how you write the parser will depend to some extent on the
format of the binary blob itself, so I'd suggest getting a good
understanding of that before you attack the coding.
Actually, I can do both at the same time. I'm working with a tool called Kaitai Struct, basically I'm writing the specification and generate a parser from that. Though I needed to roll my own C-generator, for better or worse.
If it turns out to basically be a
binary representation of xml, then it may be appropriate to look at an
xml parser (e.g. dlls/ntdll/actct.x).
I'm afraid it's most likely not that simple. The compiler does a lot of rearranging the data, it's not much like the original XML anymore.
Once you start coding, you could send the outline parser or tests to
wine-devel as an RFC. The good news is that figuring out the format
of the blob is likely to take much longer than actually coding, so any
false steps that you might make are not going to affect the overall
effort too much.
That's probably very true.
FWIW, I have the complete project on github. The parser is here: https://github.com/DarkShadow44/UIRibbon-Reversing/blob/master/test/tests/UI...
Would that code style be okay?
As said, this is generated from the file definition format I'm creating. And since I generate this with a small C# program (also part of this repo), I can adjust the code as needed.
Another approach could be to implement the tool that creates such blobs,
MS build tools must have something for that. This way you can start with
minimal possible ribbon description, then tickle input and see what
comes up in the blob.
Yes, there is UICC.exe to turn a xml into a blob. I use that to reverse engineer the format - change the xml, see how the blob changes. Is that what you mean?
I don't quite understand why I would want to implement the tools that creates the blob though, that needs to do a lot of validation that isn't really needed to 'just' decode the blob.
I was thinking about using this in tests mainly.
I don't know if activation context code is useful for that, it does not
use binary xml representation, your case could be closer xaml/baml.Maybe
you can check WPF opensource project for that, it supposed to provide
Xaml implementation. (WPF has its own Ribbon control by the way,
probably separate from win32 one).
Yeah, I looked into baml - but to me it looks completely different. A shame really, would have made it a lot easier.
Then maybe it's converted to something far from original xml structure.
Regards,
Fabian Maurer