Re: midlc parse error

Robert Doerr <[email protected]>
Newsgroups gmane.network.samba.java
Message-ID <[email protected]>
13.09.2011 18:53, Michael B Allen:
> On Sun, Sep 11, 2011 at 3:00 AM, Robert Doerr<[email protected]>  wrote:
>> Hello,
>>
>> I get some parse error when trying to compile the idl for the net
>> shutdown command and am not sure if I did right.
>> Here are my steps so far:
>> - compiled midlc under cygwin
>> - extracted three IDL-Files from [MS-RSP].pdf (download from microsoft):
>> initshutdown.idl, windowsshutdown.idl winreg.idl
>> - executed ./midlc<filename>    for all three files
>>
>> For each file I get a parse failure from midlc for line 4. This line
>> looks like (example from windowsshutdown.idl):
>>   [size_is(MaximumLength / 2), length_is((Length) / 2) ] unsigned short*
>> Buffer;
>> The corresponding lines in the other files look similar.
>>
>> midlc stops in parse.c on line 69 with the message "invalid attribute".
>>
>> What am I doing wrong?
> Hi Robert,
>
> Midlc only supports a subset of Microsoft IDL so copying and pasting
> from Microsoft literature is almost certainly not going to work. You
> will need to narrow down and isolate things a little. However in this
> particular case I know for a fact midlc can handle that input. That
> whole line is actually part of the definition for UNICODE_STRING which
> is very common in JCIFS RPCs compiled with midlc. Look at
> src/jcifs/dcerpc/rpc.idl and you will see a definition for
> unicode_string with the same IDL in it.  Try copying that typedef and
> replace the corresponding chunk of IDL with that unicode_string
> definition. Study the various idl included with JCIFS in
> src/jcifs/dcerpc/msrpc/*.idl to get a better idea of what midlc wants.
> With a little work you should be able to get it to work no problem.
>
> Mike
>
Hi Michael,

thanks for pushing me in the right direction! After looking at the files 
you mentioned it was clear what's going on.
Unfortuately the WindowsShutdown interface (the one I actually need) 
uses RPC over TCP/IP transport (ncacn_ip_tcp).
Below the reworked windowsshutdown.idl which compiles correctly (with 
rpc.idl in the same directory) for further reference.

Regards
Robert

windowsshutdown.idl:

[
uuid(d95afe70-a6d5-4259-822e-2c84da1ddb0d),
pointer_default( unique ),
version(1.0)
]
interface WindowsShutdown {
     import "rpc.idl";
     unsigned long WsdrInitiateShutdown(
         [ in ] policy_handle Binding,
         [ in, unique ] unicode_string lpMessage,
         [ in ] unsigned long dwGracePeriod,
         [ in ] unsigned long dwShudownFlags,
         [ in ] unsigned long dwReason,
         [ in, unique ] unicode_string lpClientHint
     );
     unsigned long WsdrAbortShutdown(
         [ in ] policy_handle Binding,
         [ in, unique ] unicode_string lpClientHint
     );
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.