ReactOS 0.4.15-dev-7918-g2a2556c
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
34#include <stddef.h>
35#include <stdio.h>
36#include <stdlib.h>
37
38#define PORT "4114"
39#define PIPE "\\pipe\\wine_rpcrt4_test"
40
41#define INT_CODE 4198
42
43static const char *progname;
45
47
48static void (WINAPI *pNDRSContextMarshall2)(RPC_BINDING_HANDLE, NDR_SCONTEXT, void*, NDR_RUNDOWN, void*, ULONG);
49static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*, ULONG, void*, ULONG);
50static RPC_STATUS (WINAPI *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, RPC_MGR_EPV*, unsigned int,
51 unsigned int,RPC_IF_CALLBACK_FN*);
52static RPC_STATUS (WINAPI *pRpcBindingSetAuthInfoExA)(RPC_BINDING_HANDLE, RPC_CSTR, ULONG, ULONG,
54static RPC_STATUS (WINAPI *pRpcServerRegisterAuthInfoA)(RPC_CSTR, ULONG, RPC_AUTH_KEY_RETRIEVAL_FN, LPVOID);
55
56static char *domain_and_user;
57
58static int (__cdecl *int_return)(void);
59static int (__cdecl *square)(int x);
60static int (__cdecl *sum)(int x, int y);
61static signed char (__cdecl *sum_char)(signed char x, signed char y);
62static short (__cdecl *sum_short)(short x, short y);
63static int (__cdecl *sum_float)(float x, float y);
64static int (__cdecl *sum_double_int)(int x, double y);
65static hyper (__cdecl *sum_hyper)(hyper x, hyper y);
66static int (__cdecl *sum_hyper_int)(hyper x, hyper y);
67static int (__cdecl *sum_char_hyper)(signed char x, hyper y);
68static void (__cdecl *square_out)(int x, int *y);
69static void (__cdecl *square_ref)(int *x);
70static int (__cdecl *str_length)(const char *s);
71static int (__cdecl *str_t_length)(str_t s);
72static int (__cdecl *cstr_length)(const char *s, int n);
73static int (__cdecl *dot_self)(vector_t *v);
74static double (__cdecl *square_half)(double x, double *y);
75static float (__cdecl *square_half_float)(float x, float *y);
76static LONG (__cdecl *square_half_long)(LONG x, LONG *y);
77static int (__cdecl *sum_fixed_array)(int a[5]);
78static int (__cdecl *pints_sum)(pints_t *pints);
79static double (__cdecl *ptypes_sum)(ptypes_t *ptypes);
80static int (__cdecl *dot_pvectors)(pvectors_t *pvectors);
81static int (__cdecl *sum_sp)(sp_t *sp);
82static double (__cdecl *square_sun)(sun_t *su);
83static int (__cdecl *test_list_length)(test_list_t *ls);
84static int (__cdecl *sum_fixed_int_3d)(int m[2][3][4]);
85static int (__cdecl *sum_conf_array)(int x[], int n);
86static int (__cdecl *sum_conf_ptr_by_conf_ptr)(int n1, int *n2_then_x1, int *x2);
87static int (__cdecl *sum_unique_conf_array)(int x[], int n);
88static int (__cdecl *sum_unique_conf_ptr)(int *x, int n);
89static int (__cdecl *sum_var_array)(int x[20], int n);
90static int (__cdecl *dot_two_vectors)(vector_t vs[2]);
91static void (__cdecl *get_number_array)(int x[20], int *n);
92static int (__cdecl *sum_cs)(cs_t *cs);
93static int (__cdecl *sum_cps)(cps_t *cps);
94static int (__cdecl *sum_cpsc)(cpsc_t *cpsc);
95static int (__cdecl *get_cpsc)(int n, cpsc_t *cpsc);
96static int (__cdecl *sum_complex_array)(int n, refpint_t pi[]);
97static int (__cdecl *square_puint)(puint_t p);
98static int (__cdecl *sum_puints)(puints_t *p);
99static int (__cdecl *sum_cpuints)(cpuints_t *p);
100static int (__cdecl *dot_copy_vectors)(vector_t u, vector_t v);
101static double (__cdecl *square_encu)(encu_t *eu);
102static double (__cdecl *square_unencu)(int t, unencu_t *eu);
103static int (__cdecl *sum_parr)(int *a[3]);
104static int (__cdecl *sum_pcarr)(int *a[], int n);
105static int (__cdecl *enum_ord)(e_t e);
106static double (__cdecl *square_encue)(encue_t *eue);
107static void (__cdecl *check_se2)(se_t *s);
108static int (__cdecl *sum_toplev_conf_2n)(int *x, int n);
109static int (__cdecl *sum_toplev_conf_cond)(int *x, int a, int b, int c);
110static int (__cdecl *square_test_us)(test_us_t *tus);
111static double (__cdecl *sum_aligns)(aligns_t *a);
112static int (__cdecl *sum_padded)(padded_t *p);
113static int (__cdecl *sum_padded2)(padded_t ps[2]);
114static int (__cdecl *sum_padded_conf)(padded_t *ps, int n);
115static int (__cdecl *sum_bogus)(bogus_t *b);
116static void (__cdecl *check_null)(int *null);
117static int (__cdecl *str_struct_len)(str_struct_t *s);
118static int (__cdecl *wstr_struct_len)(wstr_struct_t *s);
119static int (__cdecl *sum_doub_carr)(doub_carr_t *dc);
120static void (__cdecl *make_pyramid_doub_carr)(unsigned char n, doub_carr_t **dc);
121static unsigned (__cdecl *hash_bstr)(bstr_t s);
122static void (__cdecl *get_a_bstr)(bstr_t *s);
123static void (__cdecl *get_name)(name_t *name);
124static void (__cdecl *get_names)(int *n, str_array_t *names);
125static void (__cdecl *get_namesw)(int *n, wstr_array_t *names);
126static int (__cdecl *sum_pcarr2)(int n, int **pa);
127static int (__cdecl *sum_L1_norms)(int n, vector_t *vs);
128static s123_t* (__cdecl *get_s123)(void);
129static void (__cdecl *get_numbers)(int length, int size, pints_t pn[]);
130static void (__cdecl *get_numbers_struct)(numbers_struct_t **ns);
132static rint_t (__cdecl *echo_ranged_int)(int i, int j, int k);
133static rint_t (__cdecl *echo_ranged_int2)(int i);
134static void (__cdecl *get_ranged_enum)(renum_t *re);
135static void (__cdecl *context_handle_test)(void);
136static void (__cdecl *full_pointer_test)(int *a, int *b);
137static void (__cdecl *full_pointer_null_test)(int *a, int *b);
138static void (__cdecl *authinfo_test)(unsigned int protseq, int secure);
139static void (__cdecl *stop)(void);
140static void (__cdecl *stop_autolisten)(void);
141static void (__cdecl *ip_test)(ipu_t *a);
142static int (__cdecl *sum_ptr_array)(int *a[2]);
143static int (__cdecl *sum_array_ptr)(int (*a)[2]);
144static ctx_handle_t (__cdecl *get_handle)(void);
145static void (__cdecl *get_handle_by_ptr)(ctx_handle_t *r);
146static void (__cdecl *test_handle)(ctx_handle_t ctx_handle);
147
148#define SERVER_FUNCTIONS \
149 X(int_return) \
150 X(square) \
151 X(sum) \
152 X(sum_char) \
153 X(sum_short) \
154 X(sum_float) \
155 X(sum_double_int) \
156 X(sum_hyper) \
157 X(sum_hyper_int) \
158 X(sum_char_hyper) \
159 X(square_out) \
160 X(square_ref) \
161 X(str_length) \
162 X(str_t_length) \
163 X(cstr_length) \
164 X(dot_self) \
165 X(square_half) \
166 X(square_half_float) \
167 X(square_half_long) \
168 X(sum_fixed_array) \
169 X(pints_sum) \
170 X(ptypes_sum) \
171 X(dot_pvectors) \
172 X(sum_sp) \
173 X(square_sun) \
174 X(test_list_length) \
175 X(sum_fixed_int_3d) \
176 X(sum_conf_array) \
177 X(sum_conf_ptr_by_conf_ptr) \
178 X(sum_unique_conf_array) \
179 X(sum_unique_conf_ptr) \
180 X(sum_var_array) \
181 X(dot_two_vectors) \
182 X(get_number_array) \
183 X(sum_cs) \
184 X(sum_cps) \
185 X(sum_cpsc) \
186 X(get_cpsc) \
187 X(sum_complex_array) \
188 X(square_puint) \
189 X(sum_puints) \
190 X(sum_cpuints) \
191 X(dot_copy_vectors) \
192 X(square_encu) \
193 X(square_unencu) \
194 X(sum_parr) \
195 X(sum_pcarr) \
196 X(enum_ord) \
197 X(square_encue) \
198 X(check_se2) \
199 X(sum_toplev_conf_2n) \
200 X(sum_toplev_conf_cond) \
201 X(square_test_us) \
202 X(sum_aligns) \
203 X(sum_padded) \
204 X(sum_padded2) \
205 X(sum_padded_conf) \
206 X(sum_bogus) \
207 X(check_null) \
208 X(str_struct_len) \
209 X(wstr_struct_len) \
210 X(sum_doub_carr) \
211 X(make_pyramid_doub_carr) \
212 X(hash_bstr) \
213 X(get_a_bstr) \
214 X(get_name) \
215 X(get_names) \
216 X(get_namesw) \
217 X(sum_pcarr2) \
218 X(sum_L1_norms) \
219 X(get_s123) \
220 X(get_numbers) \
221 X(get_numbers_struct) \
222 X(get_filename) \
223 X(echo_ranged_int) \
224 X(echo_ranged_int2) \
225 X(get_ranged_enum) \
226 X(context_handle_test) \
227 X(full_pointer_test) \
228 X(full_pointer_null_test) \
229 X(authinfo_test) \
230 X(stop) \
231 X(stop_autolisten) \
232 X(ip_test) \
233 X(sum_ptr_array) \
234 X(sum_array_ptr) \
235 X(get_handle) \
236 X(get_handle_by_ptr) \
237 X(test_handle)
238
239/* type check statements generated in header file */
241
242static const WCHAR helloW[] = { 'H','e','l','l','o',0 };
243static const WCHAR worldW[] = { 'W','o','r','l','d','!',0 };
244
246
247static void set_interp_interface(void)
248{
249 is_interp = TRUE;
250
251#define X(name) name = interp_##name;
253#undef X
254}
255
256static void set_mixed_interface(void)
257{
259
260#define X(name) name = mixed_##name;
262#undef X
263}
264
265static void InitFunctionPointers(void)
266{
267 HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll");
268
269 pNDRSContextMarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextMarshall2");
270 pNDRSContextUnmarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextUnmarshall2");
271 pRpcServerRegisterIfEx = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterIfEx");
272 pRpcBindingSetAuthInfoExA = (void *)GetProcAddress(hrpcrt4, "RpcBindingSetAuthInfoExA");
273 pRpcServerRegisterAuthInfoA = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterAuthInfoA");
274
275 if (!pNDRSContextMarshall2) old_windows_version = TRUE;
276}
277
280{
281 return HeapAlloc(GetProcessHeap(), 0, n);
282}
283
284void __RPC_USER
286{
288}
289
290static char *
291xstrdup(const char *s)
292{
293 char *d = HeapAlloc(GetProcessHeap(), 0, strlen(s) + 1);
294 strcpy(d, s);
295 return d;
296}
297
299{
300 return INT_CODE;
301}
302
304{
305 return x * x;
306}
307
308int __cdecl s_sum(int x, int y)
309{
310 return x + y;
311}
312
313signed char __cdecl s_sum_char(signed char x, signed char y)
314{
315 return x + y;
316}
317
318short __cdecl s_sum_short(short x, short y)
319{
320 return x + y;
321}
322
323int __cdecl s_sum_float(float x, float y)
324{
325 return x + y;
326}
327
328int __cdecl s_sum_double_int(int x, double y)
329{
330 return x + y;
331}
332
334{
335 return x + y;
336}
337
339{
340 return x + y;
341}
342
344{
345 return x + y;
346}
347
348void __cdecl s_square_out(int x, int *y)
349{
350 *y = s_square(x);
351}
352
354{
355 *x = s_square(*x);
356}
357
358int __cdecl s_str_length(const char *s)
359{
360 return strlen(s);
361}
362
364{
365 return strlen(s);
366}
367
368int __cdecl s_cstr_length(const char *s, int n)
369{
370 int len = 0;
371 while (0 < n-- && *s++)
372 ++len;
373 return len;
374}
375
377{
378 return s_square(v->x) + s_square(v->y) + s_square(v->z);
379}
380
381double __cdecl s_square_half(double x, double *y)
382{
383 *y = x / 2.0;
384 return x * x;
385}
386
387float __cdecl s_square_half_float(float x, float *y)
388{
389 *y = x / 2.0f;
390 return x * x;
391}
392
394{
395 *y = x / 2;
396 return x * x;
397}
398
400{
401 return a[0] + a[1] + a[2] + a[3] + a[4];
402}
403
404int __cdecl s_pints_sum(pints_t *pints)
405{
406 return *pints->pi + **pints->ppi + ***pints->pppi;
407}
408
409double __cdecl s_ptypes_sum(ptypes_t *pt)
410{
411 return *pt->pc + *pt->ps + *pt->pl + *pt->pf + *pt->pd;
412}
413
414int __cdecl s_dot_pvectors(pvectors_t *p)
415{
416 return p->pu->x * (*p->pv)->x + p->pu->y * (*p->pv)->y + p->pu->z * (*p->pv)->z;
417}
418
420{
421 return sp->x + sp->s->x;
422}
423
424double __cdecl s_square_sun(sun_t *su)
425{
426 switch (su->s)
427 {
428 case SUN_I: return su->u.i * su->u.i;
429 case SUN_F1:
430 case SUN_F2: return su->u.f * su->u.f;
431 case SUN_PI: return (*su->u.pi) * (*su->u.pi);
432 default:
433 return 0.0;
434 }
435}
436
438{
439 return (list->t == TL_LIST
440 ? 1 + s_test_list_length(list->u.tail)
441 : 0);
442}
443
444int __cdecl s_sum_fixed_int_3d(int m[2][3][4])
445{
446 int i, j, k;
447 int sum = 0;
448
449 for (i = 0; i < 2; ++i)
450 for (j = 0; j < 3; ++j)
451 for (k = 0; k < 4; ++k)
452 sum += m[i][j][k];
453
454 return sum;
455}
456
458{
459 int *p = x, *end = p + n;
460 int sum = 0;
461
462 while (p < end)
463 sum += *p++;
464
465 return sum;
466}
467
469{
470 int i;
471 int sum = 0;
472 if(n1 == 0)
473 return 0;
474
475 for(i = 1; i < n1; ++i)
476 sum += n2_then_x1[i];
477
478 for(i = 0; i < *n2_then_x1; ++i)
479 sum += x2[i];
480
481 return sum;
482}
483
485{
486 return s_sum_conf_array(x, n);
487}
488
490{
491 return x ? s_sum_conf_array(x, n) : 0;
492}
493
494int __cdecl s_sum_var_array(int x[20], int n)
495{
496 ok(0 <= n, "RPC sum_var_array\n");
497 ok(n <= 20, "RPC sum_var_array\n");
498
499 return s_sum_conf_array(x, n);
500}
501
502int __cdecl s_sum_complex_array(int n, refpint_t pi[])
503{
504 int total = 0;
505 for (; n > 0; n--)
506 total += *pi[n - 1];
507 return total;
508}
509
511{
512 return vs[0].x * vs[1].x + vs[0].y * vs[1].y + vs[0].z * vs[1].z;
513}
514
515void __cdecl s_get_number_array(int x[20], int *n)
516{
517 int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
518 memcpy(x, c, sizeof(c));
519 *n = ARRAY_SIZE(c);
520}
521
523{
524 return s_sum_conf_array(cs->ca, cs->n);
525}
526
527int __cdecl s_sum_cps(cps_t *cps)
528{
529 int sum = 0;
530 int i;
531
532 for (i = 0; i < *cps->pn; ++i)
533 sum += cps->ca1[i];
534
535 for (i = 0; i < 2 * cps->n; ++i)
536 sum += cps->ca2[i];
537
538 return sum;
539}
540
542{
543 int sum = 0;
544 int i;
545 for (i = 0; i < (cpsc->c ? cpsc->a : cpsc->b); ++i)
546 sum += cpsc->ca[i];
547 return sum;
548}
549
550int __cdecl s_get_cpsc(int n, cpsc_t *cpsc)
551{
552 int i, ret;
553
554 cpsc->a = 2 * n;
555 cpsc->b = 2;
556 cpsc->c = 1;
557 cpsc->ca = MIDL_user_allocate( cpsc->a * sizeof(int) );
558 for (i = ret = 0; i < cpsc->a; i++) cpsc->ca[i] = i;
559 for (i = ret = 0; i < cpsc->a; i++) ret += cpsc->ca[i];
560 return ret;
561}
562
564{
565 int n = atoi(p);
566 return n * n;
567}
568
569int __cdecl s_sum_puints(puints_t *p)
570{
571 int sum = 0;
572 int i;
573 for (i = 0; i < p->n; ++i)
574 sum += atoi(p->ps[i]);
575 return sum;
576}
577
578int __cdecl s_sum_cpuints(cpuints_t *p)
579{
580 int sum = 0;
581 int i;
582 for (i = 0; i < p->n; ++i)
583 sum += atoi(p->ps[i]);
584 return sum;
585}
586
588{
589 return u.x * v.x + u.y * v.y + u.z * v.z;
590}
591
592int __cdecl s_square_test_us(test_us_t *tus)
593{
594 int n = atoi(tus->us.x);
595 return n * n;
596}
597
598double __cdecl s_square_encu(encu_t *eu)
599{
600 switch (eu->t)
601 {
602 case ENCU_I: return eu->tagged_union.i * eu->tagged_union.i;
603 case ENCU_F: return eu->tagged_union.f * eu->tagged_union.f;
604 default:
605 return 0.0;
606 }
607}
608
609double __cdecl s_square_unencu(int t, unencu_t *eu)
610{
611 switch (t)
612 {
613 case ENCU_I: return eu->i * eu->i;
614 case ENCU_F: return eu->f * eu->f;
615 default:
616 return 0.0;
617 }
618}
619
621{
622 ok(s->f == E2, "check_se2\n");
623}
624
625int __cdecl s_sum_parr(int *a[3])
626{
627 return s_sum_pcarr(a, 3);
628}
629
630int __cdecl s_sum_pcarr(int *a[], int n)
631{
632 int i, s = 0;
633 for (i = 0; i < n; ++i)
634 s += *a[i];
635 return s;
636}
637
639{
640 switch (e)
641 {
642 case E1: return 1;
643 case E2: return 2;
644 case E3: return 3;
645 case E4: return 4;
646 default:
647 return 0;
648 }
649}
650
651double __cdecl s_square_encue(encue_t *eue)
652{
653 switch (eue->t)
654 {
655 case E1: return eue->tagged_union.i1 * eue->tagged_union.i1;
656 case E2: return eue->tagged_union.f2 * eue->tagged_union.f2;
657 default:
658 return 0.0;
659 }
660}
661
663{
664 int sum = 0;
665 int i;
666 for (i = 0; i < 2 * n; ++i)
667 sum += x[i];
668 return sum;
669}
670
671int __cdecl s_sum_toplev_conf_cond(int *x, int a, int b, int c)
672{
673 int sum = 0;
674 int n = c ? a : b;
675 int i;
676 for (i = 0; i < n; ++i)
677 sum += x[i];
678 return sum;
679}
680
681double __cdecl s_sum_aligns(aligns_t *a)
682{
683 return a->c + a->i + a->s + a->d;
684}
685
686int __cdecl s_sum_padded(padded_t *p)
687{
688 return p->i + p->c;
689}
690
691int __cdecl s_sum_padded2(padded_t ps[2])
692{
693 return s_sum_padded(&ps[0]) + s_sum_padded(&ps[1]);
694}
695
696int __cdecl s_sum_padded_conf(padded_t *ps, int n)
697{
698 int sum = 0;
699 int i;
700 for (i = 0; i < n; ++i)
701 sum += s_sum_padded(&ps[i]);
702 return sum;
703}
704
705int __cdecl s_sum_bogus(bogus_t *b)
706{
707 return *b->h.p1 + *b->p2 + *b->p3 + b->c;
708}
709
711{
712 ok(!null, "RPC check_null\n");
713}
714
715int __cdecl s_str_struct_len(str_struct_t *s)
716{
717 return lstrlenA(s->s);
718}
719
720int __cdecl s_wstr_struct_len(wstr_struct_t *s)
721{
722 return lstrlenW(s->s);
723}
724
725int __cdecl s_sum_doub_carr(doub_carr_t *dc)
726{
727 int i, j;
728 int sum = 0;
729 for (i = 0; i < dc->n; ++i)
730 for (j = 0; j < dc->a[i]->n; ++j)
731 sum += dc->a[i]->a[j];
732 return sum;
733}
734
735void __cdecl s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc)
736{
737 doub_carr_t *t;
738 int i, j;
739 t = MIDL_user_allocate(FIELD_OFFSET(doub_carr_t, a[n]));
740 t->n = n;
741 for (i = 0; i < n; ++i)
742 {
743 int v = i + 1;
744 t->a[i] = MIDL_user_allocate(FIELD_OFFSET(doub_carr_1_t, a[v]));
745 t->a[i]->n = v;
746 for (j = 0; j < v; ++j)
747 t->a[i]->a[j] = j + 1;
748 }
749 *dc = t;
750}
751
753{
754 short n = b[-1];
755 short *s = b;
756 unsigned hash = 0;
757 short i;
758 for (i = 0; i < n; ++i)
759 hash = 5 * hash + (unsigned) s[i];
760 return hash;
761}
762
764{
765 bstr_t bstr;
766 short str[] = {5, 'W', 'i', 'n', 'e', 0};
767 bstr = HeapAlloc(GetProcessHeap(), 0, sizeof(str));
768 memcpy(bstr, str, sizeof(str));
769 *b = bstr + 1;
770}
771
773{
774 const char bossman[] = "Jeremy White";
775 memcpy(name->name, bossman, min(name->size, sizeof(bossman)));
776 /* ensure nul-termination */
777 if (name->size < sizeof(bossman))
778 name->name[name->size - 1] = 0;
779}
780
781void __cdecl s_get_names(int *n, str_array_t *names)
782{
783 str_array_t list;
784
785 list = MIDL_user_allocate(2 * sizeof(list[0]));
786 list[0] = MIDL_user_allocate(6);
787 strcpy(list[0], "Hello");
788 list[1] = MIDL_user_allocate(7);
789 strcpy(list[1], "World!");
790
791 *names = list;
792 *n = 2;
793}
794
795void __cdecl s_get_namesw(int *n, wstr_array_t *names)
796{
797 wstr_array_t list;
798
799 list = MIDL_user_allocate(2 * sizeof(list[0]));
800 list[0] = MIDL_user_allocate(sizeof(helloW));
801 lstrcpyW(list[0], helloW);
802 list[1] = MIDL_user_allocate(sizeof(worldW));
803 lstrcpyW(list[1], worldW);
804
805 *names = list;
806 *n = 2;
807}
808
809int __cdecl s_sum_pcarr2(int n, int **pa)
810{
811 return s_sum_conf_array(*pa, n);
812}
813
815{
816 int i;
817 int sum = 0;
818 for (i = 0; i < n; ++i)
819 sum += abs(vs[i].x) + abs(vs[i].y) + abs(vs[i].z);
820 return sum;
821}
822
823s123_t * __cdecl s_get_s123(void)
824{
825 s123_t *s = MIDL_user_allocate(sizeof *s);
826 s->f1 = 1;
827 s->f2 = 2;
828 s->f3 = 3;
829 return s;
830}
831
833{
834 return (char *)__FILE__;
835}
836
837int __cdecl s_echo_ranged_int(int i, int j, int k)
838{
839 return min( 100, i + j + k );
840}
841
843{
844 return i;
845}
846
847void __cdecl s_get_ranged_enum(renum_t *re)
848{
849 *re = RE3;
850}
851
853{
855 RPC_BINDING_HANDLE binding;
857 unsigned char buf[20];
858 static RPC_SERVER_INTERFACE server_if =
859 {
860 sizeof(RPC_SERVER_INTERFACE),
861 {{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
862 {{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
863 NULL,
864 0,
865 0,
866 0,
867 0,
868 0,
869 };
870
871 binding = I_RpcGetCurrentCallHandle();
872 ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n");
873
874 if (!pNDRSContextMarshall2 || !pNDRSContextUnmarshall2)
875 {
876 win_skip("NDRSContextMarshall2 or NDRSContextUnmarshall2 not exported from rpcrt4.dll\n");
877 return;
878 }
879
880 h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
881 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
882
883 /* marshal a context handle with NULL userContext */
884 memset(buf, 0xcc, sizeof(buf));
885 pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
886 ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
887 ok(UuidIsNil((UUID *)&buf[4], &status), "uuid should have been nil\n");
888
889 h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
890 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
891
892 /* marshal a context handle with non-NULL userContext */
893 memset(buf, 0xcc, sizeof(buf));
894 h->userContext = (void *)0xdeadbeef;
895 pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
896 ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
897 ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
898
899 /* raises ERROR_INVALID_HANDLE exception on Vista upwards */
900 if (0)
901 {
902 h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
903 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
904 ok(h->userContext == (void *)0xdeadbeef, "userContext of interface didn't unmarshal properly: %p\n", h->userContext);
905
906 /* marshal a context handle with an interface specified */
907 h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
908 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
909
910 memset(buf, 0xcc, sizeof(buf));
911 h->userContext = (void *)0xcafebabe;
912 pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
913 ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
914 ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
915
916 h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
917 ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
918 ok(h->userContext == (void *)0xcafebabe, "userContext of interface didn't unmarshal properly: %p\n", h->userContext);
919 }
920
921 /* test same interface data, but different pointer */
922 /* raises ERROR_INVALID_HANDLE exception */
923 if (0)
924 {
925 RPC_SERVER_INTERFACE server_if_clone = server_if;
926
927 pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if_clone.InterfaceId, 0);
928 }
929
930 /* test different interface data, but different pointer */
931 /* raises ERROR_INVALID_HANDLE exception */
932 if (0)
933 {
934 static RPC_SERVER_INTERFACE server_if2 =
935 {
936 sizeof(RPC_SERVER_INTERFACE),
937 {{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
938 {{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
939 NULL,
940 0,
941 0,
942 0,
943 0,
944 0,
945 };
946 pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
947
948 pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if2.InterfaceId, 0);
949 }
950
951 binding = NULL;
953
954 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
955 ok(binding != NULL, "binding is NULL\n");
956
957 if (status == RPC_S_OK && binding != NULL)
958 {
959 unsigned char* string_binding = NULL;
960 unsigned char* object_uuid = NULL;
961 unsigned char* protseq = NULL;
962 unsigned char* network_address = NULL;
963 unsigned char* endpoint = NULL;
964 unsigned char* network_options = NULL;
965
966 status = RpcBindingToStringBindingA(binding, &string_binding);
967 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
968 ok(string_binding != NULL, "string_binding is NULL\n");
969
970 status = RpcStringBindingParseA(string_binding, &object_uuid, &protseq, &network_address, &endpoint, &network_options);
971 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
972 ok(protseq != NULL && *protseq != '\0', "protseq is %s\n", protseq);
973 ok(network_address != NULL && *network_address != '\0', "network_address is %s\n", network_address);
974
976 {
977 ok(object_uuid != NULL && *object_uuid == '\0', "object_uuid is %s\n", object_uuid);
978 ok(endpoint != NULL && *endpoint == '\0', "endpoint is %s\n", endpoint);
979 ok(network_options != NULL && *network_options == '\0', "network_options is %s\n", network_options);
980 }
981
982 RpcStringFreeA(&string_binding);
983 RpcStringFreeA(&object_uuid);
984 RpcStringFreeA(&protseq);
985 RpcStringFreeA(&network_address);
987 RpcStringFreeA(&network_options);
988 RpcBindingFree(&binding);
989 }
990}
991
992void __cdecl s_get_numbers(int length, int size, pints_t n[])
993{
994 int i;
995 for (i = 0; i < length; i++)
996 {
997 n[i].pi = midl_user_allocate(sizeof(*n[i].pi));
998 *n[i].pi = i;
999 n[i].ppi = NULL;
1000 n[i].pppi = NULL;
1001 }
1002}
1003
1004void __cdecl s_get_numbers_struct(numbers_struct_t **ns)
1005{
1006 int i;
1007 *ns = midl_user_allocate(FIELD_OFFSET(numbers_struct_t, numbers[5]));
1008 if (!*ns) return;
1009 (*ns)->length = 5;
1010 (*ns)->size = 5;
1011 for (i = 0; i < (*ns)->length; i++)
1012 {
1013 (*ns)->numbers[i].pi = NULL;
1014 (*ns)->numbers[i].ppi = NULL;
1015 (*ns)->numbers[i].pppi = NULL;
1016 }
1017 (*ns)->numbers[0].pi = midl_user_allocate(sizeof(*(*ns)->numbers[i].pi));
1018 *(*ns)->numbers[0].pi = 5;
1019}
1020
1022{
1023 ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a);
1024 ok(*b == 42, "Expected *b to be 42 instead of %d\n", *a);
1025 ok(a == b, "Expected a (%p) to point to the same memory as b (%p)\n", a, b);
1026}
1027
1029{
1030 ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a);
1031 ok(b == NULL, "Expected b to be NULL instead of %p\n", b);
1032}
1033
1034void __cdecl s_stop(void)
1035{
1036 if (!stop_wait_event)
1037 {
1038 ok(RPC_S_OK == RpcMgmtStopServerListening(NULL), "RpcMgmtStopServerListening\n");
1039 ok(RPC_S_OK == RpcServerUnregisterIf(NULL, NULL, FALSE), "RpcServerUnregisterIf\n");
1040 }
1041 ok(SetEvent(stop_event), "SetEvent\n");
1042 if (stop_wait_event)
1043 {
1044 DWORD ret;
1046 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
1047 }
1048}
1049
1051{
1055 ok(status == RPC_S_UNKNOWN_MGR_TYPE, "got %u\n", status);
1056}
1057
1058void __cdecl s_ip_test(ipu_t *a)
1059{
1060 STATSTG st;
1061 HRESULT hr;
1062
1063 hr = IStream_Stat(a->tagged_union.stream, &st, STATFLAG_NONAME);
1064 ok(hr == S_OK, "got %#x\n", hr);
1065}
1066
1068{
1069 return *a[0] + *a[1];
1070}
1071
1073{
1074 return (*a)[0] + (*a)[1];
1075}
1076
1078{
1079 return (ctx_handle_t)0xdeadbeef;
1080}
1081
1083{
1084 *r = (ctx_handle_t)0xdeadbeef;
1085}
1086
1088{
1089 ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle);
1090}
1091
1093{
1094 ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle);
1095}
1096
1097static void
1099{
1100 sprintf(buffer, "%s server %s", progname, test);
1101}
1102
1103static void
1104run_client(const char *test)
1105{
1106 char cmdline[MAX_PATH];
1109
1110 memset(&startup, 0, sizeof startup);
1111 startup.cb = sizeof startup;
1112
1114 ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
1116 ok(CloseHandle(info.hProcess), "CloseHandle\n");
1117 ok(CloseHandle(info.hThread), "CloseHandle\n");
1118}
1119
1120static void
1122{
1123 char string[] = "I am a string";
1124 WCHAR wstring[] = {'I',' ','a','m',' ','a',' ','w','s','t','r','i','n','g', 0};
1125 int f[5] = {1, 3, 0, -2, -4};
1126 vector_t a = {1, 3, 7};
1127 vector_t vec1 = {4, -2, 1}, vec2 = {-5, 2, 3}, *pvec2 = &vec2;
1128 pvectors_t pvecs = {&vec1, &pvec2};
1129 sp_inner_t spi = {42};
1130 sp_t sp = {-13, &spi};
1131 aligns_t aligns;
1132 pints_t pints;
1133 ptypes_t ptypes;
1134 padded_t padded;
1135 padded_t padded2[2];
1136 bogus_t bogus;
1137 int i1, i2, i3, *pi2, *pi3, **ppi3;
1138 double u, v;
1139 float s, t;
1140 LONG q, r;
1141 short h;
1142 char c;
1143 int x;
1144 hyper y;
1145 str_struct_t ss = {string};
1146 wstr_struct_t ws = {wstring};
1147 str_t str;
1148 se_t se;
1149 renum_t re;
1150
1151 ok(int_return() == INT_CODE, "RPC int_return\n");
1152
1153 ok(square(7) == 49, "RPC square\n");
1154 x = sum(23, -4);
1155 ok(x == 19, "RPC sum got %d\n", x);
1156 c = sum_char(-23, 50);
1157 ok(c == 27, "RPC sum_char got %d\n", (int)c);
1158 h = sum_short(1122, -344);
1159 ok(h == 778, "RPC sum_short got %d\n", (int)h);
1160 x = sum_float(123.45, -32.2);
1161 ok(x == 91, "RPC sum_float got %d\n", x);
1162 x = sum_double_int(-78, 148.46);
1163 ok(x == 70, "RPC sum_double_int got %d\n", x);
1164 y = sum_hyper((hyper)0x12345678 << 16, (hyper)0x33557799 << 16);
1165 ok(y == (hyper)0x4589ce11 << 16, "RPC hyper got %s\n", wine_dbgstr_longlong(y));
1166 x = sum_hyper_int((hyper)0x24242424 << 16, -((hyper)0x24241212 << 16));
1167 ok(x == 0x12120000, "RPC hyper_int got 0x%x\n", x);
1168 x = sum_char_hyper( 12, ((hyper)0x42424242 << 32) | 0x33334444 );
1169 ok(x == 0x33334450, "RPC char_hyper got 0x%x\n", x);
1170
1171 x = 0;
1172 square_out(11, &x);
1173 ok(x == 121, "RPC square_out\n");
1174
1175 x = 5;
1176 square_ref(&x);
1177 ok(x == 25, "RPC square_ref\n");
1178
1179 ok(str_length(string) == strlen(string), "RPC str_length\n");
1180 ok(str_t_length(string) == strlen(string), "RPC str_length\n");
1181 ok(dot_self(&a) == 59, "RPC dot_self\n");
1182
1183 ok(str_struct_len(&ss) == lstrlenA(string), "RPC str_struct_len\n");
1184 ok(wstr_struct_len(&ws) == lstrlenW(wstring), "RPC str_struct_len\n");
1185
1186 v = 0.0;
1187 u = square_half(3.0, &v);
1188 ok(u == 9.0, "RPC square_half\n");
1189 ok(v == 1.5, "RPC square_half\n");
1190
1191 t = 0.0f;
1192 s = square_half_float(3.0f, &t);
1193 ok(s == 9.0f, "RPC square_half_float\n");
1194 ok(t == 1.5f, "RPC square_half_float\n");
1195
1196 r = 0;
1197 q = square_half_long(3, &r);
1198 ok(q == 9, "RPC square_half_long\n");
1199 ok(r == 1, "RPC square_half_long\n");
1200
1201 i1 = 19;
1202 i2 = -3;
1203 i3 = -29;
1204 pi2 = &i2;
1205 pi3 = &i3;
1206 ppi3 = &pi3;
1207 pints.pi = &i1;
1208 pints.ppi = &pi2;
1209 pints.pppi = &ppi3;
1210 ok(pints_sum(&pints) == -13, "RPC pints_sum\n");
1211
1212 c = 10;
1213 h = 3;
1214 q = 14;
1215 s = -5.0f;
1216 u = 11.0;
1217 ptypes.pc = &c;
1218 ptypes.ps = &h;
1219 ptypes.pl = &q;
1220 ptypes.pf = &s;
1221 ptypes.pd = &u;
1222 ok(ptypes_sum(&ptypes) == 33.0, "RPC ptypes_sum\n");
1223
1224 ok(dot_pvectors(&pvecs) == -21, "RPC dot_pvectors\n");
1225 ok(dot_copy_vectors(vec1, vec2) == -21, "RPC dot_copy_vectors\n");
1226 ok(sum_fixed_array(f) == -2, "RPC sum_fixed_array\n");
1227 ok(sum_sp(&sp) == 29, "RPC sum_sp\n");
1228
1229 ok(enum_ord(E1) == 1, "RPC enum_ord\n");
1230 ok(enum_ord(E2) == 2, "RPC enum_ord\n");
1231 ok(enum_ord(E3) == 3, "RPC enum_ord\n");
1232 ok(enum_ord(E4) == 4, "RPC enum_ord\n");
1233
1234 se.f = E2;
1235 check_se2(&se);
1236
1237 memset(&aligns, 0, sizeof(aligns));
1238 aligns.c = 3;
1239 aligns.i = 4;
1240 aligns.s = 5;
1241 aligns.d = 6.0;
1242 ok(sum_aligns(&aligns) == 18.0, "RPC sum_aligns\n");
1243
1244 padded.i = -3;
1245 padded.c = 8;
1246 ok(sum_padded(&padded) == 5, "RPC sum_padded\n");
1247 padded2[0].i = -5;
1248 padded2[0].c = 1;
1249 padded2[1].i = 3;
1250 padded2[1].c = 7;
1251 ok(sum_padded2(padded2) == 6, "RPC sum_padded2\n");
1252 padded2[0].i = -5;
1253 padded2[0].c = 1;
1254 padded2[1].i = 3;
1255 padded2[1].c = 7;
1256 ok(sum_padded_conf(padded2, 2) == 6, "RPC sum_padded_conf\n");
1257
1258 i1 = 14;
1259 i2 = -7;
1260 i3 = -4;
1261 bogus.h.p1 = &i1;
1262 bogus.p2 = &i2;
1263 bogus.p3 = &i3;
1264 bogus.c = 9;
1265 ok(sum_bogus(&bogus) == 12, "RPC sum_bogus\n");
1266
1267 check_null(NULL);
1268
1269 if (!is_interp || sizeof(void*) != 8) { /* broken in widl for win64 */
1270 str = get_filename();
1271 ok(!strcmp(str, __FILE__), "get_filename() returned %s instead of %s\n", str, __FILE__);
1273 }
1274
1275 x = echo_ranged_int(0,0,0);
1276 ok(x == 0, "echo_ranged_int() returned %d instead of 0\n", x);
1277 x = echo_ranged_int(10,20,100);
1278 ok(x == 100, "echo_ranged_int() returned %d instead of 100\n", x);
1279 x = echo_ranged_int2(40);
1280 ok(x == 40, "echo_ranged_int() returned %d instead of 40\n", x);
1281
1283 {
1284 re = 0xdeadbeef;
1285 get_ranged_enum(&re);
1286 ok(re == RE3 ||
1287 broken(re == MAKELONG(re, 0xdead)), /* Win 8, Win 10 */
1288 "get_ranged_enum() returned %x instead of RE3\n", re);
1289 }
1290}
1291
1292static void
1294{
1295 encue_t eue;
1296 encu_t eu;
1297 unencu_t uneu;
1298 sun_t su;
1299 ipu_t ipu;
1300 LONG ref;
1301 int i;
1302
1303 su.s = SUN_I;
1304 su.u.i = 9;
1305 ok(square_sun(&su) == 81.0, "RPC square_sun\n");
1306
1307 su.s = SUN_F1;
1308 su.u.f = 5.0;
1309 ok(square_sun(&su) == 25.0, "RPC square_sun\n");
1310
1311 su.s = SUN_F2;
1312 su.u.f = -2.0;
1313 ok(square_sun(&su) == 4.0, "RPC square_sun\n");
1314
1315 su.s = SUN_PI;
1316 su.u.pi = &i;
1317 i = 11;
1318 ok(square_sun(&su) == 121.0, "RPC square_sun\n");
1319
1320 eu.t = ENCU_I;
1321 eu.tagged_union.i = 7;
1322 ok(square_encu(&eu) == 49.0, "RPC square_encu\n");
1323
1324 eu.t = ENCU_F;
1325 eu.tagged_union.f = 3.0;
1326 ok(square_encu(&eu) == 9.0, "RPC square_encu\n");
1327
1328 uneu.i = 4;
1329 ok(square_unencu(ENCU_I, &uneu) == 16.0, "RPC square_unencu\n");
1330
1331 uneu.f = 5.0;
1332 ok(square_unencu(ENCU_F, &uneu) == 25.0, "RPC square_unencu\n");
1333
1334 eue.t = E1;
1335 eue.tagged_union.i1 = 8;
1336 ok(square_encue(&eue) == 64.0, "RPC square_encue\n");
1337
1338 eue.t = E2;
1339 eue.tagged_union.f2 = 10.0;
1340 ok(square_encue(&eue) == 100.0, "RPC square_encue\n");
1341
1343
1344 CreateStreamOnHGlobal(NULL, TRUE, &ipu.tagged_union.stream);
1345 ip_test(&ipu);
1346 ref = IStream_Release(ipu.tagged_union.stream);
1347 ok(!ref, "got %u refs\n", ref);
1348
1350}
1351
1352static test_list_t *
1354{
1355 test_list_t *n = HeapAlloc(GetProcessHeap(), 0, sizeof *n);
1356 n->t = TL_NULL;
1357 n->u.x = 0;
1358 return n;
1359}
1360
1361static test_list_t *
1362make_list(test_list_t *tail)
1363{
1364 test_list_t *n = HeapAlloc(GetProcessHeap(), 0, sizeof *n);
1365 n->t = TL_LIST;
1366 n->u.tail = tail;
1367 return n;
1368}
1369
1370static void
1371free_list(test_list_t *list)
1372{
1373 if (list->t == TL_LIST)
1374 free_list(list->u.tail);
1376}
1377
1380{
1381 return start + sizeof(int);
1382}
1383
1384unsigned char * __RPC_USER
1385puint_t_UserMarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
1386{
1387 int n = atoi(*p);
1388 memcpy(buffer, &n, sizeof n);
1389 return buffer + sizeof n;
1390}
1391
1392unsigned char * __RPC_USER
1393puint_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
1394{
1395 int n;
1396 memcpy(&n, buffer, sizeof n);
1397 *p = HeapAlloc(GetProcessHeap(), 0, 10);
1398 sprintf(*p, "%d", n);
1399 return buffer + sizeof n;
1400}
1401
1402void __RPC_USER
1404{
1405 HeapFree(GetProcessHeap(), 0, *p);
1406}
1407
1410{
1411 return start + sizeof(struct wire_us);
1412}
1413
1414unsigned char * __RPC_USER
1415us_t_UserMarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
1416{
1417 struct wire_us wus;
1418 wus.x = atoi(pus->x);
1419 memcpy(buffer, &wus, sizeof wus);
1420 return buffer + sizeof wus;
1421}
1422
1423unsigned char * __RPC_USER
1424us_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
1425{
1426 struct wire_us wus;
1427 memcpy(&wus, buffer, sizeof wus);
1428 pus->x = HeapAlloc(GetProcessHeap(), 0, 10);
1429 sprintf(pus->x, "%d", wus.x);
1430 return buffer + sizeof wus;
1431}
1432
1433void __RPC_USER
1435{
1436 HeapFree(GetProcessHeap(), 0, pus->x);
1437}
1438
1441{
1442 return start + FIELD_OFFSET(user_bstr_t, data[(*b)[-1]]);
1443}
1444
1445unsigned char * __RPC_USER
1447{
1448 wire_bstr_t wb = (wire_bstr_t) buffer;
1449 wb->n = (*b)[-1];
1450 memcpy(&wb->data, *b, wb->n * sizeof wb->data[0]);
1451 return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
1452}
1453
1454unsigned char * __RPC_USER
1456{
1457 wire_bstr_t wb = (wire_bstr_t) buffer;
1458 short *data = HeapAlloc(GetProcessHeap(), 0, (wb->n + 1) * sizeof *data);
1459 data[0] = wb->n;
1460 memcpy(&data[1], wb->data, wb->n * sizeof data[1]);
1461 *b = &data[1];
1462 return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
1463}
1464
1465void __RPC_USER
1467{
1468 HeapFree(GetProcessHeap(), 0, &((*b)[-1]));
1469}
1470
1471static void
1473{
1474 int a[] = {1, 2, 3, 4};
1475 char p1[] = "11";
1476 test_list_t *list = make_list(make_list(make_list(null_list())));
1477 test_us_t tus = {{p1}};
1478 int *pa[4];
1479 puints_t pus;
1480 cpuints_t cpus;
1481 short bstr_data[] = { 5, 'H', 'e', 'l', 'l', 'o' };
1482 bstr_t bstr = &bstr_data[1], bstr2;
1483 name_t name;
1484 void *buffer;
1485 int *pa2;
1486 s123_t *s123;
1487 int val = 42;
1488
1489 ok(test_list_length(list) == 3, "RPC test_list_length\n");
1490 ok(square_puint(p1) == 121, "RPC square_puint\n");
1491 pus.n = 4;
1492 pus.ps = HeapAlloc(GetProcessHeap(), 0, pus.n * sizeof pus.ps[0]);
1493 pus.ps[0] = xstrdup("5");
1494 pus.ps[1] = xstrdup("6");
1495 pus.ps[2] = xstrdup("7");
1496 pus.ps[3] = xstrdup("8");
1497 ok(sum_puints(&pus) == 26, "RPC sum_puints\n");
1498 HeapFree(GetProcessHeap(), 0, pus.ps[0]);
1499 HeapFree(GetProcessHeap(), 0, pus.ps[1]);
1500 HeapFree(GetProcessHeap(), 0, pus.ps[2]);
1501 HeapFree(GetProcessHeap(), 0, pus.ps[3]);
1502 HeapFree(GetProcessHeap(), 0, pus.ps);
1503 cpus.n = 4;
1504 cpus.ps = HeapAlloc(GetProcessHeap(), 0, cpus.n * sizeof cpus.ps[0]);
1505 cpus.ps[0] = xstrdup("5");
1506 cpus.ps[1] = xstrdup("6");
1507 cpus.ps[2] = xstrdup("7");
1508 cpus.ps[3] = xstrdup("8");
1509 ok(sum_cpuints(&cpus) == 26, "RPC sum_puints\n");
1510 HeapFree(GetProcessHeap(), 0, cpus.ps[0]);
1511 HeapFree(GetProcessHeap(), 0, cpus.ps[1]);
1512 HeapFree(GetProcessHeap(), 0, cpus.ps[2]);
1513 HeapFree(GetProcessHeap(), 0, cpus.ps[3]);
1514 HeapFree(GetProcessHeap(), 0, cpus.ps);
1515 ok(square_test_us(&tus) == 121, "RPC square_test_us\n");
1516
1517 pa[0] = &a[0];
1518 pa[1] = &a[1];
1519 pa[2] = &a[2];
1520 ok(sum_parr(pa) == 6, "RPC sum_parr\n");
1521
1522 pa[0] = &a[0];
1523 pa[1] = &a[1];
1524 pa[2] = &a[2];
1525 pa[3] = &a[3];
1526 ok(sum_pcarr(pa, 4) == 10, "RPC sum_pcarr\n");
1527
1528 ok(hash_bstr(bstr) == s_hash_bstr(bstr), "RPC hash_bstr_data\n");
1529
1530 get_a_bstr(&bstr);
1531 s_get_a_bstr(&bstr2);
1532 ok(!lstrcmpW((LPCWSTR)bstr, (LPCWSTR)bstr2), "bstr mismatch\n");
1533 HeapFree(GetProcessHeap(), 0, bstr - 1);
1534 HeapFree(GetProcessHeap(), 0, bstr2 - 1);
1535
1536 free_list(list);
1537
1539 {
1540 int n;
1541 str_array_t names;
1542 wstr_array_t namesw;
1543
1544 name.size = 10;
1546 get_name(&name);
1547 ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer);
1548 ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name);
1550
1551 if (!is_interp) { /* broken in widl */
1552 n = -1;
1553 names = NULL;
1554 get_names(&n, &names);
1555 ok(n == 2, "expected 2, got %d\n", n);
1557 ok(!strcmp(names[0], "Hello"), "expected Hello, got %s\n", names[0]);
1559 ok(!strcmp(names[1], "World!"), "expected World!, got %s\n", names[1]);
1563
1564 n = -1;
1565 namesw = NULL;
1566 get_namesw(&n, &namesw);
1567 ok(n == 2, "expected 2, got %d\n", n);
1569 ok(!lstrcmpW(namesw[0], helloW), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0]));
1571 ok(!lstrcmpW(namesw[1], worldW), "expected World!, got %s\n", wine_dbgstr_w(namesw[1]));
1572 MIDL_user_free(namesw[0]);
1573 MIDL_user_free(namesw[1]);
1574 MIDL_user_free(namesw);
1575 }
1576 }
1577
1578 if (!is_interp) { /* broken in widl */
1579 pa2 = a;
1581 ok(sum_pcarr2(4, &pa2) == 10, "RPC sum_pcarr2\n");
1582 }
1583
1584 s123 = get_s123();
1585 ok(s123->f1 == 1 && s123->f2 == 2 && s123->f3 == 3, "RPC get_s123\n");
1586 MIDL_user_free(s123);
1587
1588 full_pointer_test(&val, &val);
1589 full_pointer_null_test(&val, NULL);
1590}
1591
1592static int
1594{
1595 int i, j;
1596 for (i = 0; i < dc->n; ++i)
1597 for (j = 0; j < dc->a[i]->n; ++j)
1598 if (dc->a[i]->a[j] != j + 1)
1599 return FALSE;
1600 return TRUE;
1601}
1602
1603static void
1605{
1606 int i;
1607 for (i = 0; i < dc->n; ++i)
1608 MIDL_user_free(dc->a[i]);
1610}
1611
1612static void
1614{
1615 int m[2][3][4] =
1616 {
1617 {{1, 2, 3, 4}, {-1, -3, -5, -7}, {0, 2, 4, 6}},
1618 {{1, -2, 3, -4}, {2, 3, 5, 7}, {-4, -1, -14, 4114}}
1619 };
1620 int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
1621 int c2[] = {10, 100, 200};
1622 int c3[20];
1623 vector_t vs[2] = {{1, -2, 3}, {4, -5, -6}};
1624 cps_t cps;
1625 cpsc_t cpsc;
1626 cs_t *cs;
1627 int n;
1628 int ca[5] = {1, -2, 3, -4, 5};
1629 int tmp[10];
1630 doub_carr_t *dc;
1631 int *pi;
1632 pints_t api[5];
1633 numbers_struct_t *ns;
1634 refpint_t rpi[5];
1635 int i0 = 1, i1 = 2, *ptr_array[2] = {&i0, &i1}, array[2] = {3, 4};
1636
1638 {
1639 const char str1[25] = "Hello";
1640 ok(cstr_length(str1, sizeof str1) == strlen(str1), "RPC cstr_length\n");
1641 }
1642
1643 ok(sum_fixed_int_3d(m) == 4116, "RPC sum_fixed_int_3d\n");
1644
1645 ok(sum_conf_array(c, 10) == 45, "RPC sum_conf_array\n");
1646 ok(sum_conf_array(&c[5], 2) == 11, "RPC sum_conf_array\n");
1647 ok(sum_conf_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
1648 ok(sum_conf_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
1649
1650 ok(sum_conf_ptr_by_conf_ptr(1, c2, c) == 45, "RPC sum_conf_ptr_by_conf_ptr\n");
1651 ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 345, "RPC sum_conf_ptr_by_conf_ptr\n");
1652 c2[0] = 0;
1653 ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 300, "RPC sum_conf_ptr_by_conf_ptr\n");
1654
1655 ok(sum_unique_conf_array(ca, 4) == -2, "RPC sum_unique_conf_array\n");
1656 ok(sum_unique_conf_ptr(ca, 5) == 3, "RPC sum_unique_conf_array\n");
1657 ok(sum_unique_conf_ptr(NULL, 10) == 0, "RPC sum_unique_conf_array\n");
1658
1659 get_number_array(c3, &n);
1660 ok(n == 10, "RPC get_num_array\n");
1661 for (; n > 0; n--)
1662 ok(c3[n-1] == c[n-1], "get_num_array returned wrong value %d @ %d\n",
1663 c3[n-1], n);
1664 ok(sum_var_array(c, 10) == 45, "RPC sum_conf_array\n");
1665 ok(sum_var_array(&c[5], 2) == 11, "RPC sum_conf_array\n");
1666 ok(sum_var_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
1667 ok(sum_var_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
1668
1669 ok(dot_two_vectors(vs) == -4, "RPC dot_two_vectors\n");
1670 cs = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(cs_t, ca[5]));
1671 cs->n = 5;
1672 cs->ca[0] = 3;
1673 cs->ca[1] = 5;
1674 cs->ca[2] = -2;
1675 cs->ca[3] = -1;
1676 cs->ca[4] = -4;
1677 ok(sum_cs(cs) == 1, "RPC sum_cs\n");
1678 HeapFree(GetProcessHeap(), 0, cs);
1679
1680 n = 5;
1681 cps.pn = &n;
1682 cps.ca1 = &c[2];
1683 cps.n = 3;
1684 cps.ca2 = &c[3];
1685 ok(sum_cps(&cps) == 53, "RPC sum_cps\n");
1686
1687 cpsc.a = 4;
1688 cpsc.b = 5;
1689 cpsc.c = 1;
1690 cpsc.ca = c;
1691 ok(sum_cpsc(&cpsc) == 6, "RPC sum_cpsc\n");
1692 cpsc.a = 4;
1693 cpsc.b = 5;
1694 cpsc.c = 0;
1695 cpsc.ca = c;
1696 ok(sum_cpsc(&cpsc) == 10, "RPC sum_cpsc\n");
1697
1698 cpsc.ca = NULL;
1699 ok(get_cpsc(5, &cpsc) == 45, "RPC sum_cpsc\n");
1700 ok( cpsc.a == 10, "RPC get_cpsc %u\n", cpsc.a );
1701 for (n = 0; n < 10; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] );
1702
1703 memset( tmp, 0x33, sizeof(tmp) );
1704 cpsc.ca = tmp;
1705 ok(get_cpsc(4, &cpsc) == 28, "RPC sum_cpsc\n");
1706 ok( cpsc.a == 8, "RPC get_cpsc %u\n", cpsc.a );
1707 ok( cpsc.ca == tmp, "RPC get_cpsc %p/%p\n", cpsc.ca, tmp );
1708 for (n = 0; n < 8; n++) ok( cpsc.ca[n] == n, "RPC get_cpsc[%d] = %d\n", n, cpsc.ca[n] );
1709
1710 ok(sum_toplev_conf_2n(c, 3) == 15, "RPC sum_toplev_conf_2n\n");
1711 ok(sum_toplev_conf_cond(c, 5, 6, 1) == 10, "RPC sum_toplev_conf_cond\n");
1712 ok(sum_toplev_conf_cond(c, 5, 6, 0) == 15, "RPC sum_toplev_conf_cond\n");
1713
1714 dc = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_t, a[2]));
1715 dc->n = 2;
1716 dc->a[0] = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_1_t, a[3]));
1717 dc->a[0]->n = 3;
1718 dc->a[0]->a[0] = 5;
1719 dc->a[0]->a[1] = 1;
1720 dc->a[0]->a[2] = 8;
1721 dc->a[1] = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_1_t, a[2]));
1722 dc->a[1]->n = 2;
1723 dc->a[1]->a[0] = 2;
1724 dc->a[1]->a[1] = 3;
1725 ok(sum_doub_carr(dc) == 19, "RPC sum_doub_carr\n");
1726 HeapFree(GetProcessHeap(), 0, dc->a[0]);
1727 HeapFree(GetProcessHeap(), 0, dc->a[1]);
1728 HeapFree(GetProcessHeap(), 0, dc);
1729
1730 dc = NULL;
1731 make_pyramid_doub_carr(4, &dc);
1732 ok(check_pyramid_doub_carr(dc), "RPC make_pyramid_doub_carr\n");
1734
1735 ok(sum_L1_norms(2, vs) == 21, "RPC sum_L1_norms\n");
1736
1737 memset(api, 0, sizeof(api));
1738 pi = HeapAlloc(GetProcessHeap(), 0, sizeof(*pi));
1739 *pi = -1;
1740 api[0].pi = pi;
1741 get_numbers(1, 1, api);
1742 ok(api[0].pi == pi, "RPC conformant varying array [out] pointer changed from %p to %p\n", pi, api[0].pi);
1743 ok(*api[0].pi == 0, "pi unmarshalled incorrectly %d\n", *api[0].pi);
1744
1746 {
1747 ns = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(numbers_struct_t, numbers[5]));
1748 ns->length = 5;
1749 ns->size = 5;
1750 ns->numbers[0].pi = pi;
1751 get_numbers_struct(&ns);
1752 ok(ns->numbers[0].pi == pi, "RPC conformant varying struct embedded pointer changed from %p to %p\n", pi, ns->numbers[0].pi);
1753 ok(*ns->numbers[0].pi == 5, "pi unmarshalled incorrectly %d\n", *ns->numbers[0].pi);
1754 HeapFree(GetProcessHeap(), 0, ns);
1755 }
1756 HeapFree(GetProcessHeap(), 0, pi);
1757
1758 pi = HeapAlloc(GetProcessHeap(), 0, 5 * sizeof(*pi));
1759 pi[0] = 3; rpi[0] = &pi[0];
1760 pi[1] = 5; rpi[1] = &pi[1];
1761 pi[2] = -2; rpi[2] = &pi[2];
1762 pi[3] = -1; rpi[3] = &pi[3];
1763 pi[4] = -4; rpi[4] = &pi[4];
1764 ok(sum_complex_array(5, rpi) == 1, "RPC sum_complex_array\n");
1765 HeapFree(GetProcessHeap(), 0, pi);
1766
1767 ok(sum_ptr_array(ptr_array) == 3, "RPC sum_ptr_array\n");
1768 ok(sum_array_ptr(&array) == 7, "RPC sum_array_ptr\n");
1769}
1770
1771void __cdecl s_authinfo_test(unsigned int protseq, int secure)
1772{
1773 RPC_BINDING_HANDLE binding;
1775 ULONG level, authnsvc;
1776 RPC_AUTHZ_HANDLE privs;
1777 unsigned char *principal;
1778
1779 binding = I_RpcGetCurrentCallHandle();
1780 ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n");
1781
1782 level = authnsvc = 0xdeadbeef;
1783 privs = (RPC_AUTHZ_HANDLE)0xdeadbeef;
1784 principal = (unsigned char *)0xdeadbeef;
1785
1786 if (secure || protseq == RPC_PROTSEQ_LRPC)
1787 {
1788 status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
1790 {
1791 win_skip("RpcBindingInqAuthClientA not supported\n");
1792 return;
1793 }
1794 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
1795 ok(privs != (RPC_AUTHZ_HANDLE)0xdeadbeef, "privs unchanged\n");
1796 ok(principal != (unsigned char *)0xdeadbeef, "principal unchanged\n");
1797 if (protseq != RPC_PROTSEQ_LRPC)
1798 {
1799 todo_wine
1800 ok(principal != NULL, "NULL principal\n");
1801 }
1802 if (protseq == RPC_PROTSEQ_LRPC && principal)
1803 {
1804 int len;
1805 char *spn;
1806
1807 len = WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, NULL, 0, NULL, NULL);
1808 spn = HeapAlloc( GetProcessHeap(), 0, len );
1809 WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, spn, len, NULL, NULL);
1810
1811 ok(!strcmp(domain_and_user, spn), "expected %s got %s\n", domain_and_user, spn);
1812 HeapFree( GetProcessHeap(), 0, spn );
1813 }
1814 ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "level unchanged\n");
1815 ok(authnsvc == RPC_C_AUTHN_WINNT, "authnsvc unchanged\n");
1816 RpcStringFreeA(&principal);
1817
1818 status = RpcBindingInqAuthClientA(NULL, &privs, &principal, &level, &authnsvc, NULL);
1819 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
1820 RpcStringFreeA(&principal);
1821
1822 status = RpcBindingInqAuthClientExA(NULL, &privs, &principal, &level, &authnsvc, NULL, 0);
1823 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
1824 RpcStringFreeA(&principal);
1825
1827 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
1829 ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
1830
1831 }
1832 else
1833 {
1834 status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
1835 ok(status == RPC_S_BINDING_HAS_NO_AUTH, "expected RPC_S_BINDING_HAS_NO_AUTH got %u\n", status);
1836 ok(privs == (RPC_AUTHZ_HANDLE)0xdeadbeef, "got %p\n", privs);
1837 ok(principal == (unsigned char *)0xdeadbeef, "got %s\n", principal);
1838 ok(level == 0xdeadbeef, "got %u\n", level);
1839 ok(authnsvc == 0xdeadbeef, "got %u\n", authnsvc);
1840 }
1841}
1842
1843static void test_handle_return(void)
1844{
1845 ctx_handle_t handle, handle2;
1846
1847 handle = get_handle();
1848 test_handle(handle);
1849 get_handle_by_ptr(&handle2);
1850 test_handle(handle2);
1851}
1852
1853static void
1855{
1856 basic_tests();
1857 union_tests();
1858 pointer_tests();
1859 array_tests();
1860 context_handle_test();
1862}
1863
1864static void
1866{
1868 RPC_SECURITY_QOS qos;
1869
1870 qos.Version = 1;
1874
1876 RPC_C_AUTHN_WINNT, NULL, 0, &qos);
1877 ok(status == RPC_S_OK, "RpcBindingSetAuthInfoExA failed %d\n", status);
1878}
1879
1880#define test_is_server_listening(a,b) _test_is_server_listening(__LINE__,a,b)
1881static void _test_is_server_listening(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status)
1882{
1885 ok_(__FILE__,line)(status == expected_status, "RpcMgmtIsServerListening returned %u, expected %u\n",
1886 status, expected_status);
1887}
1888
1889#define test_is_server_listening2(a,b,c) _test_is_server_listening2(__LINE__,a,b,c)
1890static void _test_is_server_listening2(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status,
1891 RPC_STATUS expected_status2)
1892{
1895 ok_(__FILE__,line)(status == expected_status || status == expected_status2,
1896 "RpcMgmtIsServerListening returned %u, expected %u or %u\n",
1897 status, expected_status, expected_status2);
1898}
1899
1900static void
1901client(const char *test)
1902{
1903 static unsigned char iptcp[] = "ncacn_ip_tcp";
1904 static unsigned char np[] = "ncacn_np";
1905 static unsigned char ncalrpc[] = "ncalrpc";
1906 static unsigned char address[] = "127.0.0.1";
1907 static unsigned char address_np[] = "\\\\.";
1908 static unsigned char port[] = PORT;
1909 static unsigned char pipe[] = PIPE;
1910 static unsigned char guid[] = "00000000-4114-0704-2301-000000000000";
1911
1912 unsigned char *binding;
1913
1914 if (strcmp(test, "tcp_basic") == 0)
1915 {
1916 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
1917 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
1918
1919 run_tests();
1920 authinfo_test(RPC_PROTSEQ_TCP, 0);
1922
1923 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
1924 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
1925 }
1926 else if (strcmp(test, "tcp_secure") == 0)
1927 {
1928 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
1929 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
1930
1931 set_auth_info(IMixedServer_IfHandle);
1932 authinfo_test(RPC_PROTSEQ_TCP, 1);
1933 test_is_server_listening(IMixedServer_IfHandle, RPC_S_ACCESS_DENIED);
1934
1935 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
1936 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
1937 }
1938 else if (strcmp(test, "ncalrpc_basic") == 0)
1939 {
1940 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
1941 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
1942
1943 run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */
1944 authinfo_test(RPC_PROTSEQ_LRPC, 0);
1945 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
1946
1947 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
1948 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
1949 }
1950 else if (strcmp(test, "ncalrpc_autolisten") == 0)
1951 {
1952 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
1953 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
1954
1955 run_tests();
1956 authinfo_test(RPC_PROTSEQ_LRPC, 0);
1958 test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING);
1959
1960 stop_autolisten();
1961 ok(int_return() == INT_CODE, "RPC int_return\n");
1962
1963 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
1964 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
1965 }
1966 else if (strcmp(test, "ncalrpc_secure") == 0)
1967 {
1968 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
1969 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
1970
1971 set_auth_info(IMixedServer_IfHandle);
1972 authinfo_test(RPC_PROTSEQ_LRPC, 1);
1973 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
1974
1975 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
1976 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
1977 }
1978 else if (strcmp(test, "np_basic") == 0)
1979 {
1980 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
1981 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
1982
1983 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
1984 run_tests();
1985 authinfo_test(RPC_PROTSEQ_NMP, 0);
1986 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
1987 stop();
1988 test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING);
1989
1990 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
1991 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
1992 }
1993 else if (strcmp(test, "np_basic_interp") == 0)
1994 {
1996
1997 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
1998 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IInterpServer_IfHandle), "RpcBindingFromStringBinding\n");
1999
2000 test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK);
2001 run_tests();
2002 authinfo_test(RPC_PROTSEQ_NMP, 0);
2003 test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK);
2004
2005 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2006 ok(RPC_S_OK == RpcBindingFree(&IInterpServer_IfHandle), "RpcBindingFree\n");
2007 }
2008}
2009
2010static void
2012{
2013 static unsigned char iptcp[] = "ncacn_ip_tcp";
2014 static unsigned char port[] = PORT;
2015 static unsigned char np[] = "ncacn_np";
2016 static unsigned char pipe[] = PIPE;
2017 static unsigned char ncalrpc[] = "ncalrpc";
2018 static unsigned char guid[] = "00000000-4114-0704-2301-000000000000";
2019 RPC_STATUS status, iptcp_status, np_status, ncalrpc_status;
2020 DWORD ret;
2021
2022 /* needed for tests involving interface pointers */
2024
2025 iptcp_status = RpcServerUseProtseqEpA(iptcp, 20, port, NULL);
2026 ok(iptcp_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_ip_tcp) failed with status %d\n", iptcp_status);
2027
2028 ncalrpc_status = RpcServerUseProtseqEpA(ncalrpc, 0, guid, NULL);
2029 ok(ncalrpc_status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", ncalrpc_status);
2030
2031 np_status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
2032 if (np_status == RPC_S_PROTSEQ_NOT_SUPPORTED)
2033 skip("Protocol sequence ncacn_np is not supported\n");
2034 else
2035 ok(np_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", np_status);
2036
2037 if (pRpcServerRegisterIfEx)
2038 {
2039 trace("Using RpcServerRegisterIfEx\n");
2040 status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
2043 ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %d\n", status);
2044 status = pRpcServerRegisterIfEx(s_IInterpServer_v0_0_s_ifspec, NULL, NULL,
2047 ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %d\n", status);
2048 }
2049 else
2050 {
2051 status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
2052 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
2053 status = RpcServerRegisterIf(s_IInterpServer_v0_0_s_ifspec, NULL, NULL);
2054 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
2055 }
2057 status = RpcServerListen(1, 20, TRUE);
2058 ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
2061 ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
2062
2063 if (iptcp_status == RPC_S_OK)
2064 run_client("tcp_basic");
2065 else
2066 skip("tcp tests skipped due to earlier failure\n");
2067
2068 if (ncalrpc_status == RPC_S_OK)
2069 {
2070 run_client("ncalrpc_basic");
2071
2072 /* we don't need to register RPC_C_AUTHN_WINNT for ncalrpc */
2073 run_client("ncalrpc_secure");
2074 }
2075 else
2076 skip("lrpc tests skipped due to earlier failure\n");
2077
2078 if (np_status == RPC_S_OK)
2079 {
2080 run_client("np_basic_interp");
2081 run_client("np_basic");
2082 }
2083 else
2084 {
2085 skip("np_basic tests skipped due to earlier failure\n");
2086 /* np client is what signals stop_event, so bail out if we didn't run do it */
2087 return;
2088 }
2089
2091 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2092
2093 /* if the stop event didn't fire then RpcMgmtWaitServerListen will wait
2094 * forever, so don't bother calling it in this case */
2095 if (ret == WAIT_OBJECT_0)
2096 {
2098 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
2099 }
2100
2102 stop_event = NULL;
2103
2104 if (pRpcServerRegisterIfEx)
2105 {
2106 status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
2109 ok(status == RPC_S_OK, "RpcServerRegisterIf() failed: %u\n", status);
2110
2111 run_client("ncalrpc_autolisten");
2112
2113 status = RpcServerUnregisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, TRUE);
2114 ok(status == RPC_S_OK, "RpcServerUnregisterIf() failed: %u\n", status);
2115 }
2116
2118}
2119
2121{
2123
2124 status = RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle);
2125 ok(status == RPC_S_OK, "RpcBindingFromStringBinding\n");
2126
2127 test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
2128 stop();
2129 trace("stopped\n");
2130
2131 status = RpcBindingFree(&IMixedServer_IfHandle);
2132 ok(status == RPC_S_OK, "RpcBindingFree\n");
2133 return 0;
2134}
2135
2137{
2139
2140 trace("waiting\n");
2142 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
2143 trace("done\n");
2144
2145 return 0;
2146}
2147
2148static void test_stop_wait_for_call(unsigned char *binding)
2149{
2150 HANDLE client_thread, wait_listen_thread;
2152 DWORD ret;
2153
2154 status = RpcServerListen(1, 20, TRUE);
2155 ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
2157
2159 ok(stop_wait_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
2161 ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
2162
2163 wait_listen_thread = CreateThread(NULL, 0, wait_listen_proc, 0, 0, NULL);
2164 ok(wait_listen_thread != NULL, "CreateThread failed\n");
2165
2166 client_thread = CreateThread(NULL, 0, listen_test_client_thread, binding, 0, NULL);
2167 ok(client_thread != NULL, "CreateThread failed\n");
2168 CloseHandle(client_thread);
2169
2171 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2172
2174 ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n");
2176
2177 ret = WaitForSingleObject(wait_listen_thread, 500);
2178 ok(WAIT_TIMEOUT == ret, "WaitForSingleObject\n");
2179
2181
2182 ret = WaitForSingleObject(wait_listen_thread, 10000);
2183 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject returned %u\n", ret);
2184
2185 CloseHandle(wait_listen_thread);
2186
2190 stop_event = NULL;
2191}
2192
2193static void test_server_listening(void)
2194{
2195 static unsigned char np[] = "ncacn_np";
2196 static unsigned char address_np[] = "\\\\.";
2197 static unsigned char pipe[] = PIPE "listen_test";
2198 static unsigned char ncalrpc[] = "ncalrpc";
2199 static unsigned char guid[] = "00000000-4114-0704-2302-000000000000";
2200 unsigned char *binding;
2202
2203 status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
2204 ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status);
2205
2206 status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
2207 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
2208
2210 status = RpcServerListen(1, 20, TRUE);
2211 ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
2213
2214 status = RpcServerListen(1, 20, TRUE);
2215 ok(status == RPC_S_ALREADY_LISTENING, "RpcServerListen failed with status %d\n", status);
2216
2218 ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n");
2220
2222 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
2223
2225 ok(status == RPC_S_NOT_LISTENING, "RpcMgmtWaitServerListening failed with status %d\n", status);
2226
2227 /* test that server stop waits for a call in progress */
2228 status = RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding);
2229 ok(status == RPC_S_OK, "RpcStringBindingCompose\n");
2230
2231 test_stop_wait_for_call(binding);
2232
2233 status = RpcStringFreeA(&binding);
2234 ok(status == RPC_S_OK, "RpcStringFree\n");
2235
2236 /* repeat the test using ncalrpc */
2237 status = RpcServerUseProtseqEpA(ncalrpc, 0, guid, NULL);
2238 ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
2239
2240 status = RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding);
2241 ok(status == RPC_S_OK, "RpcStringBindingCompose\n");
2242
2243 test_stop_wait_for_call(binding);
2244
2245 status = RpcStringFreeA(&binding);
2246 ok(status == RPC_S_OK, "RpcStringFree\n");
2247}
2248
2250{
2251 SECURITY_ATTRIBUTES sec_attr = { sizeof(sec_attr), NULL, TRUE };
2252 HANDLE ready_event;
2253 char cmdline[MAX_PATH];
2256 DWORD ret;
2257
2258 memset(&startup, 0, sizeof startup);
2259 startup.cb = sizeof startup;
2260
2261 ready_event = CreateEventW(&sec_attr, TRUE, FALSE, NULL);
2262 ok(ready_event != NULL, "CreateEvent failed: %u\n", GetLastError());
2263
2264#ifdef __REACTOS__
2265 sprintf(cmdline, "%s server run %Ix", progname, (UINT_PTR)ready_event);
2266#else
2267 sprintf(cmdline, "%s server run %lx", progname, (UINT_PTR)ready_event);
2268#endif
2269 trace("running server process...\n");
2270 ok(CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
2271 ret = WaitForSingleObject(ready_event, 10000);
2272 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2273
2274 ok(CloseHandle(info.hThread), "CloseHandle\n");
2275 ok(CloseHandle(ready_event), "CloseHandle\n");
2276 return info.hProcess;
2277}
2278
2279static void run_server(HANDLE ready_event)
2280{
2281 static unsigned char np[] = "ncacn_np";
2282 static unsigned char pipe[] = PIPE "term_test";
2284 BOOL ret;
2285
2286 status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
2287 ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status);
2288
2289 status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
2290 ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
2291
2293 status = RpcServerListen(1, 20, TRUE);
2294 ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
2295
2297 ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
2298
2299 ret = SetEvent(ready_event);
2300 ok(ret, "SetEvent failed: %u\n", GetLastError());
2301
2303 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2304
2306 ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
2307
2309 stop_event = NULL;
2310}
2311
2313{
2314 basic_tests();
2315 return 0;
2316}
2317
2318static void test_reconnect(void)
2319{
2320 static unsigned char np[] = "ncacn_np";
2321 static unsigned char address_np[] = "\\\\.";
2322 static unsigned char pipe[] = PIPE "term_test";
2323 unsigned char *binding;
2324 HANDLE threads[32];
2325 HANDLE server_process;
2326 unsigned i;
2327 DWORD ret;
2328
2329 server_process = create_server_process();
2330
2331 ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
2332 ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
2333
2334 for (i = 0; i < ARRAY_SIZE(threads); i++)
2335 {
2337 ok(threads[i] != NULL, "CreateThread failed: %u\n", GetLastError());
2338 }
2339
2340 for (i = 0; i < ARRAY_SIZE(threads); i++)
2341 {
2342 ret = WaitForSingleObject(threads[i], 10000);
2343 ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
2345 }
2346
2347 stop();
2348
2349 winetest_wait_child_process(server_process);
2350 ok(CloseHandle(server_process), "CloseHandle\n");
2351
2352 /* create new server, rpcrt4 will connect to it once sending to existing connection fails
2353 * that current connection is broken. */
2354 server_process = create_server_process();
2355 basic_tests();
2356 stop();
2357
2358 winetest_wait_child_process(server_process);
2359 ok(CloseHandle(server_process), "CloseHandle\n");
2360
2361 ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
2362 ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
2363}
2364
2366{
2367 HANDLE token;
2369 {
2371 DWORD size;
2372 BOOL ret;
2373
2375 CloseHandle( token );
2376 return (ret && type == TokenElevationTypeFull);
2377 }
2378 return FALSE;
2379}
2380
2382{
2383 HRESULT hr, init;
2384 INetFwMgr *mgr = NULL;
2387 VARIANT_BOOL enabled = VARIANT_FALSE;
2388
2390
2391 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
2392 (void **)&mgr );
2393 ok( hr == S_OK, "got %08x\n", hr );
2394 if (hr != S_OK) goto done;
2395
2396 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
2397 ok( hr == S_OK, "got %08x\n", hr );
2398 if (hr != S_OK) goto done;
2399
2400 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
2401 if (hr != S_OK) goto done;
2402
2403 hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
2404 ok( hr == S_OK, "got %08x\n", hr );
2405
2406done:
2407 if (policy) INetFwPolicy_Release( policy );
2408 if (profile) INetFwProfile_Release( profile );
2409 if (mgr) INetFwMgr_Release( mgr );
2410 if (SUCCEEDED( init )) CoUninitialize();
2411 return (enabled == VARIANT_TRUE);
2412}
2413
2415{
2419
2421{
2422 static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
2423 HRESULT hr, init;
2424 INetFwMgr *mgr = NULL;
2430
2432 {
2434 return E_FAIL;
2435 }
2437
2438 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
2439 (void **)&mgr );
2440 ok( hr == S_OK, "got %08x\n", hr );
2441 if (hr != S_OK) goto done;
2442
2443 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
2444 ok( hr == S_OK, "got %08x\n", hr );
2445 if (hr != S_OK) goto done;
2446
2447 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
2448 if (hr != S_OK) goto done;
2449
2450 hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
2451 ok( hr == S_OK, "got %08x\n", hr );
2452 if (hr != S_OK) goto done;
2453
2454 hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
2455 &IID_INetFwAuthorizedApplication, (void **)&app );
2456 ok( hr == S_OK, "got %08x\n", hr );
2457 if (hr != S_OK) goto done;
2458
2459 hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
2460 if (hr != S_OK) goto done;
2461
2463 hr = INetFwAuthorizedApplication_put_Name( app, name );
2465 ok( hr == S_OK, "got %08x\n", hr );
2466 if (hr != S_OK) goto done;
2467
2468 if (op == APP_ADD)
2469 hr = INetFwAuthorizedApplications_Add( apps, app );
2470 else if (op == APP_REMOVE)
2471 hr = INetFwAuthorizedApplications_Remove( apps, image );
2472 else
2473 hr = E_INVALIDARG;
2474
2475done:
2476 if (app) INetFwAuthorizedApplication_Release( app );
2477 if (apps) INetFwAuthorizedApplications_Release( apps );
2478 if (policy) INetFwPolicy_Release( policy );
2479 if (profile) INetFwProfile_Release( profile );
2480 if (mgr) INetFwMgr_Release( mgr );
2481 if (SUCCEEDED( init )) CoUninitialize();
2483 return hr;
2484}
2485
2487{
2488 ULONG size = 0;
2489 int argc;
2490 char **argv;
2491 BOOL firewall_enabled = is_firewall_enabled(), firewall_disabled = FALSE;
2492
2495
2496 ok(!GetUserNameExA(NameSamCompatible, NULL, &size), "GetUserNameExA\n");
2498 ok(GetUserNameExA(NameSamCompatible, domain_and_user, &size), "GetUserNameExA\n");
2499
2501 progname = argv[0];
2502
2503 if (argc == 3)
2504 {
2506 {
2507 client(argv[2]);
2508 }
2510 {
2511 trace("Exception %d\n", RpcExceptionCode());
2512 }
2514 }
2515 else if (argc == 4)
2516 {
2517 if (!strcmp(argv[3], "listen"))
2518 {
2520 }
2521 else if(!strcmp(argv[2], "run"))
2522 {
2524#ifdef __REACTOS__
2525 sscanf(argv[3], "%Ix", &event);
2526#else
2527 sscanf(argv[3], "%lx", &event);
2528#endif
2530 }
2531 }
2532 else
2533 {
2534 if (firewall_enabled)
2535 {
2536 if (is_process_elevated())
2537 {
2539 if (hr == S_OK)
2540 {
2541 firewall_enabled = FALSE;
2542 firewall_disabled = TRUE;
2543 }
2544 else
2545 {
2546 skip("can't authorize app in firewall %08x\n", hr);
2547 }
2548 }
2549 else
2550 {
2551 trace("no privileges, skipping tests to avoid firewall dialog\n");
2552 }
2553 }
2554
2555 if (!firewall_enabled) server();
2556
2557 /* Those tests cause occasional crashes on winxp and win2k3 */
2558 if (GetProcAddress(GetModuleHandleA("rpcrt4.dll"), "RpcExceptionFilter"))
2560 else
2561 win_skip("Skipping reconnect tests on too old Windows version\n");
2562
2563 run_client("test listen");
2564 if (firewall_disabled) set_firewall(APP_REMOVE);
2565 }
2566
2568}
static int argc
Definition: ServiceArgs.c:12
#define broken(x)
Definition: _sntprintf.h:21
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define __cdecl
Definition: accygwin.h:79
struct outqueuenode * tail
Definition: adnsresfilter.c:66
static void startup(void)
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#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:33
int get_name(unsigned char **pos, uint32_t *remaining, const char **out_name)
Definition: util.c:55
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 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:455
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
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 HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#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:4741
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
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
#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:93
WDF_INTERRUPT_POLICY policy
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
GLsizeiptr size
Definition: glext.h:5919
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
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
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,...)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
static const WCHAR testW[]
Definition: jsregexp.c:44
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define profile
Definition: kernel32.h:12
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
const GUID * guid
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define for
Definition: utility.h:88
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static HANDLE ULONG_PTR DWORD threads
Definition: process.c:81
#define todo_wine
Definition: custom.c:79
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:80
static void test_handle_return(void)
Definition: server.c:1843
int __cdecl s_sum_unique_conf_ptr(int *x, int n)
Definition: server.c:489
int __cdecl s_sum_toplev_conf_2n(int *x, int n)
Definition: server.c:662
void __cdecl s_get_namesw(int *n, wstr_array_t *names)
Definition: server.c:795
static DWORD WINAPI basic_tests_thread(void *arg)
Definition: server.c:2312
int __cdecl s_sum_var_array(int x[20], int n)
Definition: server.c:494
static int pints_t pn[]
Definition: server.c:129
static void set_interp_interface(void)
Definition: server.c:247
void __RPC_USER bstr_t_UserFree(ULONG *flags, bstr_t *b)
Definition: server.c:1466
int __cdecl s_sum_doub_carr(doub_carr_t *dc)
Definition: server.c:725
signed char __cdecl s_sum_char(signed char x, signed char y)
Definition: server.c:313
static void test_server_listening(void)
Definition: server.c:2193
void __cdecl s_get_ranged_enum(renum_t *re)
Definition: server.c:847
int __cdecl s_str_length(const char *s)
Definition: server.c:358
int __cdecl s_sum_hyper_int(hyper x, hyper y)
Definition: server.c:338
void __cdecl s_stop_autolisten(void)
Definition: server.c:1050
void __cdecl s_full_pointer_test(int *a, int *b)
Definition: server.c:1021
int __cdecl s_sum_conf_array(int x[], int n)
Definition: server.c:457
int __cdecl s_dot_two_vectors(vector_t vs[2])
Definition: server.c:510
unsigned char *__RPC_USER us_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
Definition: server.c:1424
int __cdecl s_echo_ranged_int(int i, int j, int k)
Definition: server.c:837
static doub_carr_t ** dc
Definition: server.c:120
int __cdecl s_sum_parr(int *a[3])
Definition: server.c:625
int __cdecl s_sum_cpuints(cpuints_t *p)
Definition: server.c:578
ULONG __RPC_USER puint_t_UserSize(ULONG *flags, ULONG start, puint_t *p)
Definition: server.c:1379
#define INT_CODE
Definition: server.c:41
static void pointer_tests(void)
Definition: server.c:1472
int __cdecl s_wstr_struct_len(wstr_struct_t *s)
Definition: server.c:720
double __cdecl s_square_encue(encue_t *eue)
Definition: server.c:651
int __cdecl s_sum_cps(cps_t *cps)
Definition: server.c:527
static int j
Definition: server.c:132
int __cdecl s_sum_pcarr(int *a[], int n)
Definition: server.c:630
s123_t *__cdecl s_get_s123(void)
Definition: server.c:823
int __cdecl s_sum_padded_conf(padded_t *ps, int n)
Definition: server.c:696
static const WCHAR helloW[]
Definition: server.c:242
static cpsc_t * cpsc
Definition: server.c:95
int __cdecl s_sum_char_hyper(signed char x, hyper y)
Definition: server.c:343
static HRESULT set_firewall(enum firewall_op op)
Definition: server.c:2420
static int size
Definition: server.c:129
#define SERVER_FUNCTIONS
Definition: server.c:148
static void basic_tests(void)
Definition: server.c:1121
static void run_server(HANDLE ready_event)
Definition: server.c:2279
int __cdecl s_sum_pcarr2(int n, int **pa)
Definition: server.c:809
static unencu_t * eu
Definition: server.c:102
void __cdecl s_get_name(name_t *name)
Definition: server.c:772
int __cdecl s_test_list_length(test_list_t *list)
Definition: server.c:437
void __cdecl s_get_a_bstr(bstr_t *b)
Definition: server.c:763
static void array_tests(void)
Definition: server.c:1613
double __cdecl s_square_unencu(int t, unencu_t *eu)
Definition: server.c:609
int __cdecl s_sum_sp(sp_t *sp)
Definition: server.c:419
static void NDR_RUNDOWN
Definition: server.c:48
int __cdecl s_dot_pvectors(pvectors_t *p)
Definition: server.c:414
#define PORT
Definition: server.c:38
unsigned char *__RPC_USER puint_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
Definition: server.c:1393
@ APP_REMOVE
Definition: server.c:2417
@ APP_ADD
Definition: server.c:2416
#define PIPE
Definition: server.c:39
unsigned char *__RPC_USER bstr_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
Definition: server.c:1455
static void union_tests(void)
Definition: server.c:1293
static void void ULONG
Definition: server.c:48
unsigned char *__RPC_USER us_t_UserMarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
Definition: server.c:1415
static void make_cmdline(char buffer[MAX_PATH], const char *test)
Definition: server.c:1098
static NDR_SCONTEXT
Definition: server.c:48
int __cdecl s_sum_toplev_conf_cond(int *x, int a, int b, int c)
Definition: server.c:671
static DWORD WINAPI listen_test_client_thread(void *binding)
Definition: server.c:2120
static vector_t v
Definition: server.c:100
static int n
Definition: server.c:72
static void free_pyramid_doub_carr(doub_carr_t *dc)
Definition: server.c:1604
float __cdecl s_square_half_float(float x, float *y)
Definition: server.c:387
void __cdecl s_full_pointer_null_test(int *a, int *b)
Definition: server.c:1028
hyper __cdecl s_sum_hyper(hyper x, hyper y)
Definition: server.c:333
static int int b
Definition: server.c:109
void __cdecl s_check_null(int *null)
Definition: server.c:710
static str_array_t * names
Definition: server.c:124
double __cdecl s_sum_aligns(aligns_t *a)
Definition: server.c:681
static void test_reconnect(void)
Definition: server.c:2318
static HANDLE stop_wait_event
Definition: server.c:46
short __cdecl s_sum_short(short x, short y)
Definition: server.c:318
double __cdecl s_square_half(double x, double *y)
Definition: server.c:381
void __RPC_USER us_t_UserFree(ULONG *flags, us_t *pus)
Definition: server.c:1434
int __cdecl s_sum_padded(padded_t *p)
Definition: server.c:686
int __cdecl s_enum_ord(e_t e)
Definition: server.c:638
static void test_stop_wait_for_call(unsigned char *binding)
Definition: server.c:2148
void __cdecl s_square_out(int x, int *y)
Definition: server.c:348
fnprintf * p_printf
Definition: server.c:240
static test_list_t * null_list(void)
Definition: server.c:1353
static s123_t *__cdecl * get_s123(void)
static int * n2_then_x1
Definition: server.c:86
int __cdecl s_square_test_us(test_us_t *tus)
Definition: server.c:592
int __cdecl s_sum_puints(puints_t *p)
Definition: server.c:569
static char * domain_and_user
Definition: server.c:56
double __cdecl s_square_encu(encu_t *eu)
Definition: server.c:598
int __cdecl s_pints_sum(pints_t *pints)
Definition: server.c:404
static BOOL is_interp
Definition: server.c:245
static HANDLE stop_event
Definition: server.c:46
int __cdecl s_sum_cs(cs_t *cs)
Definition: server.c:522
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_SECURITY_QOS *static RPC_AUTH_KEY_RETRIEVAL_FN
Definition: server.c:54
static BOOL old_windows_version
Definition: server.c:44
void __cdecl s_get_numbers(int length, int size, pints_t n[])
Definition: server.c:992
static void set_mixed_interface(void)
Definition: server.c:256
static BOOL is_process_elevated(void)
Definition: server.c:2365
int __cdecl s_str_t_length(str_t s)
Definition: server.c:363
static unsigned(__cdecl *hash_bstr)(bstr_t s)
static int y
Definition: server.c:60
static HANDLE create_server_process(void)
Definition: server.c:2249
int __cdecl s_sum_array_ptr(int(*a)[2])
Definition: server.c:1072
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_CSTR
Definition: server.c:52
static vector_t * vs
Definition: server.c:127
str_t __cdecl s_get_filename(void)
Definition: server.c:832
static int a
Definition: server.c:109
void __cdecl s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc)
Definition: server.c:735
int __cdecl s_sum_double_int(int x, double y)
Definition: server.c:328
static rint_t(__cdecl *echo_ranged_int)(int i
int __cdecl s_sum(int x, int y)
Definition: server.c:308
#define test_is_server_listening2(a, b, c)
Definition: server.c:1889
static void run_client(const char *test)
Definition: server.c:1104
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_SECURITY_QOS *static LPVOID
Definition: server.c:54
void __RPC_USER puint_t_UserFree(ULONG *flags, puint_t *p)
Definition: server.c:1403
void __RPC_USER ctx_handle_t_rundown(ctx_handle_t ctx_handle)
Definition: server.c:1092
void __cdecl s_get_numbers_struct(numbers_struct_t **ns)
Definition: server.c:1004
unsigned char *__RPC_USER puint_t_UserMarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
Definition: server.c:1385
ctx_handle_t __cdecl s_get_handle(void)
Definition: server.c:1077
void __cdecl s_get_names(int *n, str_array_t *names)
Definition: server.c:781
int __cdecl s_echo_ranged_int2(int i)
Definition: server.c:842
void __cdecl s_square_ref(int *x)
Definition: server.c:353
int __cdecl s_cstr_length(const char *s, int n)
Definition: server.c:368
static int ** pa
Definition: server.c:126
static int int k
Definition: server.c:132
static DWORD WINAPI wait_listen_proc(void *arg)
Definition: server.c:2136
int __cdecl s_str_struct_len(str_struct_t *s)
Definition: server.c:715
static str_t(__cdecl *get_filename)(void)
static UUID RPC_MGR_EPV unsigned int
Definition: server.c:50
int __cdecl s_sum_bogus(bogus_t *b)
Definition: server.c:705
int __cdecl s_sum_fixed_int_3d(int m[2][3][4])
Definition: server.c:444
void __cdecl s_check_se2(se_t *s)
Definition: server.c:620
int __cdecl s_dot_copy_vectors(vector_t u, vector_t v)
Definition: server.c:587
ULONG __RPC_USER us_t_UserSize(ULONG *flags, ULONG start, us_t *pus)
Definition: server.c:1409
static void server(void)
Definition: server.c:2011
int __cdecl s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2)
Definition: server.c:468
static BOOL is_firewall_enabled(void)
Definition: server.c:2381
int __cdecl s_sum_complex_array(int n, refpint_t pi[])
Definition: server.c:502
LONG __cdecl s_square_half_long(LONG x, LONG *y)
Definition: server.c:393
static void run_tests(void)
Definition: server.c:1854
int __cdecl s_sum_float(float x, float y)
Definition: server.c:323
static float(__cdecl *square_half_float)(float x
static int int * x2
Definition: server.c:86
static const char * progname
Definition: server.c:43
void __cdecl s_test_handle(ctx_handle_t ctx_handle)
Definition: server.c:1087
static int int int c
Definition: server.c:109
void __cdecl s_get_number_array(int x[20], int *n)
Definition: server.c:515
static ctx_handle_t(__cdecl *get_handle)(void)
static void _test_is_server_listening2(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status, RPC_STATUS expected_status2)
Definition: server.c:1890
int __cdecl s_sum_padded2(padded_t ps[2])
Definition: server.c:691
static refpint_t pi[]
Definition: server.c:96
int __cdecl s_int_return(void)
Definition: server.c:298
static int check_pyramid_doub_carr(doub_carr_t *dc)
Definition: server.c:1593
static test_list_t * make_list(test_list_t *tail)
Definition: server.c:1362
static UUID RPC_MGR_EPV unsigned unsigned RPC_IF_CALLBACK_FN *static RPC_AUTH_IDENTITY_HANDLE
Definition: server.c:53
int __cdecl s_sum_fixed_array(int a[5])
Definition: server.c:399
void __cdecl s_get_handle_by_ptr(ctx_handle_t *r)
Definition: server.c:1082
unsigned char *__RPC_USER bstr_t_UserMarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
Definition: server.c:1446
int __cdecl s_sum_cpsc(cpsc_t *cpsc)
Definition: server.c:541
#define test_is_server_listening(a, b)
Definition: server.c:1880
double __cdecl s_square_sun(sun_t *su)
Definition: server.c:424
int __cdecl s_dot_self(vector_t *v)
Definition: server.c:376
unsigned __cdecl s_hash_bstr(bstr_t b)
Definition: server.c:752
static int secure
Definition: server.c:138
double __cdecl s_ptypes_sum(ptypes_t *pt)
Definition: server.c:409
static void InitFunctionPointers(void)
Definition: server.c:265
int __cdecl s_sum_unique_conf_array(int x[], int n)
Definition: server.c:484
static void free_list(test_list_t *list)
Definition: server.c:1371
void __cdecl s_context_handle_test(void)
Definition: server.c:852
void __cdecl s_authinfo_test(unsigned int protseq, int secure)
Definition: server.c:1771
static const WCHAR worldW[]
Definition: server.c:243
int __cdecl s_sum_L1_norms(int n, vector_t *vs)
Definition: server.c:814
static void set_auth_info(RPC_BINDING_HANDLE handle)
Definition: server.c:1865
int __cdecl s_square_puint(puint_t p)
Definition: server.c:563
ULONG __RPC_USER bstr_t_UserSize(ULONG *flags, ULONG start, bstr_t *b)
Definition: server.c:1440
void __cdecl s_ip_test(ipu_t *a)
Definition: server.c:1058
static void _test_is_server_listening(unsigned line, RPC_BINDING_HANDLE binding, RPC_STATUS expected_status)
Definition: server.c:1881
int __cdecl s_get_cpsc(int n, cpsc_t *cpsc)
Definition: server.c:550
static char * xstrdup(const char *s)
Definition: server.c:291
int __cdecl s_sum_ptr_array(int *a[2])
Definition: server.c:1067
void __cdecl s_stop(void)
Definition: server.c:1034
int __cdecl s_square(int x)
Definition: server.c:303
#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
#define L(x)
Definition: ntvdm.h:50
@ 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 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:787
RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE *ServerBinding)
Definition: rpc_binding.c:1646
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:564
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1463
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:457
RPC_STATUS WINAPI RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding)
Definition: rpc_binding.c:920
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:1596
RPC_STATUS WINAPI RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:840
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1056
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:1572
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:107
INT64 hyper
Definition: rpcndr.h:117
#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:268
RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR *String)
Definition: rpcrt4_main.c:158
#define RpcEndExcept
Definition: rpc.h:128
#define midl_user_free
Definition: rpc.h:45
#define __RPC_FAR
Definition: rpc.h:56
#define RpcTryExcept
Definition: rpc.h:126
#define RpcExcept(expr)
Definition: rpc.h:127
long RPC_STATUS
Definition: rpc.h:52
#define __RPC_USER
Definition: rpc.h:65
#define RpcExceptionCode()
Definition: rpc.h:132
#define midl_user_allocate
Definition: rpc.h:44
#define ros_skip_flaky
Definition: test.h:177
#define win_skip
Definition: test.h:160
int winetest_get_mainargs(char ***pargv)
void winetest_wait_child_process(HANDLE process)
#define memset(x, y, z)
Definition: compat.h:39
static FILE * client
Definition: client.c:41
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
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: 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
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
int ret
_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:406
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
#define WINAPI
Definition: msvc.h:6
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1014
#define RPC_S_ALREADY_LISTENING
Definition: winerror.h:1024
#define RPC_S_BINDING_HAS_NO_AUTH
Definition: winerror.h:1054
#define RPC_S_CANNOT_SUPPORT
Definition: winerror.h:1072
#define RPC_S_NOT_LISTENING
Definition: winerror.h:1026
#define RPC_S_UNKNOWN_MGR_TYPE
Definition: winerror.h:1027
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
@ TokenElevationTypeFull
Definition: winnt_old.h:2487
static int init
Definition: wintirpc.c:33
#define TOKEN_QUERY
Definition: setypes.h:928
@ TokenElevationType
Definition: setypes.h:983
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185