#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