From 5ae04bca01b974672fcc3c68acf3fc9bab61ba05 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 1 Feb 2011 09:59:59 +0100 Subject: midltests: add invalid/midltests_pipe_struct_union_01.idl pipes with unions are not supported by midl, so we don't need to implement them in pidl:-) metze --- .../invalid/midltests_pipe_struct_union_01.idl | 279 +++++++++++++++++++++ .../invalid/midltests_pipe_struct_union_01.txt | 17 ++ 2 files changed, 296 insertions(+) create mode 100644 testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.idl create mode 100644 testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.txt (limited to 'testprogs') diff --git a/testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.idl b/testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.idl new file mode 100644 index 0000000000..517806b7e0 --- /dev/null +++ b/testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.idl @@ -0,0 +1,279 @@ +#ifndef MIDLTESTS_C_CODE + +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(unique) +] +interface midltests +{ + typedef pipe char pipe_char; + typedef pipe hyper pipe_hyper; + typedef struct { + long l; + short s; + [switch_is(l)] union { + [case(0)]; + [case(1)] char c; + [case(2)] short s; + [case(4)] long l; + [case(8)] hyper h; + } u; + } structtype; + typedef pipe structtype pipe_structtype; + + struct msg { + long l; + [size_is(l)] char *m; + }; + + long midltests_fn( + [out,ref] struct msg *out1, + [out,ref] pipe_structtype *outp, + [in,ref] pipe_structtype *inp, + [in] struct msg in1 + ); + + long midltests_ping( [in] struct msg in1); + +} + +#elif MIDLTESTS_C_CODE + +struct pipe_char_state { + const char *name; + unsigned long count; + unsigned long sleep; +}; + +void pipe_char_pull( + char * _state, + unsigned char * buf, + unsigned long esize, + unsigned long * ecount) +{ + struct pipe_char_state *state = (struct pipe_char_state *)_state; + + printf("pull1:%s: esize[%u] ecount[%u]\n", + state->name, esize, *ecount); + *ecount = state->count--; + if (*ecount > esize) { + *ecount = esize; + } + memset(buf, 0xDD, *ecount * sizeof(*buf)); + printf("pull2:%s: esize[%u] ecount[%u]\n", + state->name, esize, *ecount); +} + +void pipe_char_push( + char * _state, + unsigned char * buf, + unsigned long ecount) +{ + struct pipe_char_state *state = (struct pipe_char_state *)_state; + + printf("push:%s: ecount[%u]\n", + state->name, ecount); +} + +void pipe_char_alloc( + char * _state, + unsigned long bsize, + unsigned char * * buf, + unsigned long * bcount) +{ + struct pipe_char_state *state = (struct pipe_char_state *)_state; + + printf("alloc1:%s: bsize[%u], bcount[%u]\n", + state->name, bsize, *bcount); + *bcount = bsize / sizeof(**buf); + *buf = malloc(*bcount * sizeof(**buf)); + printf("alloc2:%s: bsize[%u], bcount[%u]\n", + state->name, bsize, *bcount); +} + +struct pipe_hyper_state { + const char *name; + unsigned long count; + unsigned long sleep; +}; + +void pipe_hyper_pull( + char * _state, + hyper * buf, + unsigned long esize, + unsigned long * ecount) +{ + struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state; + + printf("pull1:%s: esize[%u] ecount[%u]\n", + state->name, esize, *ecount); + *ecount = state->count--; + if (*ecount > esize) { + *ecount = esize; + } + memset(buf, 0xDD, *ecount * sizeof(*buf)); + printf("pull2:%s: esize[%u] ecount[%u]\n", + state->name, esize, *ecount); +} + +void pipe_hyper_push( + char * _state, + hyper * buf, + unsigned long ecount) +{ + struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state; + + printf("push:%s: ecount[%u]\n", + state->name, ecount); +} + +void pipe_hyper_alloc( + char * _state, + unsigned long bsize, + hyper * * buf, + unsigned long * bcount) +{ + struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state; + + printf("alloc1:%s: bsize[%u], bcount[%u]\n", + state->name, bsize, *bcount); + *bcount = bsize / sizeof(**buf); + *buf = malloc(*bcount * sizeof(**buf)); + printf("alloc2:%s: bsize[%u], bcount[%u]\n", + state->name, bsize, *bcount); +} +struct pipe_structtype_state { + const char *name; + unsigned long count; + unsigned long sleep; +}; + +void pipe_structtype_pull( + char * _state, + structtype * buf, + unsigned long esize, + unsigned long * ecount) +{ + struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state; + + printf("pull1:%s: esize[%u] ecount[%u]\n", + state->name, esize, *ecount); + *ecount = state->count--; + if (*ecount > esize) { + *ecount = esize; + } + memset(buf, 0xDD, *ecount * sizeof(*buf)); + printf("pull2:%s: esize[%u] ecount[%u]\n", + state->name, esize, *ecount); +} + +void pipe_structtype_push( + char * _state, + structtype * buf, + unsigned long ecount) +{ + struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state; + + printf("push:%s: ecount[%u]\n", + state->name, ecount); +} + +void pipe_structtype_alloc( + char * _state, + unsigned long bsize, + structtype * * buf, + unsigned long * bcount) +{ + struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state; + + printf("alloc1:%s: bsize[%u], bcount[%u]\n", + state->name, bsize, *bcount); + *bcount = bsize / sizeof(**buf); + *buf = malloc(*bcount * sizeof(**buf)); + printf("alloc2:%s: bsize[%u], bcount[%u]\n", + state->name, bsize, *bcount); +} +static void midltests(void) +{ + struct msg out1; + unsigned char out1b[3]; + struct pipe_structtype_state outs; + pipe_structtype outp; + struct pipe_structtype_state ins; + pipe_structtype inp; + struct msg in1; + unsigned char in1b[3]; + + in1.l = sizeof(in1b); + memset(&in1b, 0xAA, sizeof(in1b)); + in1.m = in1b; + + memset(&outs, 0, sizeof(outs)); + outs.name = "outp"; + memset(&outp, 0, sizeof(outp)); + outp.pull = pipe_structtype_pull; + outp.push = pipe_structtype_push; + outp.alloc = pipe_structtype_alloc; + outp.state = (char *)&outs; + + memset(&ins, 0, sizeof(ins)); + ins.name = "inp"; + ins.count = 1; + memset(&inp, 0, sizeof(inp)); + inp.pull = pipe_structtype_pull; + inp.push = pipe_structtype_push; + inp.alloc = pipe_structtype_alloc; + inp.state = (char *)&ins; + + out1.l = sizeof(out1b); + memset(&out1b, 0xFF, sizeof(out1b)); + out1.m = out1b; + + cli_midltests_ping(in1); + cli_midltests_fn(&out1, outp, inp, in1); +} + +long srv_midltests_fn( + /* [ref][out] */ struct msg *out1, + /* [out] */ pipe_structtype outp, + /* [in] */ pipe_structtype inp, + /* [in] */ struct msg in1) +{ + structtype inb[500]; + unsigned long inb_len = 0; + structtype *outb = NULL; + unsigned long outb_size = 0; + unsigned long outb_len = 0; + + printf("srv_midltests_fn: Start\n"); + + do { + inp.pull(inp.state, inb, sizeof(inb), &inb_len); + printf("pull inp_len[%u]\n", inb_len); + } while (inb_len > 0); + + outb_size = 5; + do { + outp.alloc(outp.state, outb_size, &outb, &outb_len); + memset(outb, 0xCC, outb_len * sizeof(*outb)); + outp.push(outp.state, outb, outb_len); + printf("push outb_len[%u]\n", outb_len); + //Sleep(1000); + outb_size--; + } while (outb_len > 0); + + out1->l = 3; + out1->m = (unsigned char *)malloc(out1->l); + memset(out1->m, 0xBB, out1->l); + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} + +long srv_midltests_ping( + /* [in] */ struct msg in1) +{ + printf("srv_midltests_fn: Start\n"); + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} +#endif diff --git a/testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.txt b/testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.txt new file mode 100644 index 0000000000..46f8de52bb --- /dev/null +++ b/testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.txt @@ -0,0 +1,17 @@ + +Microsoft (R) Program Maintenance Utility Version 10.00.30319.01 +Copyright (C) Microsoft Corporation. All rights reserved. + + midl /target NT60 /prefix client cli_ /prefix server srv_ /prefix switch swi_ /acf midltests.acf midltests.idl +Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555 +Copyright (c) Microsoft Corporation. All rights reserved. +64 bit Processing .\midltests.idl +midltests.idl +64 bit Processing .\midltests.acf +midltests.acf +.\midltests.idl(34) : error MIDL2028 : feature not implemented : pipes can't contain unions [ Type 'pipe_structtype' ( Parameter 'outp' ) ] +.\midltests.idl(34) : error MIDL2028 : feature not implemented : pipes can't contain unions [ Type 'pipe_structtype' ( Parameter 'inp' ) ] +NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64\midl.EXE"' : return code '0x8a6' +Stop. +NMAKE : fatal error U1077: 'call' : return code '0x2' +Stop. -- cgit