MIDLC IDL Compiler

Michael B Allen mba2000 at ioplex.com
Fri Jan 14 03:09:33 GMT 2005


Andrew Tridgell said:
> Michael,
>
> I should explain a little more about how pidl handles element oriented
> meta-data and multiple passes.
>
> It's quite common in IDL for the generated code to need to be able to
> remember something about a element deeply nested in the structures,
> then come back later and use that bit of meta information at a later
> date (like in a subsequent pass). One situation where this is needed
> is the size being declared after the array (like you mentioned), but
> it also happens with "relative" marshalling of pointers (like in
> spoolss and security.idl).

Are you talking about security descriptors? I don't think security
descriptors are not marshalled using IDL generated code. AFAIK NDR by
itself is not capable if encoding or decoding security descriptors. I
suspect MS chose to use transmit_as to call the serialization routines
used by the NT_TRANSACT calls for getting setting descriptors. Which makes
sense considering they already had the routines and they're probably a lot
faster.

Or I suspect you know this and the whole "relative" thing is a pidl
extension?


> The relative pointers are particularly nasty as they cross structure
> boundaries. So the 2nd pass doesn't happen till you have not only
> completed this structure, but also completed all the upper level
> encapsulating strucrures!
>
> When I was first writing pidl this was a problem I hit my head against
> for a long time, then I finally realised the general solution. The

If they're not handled using conventional IDL then I bet!

> trick is that the address of the element is a unique key that can be
> used to lookup meta-data between passes.
>
> Thats what the ndr_token_*() functions are about. It allows the code
> generator to say something like "store this bit of meta-data with that
> element in this structure I'm working on, and then give it back to me

I don't do any lookups or anything like like this. Is this token thing
used in regular RPCs like LsarLookupSids or srvsvc ShareEnumAll? Do you
have another example besides security descriptors? A specific call in
spoolss perhaps?

Mike


More information about the samba-technical mailing list