diff options
Diffstat (limited to 'testprogs/win32/midltests/todo')
9 files changed, 1310 insertions, 0 deletions
diff --git a/testprogs/win32/midltests/todo/midltests-array-range.idl b/testprogs/win32/midltests/todo/midltests-array-range.idl new file mode 100644 index 0000000..1d60fd6 --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-array-range.idl @@ -0,0 +1,39 @@ +#ifndef MIDLTESTS_C_CODE + +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(unique) +] +interface midltests +{ + long midltests_fn( + [out,ref] long *count, + [out,ref,size_is(,*count),range(0,1)] long **array, + [out,ref] long *error + ); +} + +#elif MIDLTESTS_C_CODE + +static void midltests(void) +{ + long count; + long *array; + long error; + + cli_midltests_fn(&count, &array, &error); +} + +long srv_midltests_fn(long *count, long **array, long *error) +{ + printf("srv_midltests_fn: Start\n"); + *count=2; + *array=(long *)malloc((*count) * sizeof(long)); + (*array)[0] = 7; + (*array)[1] = 7; + *error=0; + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} + +#endif diff --git a/testprogs/win32/midltests/todo/midltests-pipe-02.idl b/testprogs/win32/midltests/todo/midltests-pipe-02.idl new file mode 100644 index 0000000..e6be283 --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-pipe-02.idl @@ -0,0 +1,153 @@ +#ifndef MIDLTESTS_C_CODE + +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(unique) +] +interface midltests +{ + typedef pipe char pipe_char; + + struct msg { + long l; + [size_is(l)] char *m; + }; + + long midltests_fn( + [out,ref] struct msg *out1, + [out] pipe_char outp, + [in] pipe_char inp, + [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);
+ 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);
+}
+ +static void midltests(void) +{ + struct msg out1; + unsigned char out1b[3]; + struct pipe_char_state outs; + pipe_char outp; + struct pipe_char_state ins; + pipe_char 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_char_pull; + outp.push = pipe_char_push; + outp.alloc = pipe_char_alloc; + outp.state = (char *)&outs; + + memset(&ins, 0, sizeof(ins)); + ins.name = "inp"; + ins.count = 1; + memset(&inp, 0, sizeof(inp)); + inp.pull = pipe_char_pull; + inp.push = pipe_char_push; + inp.alloc = pipe_char_alloc; + inp.state = (char *)&ins; + + out1.l = sizeof(out1b); + memset(&out1b, 0xFF, sizeof(out1b)); + out1.m = out1b; + + cli_midltests_fn(&out1, outp, inp, in1); +} + +long srv_midltests_fn( + /* [ref][out] */ struct msg *out1,
+ /* [out] */ pipe_char outp,
+ /* [in] */ pipe_char inp,
+ /* [in] */ struct msg in1) +{ + char inb[500]; + unsigned long inb_len = 0; + char *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); + 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; +} + +#endif diff --git a/testprogs/win32/midltests/todo/midltests-pipe-03-hyper.idl b/testprogs/win32/midltests/todo/midltests-pipe-03-hyper.idl new file mode 100644 index 0000000..475aedd --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-pipe-03-hyper.idl @@ -0,0 +1,205 @@ +#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; + + struct msg { + long l; + [size_is(l)] char *m; + }; + + long midltests_fn( + [out,ref] struct msg *out1, + [out] pipe_hyper outp, + [in] pipe_hyper inp, + [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); +} +static void midltests(void) +{ + struct msg out1; + unsigned char out1b[3]; + struct pipe_hyper_state outs; + pipe_hyper outp; + struct pipe_hyper_state ins; + pipe_hyper 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_hyper_pull; + outp.push = pipe_hyper_push; + outp.alloc = pipe_hyper_alloc; + outp.state = (char *)&outs; + + memset(&ins, 0, sizeof(ins)); + ins.name = "inp"; + ins.count = 1; + memset(&inp, 0, sizeof(inp)); + inp.pull = pipe_hyper_pull; + inp.push = pipe_hyper_push; + inp.alloc = pipe_hyper_alloc; + inp.state = (char *)&ins; + + out1.l = sizeof(out1b); + memset(&out1b, 0xFF, sizeof(out1b)); + out1.m = out1b; + + cli_midltests_fn(&out1, outp, inp, in1); +} + +long srv_midltests_fn( + /* [ref][out] */ struct msg *out1,
+ /* [out] */ pipe_hyper outp, + /* [in] */ pipe_hyper inp, + /* [in] */ struct msg in1) +{ + hyper inb[500]; + unsigned long inb_len = 0; + hyper *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; +} + +#endif diff --git a/testprogs/win32/midltests/todo/midltests-pipe-04-struct.idl b/testprogs/win32/midltests/todo/midltests-pipe-04-struct.idl new file mode 100644 index 0000000..07921b8 --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-pipe-04-struct.idl @@ -0,0 +1,272 @@ +#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; + } structtype; + typedef pipe structtype pipe_structtype; + + struct msg { + long l; + [size_is(l)] char *m; + }; + + long midltests_fn( + [out,ref] struct msg *out1, + [out] pipe_structtype outp, + [in] 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/todo/midltests-pipe-first.idl b/testprogs/win32/midltests/todo/midltests-pipe-first.idl new file mode 100755 index 0000000..ef28943 --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-pipe-first.idl @@ -0,0 +1,233 @@ +#ifndef MIDLTESTS_C_CODE +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(unique) +] +interface midltests +{ +/* typedef struct st_wire { + long len; + //[size_is(len)] char data[*]; + [size_is(l2)] char *d2; + long l2; + } st_wire_t; + struct st_local { + short s1; + short s2; + }; + typedef [transmit_as(st_wire_t)] struct st_local st_local_t; + + long midltests_fn( + [in] st_local_t st + + ); +*/ +/* struct my_ace { + long ace1; + long ace2; + }; + struct my_acl { + long revision; + long num_aces; + [size_is(num_aces)] struct my_ace *aces; + }; + long midltests_fn( + [in,ref] struct my_acl *acl + ); +*/ +/* struct my_str { + long l1; + [string] wchar_t str[260+1]; + long l2; + }; + long midltests_fn( + [in,out,ref] struct my_str *str + ); +*/ + long foo(); + long midltests_fn( + [in] long size, + [out,ref,size_is(size),length_is(*length)] byte *bytes, + [out,ref] long *length + ); + + typedef pipe byte BYTE_PIPE; + typedef pipe long LONG_PIPE; + + long midltests_fn_pipe( + [in] long count, + [out,ref] long *start_magic, + [out] BYTE_PIPE b, + [out, ref] long *mid_magic, + [out] LONG_PIPE l, + [out,ref] long *end_magic + ); + +} +#elif MIDLTESTS_C_CODE +/* +void __RPC_USER st_local_t_to_xmit(st_local_t *l, st_wire_t **w) +{ + *w = malloc(4+ sizeof(st_wire_t)); + (*w)->len = sizeof(st_local_t); + //(*w)->data = malloc((*w)->len); + memcpy((*w)->data, l, sizeof(st_local_t)); + //memset(*w, 0xcd, sizeof(st_wire_t)); +} + +void __RPC_USER st_local_t_from_xmit(st_wire_t *w, st_local_t *l) +{ + memcpy(l, w->data, sizeof(st_local_t)); +// memset(l, 0, sizeof(st_local_t)); +} + +void __RPC_USER st_local_t_free_inst(st_local_t *l) +{ + +} + +void __RPC_USER st_local_t_free_xmit(st_wire_t *w) +{ + //free(w->data); + free(w); +} +*/ + +void __RPC_USER cli_push_b(char * state, + byte * buf, + unsigned long ecount) +{ + printf("cli_push_b ecount[%lu]\n", ecount); +} + +void __RPC_USER cli_alloc_b(char * state, + unsigned long bsize, + byte * * buf, + unsigned long * bcount ) +{ + printf("cli_alloc_b bsize[%lu]\n", bsize); + *buf = NULL; + *bcount = 0; +} + +void __RPC_USER cli_push_l(char * state, + long * buf, + unsigned long ecount) +{ + printf("cli_push_l ecount[%lu]\n", ecount); +} + +void __RPC_USER cli_alloc_l(char * state, + unsigned long bsize, + long * * buf, + unsigned long * bcount ) +{ + printf("cli_alloc_l bsize[%lu]\n", bsize); + *buf = NULL; + *bcount = 0; +} + +static void midltests() +{ +/* st_local_t st; + st.s1 = 1; + st.s2 = 2; + cli_midltests_fn(st); +*/ +/* struct my_acl acl; + struct my_ace aces[3]; + aces[0].ace1 = 1; + aces[0].ace2 = 2; + aces[1].ace1 = 1; + aces[1].ace2 = 2; + aces[2].ace1 = 1; + aces[2].ace2 = 2; + acl.revision = 5; + acl.num_aces = 1; + acl.aces = aces; + cli_midltests_fn(&acl); +*/ +/* struct my_str str; + memset(&str, 0, sizeof(str)); + str.l1 = 1; + printf("here: %d\n", __LINE__); + //wcscpy(str.str, L'Hello World\0'); + str.l2 = 2; + printf("here: %d\n", __LINE__); + cli_midltests_fn(&str); +*/ + byte buf[10]; + long length = 0; + memset(buf, 0xdf, sizeof(buf)); +// cli_midltests_fn(sizeof(buf), buf, &length); + +/* long count = 2; + long start_magic; + BYTE_PIPE b; + long mid_magic; + LONG_PIPE l; + long end_magic; + + + memset(&b, 0, sizeof(b)); + memset(&l, 0, sizeof(l)); + + b.alloc = cli_alloc_b; + b.push = cli_push_b; + + l.alloc = cli_alloc_l; + l.push = cli_push_l; + + printf("cli call start\n"); + cli_midltests_fn(count, + &start_magic, + b, + &mid_magic, + l, + &end_magic); + printf("cli call end\n"); +*/ +} + +//long srv_midltests_fn(struct my_str *str)//struct my_acl *acl)//st_local_t st) +//long srv_midltests_fn(long size, byte *bytes, long *length) +#if 1 +long srv_midltests_fn( + /* [in] */ long count, + /* [ref][out] */ long *start_magic, + /* [out] */ BYTE_PIPE b, + /* [ref][out] */ long *mid_magic, + /* [out] */ LONG_PIPE l, + /* [ref][out] */ long *end_magic) +#endif +{ +/* byte bytes[10]; + long longs[10]; + int i; +*/ + printf("srv_midltests_fn: Start\n"); + //printf("s1[%d] s2[%d]\n", st.s1, st.s2); + //printf(l1[%d] str[%s] l2[%d]\n", str->l1, str->str, str->l2); + +/* *start_magic = 0x01234567; + *mid_magic = 0x88888888; + *end_magic = 0xFEDCBA09; + + memset(bytes, 0xBE, sizeof(bytes)); + memset(longs, 0xAC, sizeof(longs)); + + for (i=0; i < count; i++) { + b.push(b.state, bytes, sizeof(bytes)/sizeof(bytes[0])); + } + b.push(b.state, NULL, 0); + + for (i=0; i < count; i++) { + l.push(l.state, longs, sizeof(longs)/sizeof(longs[0])); + } + l.push(l.state, NULL, 0); +*/ + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} + +#endif
\ No newline at end of file diff --git a/testprogs/win32/midltests/todo/midltests-pipe-sync-ndr32-downgrade-02.idl b/testprogs/win32/midltests/todo/midltests-pipe-sync-ndr32-downgrade-02.idl new file mode 100644 index 0000000..760401e --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-pipe-sync-ndr32-downgrade-02.idl @@ -0,0 +1,296 @@ +#ifndef MIDLTESTS_C_CODE + +/* + * For midltests_tcp.exe you may want to + * redirect the traffic via rinetd + * with a /etc/rinetd.conf like this: + * + * 172.31.9.1 5032 172.31.9.8 5032 + * 172.31.9.1 5064 172.31.9.8 5064 + * + * This is useful to watch the traffic with + * a network sniffer. + */ + +cpp_quote("#define LISTEN_IP \"0.0.0.0\"") +cpp_quote("#define FORWARD_IP \"127.0.0.1\"") +cpp_quote("#define CONNECT_IP \"172.31.9.1\"") + + +/* + * With midltests_tcp.exe NDR64 is enforced by default. + * For testing it might be needed to allow downgrades + * to NDR32. This is needed when you use 'pipe'. + */ +cpp_quote("#define DONOT_FORCE_NDR64 1") + +[ + 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; + } structtype; + typedef pipe structtype pipe_structtype; + + struct msg { + long l; + [size_is(l)] char *m; + }; + + long midltests_fn( + [out,ref] struct msg *out1, + [out] pipe_structtype outp, + [in] 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[5000]; + + 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 = 100; + 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/todo/midltests-string-in-out-ref.idl b/testprogs/win32/midltests/todo/midltests-string-in-out-ref.idl new file mode 100644 index 0000000..4db6f96 --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-string-in-out-ref.idl @@ -0,0 +1,33 @@ +#ifndef MIDLTESTS_C_CODE + +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(unique) +] +interface midltests +{ + long midltests_fn( + [in,out,ref,string] wchar_t *s + ); +} + +#elif MIDLTESTS_C_CODE + +static void midltests(void) +{ + wchar_t s[] = { 's', 'a', 'm', 'b', 'a', 0 }; + + cli_midltests_fn(s); +} + +long srv_midltests_fn(wchar_t *s) +{ + printf("srv_midltests_fn: Start\n"); + s[1] = 0; + s[2] = 'M'; + s[5] = '4'; + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} + +#endif diff --git a/testprogs/win32/midltests/todo/midltests-transmit-as.idl b/testprogs/win32/midltests/todo/midltests-transmit-as.idl new file mode 100755 index 0000000..bf5bc3f --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests-transmit-as.idl @@ -0,0 +1,59 @@ +#ifndef MIDLTESTS_C_CODE +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(unique) +] +interface midltests +{ + typedef struct st_wire { + char data[20]; + } st_wire_t; + struct st_local { + short s1; + short s2; + }; + typedef [transmit_as(st_wire_t)] struct st_local st_local_t; + + long midltests_fn( + [in] st_local_t st + ); +} +#elif MIDLTESTS_C_CODE + +void __RPC_USER st_local_t_to_xmit(st_local_t *l, st_wire_t **w) +{ + *w = malloc(sizeof(st_wire_t)); + memset(*w, 0xcd, sizeof(st_wire_t)); +} + +void __RPC_USER st_local_t_from_xmit(st_wire_t *w, st_local_t *l) +{ + memset(l, 0, sizeof(st_local_t)); +} + +void __RPC_USER st_local_t_free_inst(st_local_t *l) +{ + +} + +void __RPC_USER st_local_t_free_xmit(st_wire_t *w) +{ + free(w); +} + +static void midltests() +{ + char s[64]; + st_local_t st; + strcpy(s, "TestString"); + cli_midltests_fn(st); +} + +long srv_midltests_fn(st_local_t st) +{ + printf("srv_midltests_fn: Start\n"); + printf("srv_midltests_fn: End\n"); + return 0x65757254; +} + +#endif
\ No newline at end of file diff --git a/testprogs/win32/midltests/todo/midltests_pointer_default.idl b/testprogs/win32/midltests/todo/midltests_pointer_default.idl new file mode 100755 index 0000000..9e0c18f --- /dev/null +++ b/testprogs/win32/midltests/todo/midltests_pointer_default.idl @@ -0,0 +1,20 @@ +[ + uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"), + pointer_default(ptr) +] +interface midltests +{ + struct midltests_struct { + [ref] long ****p; + [ref] long **a; + [ref] long **b; + [ref] long **c; + }; + + void midltests_fn( + //[in] long size, + [in,out,ref] struct midltests_struct *s + //[in,ref,size_is(,size)] long ***array + ); + +}
\ No newline at end of file |