| 1 | #ifndef MIDLTESTS_C_CODE
|
|---|
| 2 | [
|
|---|
| 3 | uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
|
|---|
| 4 | pointer_default(unique)
|
|---|
| 5 | ]
|
|---|
| 6 | interface midltests
|
|---|
| 7 | {
|
|---|
| 8 | /* typedef struct st_wire {
|
|---|
| 9 | long len;
|
|---|
| 10 | //[size_is(len)] char data[*];
|
|---|
| 11 | [size_is(l2)] char *d2;
|
|---|
| 12 | long l2;
|
|---|
| 13 | } st_wire_t;
|
|---|
| 14 | struct st_local {
|
|---|
| 15 | short s1;
|
|---|
| 16 | short s2;
|
|---|
| 17 | };
|
|---|
| 18 | typedef [transmit_as(st_wire_t)] struct st_local st_local_t;
|
|---|
| 19 |
|
|---|
| 20 | long midltests_fn(
|
|---|
| 21 | [in] st_local_t st
|
|---|
| 22 |
|
|---|
| 23 | );
|
|---|
| 24 | */
|
|---|
| 25 | /* struct my_ace {
|
|---|
| 26 | long ace1;
|
|---|
| 27 | long ace2;
|
|---|
| 28 | };
|
|---|
| 29 | struct my_acl {
|
|---|
| 30 | long revision;
|
|---|
| 31 | long num_aces;
|
|---|
| 32 | [size_is(num_aces)] struct my_ace *aces;
|
|---|
| 33 | };
|
|---|
| 34 | long midltests_fn(
|
|---|
| 35 | [in,ref] struct my_acl *acl
|
|---|
| 36 | );
|
|---|
| 37 | */
|
|---|
| 38 | /* struct my_str {
|
|---|
| 39 | long l1;
|
|---|
| 40 | [string] wchar_t str[260+1];
|
|---|
| 41 | long l2;
|
|---|
| 42 | };
|
|---|
| 43 | long midltests_fn(
|
|---|
| 44 | [in,out,ref] struct my_str *str
|
|---|
| 45 | );
|
|---|
| 46 | */
|
|---|
| 47 | long foo();
|
|---|
| 48 | long midltests_fn(
|
|---|
| 49 | [in] long size,
|
|---|
| 50 | [out,ref,size_is(size),length_is(*length)] byte *bytes,
|
|---|
| 51 | [out,ref] long *length
|
|---|
| 52 | );
|
|---|
| 53 |
|
|---|
| 54 | typedef pipe byte BYTE_PIPE;
|
|---|
| 55 | typedef pipe long LONG_PIPE;
|
|---|
| 56 |
|
|---|
| 57 | long midltests_fn_pipe(
|
|---|
| 58 | [in] long count,
|
|---|
| 59 | [out,ref] long *start_magic,
|
|---|
| 60 | [out] BYTE_PIPE b,
|
|---|
| 61 | [out, ref] long *mid_magic,
|
|---|
| 62 | [out] LONG_PIPE l,
|
|---|
| 63 | [out,ref] long *end_magic
|
|---|
| 64 | );
|
|---|
| 65 |
|
|---|
| 66 | }
|
|---|
| 67 | #elif MIDLTESTS_C_CODE
|
|---|
| 68 | /*
|
|---|
| 69 | void __RPC_USER st_local_t_to_xmit(st_local_t *l, st_wire_t **w)
|
|---|
| 70 | {
|
|---|
| 71 | *w = malloc(4+ sizeof(st_wire_t));
|
|---|
| 72 | (*w)->len = sizeof(st_local_t);
|
|---|
| 73 | //(*w)->data = malloc((*w)->len);
|
|---|
| 74 | memcpy((*w)->data, l, sizeof(st_local_t));
|
|---|
| 75 | //memset(*w, 0xcd, sizeof(st_wire_t));
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | void __RPC_USER st_local_t_from_xmit(st_wire_t *w, st_local_t *l)
|
|---|
| 79 | {
|
|---|
| 80 | memcpy(l, w->data, sizeof(st_local_t));
|
|---|
| 81 | // memset(l, 0, sizeof(st_local_t));
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | void __RPC_USER st_local_t_free_inst(st_local_t *l)
|
|---|
| 85 | {
|
|---|
| 86 |
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| 89 | void __RPC_USER st_local_t_free_xmit(st_wire_t *w)
|
|---|
| 90 | {
|
|---|
| 91 | //free(w->data);
|
|---|
| 92 | free(w);
|
|---|
| 93 | }
|
|---|
| 94 | */
|
|---|
| 95 |
|
|---|
| 96 | void __RPC_USER cli_push_b(char * state,
|
|---|
| 97 | byte * buf,
|
|---|
| 98 | unsigned long ecount)
|
|---|
| 99 | {
|
|---|
| 100 | printf("cli_push_b ecount[%lu]\n", ecount);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | void __RPC_USER cli_alloc_b(char * state,
|
|---|
| 104 | unsigned long bsize,
|
|---|
| 105 | byte * * buf,
|
|---|
| 106 | unsigned long * bcount )
|
|---|
| 107 | {
|
|---|
| 108 | printf("cli_alloc_b bsize[%lu]\n", bsize);
|
|---|
| 109 | *buf = NULL;
|
|---|
| 110 | *bcount = 0;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | void __RPC_USER cli_push_l(char * state,
|
|---|
| 114 | long * buf,
|
|---|
| 115 | unsigned long ecount)
|
|---|
| 116 | {
|
|---|
| 117 | printf("cli_push_l ecount[%lu]\n", ecount);
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | void __RPC_USER cli_alloc_l(char * state,
|
|---|
| 121 | unsigned long bsize,
|
|---|
| 122 | long * * buf,
|
|---|
| 123 | unsigned long * bcount )
|
|---|
| 124 | {
|
|---|
| 125 | printf("cli_alloc_l bsize[%lu]\n", bsize);
|
|---|
| 126 | *buf = NULL;
|
|---|
| 127 | *bcount = 0;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| 130 | static void midltests()
|
|---|
| 131 | {
|
|---|
| 132 | /* st_local_t st;
|
|---|
| 133 | st.s1 = 1;
|
|---|
| 134 | st.s2 = 2;
|
|---|
| 135 | cli_midltests_fn(st);
|
|---|
| 136 | */
|
|---|
| 137 | /* struct my_acl acl;
|
|---|
| 138 | struct my_ace aces[3];
|
|---|
| 139 | aces[0].ace1 = 1;
|
|---|
| 140 | aces[0].ace2 = 2;
|
|---|
| 141 | aces[1].ace1 = 1;
|
|---|
| 142 | aces[1].ace2 = 2;
|
|---|
| 143 | aces[2].ace1 = 1;
|
|---|
| 144 | aces[2].ace2 = 2;
|
|---|
| 145 | acl.revision = 5;
|
|---|
| 146 | acl.num_aces = 1;
|
|---|
| 147 | acl.aces = aces;
|
|---|
| 148 | cli_midltests_fn(&acl);
|
|---|
| 149 | */
|
|---|
| 150 | /* struct my_str str;
|
|---|
| 151 | memset(&str, 0, sizeof(str));
|
|---|
| 152 | str.l1 = 1;
|
|---|
| 153 | printf("here: %d\n", __LINE__);
|
|---|
| 154 | //wcscpy(str.str, L'Hello World\0');
|
|---|
| 155 | str.l2 = 2;
|
|---|
| 156 | printf("here: %d\n", __LINE__);
|
|---|
| 157 | cli_midltests_fn(&str);
|
|---|
| 158 | */
|
|---|
| 159 | byte buf[10];
|
|---|
| 160 | long length = 0;
|
|---|
| 161 | memset(buf, 0xdf, sizeof(buf));
|
|---|
| 162 | // cli_midltests_fn(sizeof(buf), buf, &length);
|
|---|
| 163 |
|
|---|
| 164 | /* long count = 2;
|
|---|
| 165 | long start_magic;
|
|---|
| 166 | BYTE_PIPE b;
|
|---|
| 167 | long mid_magic;
|
|---|
| 168 | LONG_PIPE l;
|
|---|
| 169 | long end_magic;
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 | memset(&b, 0, sizeof(b));
|
|---|
| 173 | memset(&l, 0, sizeof(l));
|
|---|
| 174 |
|
|---|
| 175 | b.alloc = cli_alloc_b;
|
|---|
| 176 | b.push = cli_push_b;
|
|---|
| 177 |
|
|---|
| 178 | l.alloc = cli_alloc_l;
|
|---|
| 179 | l.push = cli_push_l;
|
|---|
| 180 |
|
|---|
| 181 | printf("cli call start\n");
|
|---|
| 182 | cli_midltests_fn(count,
|
|---|
| 183 | &start_magic,
|
|---|
| 184 | b,
|
|---|
| 185 | &mid_magic,
|
|---|
| 186 | l,
|
|---|
| 187 | &end_magic);
|
|---|
| 188 | printf("cli call end\n");
|
|---|
| 189 | */
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | //long srv_midltests_fn(struct my_str *str)//struct my_acl *acl)//st_local_t st)
|
|---|
| 193 | //long srv_midltests_fn(long size, byte *bytes, long *length)
|
|---|
| 194 | #if 1
|
|---|
| 195 | long srv_midltests_fn(
|
|---|
| 196 | /* [in] */ long count,
|
|---|
| 197 | /* [ref][out] */ long *start_magic,
|
|---|
| 198 | /* [out] */ BYTE_PIPE b,
|
|---|
| 199 | /* [ref][out] */ long *mid_magic,
|
|---|
| 200 | /* [out] */ LONG_PIPE l,
|
|---|
| 201 | /* [ref][out] */ long *end_magic)
|
|---|
| 202 | #endif
|
|---|
| 203 | {
|
|---|
| 204 | /* byte bytes[10];
|
|---|
| 205 | long longs[10];
|
|---|
| 206 | int i;
|
|---|
| 207 | */
|
|---|
| 208 | printf("srv_midltests_fn: Start\n");
|
|---|
| 209 | //printf("s1[%d] s2[%d]\n", st.s1, st.s2);
|
|---|
| 210 | //printf(l1[%d] str[%s] l2[%d]\n", str->l1, str->str, str->l2);
|
|---|
| 211 |
|
|---|
| 212 | /* *start_magic = 0x01234567;
|
|---|
| 213 | *mid_magic = 0x88888888;
|
|---|
| 214 | *end_magic = 0xFEDCBA09;
|
|---|
| 215 |
|
|---|
| 216 | memset(bytes, 0xBE, sizeof(bytes));
|
|---|
| 217 | memset(longs, 0xAC, sizeof(longs));
|
|---|
| 218 |
|
|---|
| 219 | for (i=0; i < count; i++) {
|
|---|
| 220 | b.push(b.state, bytes, sizeof(bytes)/sizeof(bytes[0]));
|
|---|
| 221 | }
|
|---|
| 222 | b.push(b.state, NULL, 0);
|
|---|
| 223 |
|
|---|
| 224 | for (i=0; i < count; i++) {
|
|---|
| 225 | l.push(l.state, longs, sizeof(longs)/sizeof(longs[0]));
|
|---|
| 226 | }
|
|---|
| 227 | l.push(l.state, NULL, 0);
|
|---|
| 228 | */
|
|---|
| 229 | printf("srv_midltests_fn: End\n");
|
|---|
| 230 | return 0x65757254;
|
|---|
| 231 | }
|
|---|
| 232 |
|
|---|
| 233 | #endif
|
|---|