summaryrefslogtreecommitdiff
path: root/testprogs/win32/midltests/todo/midltests-pipe-first.idl
blob: ef28943d92c725f8c4100f3bf5b61d2d15f93dce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
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