Sunday, July 30, 2017

More operations on slots for the P/Invoke tool

Yesterday and today, I made a couple more additions to my P/Invoke command-line tool. The call instruction now takes an optional /into switch specifying the name of a slot. If the slot doesn't exist, it is created with the kind specified by the /return switch.

For a few Windows API functions, it's necessary to pass both the address of a field and its length. Allocated slots have the allocsize keyword, but that applies to the buffer pointed to by the slot's data, not the slot's data itself. Now there's also a slotsize keyword that produces the size of a slot's data, supporting the as and in modifiers just like allocsize.

Previously it was only possible to create slots of standard kinds. I introduced the block psuedo-kind that, in the newslot command, creates a custom kind based on a list of fields. This allows structures to be returned.

No comments:

Post a Comment