ReactOS 0.4.16-dev-1946-g52006dd
server.c
Go to the documentation of this file.
1/*
2 * Tests for WIDL and RPC server/clients.
3 *
4 * Copyright (C) Google 2007 (Dan Hipschman)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22#include <windows.h>
23#include <ole2.h>
24#include <oleauto.h>
25#include <secext.h>
26#include <rpcdce.h>
27#include <netfw.h>
28#include "wine/test.h"
29#include "server_s.h"
30#define SKIP_TYPE_DECLS
31#include "server_interp_s.h"
32#include "server_defines.h"
33#include "explicit_handle.h"
34
35#include <stddef.h>
36#include <stdio.h>
37#include <stdlib.h>
38
39#define PORT "4114"
40#define PIPE "\\pipe\\wine_rpcrt4_test"
41
42#define INT_CODE 4198
43
44static const char *progname, *client_test_name;
46
49
50static void (WINAPI *pNDRSContextMarshall2)(RPC_BINDING_HANDLE, NDR_SCONTEXT, void*, NDR_RUNDOWN, void*, ULONG);
51static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*, ULONG, void*, ULONG);
52static RPC_STATUS (WINAPI *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, RPC_MGR_EPV*, unsigned int,
53 unsigned int,RPC_IF_CALLBACK_FN*);
54static RPC_STATUS (WINAPI *pRpcBindingSetAuthInfoExA)(RPC_BINDING_HANDLE, RPC_CSTR, ULONG, ULONG,
56static RPC_STATUS (WINAPI *pRpcServerRegisterAuthInfoA)(RPC_CSTR, ULONG, RPC_AUTH_KEY_RETRIEVAL_FN, LPVOID);
57
58static char *domain_and_user;
59
60static int (__cdecl *int_return)(void);
61static int (__cdecl *square)(int x);
62static int (__cdecl *sum)(int x, int y);
63static signed char (__cdecl *sum_char)(signed char x, signed char y);
64static short (__cdecl *sum_short)(short x, short y);
65static int (__cdecl *sum_float)(float x, float y);
66static int (__cdecl *sum_double_int)(int x, double y);
67static hyper (__cdecl *sum_hyper)(hyper x, hyper y);
68static int (__cdecl *sum_hyper_int)(hyper x, hyper y);
69static int (__cdecl *sum_char_hyper)(signed char x, hyper y);
70static void (__cdecl *square_out)(int x, int *y);
71static int (__cdecl *sum_chars)(int a, chars_t x, chars_t y);
72static int (__cdecl *sum_ints)(int a, ints_t x, ints_t y);
73static int (__cdecl *sum_flts)(int a, flts_t x, flts_t y);
74static int (__cdecl *sum_dbls)(int a, dbls_t x, dbls_t y);
75static int (__cdecl *sum_iiff)(int x0, int y0, float x1, float y1);
76static int (__cdecl *sum_ifif)(int x0, float y0, int x1, float y1);
77static int (__cdecl *sum_iidd)(int x0, int y0, double x1, double y1);
78static int (__cdecl *sum_idid)(int x0, double y0, int x1, double y1);
79static int (__cdecl *sum_ififififififif)(int x0, float y0, int x1, float y1, int x2, float y2, int x3, float y3, int x4, float y4, int x5, float y5, int x6, float y6);
80static int (__cdecl *sum_ididididididid)(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6);
81static int (__cdecl *sum_idfdifdfifdfidifdidf)(int x0, double y0, float z0, double y1, int x1, float z1, double y2, float z2, int x2, float z3, double y3, float z4, int x3, double y4, int x4, float z5, double y5, int x5, double y6, float z6);
82static int (__cdecl *sum_ididididididididididid)(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6, int x7, double y7, int x8, double y8);
83static int (__cdecl *sum_iidiidiidiidiidiidiidiidiidiidiid)(int x0, int x1, double y0, int x2, int x3, double y1, int x4, int x5, double y2, int x6, int x7, double y3, int x8, int x9, double y4, int x10, int x11, double y5, int x12, int x13, double y6, int x14, int x15, double y7, int x16, int x17, double y8);
84static int (__cdecl *sum_iyiy)(int x0, hyper y0, int x1, hyper y1);
85static void (__cdecl *square_ref)(int *x);
86static int (__cdecl *str_length)(const char *s);
87static int (__cdecl *str_t_length)(str_t s);
88static int (__cdecl *cstr_length)(const char *s, int n);
89static int (__cdecl *dot_self)(vector_t *v);
90static double (__cdecl *square_half)(double x, double *y);
91static float (__cdecl *square_half_float)(float x, float *y);
92static LONG (__cdecl *square_half_long)(LONG x, LONG *y);
93static int (__cdecl *sum_fixed_array)(int a[5]);
94static int (__cdecl *pints_sum)(pints_t *pints);
95static double (__cdecl *ptypes_sum)(ptypes_t *ptypes);
96static int (__cdecl *dot_pvectors)(pvectors_t *pvectors);
97static int (__cdecl *sum_sp)(sp_t *sp);
98static double (__cdecl *square_sun)(sun_t *su);
99static int (__cdecl *test_list_length)(test_list_t *ls);
100static int (__cdecl *sum_fixed_int_3d)(int m[2][3][4]);
101static int (__cdecl *sum_conf_array)(int x[], int n);
102static int (__cdecl *sum_conf_ptr_by_conf_ptr)(int n1, int *n2_then_x1, int *x2);
103static int (__cdecl *sum_unique_conf_array)(int x[], int n);
104static int (__cdecl *sum_unique_conf_ptr)(int *x, int n);
105static int (__cdecl *sum_var_array)(int x[20], int n);
106static int (__cdecl *dot_two_vectors)(vector_t vs[2]);
107static void (__cdecl *get_number_array)(int x[20], int *n);
108static int (__cdecl *sum_cs)(cs_t *cs);
109static int (__cdecl *sum_cps)(cps_t *cps);
110static int (__cdecl *sum_cpsc)(cpsc_t *cpsc);
111static int (__cdecl *get_cpsc)(int n, cpsc_t *cpsc);
112static int (__cdecl *sum_complex_array)(int n, refpint_t pi[]);
113static int (__cdecl *sum_blob)(cs_blob_t *blob);
114static int (__cdecl *sum_data)(cs_data_t *data);
115static int (__cdecl *sum_container)(cs_container_t *container);
116static int (__cdecl *square_puint)(puint_t p);
117static int (__cdecl *sum_puints)(puints_t *p);
118static int (__cdecl *sum_cpuints)(cpuints_t *p);
119static int (__cdecl *dot_copy_vectors)(vector_t u, vector_t v);
120static double (__cdecl *square_encu)(encu_t *eu);
121static double (__cdecl *square_unencu)(int t, unencu_t *eu);
122static int (__cdecl *sum_parr)(int *a[3]);
123static int (__cdecl *sum_pcarr)(int *a[], int n);
124static int (__cdecl *enum_ord)(e_t e);
125static double (__cdecl *square_encue)(encue_t *eue);
126static void (__cdecl *check_se2)(se_t *s);
127static int (__cdecl *sum_toplev_conf_2n)(int *x, int n);
128static int (__cdecl *sum_toplev_conf_cond)(int *x, int a, int b, int c);
129static int (__cdecl *square_test_us)(test_us_t *tus);
130static double (__cdecl *sum_aligns)(aligns_t *a);
131static int (__cdecl *sum_padded)(padded_t *p);
132static int (__cdecl *sum_padded2)(padded_t ps[2]);
133static int (__cdecl *sum_padded_conf)(padded_t *ps, int n);
134static int (__cdecl *sum_bogus)(bogus_t *b);
135static void (__cdecl *check_null)(int *null);
136static int (__cdecl *str_struct_len)(str_struct_t *s);
137static int (__cdecl *wstr_struct_len)(wstr_struct_t *s);
138static int (__cdecl *sum_doub_carr)(doub_carr_t *dc);
139static void (__cdecl *make_pyramid_doub_carr)(unsigned char n, doub_carr_t **dc);
140static unsigned (__cdecl *hash_bstr)(bstr_t s);
141static void (__cdecl *get_a_bstr)(bstr_t *s);
142static void (__cdecl *get_name)(name_t *name);
143static void (__cdecl *get_names)(int *n, str_array_t *names);
144static void (__cdecl *get_namesw)(int *n, wstr_array_t *names);
145static int (__cdecl *sum_pcarr2)(int n, int **pa);
146static int (__cdecl *sum_L1_norms)(int n, vector_t *vs);
147static s123_t* (__cdecl *get_s123)(void);
148static void (__cdecl *get_numbers)(int length, int size, pints_t pn[]);
149static void (__cdecl *get_numbers_struct)(numbers_struct_t **ns);
151static rint_t (__cdecl *echo_ranged_int)(int i, int j, int k);
152static rint_t (__cdecl *echo_ranged_int2)(int i);
153static void (__cdecl *get_ranged_enum)(renum_t *re);
154static void (__cdecl *context_handle_test)(void);
155static void (__cdecl *full_pointer_test)(int *a, int *b);
156static void (__cdecl *full_pointer_null_test)(int *a, int *b);
157static void (__cdecl *authinfo_test)(unsigned int protseq, int secure);
158static void (__cdecl *stop)(void);
159static void (__cdecl *stop_autolisten)(void);
160static void (__cdecl *ip_test)(ipu_t *a);
161static int (__cdecl *sum_ptr_array)(int *a[2]);
162static int (__cdecl *sum_array_ptr)(int (*a)[2]);
163static ctx_handle_t (__cdecl *get_handle)(void);
164static void (__cdecl *get_handle_by_ptr)(ctx_handle_t *r);
165static void (__cdecl *test_handle)(ctx_handle_t ctx_handle);
166static void (__cdecl *test_I_RpcBindingInqLocalClientPID)(unsigned int protseq, RPC_BINDING_HANDLE binding);
167
168#define SERVER_FUNCTIONS \
169 X(int_return) \
170 X(square) \
171 X(sum) \
172 X(sum_char) \
173 X(sum_short) \
174 X(sum_float) \
175 X(sum_double_int) \
176 X(sum_hyper) \
177 X(sum_hyper_int) \
178 X(sum_char_hyper) \
179 X(sum_chars) \
180 X(sum_ints) \
181 X(sum_flts) \
182 X(sum_dbls) \
183 X(sum_iiff) \
184 X(sum_ifif) \
185 X(sum_iidd) \
186 X(sum_idid) \
187 X(sum_ififififififif) \
188 X(sum_ididididididid) \
189 X(sum_idfdifdfifdfidifdidf) \
190 X(sum_ididididididididididid) \
191 X(sum_iidiidiidiidiidiidiidiidiidiidiid) \
192 X(sum_iyiy) \
193 X(square_out) \
194 X(square_ref) \
195 X(str_length) \
196 X(str_t_length) \
197 X(cstr_length) \
198 X(dot_self) \
199 X(square_half) \
200 X(square_half_float) \
201 X(square_half_long) \
202 X(sum_fixed_array) \
203 X(pints_sum) \
204 X(ptypes_sum) \
205 X(dot_pvectors) \
206 X(sum_sp) \
207 X(square_sun) \
208 X(test_list_length) \
209 X(sum_fixed_int_3d) \
210 X(sum_conf_array) \
211 X(sum_conf_ptr_by_conf_ptr) \
212 X(sum_unique_conf_array) \
213 X(sum_unique_conf_ptr) \
214 X(sum_var_array) \
215 X(dot_two_vectors) \
216 X(get_number_array) \
217 X(sum_cs) \
218 X(sum_cps) \
219 X(sum_cpsc) \
220 X(get_cpsc) \
221 X(sum_complex_array) \
222 X(sum_blob) \
223 X(sum_data) \
224 X(sum_container) \
225 X(square_puint) \
226 X(sum_puints) \
227 X(sum_cpuints) \
228 X(dot_copy_vectors) \
229 X(square_encu) \
230 X(square_unencu) \
231 X(sum_parr) \
232 X(sum_pcarr) \
233 X(enum_ord) \
234 X(square_encue) \
235 X(check_se2) \
236 X(sum_toplev_conf_2n) \
237 X(sum_toplev_conf_cond) \
238 X(square_test_us) \
239 X(sum_aligns) \
240 X(sum_padded) \
241 X(sum_padded2) \
242 X(sum_padded_conf) \
243 X(sum_bogus) \
244 X(check_null) \
245 X(str_struct_len) \
246 X(wstr_struct_len) \
247 X(sum_doub_carr) \
248 X(make_pyramid_doub_carr) \
249 X(hash_bstr) \
250 X(get_a_bstr) \
251 X(get_name) \
252 X(get_names) \
253 X(get_namesw) \
254 X(sum_pcarr2) \
255 X(sum_L1_norms) \
256 X(get_s123) \
257 X(get_numbers) \
258 X(get_numbers_struct) \
259 X(get_filename) \
260 X(echo_ranged_int) \
261 X(echo_ranged_int2) \
262 X(get_ranged_enum) \
263 X(context_handle_test) \
264 X(full_pointer_test) \
265 X(full_pointer_null_test) \
266 X(authinfo_test) \
267 X(stop) \
268 X(stop_autolisten) \
269 X(ip_test) \
270 X(sum_ptr_array) \
271 X(sum_array_ptr) \
272 X(get_handle) \
273 X(get_handle_by_ptr) \
274 X(test_handle) \
275 X(test_I_RpcBindingInqLocalClientPID)
276
277/* type check statements generated in header file */
279
280static void set_interp_interface(void)
281{
282#define X(name) name = interp_##name;
284#undef X
285}
286
287static void set_mixed_interface(void)
288{
289#define X(name) name = mixed_##name;
291#undef X
292}
293
294static void InitFunctionPointers(void)
295{
296 HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll");
297
298 pNDRSContextMarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextMarshall2");
299 pNDRSContextUnmarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextUnmarshall2");
300 pRpcServerRegisterIfEx = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterIfEx");
301 pRpcBindingSetAuthInfoExA = (void *)GetProcAddress(hrpcrt4, "RpcBindingSetAuthInfoExA");
302 pRpcServerRegisterAuthInfoA = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterAuthInfoA");
303
304 if (!pNDRSContextMarshall2) old_windows_version = TRUE;
305}
306
309{
310 return malloc(n);
311}
312
313void __RPC_USER
315{
316 free(p);
317}
318
320{
321 return INT_CODE;
322}
323
325{
326 return x * x;
327}
328
329int __cdecl s_sum(int x, int y)
330{
331 return x + y;
332}
333
334signed char __cdecl s_sum_char(signed char x, signed char y)
335{
336 return x + y;
337}
338
339short __cdecl s_sum_short(short x, short y)
340{
341 return x + y;
342}
343
344int __cdecl s_sum_float(float x, float y)
345{
346 return x + y;
347}
348
349int __cdecl s_sum_double_int(int x, double y)
350{
351 return x + y;
352}
353
355{
356 return x + y;
357}
358
360{
361 return x + y;
362}
363
365{
366 return x + y;
367}
368
369int __cdecl s_sum_chars(int a, chars_t x, chars_t y)
370{
371 return a * (x.a + x.b + x.c + x.d + x.e + y.a + y.b + y.c + y.d + y.e);
372}
373
374int __cdecl s_sum_ints(int a, ints_t x, ints_t y)
375{
376 return a * (x.i + x.j + y.i + y.j);
377}
378
379int __cdecl s_sum_flts(int a, flts_t x, flts_t y)
380{
381 return a * (x.i + x.f + y.i + y.f);
382}
383
384int __cdecl s_sum_dbls(int a, dbls_t x, dbls_t y)
385{
386 return a * (x.i + x.d + y.i + y.d);
387}
388
389int __cdecl s_sum_iiff(int x0, int y0, float x1, float y1)
390{
391 return x0 + y0 + x1 + y1;
392}
393
394int __cdecl s_sum_ifif(int x0, float y0, int x1, float y1)
395{
396 return x0 + y0 + x1 + y1;
397}
398
399int __cdecl s_sum_iidd(int x0, int y0, double x1, double y1)
400{
401 return x0 + y0 + x1 + y1;
402}
403
404int __cdecl s_sum_idid(int x0, double y0, int x1, double y1)
405{
406 return x0 + y0 + x1 + y1;
407}
408
409int __cdecl s_sum_ififififififif(int x0, float y0, int x1, float y1, int x2, float y2, int x3, float y3, int x4, float y4, int x5, float y5, int x6, float y6)
410{
411 return x0 + y0 + x1 + y1 + x2 + y2 + x3 + y3 + x4 + y4 + x5 + y5 + x6 + y6;
412}
413
414int __cdecl s_sum_ididididididid(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6)
415{
416 return x0 + y0 + x1 + y1 + x2 + y2 + x3 + y3 + x4 + y4 + x5 + y5 + x6 + y6;
417}
418
419int __cdecl s_sum_idfdifdfifdfidifdidf(int x0, double y0, float z0, double y1, int x1, float z1, double y2, float z2, int x2, float z3, double y3, float z4, int x3, double y4, int x4, float z5, double y5, int x5, double y6, float z6)
420{
421 return x0 + y0 + z0 + x1 + y1 + z1 + x2 + y2 + z2 + x3 + y3 + z3 + x4 + y4 + z4 + x5 + y5 + z5 + y6 + z6;
422}
423
424int __cdecl s_sum_ididididididididididid(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6, int x7, double y7, int x8, double y8)
425{
426 return x0 + y0 + x1 + y1 + x2 + y2 + x3 + y3 + x4 + y4 + x5 + y5 + x6 + y6 + x7 + y7 + x8 + y8;
427}
428
429int __cdecl s_sum_iidiidiidiidiidiidiidiidiidiidiid(int x0, int x1, double y0, int x2, int x3, double y1, int x4, int x5, double y2, int x6, int x7, double y3, int x8, int x9, double y4, int x10, int x11, double y5, int x12, int x13, double y6, int x14, int x15, double y7, int x16, int x17, double y8)
430{
431 return x0 + x1 + y0 + x2 + x3 + y1 + x4 + x5 + y2 + x6 + x7 + y3 + x8 + x9 + y4 + x10 + x11 + y5 + x12 + x13 + y6 + x14 + x15 + y7 + x16 + x17 + y8;
432}
433
435{
436 return x0 + y0 + x1 + y1;
437}
438
439void __cdecl s_square_out(int x, int *y)
440{
441 *y = s_square(x);
442}
443
445{
446 *x = s_square(*x);
447}
448
449int __cdecl s_str_length(const char *s)
450{
451 return strlen(s);
452}
453
455{
456 return strlen(s);
457}
458
459int __cdecl s_cstr_length(const char *s, int n)
460{
461 int len = 0;
462 while (0 < n-- && *s++)
463 ++len;
464 return len;
465}
466
468{
469 return s_square(v->x) + s_square(v->y) + s_square(v->z);
470}
471
472double __cdecl s_square_half(double x, double *y)
473{
474 *y = x / 2.0;
475 return x * x;
476}
477
478float __cdecl s_square_half_float(float x, float *y)
479{
480 *y = x / 2.0f;
481 return x * x;
482}
483
485{
486 *y = x / 2;
487 return x * x;
488}
489
491{
492 return a[0] + a[1] + a[2] + a[3] + a[4];
493}
494
495int __cdecl s_pints_sum(pints_t *pints)
496{
497 return *pints->pi + **pints->ppi + ***pints->pppi;
498}
499
500double __cdecl s_ptypes_sum(ptypes_t *pt)
501{
502 return *pt->pc + *pt->ps + *pt->pl + *pt->pf + *pt->pd;
503}
504
505int __cdecl s_dot_pvectors(pvectors_t *p)
506{
507 return p->pu->x * (*p->pv)->x + p->pu->y * (*p->pv)->y + p->pu->z * (*p->pv)->z;
508}
509
511{
512 return sp->x + sp->s->x;
513}
514
515double __cdecl s_square_sun(sun_t *su)
516{
517 switch (su->s)
518 {
519 case SUN_I: return su->u.i * su->u.i;
520 case SUN_F1:
521 case SUN_F2: return su->u.f * su->u.f;
522 case SUN_PI: return (*su->u.pi) * (*su->u.pi);
523 default:
524 return 0.0;
525 }
526}
527
529{
530 return (list->t == TL_LIST
531 ? 1 + s_test_list_length(list->u.tail)
532 : 0);
533}
534
535int __cdecl s_sum_fixed_int_3d(int m[2][3][4])
536{
537 int i, j, k;
538 int sum = 0;
539
540 for (i = 0; i < 2; ++i)
541 for (j = 0; j < 3; ++j)
542 for (k = 0; k < 4; ++k)
543 sum += m[i][j][k];
544
545 return sum;
546}
547
549{
550 int *p = x, *end = p + n;
551 int sum = 0;
552
553 while (p < end)
554 sum += *p++;
555
556 return sum;
557}
558
560{
561 int i;
562 int sum = 0;
563 if(n1 == 0)
564 return 0;
565
566 for(i = 1; i < n1; ++i)
567 sum += n2_then_x1[i];
568
569 for(i = 0; i < *n2_then_x1; ++i)
570 sum += x2[i];
571
572 return sum;
573}
574
576{
577 return s_sum_conf_array(x, n);
578}
579
581{
582 return x ? s_sum_conf_array(x, n) : 0;
583}
584
585int __cdecl s_sum_var_array(int x[20], int n)
586{
587 ok(0 <= n, "RPC sum_var_array\n");
588 ok(n <= 20, "RPC sum_var_array\n");
589
590 return s_sum_conf_array(x, n);
591}
592
593int __cdecl s_sum_complex_array(int n, refpint_t pi[])
594{
595 int total = 0;
596 for (; n > 0; n--)
597 total += *pi[n - 1];
598 return total;
599}
600
601int __cdecl s_sum_blob(cs_blob_t *blob)
602{
603 int i, total = 0;
604
605 for (i = 0; i < blob->n; i++)
606 total += blob->ca[i];
607
608 return total;
609}
610
611int __cdecl s_sum_data(cs_data_t *data)
612{
613 int i, total = 0;
614
615 for (i = 0; i < data->blob.n; i++)
616 total += data->blob.ca[i];
617
618 return total;
619}
620
622{
623 int i, total = 0;
624
625 for (i = 0; i < container->data.blob.n; i++)
626 total += container->data.blob.ca[i];
627
628 return total;
629}
630
632{
633 return vs[0].x * vs[1].x + vs[0].y * vs[1].y + vs[0].z * vs[1].z;
634}
635
636void __cdecl s_get_number_array(int x[20], int *n)
637{
638 int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
639 memcpy(x, c, sizeof(c));
640 *n = ARRAY_SIZE(c);
641}
642
644{
645 return s_sum_conf_array(cs->ca, cs->n);
646}
647
648int __cdecl s_sum_cps(cps_t *cps)
649{
650 int sum = 0;
651 int i;
652
653 for (i = 0; i < *cps->pn; ++i)
654 sum += cps->ca1[i];
655
656 for (i = 0; i < 2 * cps->n; ++i)
657 sum += cps->ca2[i];
658
659 return sum;
660}
661
663{
664 int sum = 0;
665 int i;
666 for (i = 0; i < (cpsc->c ? cpsc->a : cpsc->b); ++i)
667 sum += cpsc->ca[i];
668 return sum;
669}
670
671int __cdecl s_get_cpsc(int n, cpsc_t *cpsc)
672{
673 int i, ret;
674
675 cpsc->a = 2 * n;
676 cpsc->b = 2;
677 cpsc->c = 1;
678 cpsc->ca = MIDL_user_allocate( cpsc->a * sizeof(int) );
679 for (i = ret = 0; i < cpsc->a; i++) cpsc->ca[i] = i;
680 for (i = ret = 0; i < cpsc->a; i++) ret += cpsc->ca[i];
681 return ret;
682}
683
685{
686 int n = atoi(p);
687 return n * n;
688}
689
690int __cdecl s_sum_puints(puints_t *p)
691{
692 int sum = 0;
693 int i;
694 for (i = 0; i < p->n; ++i)
695 sum += atoi(p->ps[i]);
696 return sum;
697}
698
699int __cdecl s_sum_cpuints(cpuints_t *p)
700{
701 int sum = 0;
702 int i;
703 for (i = 0; i < p->n; ++i)
704 sum += atoi(p->ps[i]);
705 return sum;
706}
707
709{
710 return u.x * v.x + u.y * v.y + u.z * v.z;
711}
712
713int __cdecl s_square_test_us(test_us_t *tus)
714{
715 int n = atoi(tus->us.x);
716 return n * n;
717}
718
719double __cdecl s_square_encu(encu_t *eu)
720{
721 switch (eu->t)
722 {
723 case ENCU_I: return eu->tagged_union.i * eu->tagged_union.i;
724 case ENCU_F: return eu->tagged_union.f * eu->tagged_union.f;
725 default:
726 return 0.0;
727 }
728}
729
730double __cdecl s_square_unencu(int t, unencu_t *eu)
731{
732 switch (t)
733 {
734 case ENCU_I: return eu->i * eu->i;
735 case ENCU_F: return eu->f * eu->f;
736 default:
737 return 0.0;
738 }
739}
740
742{
743 ok(s->f == E2, "check_se2\n");
744}
745
746int __cdecl s_sum_parr(int *a[3])
747{
748 return s_sum_pcarr(a, 3);
749}
750
751int __cdecl s_sum_pcarr(int *a[], int n)
752{
753 int i, s = 0;
754 for (i = 0; i < n; ++i)
755 s += *a[i];
756 return s;
757}
758
760{
761 switch (e)
762 {
763 case E1: return 1;
764 case E2: return 2;
765 case E3: return 3;
766 case E4: return 4;
767 default:
768 return 0;
769 }
770}
771
772double __cdecl s_square_encue(encue_t *eue)
773{
774 switch (eue->t)
775 {
776 case E1: return eue->tagged_union.i1 * eue->tagged_union.i1;
777 case E2: return eue->tagged_union.f2 * eue->tagged_union.f2;
778 default:
779 return 0.0;
780 }
781}
782
784{
785 int sum = 0;
786 int i;
787 for (i = 0; i < 2 * n; ++i)
788 sum += x[i];
789 return sum;
790}
791
792int __cdecl s_sum_toplev_conf_cond(int *x, int a, int b, int c)
793{
794 int sum = 0;
795 int n = c ? a : b;
796 int i;
797 for (i = 0; i < n; ++i)
798 sum += x[i];
799 return sum;
800}
801
802double __cdecl s_sum_aligns(aligns_t *a)
803{
804 return a->c + a->i + a->s + a->d;
805}
806
807int __cdecl s_sum_padded(padded_t *p)
808{
809 return p->i + p->c;
810}
811
812int __cdecl s_sum_padded2(padded_t ps[2])
813{
814 return s_sum_padded(&ps[0]) + s_sum_padded(&ps[1]);
815}
816
817int __cdecl s_sum_padded_conf(padded_t *ps, int n)
818{
819 int sum = 0;
820 int i;
821 for (i = 0; i < n; ++i)
822 sum += s_sum_padded(&ps[i]);
823 return sum;
824}
825
826int __cdecl s_sum_bogus(bogus_t *b)
827{
828 return *b->h.p1 + *b->p2 + *b->p3 + b->c;
829}
830
832{
833 ok(!null, "RPC check_null\n");
834}
835
836int __cdecl s_str_struct_len(str_struct_t *s)
837{
838 return lstrlenA(s->s);
839}
840
841int __cdecl s_wstr_struct_len(wstr_struct_t *s)
842{
843 return lstrlenW(s->s);
844}
845
846int __cdecl s_sum_doub_carr(doub_carr_t *dc)
847{
848 int i, j;
849 int sum = 0;
850 for (i = 0; i < dc->n; ++i)
851 for (j = 0; j < dc->a[i]->n; ++j)
852 sum += dc->a[i]->a[j];
853 return sum;
854}
855
856void __cdecl s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc)
857{
858 doub_carr_t *t;
859 int i, j;
860 t = MIDL_user_allocate(FIELD_OFFSET(doub_carr_t, a[n]));
861 t->n = n;
862 for (i = 0; i < n; ++i)
863 {
864 int v = i + 1;
865 t->a[i] = MIDL_user_allocate(FIELD_OFFSET(doub_carr_1_t, a[v]));
866 t->a[i]->n = v;
867 for (j = 0; j < v; ++j)
868 t->a[i]->a[j] = j + 1;
869 }
870 *dc = t;
871}
872
874{
875 short n = b[-1];
876 short *s = b;
877 unsigned hash = 0;
878 short i;
879 for (i = 0; i < n; ++i)
880 hash = 5 * hash + (unsigned) s[i];
881 return hash;
882}
883
885{
886 bstr_t bstr;
887 short str[] = {5, 'W', 'i', 'n', 'e', 0};
888 bstr = malloc(sizeof(str));
889 memcpy(bstr, str, sizeof(str));
890 *b = bstr + 1;
891}
892
894{
895 const char bossman[] = "Jeremy White";
896 memcpy(name->name, bossman, min(name->size, sizeof(bossman)));
897 /* ensure nul-termination */
898 if (name->size < sizeof(bossman))
899 name->name[name->size - 1] = 0;
900}
901
902void __cdecl s_get_names(int *n, str_array_t *names)
903{
904 str_array_t list;
905
906 list = MIDL_user_allocate(2 * sizeof(list[0]));
907 list[0] = MIDL_user_allocate(6);
908 strcpy(list[0], "Hello");
909 list[1] = MIDL_user_allocate(7);
910 strcpy(list[1], "World!");
911
912 *names = list;
913 *n = 2;
914}
915
916void __cdecl s_get_namesw(int *n, wstr_array_t *names)
917{
918 wstr_array_t list;
919
920 list = MIDL_user_allocate(2 * sizeof(list[0]));
921 list[0] = MIDL_user_allocate(sizeof(L"Hello"));
922 lstrcpyW(list[0], L"Hello");
923 list[1] = MIDL_user_allocate(sizeof(L"World!"));
924 lstrcpyW(list[1], L"World!");
925
926 *names = list;
927 *n = 2;
928}
929
930int __cdecl s_sum_pcarr2(int n, int **pa)
931{
932 return s_sum_conf_array(*pa, n);
933}
934
936{
937 int i;
938 int sum = 0;
939 for (i = 0; i < n; ++i)
940 sum += abs(vs[i].x) + abs(vs[i].y) + abs(vs[i].z);
941 return sum;
942}
943
944s123_t * __cdecl s_get_s123(void)
945{
946 s123_t *s = MIDL_user_allocate(sizeof *s);
947 s->f1 = 1;
948 s->f2 = 2;
949 s->f3 = 3;
950 return s;
951}
952
954{
955 void *ptr = MIDL_user_allocate(strlen(__FILE__) + 1);
956 strcpy(ptr, __FILE__);
957 return (char *)ptr;
958}
959
960int __cdecl s_echo_ranged_int(int i, int j, int k)
961{
962 return min( 100, i + j + k );
963}
964
966{
967 return i;
968}
969
970void __cdecl s_get_ranged_enum(renum_t *re)
971{
972 *re = RE3;
973}
974
976{
980 unsigned char buf[20];
981 static RPC_SERVER_INTERFACE server_if =
982 {
983 sizeof(RPC_SERVER_INTERFACE),
984 {{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
985 {{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
986 NULL,
987 0,
988 0,
989 0,
990 0,
991 0,
992 };
993
995 ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n");
996
997 if (!pNDRSContextMarshall2 || !pNDRSContextUnmarshall2)
998 {
999 win_skip("NDRSContextMarshall2 or NDRSContextUnmarshall2 not exported from rpcrt4.dll\n");
1000 return;
1001 }
1002
1003 h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
1004 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
1005
1006 /* marshal a context handle with NULL userContext */
1007 memset(buf, 0xcc, sizeof(buf));
1008 pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
1009 ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%lx\n", *(ULONG *)buf);
1010 ok(UuidIsNil((UUID *)&buf[4], &status), "uuid should have been nil\n");
1011
1012 h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
1013 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
1014
1015 /* marshal a context handle with non-NULL userContext */
1016 memset(buf, 0xcc, sizeof(buf));
1017 h->userContext = (void *)0xdeadbeef;
1018 pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
1019 ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%lx\n", *(ULONG *)buf);
1020 ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
1021
1022 /* raises ERROR_INVALID_HANDLE exception on Vista upwards */
1023 if (0)
1024 {
1025 h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
1026 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
1027 ok(h->userContext == (void *)0xdeadbeef, "userContext of interface didn't unmarshal properly: %p\n", h->userContext);
1028
1029 /* marshal a context handle with an interface specified */
1030 h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
1031 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
1032
1033 memset(buf, 0xcc, sizeof(buf));
1034 h->userContext = (void *)0xcafebabe;
1035 pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
1036 ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%lx\n", *(ULONG *)buf);
1037 ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
1038
1039 h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
1040 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
1041 ok(h->userContext == (void *)0xcafebabe, "userContext of interface didn't unmarshal properly: %p\n", h->userContext);
1042 }
1043
1044 /* test same interface data, but different pointer */
1045 /* raises ERROR_INVALID_HANDLE exception */
1046 if (0)
1047 {
1048 RPC_SERVER_INTERFACE server_if_clone = server_if;
1049
1050 pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if_clone.InterfaceId, 0);
1051 }
1052
1053 /* test different interface data, but different pointer */
1054 /* raises ERROR_INVALID_HANDLE exception */
1055 if (0)
1056 {
1057 static RPC_SERVER_INTERFACE server_if2 =
1058 {
1059 sizeof(RPC_SERVER_INTERFACE),
1060 {{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
1061 {{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
1062 NULL,
1063 0,
1064 0,
1065 0,
1066 0,
1067 0,
1068 };
1069 pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
1070
1071 pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if2.InterfaceId, 0);
1072 }
1073
1074 binding = NULL;
1076
1077 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
1078 ok(binding != NULL, "binding is NULL\n");
1079
1080 if (status == RPC_S_OK && binding != NULL)
1081 {
1082 unsigned char* string_binding = NULL;
1083 unsigned char* object_uuid = NULL;
1084 unsigned char* protseq = NULL;
1085 unsigned char* network_address = NULL;
1086 unsigned char* endpoint = NULL;
1087 unsigned char* network_options = NULL;
1088
1089 status = RpcBindingToStringBindingA(binding, &string_binding);
1090 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
1091 ok(string_binding != NULL, "string_binding is NULL\n");
1092
1093 status = RpcStringBindingParseA(string_binding, &object_uuid, &protseq, &network_address, &endpoint, &network_options);
1094 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
1095 ok(protseq != NULL && *protseq != '\0', "protseq is %s\n", protseq);
1096 ok(network_address != NULL && *network_address != '\0', "network_address is %s\n", network_address);
1097
1098 todo_wine
1099 {
1100 ok(object_uuid != NULL && *object_uuid == '\0', "object_uuid is %s\n", object_uuid);
1101 ok(endpoint != NULL && *endpoint == '\0', "endpoint is %s\n", endpoint);
1102 ok(network_options != NULL && *network_options == '\0', "network_options is %s\n", network_options);
1103 }
1104
1105 RpcStringFreeA(&string_binding);
1106 RpcStringFreeA(&object_uuid);
1107 RpcStringFreeA(&protseq);
1108 RpcStringFreeA(&network_address);
1110 RpcStringFreeA(&network_options);
1112 }
1113}
1114
1115void __cdecl s_get_numbers(int length, int size, pints_t n[])
1116{
1117 int i;
1118 for (i = 0; i < length; i++)
1119 {
1120 n[i].pi = midl_user_allocate(sizeof(*n[i].pi));
1121 *n[i].pi = i;
1122 n[i].ppi = NULL;
1123 n[i].pppi = NULL;
1124 }
1125}
1126
1127void __cdecl s_get_numbers_struct(numbers_struct_t **ns)
1128{
1129 int i;
1130 *ns = midl_user_allocate(FIELD_OFFSET(numbers_struct_t, numbers[5]));
1131 if (!*ns) return;
1132 (*ns)->length = 5;
1133 (*ns)->size = 5;
1134 for (i = 0; i < (*ns)->length; i++)
1135 {
1136 (*ns)->numbers[i].pi = NULL;
1137 (*ns)->numbers[i].ppi = NULL;
1138 (*ns)->numbers[i].pppi = NULL;
1139 }
1140 (*ns)->numbers[0].pi = midl_user_allocate(sizeof(*(*ns)->numbers[i].pi));
1141 *(*ns)->numbers[0].pi = 5;
1142}
1143
1145{
1146 ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a);
1147 ok(*b == 42, "Expected *b to be 42 instead of %d\n", *a);
1148 ok(a == b, "Expected a (%p) to point to the same memory as b (%p)\n", a, b);
1149}
1150
1152{
1153 ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a);
1154 ok(b == NULL, "Expected b to be NULL instead of %p\n", b);
1155}
1156
1157void __cdecl s_stop(void)
1158{
1159 if (!stop_wait_event)
1160 {
1161 ok(RPC_S_OK == RpcMgmtStopServerListening(NULL), "RpcMgmtStopServerListening\n");
1162 ok(RPC_S_OK == RpcServerUnregisterIf(NULL, NULL, FALSE), "RpcServerUnregisterIf\n");
1163 }
1164 ok(SetEvent(stop_event), "SetEvent\n");
1165 if (stop_wait_event)
1166 {
1167 DWORD ret;
1169 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
1170 }
1171}
1172
1174{
1177 todo_wine
1178 ok(status == RPC_S_UNKNOWN_MGR_TYPE, "got %lu\n", status);
1179}
1180
1181void __cdecl s_ip_test(ipu_t *a)
1182{
1183 STATSTG st;
1184 HRESULT hr;
1185
1186 hr = IStream_Stat(a->tagged_union.stream, &st, STATFLAG_NONAME);
1187 ok(hr == S_OK, "got %#lx\n", hr);
1188}
1189
1191{
1192 return *a[0] + *a[1];
1193}
1194
1196{
1197 return (*a)[0] + (*a)[1];
1198}
1199
1201{
1202 return (ctx_handle_t)0xdeadbeef;
1203}
1204
1206{
1207 *r = (ctx_handle_t)0xdeadbeef;
1208}
1209
1211{
1212 ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle);
1213}
1214
1216{
1217 unsigned int protseq;
1219};
1220
1222{
1225 ULONG pid;
1226
1228
1230 ok(status == RPC_S_NO_CALL_ACTIVE, "Got unexpected %ld.\n", status);
1231
1232 /* Other protocol sequences throw exceptions */
1233 if (params->protseq == RPC_PROTSEQ_LRPC)
1234 {
1236 ok(status == RPC_S_OK, "Got unexpected %ld.\n", status);
1237 ok(pid == client_info.dwProcessId, "Got unexpected pid.\n");
1238 }
1239
1241 return 0;
1242}
1243
1245{
1248 HANDLE thread;
1249 ULONG pid;
1250
1252
1253 /* Crash on Windows */
1254 if (0)
1255 {
1257 ok(status == RPC_S_INVALID_ARG, "Got unexpected %ld.\n", status);
1258
1260 ok(status == RPC_S_INVALID_ARG, "Got unexpected %ld.\n", status);
1261 }
1262
1265 {
1266 ok(status == RPC_S_OK, "Got unexpected %ld.\n", status);
1267 ok(pid == client_info.dwProcessId, "Got unexpected pid.\n");
1268 }
1269 else
1270 {
1271 ok(status == RPC_S_INVALID_BINDING, "Got unexpected %ld.\n", status);
1272 }
1273
1274 if (protseq == RPC_PROTSEQ_LRPC) /* Other protocol sequences throw exceptions */
1275 {
1277 ok(status == RPC_S_OK, "Got unexpected %ld.\n", status);
1278 ok(pid == client_info.dwProcessId, "Got unexpected pid.\n");
1279 }
1280
1281 params.protseq = protseq;
1282 params.binding = binding;
1286
1288}
1289
1291{
1292 ok(binding != NULL, "explicit handle is NULL\n");
1293 return a + b;
1294}
1295
1297{
1298 ok(binding != NULL, "explicit handle is NULL\n");
1299 return a + 2;
1300}
1301
1303{
1305 ULONG pid = 0;
1306 ok(binding != NULL, "explicit handle is NULL\n");
1307
1309 ok(status == RPC_S_OK, "Got unexpected %ld.\n", status);
1310 ok(pid == client_info.dwProcessId, "Got unexpected pid: %ld client pid: %ld.\n", pid, client_info.dwProcessId);
1311 ok(SetEvent(stop_event), "SetEvent\n");
1312}
1313
1315{
1316 ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle);
1317}
1318
1319static void
1321{
1322 sprintf(buffer, "%s server %s", progname, test);
1323}
1324
1325static void
1326run_client(const char *test)
1327{
1328 char cmdline[MAX_PATH];
1330
1331 memset(&startup, 0, sizeof startup);
1332 startup.cb = sizeof startup;
1333
1336 ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &client_info), "CreateProcess\n");
1338 ok(CloseHandle(client_info.hProcess), "CloseHandle\n");
1339 ok(CloseHandle(client_info.hThread), "CloseHandle\n");
1340}
1341
1342static void
1344{
1345 char string[] = "I am a string";
1346 WCHAR wstring[] = L"I am a wstring";
1347 int f[5] = {1, 3, 0, -2, -4};
1348 vector_t a = {1, 3, 7};
1349 vector_t vec1 = {4, -2, 1}, vec2 = {-5, 2, 3}, *pvec2 = &vec2;
1350 pvectors_t pvecs = {&vec1, &pvec2};
1351 sp_inner_t spi = {42};
1352 sp_t sp = {-13, &spi};
1353 aligns_t aligns;
1354 pints_t pints;
1355 ptypes_t ptypes;
1356 padded_t padded;
1357 padded_t padded2[2];
1358 bogus_t bogus;
1359 int i1, i2, i3, *pi2, *pi3, **ppi3;
1360 double u, v;
1361 float s, t;
1362 LONG q, r;
1363 short h;
1364 char c;
1365 int x;
1366 hyper y;
1367 str_struct_t ss = {string};
1368 wstr_struct_t ws = {wstring};
1369 str_t str;
1370 se_t se;
1371 renum_t re;
1372 chars_t cs1 = { 2, 4, 6, 8, 10 }, cs2 = { -1, -2, -3, -4, -5 };
1373 ints_t is1 = { 2, 4 }, is2 = { 5, 8 };
1374 flts_t fs1 = { 3, 5.5 }, fs2 = { 8, 2.3 };
1375 dbls_t ds1 = { 9, -2.5 }, ds2 = { 2, -4.2 };
1376
1377 ok(int_return() == INT_CODE, "RPC int_return\n");
1378
1379 ok(square(7) == 49, "RPC square\n");
1380 x = sum(23, -4);
1381 ok(x == 19, "RPC sum got %d\n", x);
1382 c = sum_char(-23, 50);
1383 ok(c == 27, "RPC sum_char got %d\n", (int)c);
1384 h = sum_short(1122, -344);
1385 ok(h == 778, "RPC sum_short got %d\n", (int)h);
1386 x = sum_float(123.45, -32.2);
1387 ok(x == 91, "RPC sum_float got %d\n", x);
1388 x = sum_double_int(-78, 148.46);
1389 ok(x == 70, "RPC sum_double_int got %d\n", x);
1390 y = sum_hyper((hyper)0x12345678 << 16, (hyper)0x33557799 << 16);
1391 ok(y == (hyper)0x4589ce11 << 16, "RPC hyper got %s\n", wine_dbgstr_longlong(y));
1392 x = sum_hyper_int((hyper)0x24242424 << 16, -((hyper)0x24241212 << 16));
1393 ok(x == 0x12120000, "RPC hyper_int got 0x%x\n", x);
1394 x = sum_char_hyper( 12, ((hyper)0x42424242 << 32) | 0x33334444 );
1395 ok(x == 0x33334450, "RPC char_hyper got 0x%x\n", x);
1396 x = sum_chars( 4, cs1, cs2 );
1397 ok(x == 60, "got %d\n", x);
1398 x = sum_ints( 2, is1, is2 );
1399 ok(x == 38, "got %d\n", x);
1400 x = sum_flts( 3, fs1, fs2 );
1401 ok(x == 56, "got %d\n", x);
1402 x = sum_dbls( 7, ds1, ds2 );
1403 ok(x == 30, "got %d\n", x);
1404 x = sum_iiff( 12, 23, 3.4, 4.7 );
1405 ok(x == 43, "got %d\n", x);
1406 x = sum_ifif( 12, 11.2, 23, 34.5 );
1407 ok(x == 80, "got %d\n", x);
1408 x = sum_iidd( 6, 5, 4.3, 2.1 );
1409 ok(x == 17, "got %d\n", x);
1410 x = sum_idid( 55, 44.55, 33, 22.44 );
1411 ok(x == 154, "got %d\n", x);
1412 x = sum_ififififififif( 1, 2.1, 3, 4.2, 5, 6.3, 7, 8.4, 9, 10.5, 11, 12.2, 13, 14.9 );
1413 ok(x == 107, "got %d\n", x);
1414 x = sum_ididididididid( -1, -2.1, -3, -4, -5, -6.7, -8, -9.1, -11, -12.3, -13, -14.2, -15, -16.3 );
1415 ok(x == -120, "got %d\n", x);
1416 x = sum_idfdifdfifdfidifdidf( 2, 1.2, 2.1, 2.3, 4, 3.2, 4.5, 5.5, -3, -2.2, -4.4, -5.5, 6, 6.4, -3, 8.1, 9.2, 7, -10.3, 12.4 );
1417 ok(x == 45, "got %d\n", x);
1418 x = sum_ididididididididididid( 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 5 );
1419 ok(x == 4, "got %d\n", x);
1420 x = sum_iidiidiidiidiidiidiidiidiidiidiid( 11, 22, 33.1, 44, 55, 66.1, 77, 88, 99.1, 111, 222, 333.1, 444,
1421 555, 666.1, 777, 888, 999.1, 1, 2, 3.1, 4, 5, 6.1, 7, 8, 9.1 );
1422 ok(x == 5535, "got %d\n", x);
1423 x = sum_iyiy( 1, 1234567890, 2, -1234567800 );
1424 ok(x == 93, "got %d\n", x);
1425
1426 x = 0;
1427 square_out(11, &x);
1428 ok(x == 121, "RPC square_out\n");
1429
1430 x = 5;
1431 square_ref(&x);
1432 ok(x == 25, "RPC square_ref\n");
1433
1434 ok(str_length(string) == strlen(string), "RPC str_length\n");
1435 ok(str_t_length(string) == strlen(string), "RPC str_length\n");
1436 ok(dot_self(&a) == 59, "RPC dot_self\n");
1437
1438 ok(str_struct_len(&ss) == lstrlenA(string), "RPC str_struct_len\n");
1439 ok(wstr_struct_len(&ws) == lstrlenW(wstring), "RPC str_struct_len\n");
1440
1441 v = 0.0;
1442 u = square_half(3.0, &v);
1443 ok(u == 9.0, "RPC square_half\n");
1444 ok(v == 1.5, "RPC square_half\n");
1445
1446 t = 0.0f;
1447 s = square_half_float(3.0f, &t);
1448 ok(s == 9.0f, "RPC square_half_float\n");
1449 ok(t == 1.5f, "RPC square_half_float\n");
1450
1451 r = 0;
1452 q = square_half_long(3, &r);
1453 ok(q == 9, "RPC square_half_long\n");
1454 ok(r == 1, "RPC square_half_long\n");
1455
1456 i1 = 19;
1457 i2 = -3;
1458 i3 = -29;
1459 pi2 = &i2;
1460 pi3 = &i3;
1461 ppi3 = &pi3;
1462 pints.pi = &i1;
1463 pints.ppi = &pi2;
1464 pints.pppi = &ppi3;
1465 ok(pints_sum(&pints) == -13, "RPC pints_sum\n");
1466
1467 c = 10;
1468 h = 3;
1469 q = 14;
1470 s = -5.0f;
1471 u = 11.0;
1472 ptypes.pc = &c;
1473 ptypes.ps = &h;
1474 ptypes.pl = &q;
1475 ptypes.pf = &s;
1476 ptypes.pd = &u;
1477 ok(ptypes_sum(&ptypes) == 33.0, "RPC ptypes_sum\n");
1478
1479 ok(dot_pvectors(&pvecs) == -21, "RPC dot_pvectors\n");
1480 ok(dot_copy_vectors(vec1, vec2) == -21, "RPC dot_copy_vectors\n");
1481 ok(sum_fixed_array(f) == -2, "RPC sum_fixed_array\n");
1482 ok(sum_sp(&sp) == 29, "RPC sum_sp\n");
1483
1484 ok(enum_ord(E1) == 1, "RPC enum_ord\n");
1485 ok(enum_ord(E2) == 2, "RPC enum_ord\n");
1486 ok(enum_ord(E3) == 3, "RPC enum_ord\n");
1487 ok(enum_ord(E4) == 4, "RPC enum_ord\n");
1488
1489 se.f = E2;
1490 check_se2(&se);
1491
1492 memset(&aligns, 0, sizeof(aligns));
1493 aligns.c = 3;
1494 aligns.i = 4;
1495 aligns.s = 5;
1496 aligns.d = 6.0;
1497 ok(sum_aligns(&aligns) == 18.0, "RPC sum_aligns\n");
1498
1499 padded.i = -3;
1500 padded.c = 8;
1501 ok(sum_padded(&padded) == 5, "RPC sum_padded\n");
1502 padded2[0].i = -5;
1503 padded2[0].c = 1;
1504 padded2[1].i = 3;
1505 padded2[1].c = 7;
1506 ok(sum_padded2(padded2) == 6, "RPC sum_padded2\n");
1507 padded2[0].i = -5;
1508 padded2[0].c = 1;
1509 padded2[1].i = 3;
1510 padded2[1].c = 7;
1511 ok(sum_padded_conf(padded2, 2) == 6, "RPC sum_padded_conf\n");
1512
1513 i1 = 14;
1514 i2 = -7;
1515 i3 = -4;
1516 bogus.h.p1 = &i1;
1517 bogus.p2 = &i2;
1518 bogus.p3 = &i3;
1519 bogus.c = 9;
1520 ok(sum_bogus(&bogus) == 12, "RPC sum_bogus\n");
1521
1522 check_null(NULL);
1523
1524 str = get_filename();
1525 ok(!strcmp(str, __FILE__), "get_filename() returned %s instead of %s\n", str, __FILE__);
1527
1528 x = echo_ranged_int(0,0,0);
1529 ok(x == 0, "echo_ranged_int() returned %d instead of 0\n", x);
1530 x = echo_ranged_int(10,20,100);
1531 ok(x == 100, "echo_ranged_int() returned %d instead of 100\n", x);
1532 x = echo_ranged_int2(40);
1533 ok(x == 40, "echo_ranged_int() returned %d instead of 40\n", x);
1534
1536 {
1537 re = 0xdeadbeef;
1538 get_ranged_enum(&re);
1539 ok(re == RE3 ||
1540 broken(re == MAKELONG(re, 0xdead)), /* Win 8, Win 10 */
1541 "get_ranged_enum() returned %x instead of RE3\n", re);
1542 }
1543}
1544
1545static void
1547{
1548 encue_t eue;
1549 encu_t eu;
1550 unencu_t uneu;
1551 sun_t su;
1552 ipu_t ipu;
1553 LONG ref;
1554 int i;
1555
1556 su.s = SUN_I;
1557 su.u.i = 9;
1558 ok(square_sun(&su) == 81.0, "RPC square_sun\n");
1559
1560 su.s = SUN_F1;
1561 su.u.f = 5.0;
1562 ok(square_sun(&su) == 25.0, "RPC square_sun\n");
1563
1564 su.s = SUN_F2;
1565 su.u.f = -2.0;
1566 ok(square_sun(&su) == 4.0, "RPC square_sun\n");
1567
1568 su.s = SUN_PI;
1569 su.u.pi = &i;
1570 i = 11;
1571 ok(square_sun(&su) == 121.0, "RPC square_sun\n");
1572
1573 eu.t = ENCU_I;
1574 eu.tagged_union.i = 7;
1575 ok(square_encu(&eu) == 49.0, "RPC square_encu\n");
1576
1577 eu.t = ENCU_F;
1578 eu.tagged_union.f = 3.0;
1579 ok(square_encu(&eu) == 9.0, "RPC square_encu\n");
1580
1581 uneu.i = 4;
1582 ok(square_unencu(ENCU_I, &uneu) == 16.0, "RPC square_unencu\n");
1583
1584 uneu.f = 5.0;
1585 ok(square_unencu(ENCU_F, &uneu) == 25.0, "RPC square_unencu\n");
1586
1587 eue.t = E1;
1588 eue.tagged_union.i1 = 8;
1589 ok(square_encue(&eue) == 64.0, "RPC square_encue\n");
1590
1591 eue.t = E2;
1592 eue.tagged_union.f2 = 10.0;
1593 ok(square_encue(&eue) == 100.0, "RPC square_encue\n");
1594
1596
1597 CreateStreamOnHGlobal(NULL, TRUE, &ipu.tagged_union.stream);
1598 ip_test(&ipu);
1599 ref = IStream_Release(ipu.tagged_union.stream);
1600 ok(!ref, "got %lu refs\n", ref);
1601
1603}
1604
1605static test_list_t *
1607{
1608 test_list_t *n = malloc(sizeof *n);
1609 n->t = TL_NULL;
1610 n->u.x = 0;
1611 return n;
1612}
1613
1614static test_list_t *
1615make_list(test_list_t *tail)
1616{
1617 test_list_t *n = malloc(sizeof *n);
1618 n->t = TL_LIST;
1619 n->u.tail = tail;
1620 return n;
1621}
1622
1623static void
1624free_list(test_list_t *list)
1625{
1626 if (list->t == TL_LIST)
1627 free_list(list->u.tail);
1628 free(list);
1629}
1630
1633{
1634 return start + sizeof(int);
1635}
1636
1637unsigned char * __RPC_USER
1638puint_t_UserMarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
1639{
1640 int n = atoi(*p);
1641 memcpy(buffer, &n, sizeof n);
1642 return buffer + sizeof n;
1643}
1644
1645unsigned char * __RPC_USER
1646puint_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
1647{
1648 int n;
1649 memcpy(&n, buffer, sizeof n);
1650 *p = malloc(10);
1651 sprintf(*p, "%d", n);
1652 return buffer + sizeof n;
1653}
1654
1655void __RPC_USER
1657{
1658 free(*p);
1659}
1660
1663{
1664 return start + sizeof(struct wire_us);
1665}
1666
1667unsigned char * __RPC_USER
1668us_t_UserMarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
1669{
1670 struct wire_us wus;
1671 wus.x = atoi(pus->x);
1672 memcpy(buffer, &wus, sizeof wus);
1673 return buffer + sizeof wus;
1674}
1675
1676unsigned char * __RPC_USER
1677us_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
1678{
1679 struct wire_us wus;
1680 memcpy(&wus, buffer, sizeof wus);
1681 pus->x = malloc(10);
1682 sprintf(pus->x, "%d", wus.x);
1683 return buffer + sizeof wus;
1684}
1685
1686void __RPC_USER
1688{
1689 free(pus->x);
1690}
1691
1694{
1695 return start + FIELD_OFFSET(user_bstr_t, data[(*b)[-1]]);
1696}
1697
1698unsigned char * __RPC_USER
1700{
1701 wire_bstr_t wb = (wire_bstr_t) buffer;
1702 wb->n = (*b)[-1];
1703 memcpy(&wb->data, *b, wb->n * sizeof wb->data[0]);
1704 return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
1705}
1706
1707unsigned char * __RPC_USER
1709{
1710 wire_bstr_t wb = (wire_bstr_t) buffer;
1711 short *data = malloc((wb->n + 1) * sizeof *data);
1712 data[0] = wb->n;
1713 memcpy(&data[1], wb->data, wb->n * sizeof data[1]);
1714 *b = &data[1];
1715 return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
1716}
1717
1718void __RPC_USER
1720{
1721 free(&((*b)[-1]));
1722}
1723
1724static void
1726{
1727 int a[] = {1, 2, 3, 4};
1728 char p1[] = "11";
1729 test_list_t *list = make_list(make_list(make_list(null_list())));
1730 test_us_t tus = {{p1}};
1731 int *pa[4];
1732 puints_t pus;
1733 cpuints_t cpus;
1734 short bstr_data[] = { 5, 'H', 'e', 'l', 'l', 'o' };
1735 bstr_t bstr = &bstr_data[1], bstr2;
1736 name_t name;
1737 void *buffer;
1738 int *pa2;
1739 s123_t *s123;
1740 int val = 42;
1741
1742 ok(test_list_length(list) == 3, "RPC test_list_length\n");
1743 ok(square_puint(p1) == 121, "RPC square_puint\n");
1744 pus.n = 4;
1745 pus.ps = malloc(pus.n * sizeof pus.ps[0]);
1746 pus.ps[0] = strdup("5");
1747 pus.ps[1] = strdup("6");
1748 pus.ps[2] = strdup("7");
1749 pus.ps[3] = strdup("8");
1750 ok(sum_puints(&pus) == 26, "RPC sum_puints\n");
1751 free(pus.ps[0]);
1752 free(pus.ps[1]);
1753 free(pus.ps[2]);
1754 free(pus.ps[3]);
1755 free(pus.ps);
1756 cpus.n = 4;
1757 cpus.ps = malloc(cpus.n * sizeof cpus.ps[0]);
1758 cpus.ps[0] = strdup("5");
1759 cpus.ps[1] = strdup("6");
1760 cpus.ps[2] = strdup("7");
1761 cpus.ps[3] = strdup("8");
1762 ok(sum_cpuints(&cpus) == 26, "RPC sum_puints\n");
1763 free(cpus.ps[0]);
1764 free(cpus.ps[1]);
1765 free(cpus.ps[2]);
1766 free(cpus.ps[3]);
1767 free(cpus.ps);
1768 ok(square_test_us(&tus) == 121, "RPC square_test_us\n");
1769
1770 pa[0] = &a[0];
1771 pa[1] = &a[1];
1772 pa[2] = &a[2];
1773 ok(sum_parr(pa) == 6, "RPC sum_parr\n");
1774
1775 pa[0] = &a[0];
1776 pa[1] = &a[1];
1777 pa[2] = &a[2];
1778 pa[3] = &a[3];
1779 ok(sum_pcarr(pa, 4) == 10, "RPC sum_pcarr\n");
1780
1781 ok(hash_bstr(bstr) == s_hash_bstr(bstr), "RPC hash_bstr_data\n");
1782
1783 get_a_bstr(&bstr);
1784 s_get_a_bstr(&bstr2);
1785 ok(!lstrcmpW((LPCWSTR)bstr, (LPCWSTR)bstr2), "bstr mismatch\n");
1786 free(bstr - 1);
1787 free(bstr2 - 1);
1788
1789 free_list(list);
1790
1792 {
1793 int n;
1794 str_array_t names;
1795 wstr_array_t namesw;
1796
1797 name.size = 10;
1798 name.name = buffer = calloc(1, name.size);
1799 get_name(&name);
1800 ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer);
1801 ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name);
1802 free(name.name);
1803
1804 n = -1;
1805 names = NULL;
1806 get_names(&n, &names);
1807 ok(n == 2, "expected 2, got %d\n", n);
1809 ok(!strcmp(names[0], "Hello"), "expected Hello, got %s\n", names[0]);
1811 ok(!strcmp(names[1], "World!"), "expected World!, got %s\n", names[1]);
1815
1816 n = -1;
1817 namesw = NULL;
1818 get_namesw(&n, &namesw);
1819 ok(n == 2, "expected 2, got %d\n", n);
1821 ok(!lstrcmpW(namesw[0], L"Hello"), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0]));
1823 ok(!lstrcmpW(namesw[1], L"World!"), "expected World!, got %s\n", wine_dbgstr_w(namesw[1]));
1824 MIDL_user_free(namesw[0]);
1825 MIDL_user_free(namesw[1]);
1826 MIDL_user_free(namesw);
1827 }
1828
1829 pa2 = a;
1831 ok(sum_pcarr2(4, &pa2) == 10, "RPC sum_pcarr2\n");
1832
1833 s123 = get_s123();
1834 ok(s123->f1 == 1 && s123->f2 == 2 && s123->f3 == 3, "RPC get_s123\n");
1835 MIDL_user_free(s123);
1836
1837 full_pointer_test(&val, &val);
1838 full_pointer_null_test(&val, NULL);
1839}
1840
1841static int
1843{
1844 int i, j;
1845 for (i = 0; i < dc->n; ++i)
1846 for (j = 0; j < dc->a[i]->n; ++j)
1847 if (dc->a[i]->a[j] != j + 1)
1848 return FALSE;
1849 return TRUE;
1850}
1851
1852static void
1854{
1855 int i;
1856 for (i = 0; i < dc->n; ++i)
1857 MIDL_user_free(dc->a[i]);
1859}
1860
1861static void
1863{
1864 int m[2][3][4] =
1865 {
1866 {{1, 2, 3, 4}, {-1, -3, -5, -7}, {0, 2, 4, 6}},
1867 {{1, -2, 3, -4}, {2, 3, 5, 7}, {-4, -1, -14, 4114}}
1868 };
1869 int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
1870 int c2[] = {10, 100, 200};
1871 int c3[20];
1872 vector_t vs[2] = {{1, -2, 3}, {4, -5, -6}};
1873 cps_t cps;
1874 cpsc_t cpsc;
1875 cs_blob_t blob;
1876 cs_data_t data;
1877 cs_container_t container;
1878 cs_t *cs;
1879 int n;
1880 int ca[5] = {1, -2, 3, -4, 5};
1881 int tmp[10];
1882 doub_carr_t *dc;
1883 int *pi;
1884 pints_t api[5];
1885 numbers_struct_t *ns;
1886 refpint_t rpi[5];
1887 int i0 = 1, i1 = 2, *ptr_array[2] = {&i0, &i1}, array[2] = {3, 4};
1888
1890 {
1891 const char str1[25] = "Hello";
1892 ok(cstr_length(str1, sizeof str1) == strlen(str1), "RPC cstr_length\n");
1893 }
1894
1895 ok(sum_fixed_int_3d(m) == 4116, "RPC sum_fixed_int_3d\n");
1896
1897 ok(sum_conf_array(c, 10) == 45, "RPC sum_conf_array\n");
1898 ok(sum_conf_array(&c[5], 2) == 11, "RPC sum_conf_array\n");
1899 ok(sum_conf_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
1900 ok(sum_conf_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
1901
1902 ok(sum_conf_ptr_by_conf_ptr(1, c2, c) == 45, "RPC sum_conf_ptr_by_conf_ptr\n");
1903 ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 345, "RPC sum_conf_ptr_by_conf_ptr\n");
1904 c2[0] = 0;
1905 ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 300, "RPC sum_conf_ptr_by_conf_ptr\n");
1906
1907 ok(sum_unique_conf_array(ca, 4) == -2, "RPC sum_unique_conf_array\n");
1908 ok(sum_unique_conf_ptr(ca, 5) == 3, "RPC sum_unique_conf_array\n");
1909 ok(sum_unique_conf_ptr(NULL, 10) == 0, "RPC sum_unique_conf_array\n");
1910
1911 get_number_array(c3, &n);
1912 ok(n == 10, "RPC get_num_array\n");
1913 for (; n > 0; n--)
1914 ok(c3[n-1] == c[n-1], "get_num_array returned wrong value %d @ %d\n",
1915 c3[n-1], n);
1916 ok(sum_var_array(c, 10) == 45, "RPC sum_conf_array\n");
1917 ok(sum_var_array(&c[5], 2) == 11, "RPC sum_conf_array\n");
1918 ok(sum_var_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
1919 ok(sum_var_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
1920
1921 ok(dot_two_vectors(vs) == -4, "RPC dot_two_vectors\n");
1922 cs = malloc(FIELD_OFFSET(cs_t, ca[5]));
1923 cs->n = 5;
1924 cs->ca[0] = 3;
1925 cs->ca[1] = 5;
1926 cs->ca[2] = -2;
1927 cs->ca[3] = -1;
1928 cs->ca[4] = -4;
1929 ok(sum_cs(cs) == 1, "RPC sum_cs\n");
1930 free(cs);
1931
1932 n = 5;
1933 cps.pn = &n;
1934 cps.ca1 = &c[2];
1935 cps.n = 3;
1936 cps.ca2 = &c[3];
1937 ok(sum_cps(&cps) == 53, "RPC sum_cps\n");
1938
1939 cpsc.a = 4;
1940 cpsc.b = 5;
1941 cpsc.c = 1;
1942 cpsc.ca = c;
1943 ok(sum_cpsc(&cpsc) == 6, "RPC sum_cpsc\n");
1944 cpsc.a = 4;
1945 cpsc.b = 5;
1946 cpsc.c = 0;
1947 cpsc.ca = c;
1948 ok(sum_cpsc(&cpsc) == 10, "RPC sum_cpsc\n");
1949
1950 cpsc.ca = NULL;
1951 ok(get_cpsc(5, &cpsc) == 45, "RPC sum_cpsc\n");
1952 ok( cpsc.a == 10, "RPC get_cpsc %u\n", cpsc.a );
1953 for (n = 0; n < 10; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] );
1954
1955 memset( tmp, 0x33, sizeof(tmp) );
1956 cpsc.ca = tmp;
1957 ok(get_cpsc(4, &cpsc) == 28, "RPC sum_cpsc\n");
1958 ok( cpsc.a == 8, "RPC get_cpsc %u\n", cpsc.a );
1959 ok( cpsc.ca == tmp, "RPC get_cpsc %p/%p\n", cpsc.ca, tmp );
1960 for (n = 0; n < 8; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] );
1961
1962 ok(sum_toplev_conf_2n(c, 3) == 15, "RPC sum_toplev_conf_2n\n");
1963 ok(sum_toplev_conf_cond(c, 5, 6, 1) == 10, "RPC sum_toplev_conf_cond\n");
1964 ok(sum_toplev_conf_cond(c, 5, 6, 0) == 15, "RPC sum_toplev_conf_cond\n");
1965
1966 dc = malloc(FIELD_OFFSET(doub_carr_t, a[2]));
1967 dc->n = 2;
1968 dc->a[0] = malloc(sizeof(doub_carr_1_t) + 3);
1969 dc->a[0]->n = 3;
1970 dc->a[0]->a[0] = 5;
1971 dc->a[0]->a[1] = 1;
1972 dc->a[0]->a[2] = 8;
1973 dc->a[1] = malloc(sizeof(doub_carr_1_t) + 2);
1974 dc->a[1]->n = 2;
1975 dc->a[1]->a[0] = 2;
1976 dc->a[1]->a[1] = 3;
1977 ok(sum_doub_carr(dc) == 19, "RPC sum_doub_carr\n");
1978 free(dc->a[0]);
1979 free(dc->a[1]);
1980 free(dc);
1981
1982 dc = NULL;
1983 make_pyramid_doub_carr(4, &dc);
1984 ok(check_pyramid_doub_carr(dc), "RPC make_pyramid_doub_carr\n");
1986
1987 ok(sum_L1_norms(2, vs) == 21, "RPC sum_L1_norms\n");
1988
1989 memset(api, 0, sizeof(api));
1990 pi = malloc(sizeof(*pi));
1991 *pi = -1;
1992 api[0].pi = pi;
1993 get_numbers(1, 1, api);
1994 ok(api[0].pi == pi, "RPC conformant varying array [out] pointer changed from %p to %p\n", pi, api[0].pi);
1995 ok(*api[0].pi == 0, "pi unmarshalled incorrectly %d\n", *api[0].pi);
1996
1998 {
1999 ns = calloc(1, FIELD_OFFSET(numbers_struct_t, numbers[5]));
2000 ns->length = 5;
2001 ns->size = 5;
2002 ns->numbers[0].pi = pi;
2003 get_numbers_struct(&ns);
2004 ok(ns->numbers[0].pi == pi, "RPC conformant varying struct embedded pointer changed from %p to %p\n", pi, ns->numbers[0].pi);
2005 ok(*ns->numbers[0].pi == 5, "pi unmarshalled incorrectly %d\n", *ns->numbers[0].pi);
2006 free(ns);
2007 }
2008 free(pi);
2009
2010 pi = malloc(5 * sizeof(*pi));
2011 pi[0] = 3; rpi[0] = &pi[0];
2012 pi[1] = 5; rpi[1] = &pi[1];
2013 pi[2] = -2; rpi[2] = &pi[2];
2014 pi[3] = -1; rpi[3] = &pi[3];
2015 pi[4] = -4; rpi[4] = &pi[4];
2016 ok(sum_complex_array(5, rpi) == 1, "RPC sum_complex_array\n");
2017 free(pi);
2018
2019 ok(sum_ptr_array(ptr_array) == 3, "RPC sum_ptr_array\n");
2020 ok(sum_array_ptr(&array) == 7, "RPC sum_array_ptr\n");
2021
2022 blob.n = ARRAY_SIZE(c);
2023 blob.ca = c;
2024 n = sum_blob(&blob);
2025 ok(n == 45, "RPC sum_blob = %d\n", n);
2026
2027 data.blob.n = ARRAY_SIZE(c);
2028 data.blob.ca = c;
2029 n = sum_data(&data);
2030 ok(n == 45, "RPC sum_data = %d\n", n);
2031
2032 container.data.blob.n = ARRAY_SIZE(c);
2033 container.data.blob.ca = c;
2034 n = sum_container(&container);
2035 ok(n == 45, "RPC sum_container = %d\n", n);
2036}
2037
2038void __cdecl s_authinfo_test(unsigned int protseq, int secure)
2039{
2042 ULONG level, authnsvc;
2043 RPC_AUTHZ_HANDLE privs;
2044 unsigned char *principal;
2045
2047 ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n");
2048
2049 level = authnsvc = 0xdeadbeef;
2050 privs = (RPC_AUTHZ_HANDLE)0xdeadbeef;
2051 principal = (unsigned char *)0xdeadbeef;
2052
2053 if (secure || protseq == RPC_PROTSEQ_LRPC)
2054 {
2055 status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
2057 {
2058 win_skip("RpcBindingInqAuthClientA not supported\n");
2059 return;
2060 }
2061 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
2062 ok(privs != (RPC_AUTHZ_HANDLE)0xdeadbeef, "privs unchanged\n");
2063 ok(principal != (unsigned char *)0xdeadbeef, "principal unchanged\n");
2064 if (protseq != RPC_PROTSEQ_LRPC)
2065 {
2066 todo_wine
2067 ok(principal != NULL, "NULL principal\n");
2068 }
2069 if (protseq == RPC_PROTSEQ_LRPC && principal)
2070 {
2071 int len;
2072 char *spn;
2073
2074 len = WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, NULL, 0, NULL, NULL);
2075 spn = malloc(len);
2076 WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, spn, len, NULL, NULL);
2077
2078 ok(!strcmp(domain_and_user, spn), "expected %s got %s\n", domain_and_user, spn);
2079 free(spn);
2080 }
2081 ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "level unchanged\n");
2082 ok(authnsvc == RPC_C_AUTHN_WINNT, "authnsvc unchanged\n");
2083 RpcStringFreeA(&principal);
2084
2085 status = RpcBindingInqAuthClientA(NULL, &privs, &principal, &level, &authnsvc, NULL);
2086 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
2087 RpcStringFreeA(&principal);
2088
2089 status = RpcBindingInqAuthClientExA(NULL, &privs, &principal, &level, &authnsvc, NULL, 0);
2090 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
2091 RpcStringFreeA(&principal);
2092
2094 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
2096 ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
2097
2098 }
2099 else
2100 {
2101 status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
2102 ok(status == RPC_S_BINDING_HAS_NO_AUTH, "expected RPC_S_BINDING_HAS_NO_AUTH got %lu\n", status);
2103 ok(privs == (RPC_AUTHZ_HANDLE)0xdeadbeef, "got %p\n", privs);
2104 ok(principal == (unsigned char *)0xdeadbeef, "got %s\n", principal);
2105 ok(level == 0xdeadbeef, "got %lu\n", level);
2106 ok(authnsvc == 0xdeadbeef, "got %lu\n", authnsvc);
2107 }
2108}
2109
2110static void test_handle_return(void)
2111{
2112 ctx_handle_t handle, handle2;
2113
2114 handle = get_handle();
2115 test_handle(handle);
2116 get_handle_by_ptr(&handle2);
2117 test_handle(handle2);
2118}
2119
2120static void
2122{
2123 basic_tests();
2124 union_tests();
2125 pointer_tests();
2126 array_tests();
2127 context_handle_test();
2129}
2130
2131static void
2133{
2135 RPC_SECURITY_QOS qos;
2136
2137 qos.Version = 1;
2141
2143 RPC_C_AUTHN_WINNT, NULL, 0, &qos);
2144 ok(status == RPC_S_OK, "RpcBindingSetAuthInfoExA failed %ld\n", status);
2145}
2146
2147#define test_is_server_listening(a,b) _test_is_server_listening(__LINE__,a,b)
2149{
2152 ok_(__FILE__,line)(status == expected_status, "RpcMgmtIsServerListening returned %lu, expected %lu\n",
2153 status, expected_status);
2154}
2155
2156#define test_is_server_listening2(a,b,c) _test_is_server_listening2(__LINE__,a,b,c)
2158 RPC_STATUS expected_status2)
2159{
2162 ok_(__FILE__,line)(status == expected_status || status == expected_status2,
2163 "RpcMgmtIsServerListening returned %lu, expected %lu or %lu\n",
2164 status, expected_status, expected_status2);
2165}
2166
2167static void
2168client(const char *test)
2169{
2170 static unsigned char iptcp[] = "ncacn_ip_tcp";
2171 static unsigned char np[] = "ncacn_np";
2172 static unsigned char ncalrpc[] = "ncalrpc";
2173 static unsigned char address[] = "127.0.0.1";
2174 static unsigned char address_np[] = "\\\\.";
2175 static unsigned char port[] = PORT;
2176 static unsigned char pipe[] = PIPE;
2177 static unsigned char guid[] = "00000000-4114-0704-2301-000000000000";
2178 static unsigned char explicit_handle_guid[] = "00000000-4114-0704-2301-000000000002";
2179
2180 unsigned char *binding;
2181
2182 if (strcmp(test, "tcp_basic") == 0)
2183 {
2184 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
2185 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2186
2187 run_tests();
2188 authinfo_test(RPC_PROTSEQ_TCP, 0);
2189 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_TCP, IMixedServer_IfHandle);
2191
2192 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2193 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2194 }
2195 else if (strcmp(test, "tcp_secure") == 0)
2196 {
2197 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
2198 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2199
2200 set_auth_info(IMixedServer_IfHandle);
2201 authinfo_test(RPC_PROTSEQ_TCP, 1);
2202 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_TCP, IMixedServer_IfHandle);
2203 test_is_server_listening(IMixedServer_IfHandle, RPC_S_ACCESS_DENIED);
2204
2205 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2206 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2207 }
2208 else if (strcmp(test, "ncalrpc_basic") == 0)
2209 {
2210 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
2211 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2212
2213 run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */
2214 authinfo_test(RPC_PROTSEQ_LRPC, 0);
2215 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_LRPC, IMixedServer_IfHandle);
2216 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2217
2218 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2219 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2220 }
2221 else if (strcmp(test, "ncalrpc_autolisten") == 0)
2222 {
2223 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
2224 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2225
2226 run_tests();
2227 authinfo_test(RPC_PROTSEQ_LRPC, 0);
2228 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_LRPC, IMixedServer_IfHandle);
2229 todo_wine
2230 test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING);
2231
2232 stop_autolisten();
2233 ok(int_return() == INT_CODE, "RPC int_return\n");
2234
2235 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2236 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2237 }
2238 else if (strcmp(test, "ncalrpc_secure") == 0)
2239 {
2240 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
2241 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2242
2243 set_auth_info(IMixedServer_IfHandle);
2244 authinfo_test(RPC_PROTSEQ_LRPC, 1);
2245 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_LRPC, IMixedServer_IfHandle);
2246 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2247
2248 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2249 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2250 }
2251 else if (strcmp(test, "np_basic") == 0)
2252 {
2253 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
2254 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2255
2256 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2257 run_tests();
2258 authinfo_test(RPC_PROTSEQ_NMP, 0);
2259 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_NMP, IMixedServer_IfHandle);
2260 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2261 stop();
2262 test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING);
2263
2264 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2265 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2266 }
2267 else if (strcmp(test, "np_basic_interp") == 0)
2268 {
2270
2271 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
2272 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IInterpServer_IfHandle), "RpcBindingFromStringBinding\n");
2273
2274 test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK);
2275 run_tests();
2276 authinfo_test(RPC_PROTSEQ_NMP, 0);
2277 test_I_RpcBindingInqLocalClientPID(RPC_PROTSEQ_NMP, IInterpServer_IfHandle);
2278 test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK);
2279
2280 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2281 ok(RPC_S_OK == RpcBindingFree(&IInterpServer_IfHandle), "RpcBindingFree\n");
2282 }
2283 else if (strcmp(test, "explicit_handle") == 0)
2284 {
2285 IMixedServer_IfHandle = NULL;
2286 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, explicit_handle_guid, NULL, &binding), "RpcStringBindingCompose\n");
2287 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2288
2289 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2290
2291 ok(add(IMixedServer_IfHandle, 2, 3) == 5, "RPC add\n");
2292 ok(getNum(7, IMixedServer_IfHandle) == 9, "RPC getNum\n");
2293 Shutdown(IMixedServer_IfHandle);
2294
2295 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2296 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2297 }
2298}
2299
2300static void
2302{
2303 static unsigned char iptcp[] = "ncacn_ip_tcp";
2304 static unsigned char port[] = PORT;
2305 static unsigned char np[] = "ncacn_np";
2306 static unsigned char pipe[] = PIPE;
2307 static unsigned char ncalrpc[] = "ncalrpc";
2308 static unsigned char guid[] = "00000000-4114-0704-2301-000000000000";
2309 static unsigned char explicit_handle_guid[] = "00000000-4114-0704-2301-000000000002";
2310 RPC_STATUS status, iptcp_status, np_status, ncalrpc_status;
2311 DWORD ret;
2312
2313 /* needed for tests involving interface pointers */
2315
2316 iptcp_status = RpcServerUseProtseqEpA(iptcp, 20, port, NULL);
2317 ok(iptcp_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_ip_tcp) failed with status %ld\n", iptcp_status);
2318
2319 ncalrpc_status = RpcServerUseProtseqEpA(ncalrpc, 0, guid, NULL);
2320 ok(ncalrpc_status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", ncalrpc_status);
2321
2322 np_status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
2323 if (np_status == RPC_S_PROTSEQ_NOT_SUPPORTED)
2324 skip("Protocol sequence ncacn_np is not supported\n");
2325 else
2326 ok(np_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", np_status);
2327
2328 if (pRpcServerRegisterIfEx)
2329 {
2330 trace("Using RpcServerRegisterIfEx\n");
2331 status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
2334 ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %ld\n", status);
2335 status = pRpcServerRegisterIfEx(s_IInterpServer_v0_0_s_ifspec, NULL, NULL,
2338 ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %ld\n", status);
2339 }
2340 else
2341 {
2342 status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
2343 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
2344 status = RpcServerRegisterIf(s_IInterpServer_v0_0_s_ifspec, NULL, NULL);
2345 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
2346 }
2349 ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
2352 ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
2353
2354 if (iptcp_status == RPC_S_OK)
2355 run_client("tcp_basic");
2356 else
2357 skip("tcp tests skipped due to earlier failure\n");
2358
2359 if (ncalrpc_status == RPC_S_OK)
2360 {
2361 run_client("ncalrpc_basic");
2362
2363 /* we don't need to register RPC_C_AUTHN_WINNT for ncalrpc */
2364 run_client("ncalrpc_secure");
2365 }
2366 else
2367 skip("lrpc tests skipped due to earlier failure\n");
2368
2369 if (np_status == RPC_S_OK)
2370 {
2371 run_client("np_basic_interp");
2372 run_client("np_basic");
2373 }
2374 else
2375 {
2376 skip("np_basic tests skipped due to earlier failure\n");
2377 /* np client is what signals stop_event, so bail out if we didn't run do it */
2378 return;
2379 }
2380
2382 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2383
2384 /* if the stop event didn't fire then RpcMgmtWaitServerListen will wait
2385 * forever, so don't bother calling it in this case */
2386 if (ret == WAIT_OBJECT_0)
2387 {
2389 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
2390 }
2391
2393 stop_event = NULL;
2394
2395 if (pRpcServerRegisterIfEx)
2396 {
2397 status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
2400 ok(status == RPC_S_OK, "RpcServerRegisterIf() failed: %lu\n", status);
2401
2402 run_client("ncalrpc_autolisten");
2403
2404 status = RpcServerUnregisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, TRUE);
2405 ok(status == RPC_S_OK, "RpcServerUnregisterIf() failed: %lu\n", status);
2406 }
2407
2408 /* explicit handle */
2410 ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
2411
2412 ncalrpc_status = RpcServerUseProtseqEpA(ncalrpc, 0, explicit_handle_guid, NULL);
2413 if (ncalrpc_status == RPC_S_PROTSEQ_NOT_SUPPORTED)
2414 skip("Protocol sequence ncacn_np is not supported\n");
2415 else
2416 ok(ncalrpc_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", ncalrpc_status);
2417
2418 if (pRpcServerRegisterIfEx)
2419 {
2420 trace("Using RpcServerRegisterIfEx\n");
2421 status = pRpcServerRegisterIfEx(s_RPCExplicitHandle_v0_0_s_ifspec, NULL, NULL,
2424 ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %ld\n", status);
2427 ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
2428 }
2429 else
2430 {
2431 status = RpcServerRegisterIf(s_RPCExplicitHandle_v0_0_s_ifspec, NULL, NULL);
2432 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
2434 ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
2435 }
2436
2438
2439 run_client("explicit_handle");
2440
2442 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2443
2444 if (pRpcServerRegisterIfEx)
2445 {
2446 status = RpcServerUnregisterIf(s_RPCExplicitHandle_v0_0_s_ifspec, NULL, TRUE);
2447 ok(status == RPC_S_OK, "RpcServerUnregisterIf() failed: %lu\n", status);
2448 }
2449
2451 stop_event = NULL;
2452
2454}
2455
2457{
2459
2460 status = RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle);
2461 ok(status == RPC_S_OK, "RpcBindingFromStringBinding\n");
2462
2463 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2464 stop();
2465 trace("stopped\n");
2466
2467 status = RpcBindingFree(&IMixedServer_IfHandle);
2468 ok(status == RPC_S_OK, "RpcBindingFree\n");
2469 return 0;
2470}
2471
2473{
2475
2476 trace("waiting\n");
2478 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
2479 trace("done\n");
2480
2481 return 0;
2482}
2483
2484static void test_stop_wait_for_call(unsigned char *binding)
2485{
2486 HANDLE client_thread, wait_listen_thread;
2488 DWORD ret;
2489
2491 ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
2493
2495 ok(stop_wait_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
2497 ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
2498
2499 wait_listen_thread = CreateThread(NULL, 0, wait_listen_proc, 0, 0, NULL);
2500 ok(wait_listen_thread != NULL, "CreateThread failed\n");
2501
2502 client_thread = CreateThread(NULL, 0, listen_test_client_thread, binding, 0, NULL);
2503 ok(client_thread != NULL, "CreateThread failed\n");
2504 CloseHandle(client_thread);
2505
2507 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2508
2510 ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n");
2512
2513 ret = WaitForSingleObject(wait_listen_thread, 500);
2514 ok(WAIT_TIMEOUT == ret, "WaitForSingleObject\n");
2515
2517
2518 ret = WaitForSingleObject(wait_listen_thread, 10000);
2519 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject returned %lu\n", ret);
2520
2521 CloseHandle(wait_listen_thread);
2522
2526 stop_event = NULL;
2527}
2528
2529static void test_server_listening(void)
2530{
2531 static unsigned char np[] = "ncacn_np";
2532 static unsigned char address_np[] = "\\\\.";
2533 static unsigned char pipe[] = PIPE "listen_test";
2534 static unsigned char ncalrpc[] = "ncalrpc";
2535 static unsigned char guid[] = "00000000-4114-0704-2302-000000000000";
2536 unsigned char *binding;
2538
2539 status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
2540 ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", status);
2541
2542 status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
2543 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
2544
2547 ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
2549
2551 ok(status == RPC_S_ALREADY_LISTENING, "RpcServerListen failed with status %ld\n", status);
2552
2554 ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n");
2556
2558 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
2559
2561 ok(status == RPC_S_NOT_LISTENING, "RpcMgmtWaitServerListening failed with status %ld\n", status);
2562
2563 /* test that server stop waits for a call in progress */
2564 status = RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding);
2565 ok(status == RPC_S_OK, "RpcStringBindingCompose\n");
2566
2568
2570 ok(status == RPC_S_OK, "RpcStringFree\n");
2571
2572 /* repeat the test using ncalrpc */
2573 status = RpcServerUseProtseqEpA(ncalrpc, 0, guid, NULL);
2574 ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", status);
2575
2577 ok(status == RPC_S_OK, "RpcStringBindingCompose\n");
2578
2580
2582 ok(status == RPC_S_OK, "RpcStringFree\n");
2583}
2584
2586{
2587 SECURITY_ATTRIBUTES sec_attr = { sizeof(sec_attr), NULL, TRUE };
2588 HANDLE ready_event;
2589 char cmdline[MAX_PATH];
2592 DWORD ret;
2593
2594 memset(&startup, 0, sizeof startup);
2595 startup.cb = sizeof startup;
2596
2597 ready_event = CreateEventW(&sec_attr, TRUE, FALSE, NULL);
2598 ok(ready_event != NULL, "CreateEvent failed: %lu\n", GetLastError());
2599
2600 sprintf(cmdline, "%s server run %Ix", progname, (UINT_PTR)ready_event);
2601 trace("running server process...\n");
2602 ok(CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
2603 ret = WaitForSingleObject(ready_event, 10000);
2604 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2605
2606 ok(CloseHandle(info.hThread), "CloseHandle\n");
2607 ok(CloseHandle(ready_event), "CloseHandle\n");
2608 return info.hProcess;
2609}
2610
2611static void run_server(HANDLE ready_event)
2612{
2613 static unsigned char np[] = "ncacn_np";
2614 static unsigned char pipe[] = PIPE "term_test";
2616 BOOL ret;
2617
2618 status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
2619 ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", status);
2620
2621 status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
2622 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
2623
2626 ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
2627
2629 ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
2630
2631 ret = SetEvent(ready_event);
2632 ok(ret, "SetEvent failed: %lu\n", GetLastError());
2633
2635 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2636
2638 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
2639
2641 stop_event = NULL;
2642}
2643
2645{
2646 basic_tests();
2647 return 0;
2648}
2649
2650static void test_reconnect(void)
2651{
2652 static unsigned char np[] = "ncacn_np";
2653 static unsigned char address_np[] = "\\\\.";
2654 static unsigned char pipe[] = PIPE "term_test";
2655 unsigned char *binding;
2656 HANDLE threads[32];
2657 HANDLE server_process;
2658 unsigned i;
2659 DWORD ret;
2660
2661 server_process = create_server_process();
2662
2663 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
2664 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2665
2666 for (i = 0; i < ARRAY_SIZE(threads); i++)
2667 {
2669 ok(threads[i] != NULL, "CreateThread failed: %lu\n", GetLastError());
2670 }
2671
2672 for (i = 0; i < ARRAY_SIZE(threads); i++)
2673 {
2674 ret = WaitForSingleObject(threads[i], 10000);
2675 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2677 }
2678
2679 stop();
2680
2681 wait_child_process(server_process);
2682 ok(CloseHandle(server_process), "CloseHandle\n");
2683
2684 /* create new server, rpcrt4 will connect to it once sending to existing connection fails
2685 * that current connection is broken. */
2686 server_process = create_server_process();
2687 basic_tests();
2688 stop();
2689
2690 wait_child_process(server_process);
2691 ok(CloseHandle(server_process), "CloseHandle\n");
2692
2693 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2694 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2695}
2696
2698{
2699 HANDLE token;
2701 {
2703 DWORD size;
2704 BOOL ret;
2705
2707 CloseHandle( token );
2708 return (ret && type == TokenElevationTypeFull);
2709 }
2710 return FALSE;
2711}
2712
2714{
2715 HRESULT hr, init;
2716 INetFwMgr *mgr = NULL;
2719 VARIANT_BOOL enabled = VARIANT_FALSE;
2720
2722
2723 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
2724 (void **)&mgr );
2725 ok( hr == S_OK, "got %08lx\n", hr );
2726 if (hr != S_OK) goto done;
2727
2728 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
2729 ok( hr == S_OK, "got %08lx\n", hr );
2730 if (hr != S_OK) goto done;
2731
2732 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
2733 if (hr != S_OK) goto done;
2734
2735 hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
2736 ok( hr == S_OK, "got %08lx\n", hr );
2737
2738done:
2739 if (policy) INetFwPolicy_Release( policy );
2740 if (profile) INetFwProfile_Release( profile );
2741 if (mgr) INetFwMgr_Release( mgr );
2742 if (SUCCEEDED( init )) CoUninitialize();
2743 return (enabled == VARIANT_TRUE);
2744}
2745
2747{
2751
2753{
2754 HRESULT hr, init;
2755 INetFwMgr *mgr = NULL;
2761
2763 {
2765 return E_FAIL;
2766 }
2768
2769 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
2770 (void **)&mgr );
2771 ok( hr == S_OK, "got %08lx\n", hr );
2772 if (hr != S_OK) goto done;
2773
2774 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
2775 ok( hr == S_OK, "got %08lx\n", hr );
2776 if (hr != S_OK) goto done;
2777
2778 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
2779 if (hr != S_OK) goto done;
2780
2781 hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
2782 ok( hr == S_OK, "got %08lx\n", hr );
2783 if (hr != S_OK) goto done;
2784
2785 hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
2786 &IID_INetFwAuthorizedApplication, (void **)&app );
2787 ok( hr == S_OK, "got %08lx\n", hr );
2788 if (hr != S_OK) goto done;
2789
2790 hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
2791 if (hr != S_OK) goto done;
2792
2793 name = SysAllocString( L"rpcrt4_test" );
2794 hr = INetFwAuthorizedApplication_put_Name( app, name );
2796 ok( hr == S_OK, "got %08lx\n", hr );
2797 if (hr != S_OK) goto done;
2798
2799 if (op == APP_ADD)
2800 hr = INetFwAuthorizedApplications_Add( apps, app );
2801 else if (op == APP_REMOVE)
2802 hr = INetFwAuthorizedApplications_Remove( apps, image );
2803 else
2804 hr = E_INVALIDARG;
2805
2806done:
2807 if (app) INetFwAuthorizedApplication_Release( app );
2808 if (apps) INetFwAuthorizedApplications_Release( apps );
2809 if (policy) INetFwPolicy_Release( policy );
2810 if (profile) INetFwProfile_Release( profile );
2811 if (mgr) INetFwMgr_Release( mgr );
2812 if (SUCCEEDED( init )) CoUninitialize();
2814 return hr;
2815}
2816
2818{
2819 ULONG size = 0;
2820 int argc;
2821 char **argv;
2822 BOOL firewall_enabled = is_firewall_enabled(), firewall_disabled = FALSE;
2823
2826
2827 ok(!GetUserNameExA(NameSamCompatible, NULL, &size), "GetUserNameExA\n");
2829 ok(GetUserNameExA(NameSamCompatible, domain_and_user, &size), "GetUserNameExA\n");
2830
2832 progname = argv[0];
2833
2834 if (argc == 3)
2835 {
2837 {
2838 client(argv[2]);
2839 }
2841 {
2842 trace("Exception %d\n", RpcExceptionCode());
2843 }
2845 }
2846 else if (argc == 4)
2847 {
2848 if (!strcmp(argv[3], "listen"))
2849 {
2851 }
2852 else if(!strcmp(argv[2], "run"))
2853 {
2854 ULONG event;
2855 sscanf(argv[3], "%lx", &event);
2857 }
2858 }
2859 else
2860 {
2861 if (firewall_enabled)
2862 {
2863 if (is_process_elevated())
2864 {
2866 if (hr == S_OK)
2867 {
2868 firewall_enabled = FALSE;
2869 firewall_disabled = TRUE;
2870 }
2871 else
2872 {
2873 skip("can't authorize app in firewall %08lx\n", hr);
2874 }
2875 }
2876 else
2877 {
2878 trace("no privileges, skipping tests to avoid firewall dialog\n");
2879 }
2880 }
2881
2882 if (!firewall_enabled) server();
2883
2884 /* Those tests cause occasional crashes on winxp and win2k3 */
2885 if (GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "RpcExceptionFilter"))
2887 else
2888 win_skip("Skipping reconnect tests on too old Windows version\n");
2889
2890 run_client("test listen");
2891 if (firewall_disabled) set_firewall(APP_REMOVE);
2892 }
2893
2895}
static int argc
Definition: ServiceArgs.c:12
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __cdecl
Definition: accygwin.h:79
struct outqueuenode * tail
Definition: adnsresfilter.c:66
static void startup(void)
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:73
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
void ls(int argc, const char *argv[])
Definition: cmds.c:1136
int null(void)
Definition: ftp.c:1794
#define ARRAY_SIZE(A)
Definition: main.h:20
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
Definition: util.c:55
static HANDLE thread
Definition: service.c:33
#define ULongToHandle(h)
Definition: basetsd.h:75
Definition: list.h:37
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
void __RPC_USER MIDL_user_free(void __RPC_FAR *ptr)
Definition: dhcpcsvc.c:30
void __RPC_FAR *__RPC_USER MIDL_user_allocate(SIZE_T len)
Definition: dhcpcsvc.c:25
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT op
Definition: effect.c:236
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
static const WCHAR ca[]
Definition: main.c:457
#define CloseHandle
Definition: compat.h:739
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
OLECHAR * BSTR
Definition: compat.h:2293
#define GetCurrentProcess()
Definition: compat.h:759
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define lstrlenW
Definition: compat.h:750
static const WCHAR * get_filename(const WCHAR *name, const WCHAR *endptr)
Definition: module.c:70
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4749
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
GUID guid
Definition: version.c:147
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
USHORT port
Definition: uri.c:228
unsigned char
Definition: typeof.h:29
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
firewall_op
Definition: dplayx.c:6737
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
size_t total
GLuint start
Definition: gl.h:1545
GLint level
Definition: gl.h:1546
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
struct _cl_event * event
Definition: glext.h:7739
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLdouble n
Definition: glext.h:7729
GLuint address
Definition: glext.h:9393
GLuint GLuint * names
Definition: glext.h:11545
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLdouble GLdouble z
Definition: glext.h:5874
const GLfloat * m
Definition: glext.h:10848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define ss
Definition: i386-dis.c:441
#define cs
Definition: i386-dis.c:442
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define e
Definition: ke_i.h:82
#define profile
Definition: kernel32.h:12
#define wine_dbgstr_w
Definition: kernel32.h:34
GLint x0
Definition: linetemp.h:95
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
#define ros_skip_flaky
Definition: minitest.h:84
#define win_skip
Definition: minitest.h:67
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
#define todo_wine
Definition: minitest.h:80
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define for
Definition: utility.h:88
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
static HANDLE ULONG_PTR DWORD threads
Definition: process.c:81
static const WCHAR sp[]
Definition: suminfo.c:287
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:91
static void test_handle_return(void)
Definition: server.c:2110
int __cdecl s_sum_unique_conf_ptr(int *x, int n)
Definition: server.c:580
int __cdecl s_sum_toplev_conf_2n(int *x, int n)
Definition: server.c:783
static float int float int float int x3
Definition: server.c:79
void __cdecl s_get_namesw(int *n, wstr_array_t *names)
Definition: server.c:916
int __cdecl s_sum_chars(int a, chars_t x, chars_t y)
Definition: server.c:369
int __cdecl s_sum_ifif(int x0, float y0, int x1, float y1)
Definition: server.c:394
static DWORD WINAPI basic_tests_thread(void *arg)
Definition: server.c:2644
int __cdecl s_sum_iidd(int x0, int y0, double x1, double y1)
Definition: server.c:399
int __cdecl s_sum_var_array(int x[20], int n)
Definition: server.c:585
static float int float int float int float int x4
Definition: server.c:79
static int pints_t pn[]
Definition: server.c:148
static const char * client_test_name
Definition: server.c:44
static void set_interp_interface(void)
Definition: server.c:280
void __RPC_USER bstr_t_UserFree(ULONG *flags, bstr_t *b)
Definition: server.c:1719
int __cdecl s_sum_doub_carr(doub_carr_t *dc)
Definition: server.c:846
signed char __cdecl s_sum_char(signed char x, signed char y)
Definition: server.c:334
int __cdecl s_sum_dbls(int a, dbls_t x, dbls_t y)
Definition: server.c:384
static void test_server_listening(void)
Definition: server.c:2529
void __cdecl s_get_ranged_enum(renum_t *re)
Definition: server.c:970
int __cdecl s_str_length(const char *s)
Definition: server.c:449
int __cdecl s_sum_hyper_int(hyper x, hyper y)
Definition: server.c:359
static int double int int double int int double int int double int int double int int double int int double int int double int int x17
Definition: server.c:83
void __cdecl s_Shutdown(handle_t binding)
Definition: server.c:1302
void __cdecl s_stop_autolisten(void)
Definition: server.c:1173
void __cdecl s_full_pointer_test(int *a, int *b)
Definition: server.c:1144
static int y0
Definition: server.c:75
int __cdecl s_sum_conf_array(int x[], int n)
Definition: server.c:548
int __cdecl s_dot_two_vectors(vector_t vs[2])
Definition: server.c:631
unsigned char *__RPC_USER us_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
Definition: server.c:1677
int __cdecl s_echo_ranged_int(int i, int j, int k)
Definition: server.c:960
static doub_carr_t ** dc
Definition: server.c:139
int __cdecl s_sum_iiff(int x0, int y0, float x1, float y1)
Definition: server.c:389
static double int double int double int double int double int double int double int double int double y8
Definition: server.c:82
int __cdecl s_sum_parr(int *a[3])
Definition: server.c:746
static int double int int double int int double int int double int int double int int double int int double int int x15
Definition: server.c:83
int __cdecl s_sum_cpuints(cpuints_t *p)
Definition: server.c:699
ULONG __RPC_USER puint_t_UserSize(ULONG *flags, ULONG start, puint_t *p)
Definition: server.c:1632
int __cdecl s_sum_ints(int a, ints_t x, ints_t y)
Definition: server.c:374
#define INT_CODE
Definition: server.c:42
int __cdecl s_sum_ididididididididididid(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6, int x7, double y7, int x8, double y8)
Definition: server.c:424
static RPC_BINDING_HANDLE binding
Definition: server.c:166
static void pointer_tests(void)
Definition: server.c:1725
int __cdecl s_wstr_struct_len(wstr_struct_t *s)
Definition: server.c:841
double __cdecl s_square_encue(encue_t *eue)
Definition: server.c:772
int __cdecl s_getNum(int a, handle_t binding)
Definition: server.c:1296
int __cdecl s_sum_cps(cps_t *cps)
Definition: server.c:648
static int j
Definition: server.c:151
int __cdecl s_sum_pcarr(int *a[], int n)
Definition: server.c:751
s123_t *__cdecl s_get_s123(void)
Definition: server.c:944
int __cdecl s_sum_padded_conf(padded_t *ps, int n)
Definition: server.c:817
int __cdecl s_sum_iyiy(int x0, hyper y0, int x1, hyper y1)
Definition: server.c:434
static cpsc_t * cpsc
Definition: server.c:111
int __cdecl s_sum_char_hyper(signed char x, hyper y)
Definition: server.c:364
static HRESULT set_firewall(enum firewall_op op)
Definition: server.c:2752
static int size
Definition: server.c:148
#define SERVER_FUNCTIONS
Definition: server.c:168
static float int float int float int float int float int x5
Definition: server.c:79
static void basic_tests(void)
Definition: server.c:1343
static void run_server(HANDLE ready_event)
Definition: server.c:2611
int __cdecl s_sum_pcarr2(int n, int **pa)
Definition: server.c:930
static unencu_t * eu
Definition: server.c:121
void __cdecl s_get_name(name_t *name)
Definition: server.c:893
int __cdecl s_test_list_length(test_list_t *list)
Definition: server.c:528
void __cdecl s_get_a_bstr(bstr_t *b)
Definition: server.c:884
static void array_tests(void)
Definition: server.c:1862
static double float double int float double float int float double float int double int float z5
Definition: server.c:81
double __cdecl s_square_unencu(int t, unencu_t *eu)
Definition: server.c:730
int __cdecl s_sum_sp(sp_t *sp)
Definition: server.c:510
static void NDR_RUNDOWN
Definition: server.c:50
int __cdecl s_dot_pvectors(pvectors_t *p)
Definition: server.c:505
static int double int int double int int double int int double int int double int int double int int x13
Definition: server.c:83
static DWORD CALLBACK test_I_RpcBindingInqLocalClientPID_thread_func(void *args)
Definition: server.c:1221
#define PORT
Definition: server.c:39
unsigned char *__RPC_USER puint_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
Definition: server.c:1646
@ APP_REMOVE
Definition: server.c:2749
@ APP_ADD
Definition: server.c:2748
#define PIPE
Definition: server.c:40
unsigned char *__RPC_USER bstr_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
Definition: server.c:1708
static void union_tests(void)
Definition: server.c:1546
static float int float int float int float int float int float int float y6
Definition: server.c:79
static void void ULONG
Definition: server.c:50
int __cdecl s_add(handle_t binding, int a, int b)
Definition: server.c:1290
static double int double int double int double int double int double int double int double y7
Definition: server.c:82
unsigned char *__RPC_USER us_t_UserMarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
Definition: server.c:1668
static void make_cmdline(char buffer[MAX_PATH], const char *test)
Definition: server.c:1320
static float int float int float int float int float int float int x6
Definition: server.c:79
static NDR_SCONTEXT
Definition: server.c:50
int __cdecl s_sum_toplev_conf_cond(int *x, int a, int b, int c)
Definition: server.c:792
static DWORD WINAPI listen_test_client_thread(void *binding)
Definition: server.c:2456
static vector_t v
Definition: server.c:119
static int n
Definition: server.c:88
static void free_pyramid_doub_carr(doub_carr_t *dc)
Definition: server.c:1853
float __cdecl s_square_half_float(float x, float *y)
Definition: server.c:478
void __cdecl s_full_pointer_null_test(int *a, int *b)
Definition: server.c:1151
static int double int int double int int double int int double int int double int int x11
Definition: server.c:83
hyper __cdecl s_sum_hyper(hyper x, hyper y)
Definition: server.c:354
static int int b
Definition: server.c:128
void __cdecl s_check_null(int *null)
Definition: server.c:831
static str_array_t * names
Definition: server.c:143
double __cdecl s_sum_aligns(aligns_t *a)
Definition: server.c:802
static void test_reconnect(void)
Definition: server.c:2650
static HANDLE stop_wait_event
Definition: server.c:47
static double float double int float double float int float double float z4
Definition: server.c:81
int __cdecl s_sum_ififififififif(int x0, float y0, int x1, float y1, int x2, float y2, int x3, float y3, int x4, float y4, int x5, float y5, int x6, float y6)
Definition: server.c:409
short __cdecl s_sum_short(short x, short y)
Definition: server.c:339
double __cdecl s_square_half(double x, double *y)
Definition: server.c:472
void __RPC_USER us_t_UserFree(ULONG *flags, us_t *pus)
Definition: server.c:1687
int __cdecl s_sum_padded(padded_t *p)
Definition: server.c:807
int __cdecl s_enum_ord(e_t e)
Definition: server.c:759
static void test_stop_wait_for_call(unsigned char *binding)
Definition: server.c:2484
void __cdecl s_square_out(int x, int *y)
Definition: server.c:439
fnprintf * p_printf
Definition: server.c:278
static float int float int float int float int float int float y5
Definition: server.c:79
static test_list_t * null_list(void)
Definition: server.c:1606
static s123_t *__cdecl * get_s123(void)
static double int double int double int double int double int double int double int double int x8
Definition: server.c:82
static int * n2_then_x1
Definition: server.c:102
int __cdecl s_square_test_us(test_us_t *tus)
Definition: server.c:713
static double int double int double int double int double int double int double int x7
Definition: server.c:82
int __cdecl s_sum_puints(puints_t *p)
Definition: server.c:690
static char * domain_and_user
Definition: server.c:58
static float int float int float int float y3
Definition: server.c:79
double __cdecl s_square_encu(encu_t *eu)
Definition: server.c:719
static double float double int float z1
Definition: server.c:81
int __cdecl s_pints_sum(pints_t *pints)
Definition: server.c:495
static HANDLE stop_event
Definition: server.c:47
int __cdecl s_sum_cs(cs_t *cs)
Definition: server.c:643
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_SECURITY_QOS *static RPC_AUTH_KEY_RETRIEVAL_FN
Definition: server.c:56
static BOOL old_windows_version
Definition: server.c:45
void __cdecl s_get_numbers(int length, int size, pints_t n[])
Definition: server.c:1115
static int float x1
Definition: server.c:75
static void set_mixed_interface(void)
Definition: server.c:287
static int double int int double int int double int int double int int x9
Definition: server.c:83
static BOOL is_process_elevated(void)
Definition: server.c:2697
static int double int int double int int double int int double int int double int int double int int double int x14
Definition: server.c:83
int __cdecl s_str_t_length(str_t s)
Definition: server.c:454
static unsigned(__cdecl *hash_bstr)(bstr_t s)
static int y
Definition: server.c:62
static double float double int float double float int float z3
Definition: server.c:81
static HANDLE create_server_process(void)
Definition: server.c:2585
int __cdecl s_sum_array_ptr(int(*a)[2])
Definition: server.c:1195
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_CSTR
Definition: server.c:54
static vector_t * vs
Definition: server.c:146
str_t __cdecl s_get_filename(void)
Definition: server.c:953
static int a
Definition: server.c:128
void __cdecl s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc)
Definition: server.c:856
int __cdecl s_sum_iidiidiidiidiidiidiidiidiidiidiid(int x0, int x1, double y0, int x2, int x3, double y1, int x4, int x5, double y2, int x6, int x7, double y3, int x8, int x9, double y4, int x10, int x11, double y5, int x12, int x13, double y6, int x14, int x15, double y7, int x16, int x17, double y8)
Definition: server.c:429
int __cdecl s_sum_double_int(int x, double y)
Definition: server.c:349
int __cdecl s_sum_flts(int a, flts_t x, flts_t y)
Definition: server.c:379
static rint_t(__cdecl *echo_ranged_int)(int i
int __cdecl s_sum(int x, int y)
Definition: server.c:329
#define test_is_server_listening2(a, b, c)
Definition: server.c:2156
static void run_client(const char *test)
Definition: server.c:1326
static float int float int float y2
Definition: server.c:79
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_SECURITY_QOS *static LPVOID
Definition: server.c:56
static double float double int float double float z2
Definition: server.c:81
void __RPC_USER puint_t_UserFree(ULONG *flags, puint_t *p)
Definition: server.c:1656
int __cdecl s_sum_idfdifdfifdfidifdidf(int x0, double y0, float z0, double y1, int x1, float z1, double y2, float z2, int x2, float z3, double y3, float z4, int x3, double y4, int x4, float z5, double y5, int x5, double y6, float z6)
Definition: server.c:419
void __RPC_USER ctx_handle_t_rundown(ctx_handle_t ctx_handle)
Definition: server.c:1314
void __cdecl s_get_numbers_struct(numbers_struct_t **ns)
Definition: server.c:1127
unsigned char *__RPC_USER puint_t_UserMarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
Definition: server.c:1638
ctx_handle_t __cdecl s_get_handle(void)
Definition: server.c:1200
static float int float int float int float int float y4
Definition: server.c:79
void __cdecl s_get_names(int *n, str_array_t *names)
Definition: server.c:902
int __cdecl s_echo_ranged_int2(int i)
Definition: server.c:965
void __cdecl s_square_ref(int *x)
Definition: server.c:444
int __cdecl s_cstr_length(const char *s, int n)
Definition: server.c:459
static int double int int double int int double int int double int int double int x10
Definition: server.c:83
static int ** pa
Definition: server.c:145
static int int k
Definition: server.c:151
static DWORD WINAPI wait_listen_proc(void *arg)
Definition: server.c:2472
int __cdecl s_str_struct_len(str_struct_t *s)
Definition: server.c:836
static int float float y1
Definition: server.c:75
static str_t(__cdecl *get_filename)(void)
static PROCESS_INFORMATION client_info
Definition: server.c:48
int __cdecl s_sum_ididididididid(int x0, double y0, int x1, double y1, int x2, double y2, int x3, double y3, int x4, double y4, int x5, double y5, int x6, double y6)
Definition: server.c:414
static UUID RPC_MGR_EPV unsigned int
Definition: server.c:52
static int double int int double int int double int int double int int double int int double int x12
Definition: server.c:83
int __cdecl s_sum_bogus(bogus_t *b)
Definition: server.c:826
int __cdecl s_sum_fixed_int_3d(int m[2][3][4])
Definition: server.c:535
static double float double int float double float int float double float int double int float double int double float z6
Definition: server.c:81
void __cdecl s_check_se2(se_t *s)
Definition: server.c:741
static int double int int double int int double int int double int int double int int double int int double int int double int x16
Definition: server.c:83
int __cdecl s_dot_copy_vectors(vector_t u, vector_t v)
Definition: server.c:708
ULONG __RPC_USER us_t_UserSize(ULONG *flags, ULONG start, us_t *pus)
Definition: server.c:1662
static void server(void)
Definition: server.c:2301
int __cdecl s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2)
Definition: server.c:559
static BOOL is_firewall_enabled(void)
Definition: server.c:2713
int __cdecl s_sum_complex_array(int n, refpint_t pi[])
Definition: server.c:593
LONG __cdecl s_square_half_long(LONG x, LONG *y)
Definition: server.c:484
static void run_tests(void)
Definition: server.c:2121
int __cdecl s_sum_float(float x, float y)
Definition: server.c:344
static float(__cdecl *square_half_float)(float x
static float int float int x2
Definition: server.c:79
static const char * progname
Definition: server.c:44
void __cdecl s_test_handle(ctx_handle_t ctx_handle)
Definition: server.c:1210
static int int int c
Definition: server.c:128
static chars_t x
Definition: server.c:71
void __cdecl s_get_number_array(int x[20], int *n)
Definition: server.c:636
static ctx_handle_t(__cdecl *get_handle)(void)
int __cdecl s_sum_container(cs_container_t *container)
Definition: server.c:621
static void _test_is_server_listening2(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status, RPC_STATUS expected_status2)
Definition: server.c:2157
int __cdecl s_sum_padded2(padded_t ps[2])
Definition: server.c:812
static refpint_t pi[]
Definition: server.c:112
int __cdecl s_int_return(void)
Definition: server.c:319
void __cdecl s_test_I_RpcBindingInqLocalClientPID(unsigned int protseq, RPC_BINDING_HANDLE binding)
Definition: server.c:1244
static int check_pyramid_doub_carr(doub_carr_t *dc)
Definition: server.c:1842
static test_list_t * make_list(test_list_t *tail)
Definition: server.c:1615
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_AUTH_IDENTITY_HANDLE
Definition: server.c:55
int __cdecl s_sum_blob(cs_blob_t *blob)
Definition: server.c:601
int __cdecl s_sum_fixed_array(int a[5])
Definition: server.c:490
void __cdecl s_get_handle_by_ptr(ctx_handle_t *r)
Definition: server.c:1205
int __cdecl s_sum_data(cs_data_t *data)
Definition: server.c:611
unsigned char *__RPC_USER bstr_t_UserMarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
Definition: server.c:1699
int __cdecl s_sum_cpsc(cpsc_t *cpsc)
Definition: server.c:662
#define test_is_server_listening(a, b)
Definition: server.c:2147
double __cdecl s_square_sun(sun_t *su)
Definition: server.c:515
int __cdecl s_dot_self(vector_t *v)
Definition: server.c:467
unsigned __cdecl s_hash_bstr(bstr_t b)
Definition: server.c:873
static int secure
Definition: server.c:157
double __cdecl s_ptypes_sum(ptypes_t *pt)
Definition: server.c:500
static void InitFunctionPointers(void)
Definition: server.c:294
int __cdecl s_sum_unique_conf_array(int x[], int n)
Definition: server.c:575
static void free_list(test_list_t *list)
Definition: server.c:1624
void __cdecl s_context_handle_test(void)
Definition: server.c:975
static double float z0
Definition: server.c:81
void __cdecl s_authinfo_test(unsigned int protseq, int secure)
Definition: server.c:2038
int __cdecl s_sum_L1_norms(int n, vector_t *vs)
Definition: server.c:935
static void set_auth_info(RPC_BINDING_HANDLE handle)
Definition: server.c:2132
int __cdecl s_square_puint(puint_t p)
Definition: server.c:684
int __cdecl s_sum_idid(int x0, double y0, int x1, double y1)
Definition: server.c:404
ULONG __RPC_USER bstr_t_UserSize(ULONG *flags, ULONG start, bstr_t *b)
Definition: server.c:1693
void __cdecl s_ip_test(ipu_t *a)
Definition: server.c:1181
static void _test_is_server_listening(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status)
Definition: server.c:2148
int __cdecl s_get_cpsc(int n, cpsc_t *cpsc)
Definition: server.c:671
int __cdecl s_sum_ptr_array(int *a[2])
Definition: server.c:1190
void __cdecl s_stop(void)
Definition: server.c:1157
int __cdecl s_square(int x)
Definition: server.c:324
#define min(a, b)
Definition: monoChain.cc:55
#define argv
Definition: mplay32.c:18
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
api
Definition: notification.c:38
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
@ COINIT_MULTITHREADED
Definition: objbase.h:279
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
long LONG
Definition: pedump.c:60
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
#define calloc
Definition: rosglue.h:14
#define list
Definition: rosglue.h:35
#define test
Definition: rosglue.h:37
int n1
Definition: dwarfget.c:147
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:769
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE *ServerBinding)
Definition: rpc_binding.c:1628
RPC_STATUS WINAPI RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR *ObjUuid, RPC_CSTR *Protseq, RPC_CSTR *NetworkAddr, RPC_CSTR *Endpoint, RPC_CSTR *Options)
Definition: rpc_binding.c:547
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1445
RPC_STATUS WINAPI RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr, RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR *StringBinding)
Definition: rpc_binding.c:440
RPC_STATUS WINAPI RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding)
Definition: rpc_binding.c:902
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc, ULONG Flags)
Definition: rpc_binding.c:1578
RPC_STATUS WINAPI I_RpcBindingInqLocalClientPID(RPC_BINDING_HANDLE ClientBinding, ULONG *ClientPID)
Definition: rpc_binding.c:1969
RPC_STATUS WINAPI RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:822
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1038
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, ULONG *AuthzSvc)
Definition: rpc_binding.c:1554
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1520
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1116
RPC_STATUS WINAPI RpcMgmtWaitServerListen(void)
Definition: rpc_server.c:1539
RPC_STATUS WINAPI RpcServerUseProtseqEpA(RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:910
RPC_STATUS WINAPI RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1704
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1743
RPC_STATUS WINAPI RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
Definition: rpc_server.c:1202
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596
const WCHAR * str
#define RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH
Definition: rpcdce.h:185
#define RPC_C_QOS_IDENTITY_STATIC
Definition: rpcdce.h:180
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
I_RPC_HANDLE RPC_BINDING_HANDLE
Definition: rpcdce.h:50
#define RPC_PROTSEQ_NMP
Definition: rpcdce.h:126
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
void * RPC_AUTHZ_HANDLE
Definition: rpcdce.h:48
#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY
Definition: rpcdce.h:151
void * RPC_IF_HANDLE
Definition: rpcdce.h:49
#define RPC_PROTSEQ_TCP
Definition: rpcdce.h:125
#define RPC_MGR_EPV
Definition: rpcdce.h:53
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
#define RPC_C_IMP_LEVEL_IMPERSONATE
Definition: rpcdce.h:176
RPC_STATUS RPC_ENTRY RPC_IF_CALLBACK_FN(RPC_IF_HANDLE InterfaceUuid, void *Context)
Definition: rpcdce.h:211
#define RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH
Definition: rpcdce.h:317
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
#define RPC_PROTSEQ_LRPC
Definition: rpcdce.h:127
struct _RPC_SERVER_INTERFACE RPC_SERVER_INTERFACE
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:68
INT64 hyper
Definition: rpcndr.h:77
#define RPC_S_INVALID_ARG
Definition: rpcnterr.h:23
#define RPC_S_OK
Definition: rpcnterr.h:22
#define RPC_S_ACCESS_DENIED
Definition: rpcnterr.h:29
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:293
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:164
@ Shutdown
Definition: sacdrv.h:267
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
#define RpcEndExcept
Definition: rpc.h:123
#define midl_user_free
Definition: rpc.h:41
#define __RPC_FAR
Definition: rpc.h:52
#define RpcTryExcept
Definition: rpc.h:121
#define RpcExcept(expr)
Definition: rpc.h:122
long RPC_STATUS
Definition: rpc.h:48
#define __RPC_USER
Definition: rpc.h:61
#define RpcExceptionCode()
Definition: rpc.h:127
#define midl_user_allocate
Definition: rpc.h:40
strcpy
Definition: string.h:131
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
Definition: test.h:177
#define memset(x, y, z)
Definition: compat.h:39
static FILE * client
Definition: client.c:37
int fnprintf(const char *format,...)
Definition: server.idl:48
#define SUN_I
#define SUN_PI
#define ENCU_F
#define SUN_F2
#define SUN_F1
#define TL_LIST
#define ENCU_I
#define TL_NULL
HRESULT hr
Definition: shlfolder.c:183
const char * ws
Definition: skip_ws.cpp:7
BOOLEAN WINAPI GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:1044
TCHAR * cmdline
Definition: stretchblt.cpp:32
__crt_unique_heap_ptr< wchar_t > const wstring(_malloc_crt_t(wchar_t, maxsize))
ULONG ImpersonationType
Definition: rpcdce.h:267
ULONG Capabilities
Definition: rpcdce.h:265
ULONG IdentityTracking
Definition: rpcdce.h:266
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:104
Definition: match.c:390
Definition: image.c:134
Definition: oleaut.c:84
Definition: nis.h:10
Definition: _hash_fun.h:40
Definition: parser.c:49
Definition: name.c:39
WCHAR * name
Definition: name.c:42
Definition: mxnamespace.c:45
Definition: send.c:48
Definition: ps.c:97
RPC_BINDING_HANDLE binding
Definition: server.c:1218
unsigned int protseq
Definition: server.c:1217
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFUSBPIPE PIPE
Definition: wdfusb.h:2237
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WAIT_OBJECT_0
Definition: winbase.h:383
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define WINAPI
Definition: msvc.h:6
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1370
#define RPC_S_NO_CALL_ACTIVE
Definition: winerror.h:1392
#define RPC_S_ALREADY_LISTENING
Definition: winerror.h:1380
#define RPC_S_BINDING_HAS_NO_AUTH
Definition: winerror.h:1411
#define RPC_S_CANNOT_SUPPORT
Definition: winerror.h:1429
#define RPC_S_NOT_LISTENING
Definition: winerror.h:1382
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1369
#define RPC_S_UNKNOWN_MGR_TYPE
Definition: winerror.h:1383
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
@ TokenElevationTypeFull
Definition: winnt_old.h:2700
static int init
Definition: wintirpc.c:33
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenElevationType
Definition: setypes.h:995
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180