2 * Tests for WIDL and RPC server/clients.
4 * Copyright (C) Google 2007 (Dan Hipschman)
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.
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.
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
24 #include "wine/test.h"
26 #include "server_defines.h"
33 #define PIPE "\\pipe\\wine_rpcrt4_test"
37 static const char *progname
;
38 static BOOL old_windows_version
;
40 static HANDLE stop_event
;
42 static void (WINAPI
*pNDRSContextMarshall2
)(RPC_BINDING_HANDLE
, NDR_SCONTEXT
, void*, NDR_RUNDOWN
, void*, ULONG
);
43 static NDR_SCONTEXT (WINAPI
*pNDRSContextUnmarshall2
)(RPC_BINDING_HANDLE
, void*, ULONG
, void*, ULONG
);
44 static RPC_STATUS (WINAPI
*pRpcServerRegisterIfEx
)(RPC_IF_HANDLE
,UUID
*, RPC_MGR_EPV
*, unsigned int,
45 unsigned int,RPC_IF_CALLBACK_FN
*);
46 static BOOLEAN (WINAPI
*pGetUserNameExA
)(EXTENDED_NAME_FORMAT
, LPSTR
, PULONG
);
47 static RPC_STATUS (WINAPI
*pRpcBindingSetAuthInfoExA
)(RPC_BINDING_HANDLE
, RPC_CSTR
, ULONG
, ULONG
,
48 RPC_AUTH_IDENTITY_HANDLE
, ULONG
, RPC_SECURITY_QOS
*);
49 static RPC_STATUS (WINAPI
*pRpcServerRegisterAuthInfoA
)(RPC_CSTR
, ULONG
, RPC_AUTH_KEY_RETRIEVAL_FN
, LPVOID
);
51 static char *domain_and_user
;
53 /* type check statements generated in header file */
54 fnprintf
*p_printf
= printf
;
56 static void InitFunctionPointers(void)
58 HMODULE hrpcrt4
= GetModuleHandleA("rpcrt4.dll");
59 HMODULE hsecur32
= LoadLibraryA("secur32.dll");
61 pNDRSContextMarshall2
= (void *)GetProcAddress(hrpcrt4
, "NDRSContextMarshall2");
62 pNDRSContextUnmarshall2
= (void *)GetProcAddress(hrpcrt4
, "NDRSContextUnmarshall2");
63 pRpcServerRegisterIfEx
= (void *)GetProcAddress(hrpcrt4
, "RpcServerRegisterIfEx");
64 pRpcBindingSetAuthInfoExA
= (void *)GetProcAddress(hrpcrt4
, "RpcBindingSetAuthInfoExA");
65 pRpcServerRegisterAuthInfoA
= (void *)GetProcAddress(hrpcrt4
, "RpcServerRegisterAuthInfoA");
66 pGetUserNameExA
= (void *)GetProcAddress(hsecur32
, "GetUserNameExA");
68 if (!pNDRSContextMarshall2
) old_windows_version
= TRUE
;
71 void __RPC_FAR
*__RPC_USER
72 midl_user_allocate(SIZE_T n
)
74 return HeapAlloc(GetProcessHeap(), 0, n
);
78 midl_user_free(void __RPC_FAR
*p
)
80 HeapFree(GetProcessHeap(), 0, p
);
84 xstrdup(const char *s
)
86 char *d
= HeapAlloc(GetProcessHeap(), 0, strlen(s
) + 1);
110 s_square_out(int x
, int *y
)
122 s_str_length(const char *s
)
128 s_str_t_length(str_t s
)
134 s_cstr_length(const char *s
, int n
)
137 while (0 < n
-- && *s
++)
143 s_dot_self(vector_t
*v
)
145 return s_square(v
->x
) + s_square(v
->y
) + s_square(v
->z
);
149 s_square_half(double x
, double *y
)
156 s_square_half_float(float x
, float *y
)
163 s_square_half_long(LONG x
, LONG
*y
)
170 s_sum_fixed_array(int a
[5])
172 return a
[0] + a
[1] + a
[2] + a
[3] + a
[4];
176 s_pints_sum(pints_t
*pints
)
178 return *pints
->pi
+ **pints
->ppi
+ ***pints
->pppi
;
182 s_ptypes_sum(ptypes_t
*pt
)
184 return *pt
->pc
+ *pt
->ps
+ *pt
->pl
+ *pt
->pf
+ *pt
->pd
;
188 s_dot_pvectors(pvectors_t
*p
)
190 return p
->pu
->x
* (*p
->pv
)->x
+ p
->pu
->y
* (*p
->pv
)->y
+ p
->pu
->z
* (*p
->pv
)->z
;
196 return sp
->x
+ sp
->s
->x
;
200 s_square_sun(sun_t
*su
)
204 case SUN_I
: return su
->u
.i
* su
->u
.i
;
206 case SUN_F2
: return su
->u
.f
* su
->u
.f
;
207 case SUN_PI
: return (*su
->u
.pi
) * (*su
->u
.pi
);
214 s_test_list_length(test_list_t
*list
)
216 return (list
->t
== TL_LIST
217 ? 1 + s_test_list_length(list
->u
.tail
)
222 s_sum_fixed_int_3d(int m
[2][3][4])
227 for (i
= 0; i
< 2; ++i
)
228 for (j
= 0; j
< 3; ++j
)
229 for (k
= 0; k
< 4; ++k
)
236 s_sum_conf_array(int x
[], int n
)
238 int *p
= x
, *end
= p
+ n
;
248 s_sum_conf_ptr_by_conf_ptr(int n1
, int *n2_then_x1
, int *x2
)
255 for(i
= 1; i
< n1
; ++i
)
256 sum
+= n2_then_x1
[i
];
258 for(i
= 0; i
< *n2_then_x1
; ++i
)
265 s_sum_unique_conf_array(int x
[], int n
)
267 return s_sum_conf_array(x
, n
);
271 s_sum_unique_conf_ptr(int *x
, int n
)
273 return x
? s_sum_conf_array(x
, n
) : 0;
277 s_sum_var_array(int x
[20], int n
)
279 ok(0 <= n
, "RPC sum_var_array\n");
280 ok(n
<= 20, "RPC sum_var_array\n");
282 return s_sum_conf_array(x
, n
);
286 s_dot_two_vectors(vector_t vs
[2])
288 return vs
[0].x
* vs
[1].x
+ vs
[0].y
* vs
[1].y
+ vs
[0].z
* vs
[1].z
;
294 return s_sum_conf_array(cs
->ca
, cs
->n
);
298 s_sum_cps(cps_t
*cps
)
303 for (i
= 0; i
< *cps
->pn
; ++i
)
306 for (i
= 0; i
< 2 * cps
->n
; ++i
)
313 s_sum_cpsc(cpsc_t
*cpsc
)
317 for (i
= 0; i
< (cpsc
->c
? cpsc
->a
: cpsc
->b
); ++i
)
323 s_square_puint(puint_t p
)
330 s_sum_puints(puints_t
*p
)
334 for (i
= 0; i
< p
->n
; ++i
)
335 sum
+= atoi(p
->ps
[i
]);
340 s_sum_cpuints(cpuints_t
*p
)
344 for (i
= 0; i
< p
->n
; ++i
)
345 sum
+= atoi(p
->ps
[i
]);
350 s_dot_copy_vectors(vector_t u
, vector_t v
)
352 return u
.x
* v
.x
+ u
.y
* v
.y
+ u
.z
* v
.z
;
356 s_square_test_us(test_us_t
*tus
)
358 int n
= atoi(tus
->us
.x
);
363 s_square_encu(encu_t
*eu
)
367 case ENCU_I
: return eu
->tagged_union
.i
* eu
->tagged_union
.i
;
368 case ENCU_F
: return eu
->tagged_union
.f
* eu
->tagged_union
.f
;
375 s_square_unencu(int t
, unencu_t
*eu
)
379 case ENCU_I
: return eu
->i
* eu
->i
;
380 case ENCU_F
: return eu
->f
* eu
->f
;
389 ok(s
->f
== E2
, "check_se2\n");
393 s_sum_parr(int *a
[3])
395 return s_sum_pcarr(a
, 3);
399 s_sum_pcarr(int *a
[], int n
)
402 for (i
= 0; i
< n
; ++i
)
422 s_square_encue(encue_t
*eue
)
426 case E1
: return eue
->tagged_union
.i1
* eue
->tagged_union
.i1
;
427 case E2
: return eue
->tagged_union
.f2
* eue
->tagged_union
.f2
;
434 s_sum_toplev_conf_2n(int *x
, int n
)
438 for (i
= 0; i
< 2 * n
; ++i
)
444 s_sum_toplev_conf_cond(int *x
, int a
, int b
, int c
)
449 for (i
= 0; i
< n
; ++i
)
455 s_sum_aligns(aligns_t
*a
)
457 return a
->c
+ a
->i
+ a
->s
+ a
->d
;
461 s_sum_padded(padded_t
*p
)
467 s_sum_padded2(padded_t ps
[2])
469 return s_sum_padded(&ps
[0]) + s_sum_padded(&ps
[1]);
473 s_sum_padded_conf(padded_t
*ps
, int n
)
477 for (i
= 0; i
< n
; ++i
)
478 sum
+= s_sum_padded(&ps
[i
]);
483 s_sum_bogus(bogus_t
*b
)
485 return *b
->h
.p1
+ *b
->p2
+ *b
->p3
+ b
->c
;
489 s_check_null(int *null
)
491 ok(!null
, "RPC check_null\n");
495 s_str_struct_len(str_struct_t
*s
)
497 return lstrlenA(s
->s
);
501 s_wstr_struct_len(wstr_struct_t
*s
)
503 return lstrlenW(s
->s
);
507 s_sum_doub_carr(doub_carr_t
*dc
)
511 for (i
= 0; i
< dc
->n
; ++i
)
512 for (j
= 0; j
< dc
->a
[i
]->n
; ++j
)
513 sum
+= dc
->a
[i
]->a
[j
];
518 s_make_pyramid_doub_carr(unsigned char n
, doub_carr_t
**dc
)
522 t
= MIDL_user_allocate(FIELD_OFFSET(doub_carr_t
, a
[n
]));
524 for (i
= 0; i
< n
; ++i
)
527 t
->a
[i
] = MIDL_user_allocate(FIELD_OFFSET(doub_carr_1_t
, a
[v
]));
529 for (j
= 0; j
< v
; ++j
)
530 t
->a
[i
]->a
[j
] = j
+ 1;
536 s_hash_bstr(bstr_t b
)
542 for (i
= 0; i
< n
; ++i
)
543 hash
= 5 * hash
+ (unsigned) s
[i
];
548 s_get_name(name_t
*name
)
550 const char bossman
[] = "Jeremy White";
551 memcpy(name
->name
, bossman
, min(name
->size
, sizeof(bossman
)));
552 /* ensure nul-termination */
553 if (name
->size
< sizeof(bossman
))
554 name
->name
[name
->size
- 1] = 0;
558 s_sum_pcarr2(int n
, int **pa
)
560 return s_sum_conf_array(*pa
, n
);
564 s_sum_L1_norms(int n
, vector_t
*vs
)
568 for (i
= 0; i
< n
; ++i
)
569 sum
+= abs(vs
[i
].x
) + abs(vs
[i
].y
) + abs(vs
[i
].z
);
576 s123_t
*s
= MIDL_user_allocate(sizeof *s
);
586 return (char *)__FILE__
;
589 int s_echo_ranged_int(int n
)
594 void s_get_ranged_enum(renum_t
*re
)
600 s_context_handle_test(void)
603 RPC_BINDING_HANDLE binding
;
605 unsigned char buf
[20];
606 static RPC_SERVER_INTERFACE server_if
=
608 sizeof(RPC_SERVER_INTERFACE
),
609 {{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
610 {{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
619 binding
= I_RpcGetCurrentCallHandle();
620 ok(binding
!= NULL
, "I_RpcGetCurrentCallHandle returned NULL\n");
622 if (!pNDRSContextMarshall2
|| !pNDRSContextUnmarshall2
)
624 win_skip("NDRSContextMarshall2 or NDRSContextUnmarshall2 not exported from rpcrt4.dll\n");
628 h
= pNDRSContextUnmarshall2(binding
, NULL
, NDR_LOCAL_DATA_REPRESENTATION
, NULL
, 0);
629 ok(h
!= NULL
, "NDRSContextUnmarshall2 returned NULL\n");
631 /* marshal a context handle with NULL userContext */
632 memset(buf
, 0xcc, sizeof(buf
));
633 pNDRSContextMarshall2(binding
, h
, buf
, NULL
, NULL
, 0);
634 ok(*(ULONG
*)buf
== 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG
*)buf
);
635 ok(UuidIsNil((UUID
*)&buf
[4], &status
), "uuid should have been nil\n");
637 h
= pNDRSContextUnmarshall2(binding
, NULL
, NDR_LOCAL_DATA_REPRESENTATION
, NULL
, 0);
638 ok(h
!= NULL
, "NDRSContextUnmarshall2 returned NULL\n");
640 /* marshal a context handle with non-NULL userContext */
641 memset(buf
, 0xcc, sizeof(buf
));
642 h
->userContext
= (void *)0xdeadbeef;
643 pNDRSContextMarshall2(binding
, h
, buf
, NULL
, NULL
, 0);
644 ok(*(ULONG
*)buf
== 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG
*)buf
);
645 ok(!UuidIsNil((UUID
*)&buf
[4], &status
), "uuid should not have been nil\n");
647 /* raises ERROR_INVALID_HANDLE exception on Vista upwards */
650 h
= pNDRSContextUnmarshall2(binding
, buf
, NDR_LOCAL_DATA_REPRESENTATION
, NULL
, 0);
651 ok(h
!= NULL
, "NDRSContextUnmarshall2 returned NULL\n");
652 ok(h
->userContext
== (void *)0xdeadbeef, "userContext of interface didn't unmarshal properly: %p\n", h
->userContext
);
654 /* marshal a context handle with an interface specified */
655 h
= pNDRSContextUnmarshall2(binding
, NULL
, NDR_LOCAL_DATA_REPRESENTATION
, &server_if
.InterfaceId
, 0);
656 ok(h
!= NULL
, "NDRSContextUnmarshall2 returned NULL\n");
658 memset(buf
, 0xcc, sizeof(buf
));
659 h
->userContext
= (void *)0xcafebabe;
660 pNDRSContextMarshall2(binding
, h
, buf
, NULL
, &server_if
.InterfaceId
, 0);
661 ok(*(ULONG
*)buf
== 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG
*)buf
);
662 ok(!UuidIsNil((UUID
*)&buf
[4], &status
), "uuid should not have been nil\n");
664 h
= pNDRSContextUnmarshall2(binding
, buf
, NDR_LOCAL_DATA_REPRESENTATION
, &server_if
.InterfaceId
, 0);
665 ok(h
!= NULL
, "NDRSContextUnmarshall2 returned NULL\n");
666 ok(h
->userContext
== (void *)0xcafebabe, "userContext of interface didn't unmarshal properly: %p\n", h
->userContext
);
669 /* test same interface data, but different pointer */
670 /* raises ERROR_INVALID_HANDLE exception */
673 RPC_SERVER_INTERFACE server_if_clone
= server_if
;
675 pNDRSContextUnmarshall2(binding
, buf
, NDR_LOCAL_DATA_REPRESENTATION
, &server_if_clone
.InterfaceId
, 0);
678 /* test different interface data, but different pointer */
679 /* raises ERROR_INVALID_HANDLE exception */
682 static RPC_SERVER_INTERFACE server_if2
=
684 sizeof(RPC_SERVER_INTERFACE
),
685 {{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
686 {{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
694 pNDRSContextMarshall2(binding
, h
, buf
, NULL
, &server_if
.InterfaceId
, 0);
696 pNDRSContextUnmarshall2(binding
, buf
, NDR_LOCAL_DATA_REPRESENTATION
, &server_if2
.InterfaceId
, 0);
701 s_get_numbers(int length
, int size
, pints_t n
[])
704 for (i
= 0; i
< length
; i
++)
706 n
[i
].pi
= midl_user_allocate(sizeof(*n
[i
].pi
));
714 s_get_numbers_struct(numbers_struct_t
**ns
)
717 *ns
= midl_user_allocate(FIELD_OFFSET(numbers_struct_t
, numbers
[5]));
721 for (i
= 0; i
< (*ns
)->length
; i
++)
723 (*ns
)->numbers
[i
].pi
= NULL
;
724 (*ns
)->numbers
[i
].ppi
= NULL
;
725 (*ns
)->numbers
[i
].pppi
= NULL
;
727 (*ns
)->numbers
[0].pi
= midl_user_allocate(sizeof(*(*ns
)->numbers
[i
].pi
));
728 *(*ns
)->numbers
[0].pi
= 5;
732 s_full_pointer_test(int *a
, int *b
)
734 ok(*a
== 42, "Expected *a to be 42 instead of %d\n", *a
);
735 ok(*b
== 42, "Expected *b to be 42 instead of %d\n", *a
);
736 ok(a
== b
, "Expected a (%p) to point to the same memory as b (%p)\n", a
, b
);
740 s_full_pointer_null_test(int *a
, int *b
)
742 ok(*a
== 42, "Expected *a to be 42 instead of %d\n", *a
);
743 ok(b
== NULL
, "Expected b to be NULL instead of %p\n", b
);
749 ok(RPC_S_OK
== RpcMgmtStopServerListening(NULL
), "RpcMgmtStopServerListening\n");
750 ok(RPC_S_OK
== RpcServerUnregisterIf(NULL
, NULL
, FALSE
), "RpcServerUnregisterIf\n");
751 ok(SetEvent(stop_event
), "SetEvent\n");
755 make_cmdline(char buffer
[MAX_PATH
], const char *test
)
757 sprintf(buffer
, "%s server %s", progname
, test
);
761 run_client(const char *test
)
763 char cmdline
[MAX_PATH
];
764 PROCESS_INFORMATION info
;
765 STARTUPINFOA startup
;
767 memset(&startup
, 0, sizeof startup
);
768 startup
.cb
= sizeof startup
;
770 make_cmdline(cmdline
, test
);
771 ok(CreateProcessA(NULL
, cmdline
, NULL
, NULL
, FALSE
, 0L, NULL
, NULL
, &startup
, &info
), "CreateProcess\n");
772 winetest_wait_child_process( info
.hProcess
);
773 ok(CloseHandle(info
.hProcess
), "CloseHandle\n");
774 ok(CloseHandle(info
.hThread
), "CloseHandle\n");
780 char string
[] = "I am a string";
781 WCHAR wstring
[] = {'I',' ','a','m',' ','a',' ','w','s','t','r','i','n','g', 0};
782 int f
[5] = {1, 3, 0, -2, -4};
783 vector_t a
= {1, 3, 7};
784 vector_t vec1
= {4, -2, 1}, vec2
= {-5, 2, 3}, *pvec2
= &vec2
;
785 pvectors_t pvecs
= {&vec1
, &pvec2
};
786 sp_inner_t spi
= {42};
787 sp_t sp
= {-13, &spi
};
794 int i1
, i2
, i3
, *pi2
, *pi3
, **ppi3
;
801 str_struct_t ss
= {string
};
802 wstr_struct_t ws
= {wstring
};
807 ok(int_return() == INT_CODE
, "RPC int_return\n");
809 ok(square(7) == 49, "RPC square\n");
810 ok(sum(23, -4) == 19, "RPC sum\n");
814 ok(x
== 121, "RPC square_out\n");
818 ok(x
== 25, "RPC square_ref\n");
820 ok(str_length(string
) == strlen(string
), "RPC str_length\n");
821 ok(str_t_length(string
) == strlen(string
), "RPC str_length\n");
822 ok(dot_self(&a
) == 59, "RPC dot_self\n");
824 ok(str_struct_len(&ss
) == lstrlenA(string
), "RPC str_struct_len\n");
825 ok(wstr_struct_len(&ws
) == lstrlenW(wstring
), "RPC str_struct_len\n");
828 u
= square_half(3.0, &v
);
829 ok(u
== 9.0, "RPC square_half\n");
830 ok(v
== 1.5, "RPC square_half\n");
833 s
= square_half_float(3.0f
, &t
);
834 ok(s
== 9.0f
, "RPC square_half_float\n");
835 ok(t
== 1.5f
, "RPC square_half_float\n");
838 q
= square_half_long(3, &r
);
839 ok(q
== 9, "RPC square_half_long\n");
840 ok(r
== 1, "RPC square_half_long\n");
851 ok(pints_sum(&pints
) == -13, "RPC pints_sum\n");
863 ok(ptypes_sum(&ptypes
) == 33.0, "RPC ptypes_sum\n");
865 ok(dot_pvectors(&pvecs
) == -21, "RPC dot_pvectors\n");
866 ok(dot_copy_vectors(vec1
, vec2
) == -21, "RPC dot_copy_vectors\n");
867 ok(sum_fixed_array(f
) == -2, "RPC sum_fixed_array\n");
868 ok(sum_sp(&sp
) == 29, "RPC sum_sp\n");
870 ok(enum_ord(E1
) == 1, "RPC enum_ord\n");
871 ok(enum_ord(E2
) == 2, "RPC enum_ord\n");
872 ok(enum_ord(E3
) == 3, "RPC enum_ord\n");
873 ok(enum_ord(E4
) == 4, "RPC enum_ord\n");
878 memset(&aligns
, 0, sizeof(aligns
));
883 ok(sum_aligns(&aligns
) == 18.0, "RPC sum_aligns\n");
887 ok(sum_padded(&padded
) == 5, "RPC sum_padded\n");
892 ok(sum_padded2(padded2
) == 6, "RPC sum_padded2\n");
897 ok(sum_padded_conf(padded2
, 2) == 6, "RPC sum_padded_conf\n");
906 ok(sum_bogus(&bogus
) == 12, "RPC sum_bogus\n");
910 str
= get_filename();
911 ok(!strcmp(str
, __FILE__
), "get_filename() returned %s instead of %s\n", str
, __FILE__
);
914 x
= echo_ranged_int(0);
915 ok(x
== 0, "echo_ranged_int() returned %d instead of 0\n", x
);
916 x
= echo_ranged_int(100);
917 ok(x
== 100, "echo_ranged_int() returned %d instead of 100\n", x
);
919 if (!old_windows_version
)
921 get_ranged_enum(&re
);
922 ok(re
== RE3
, "get_ranged_enum() returned %d instead of RE3\n", re
);
937 ok(square_sun(&su
) == 81.0, "RPC square_sun\n");
941 ok(square_sun(&su
) == 25.0, "RPC square_sun\n");
945 ok(square_sun(&su
) == 4.0, "RPC square_sun\n");
950 ok(square_sun(&su
) == 121.0, "RPC square_sun\n");
953 eu
.tagged_union
.i
= 7;
954 ok(square_encu(&eu
) == 49.0, "RPC square_encu\n");
957 eu
.tagged_union
.f
= 3.0;
958 ok(square_encu(&eu
) == 9.0, "RPC square_encu\n");
961 ok(square_unencu(ENCU_I
, &uneu
) == 16.0, "RPC square_unencu\n");
964 ok(square_unencu(ENCU_F
, &uneu
) == 25.0, "RPC square_unencu\n");
967 eue
.tagged_union
.i1
= 8;
968 ok(square_encue(&eue
) == 64.0, "RPC square_encue\n");
971 eue
.tagged_union
.f2
= 10.0;
972 ok(square_encue(&eue
) == 100.0, "RPC square_encue\n");
978 test_list_t
*n
= HeapAlloc(GetProcessHeap(), 0, sizeof *n
);
985 make_list(test_list_t
*tail
)
987 test_list_t
*n
= HeapAlloc(GetProcessHeap(), 0, sizeof *n
);
994 free_list(test_list_t
*list
)
996 if (list
->t
== TL_LIST
)
997 free_list(list
->u
.tail
);
998 HeapFree(GetProcessHeap(), 0, list
);
1002 puint_t_UserSize(ULONG
*flags
, ULONG start
, puint_t
*p
)
1004 return start
+ sizeof(int);
1007 unsigned char * __RPC_USER
1008 puint_t_UserMarshal(ULONG
*flags
, unsigned char *buffer
, puint_t
*p
)
1011 memcpy(buffer
, &n
, sizeof n
);
1012 return buffer
+ sizeof n
;
1015 unsigned char * __RPC_USER
1016 puint_t_UserUnmarshal(ULONG
*flags
, unsigned char *buffer
, puint_t
*p
)
1019 memcpy(&n
, buffer
, sizeof n
);
1020 *p
= HeapAlloc(GetProcessHeap(), 0, 10);
1021 sprintf(*p
, "%d", n
);
1022 return buffer
+ sizeof n
;
1026 puint_t_UserFree(ULONG
*flags
, puint_t
*p
)
1028 HeapFree(GetProcessHeap(), 0, *p
);
1032 us_t_UserSize(ULONG
*flags
, ULONG start
, us_t
*pus
)
1034 return start
+ sizeof(struct wire_us
);
1037 unsigned char * __RPC_USER
1038 us_t_UserMarshal(ULONG
*flags
, unsigned char *buffer
, us_t
*pus
)
1041 wus
.x
= atoi(pus
->x
);
1042 memcpy(buffer
, &wus
, sizeof wus
);
1043 return buffer
+ sizeof wus
;
1046 unsigned char * __RPC_USER
1047 us_t_UserUnmarshal(ULONG
*flags
, unsigned char *buffer
, us_t
*pus
)
1050 memcpy(&wus
, buffer
, sizeof wus
);
1051 pus
->x
= HeapAlloc(GetProcessHeap(), 0, 10);
1052 sprintf(pus
->x
, "%d", wus
.x
);
1053 return buffer
+ sizeof wus
;
1057 us_t_UserFree(ULONG
*flags
, us_t
*pus
)
1059 HeapFree(GetProcessHeap(), 0, pus
->x
);
1063 bstr_t_UserSize(ULONG
*flags
, ULONG start
, bstr_t
*b
)
1065 return start
+ FIELD_OFFSET(user_bstr_t
, data
[(*b
)[-1]]);
1068 unsigned char * __RPC_USER
1069 bstr_t_UserMarshal(ULONG
*flags
, unsigned char *buffer
, bstr_t
*b
)
1071 wire_bstr_t wb
= (wire_bstr_t
) buffer
;
1073 memcpy(&wb
->data
, *b
, wb
->n
* sizeof wb
->data
[0]);
1074 return buffer
+ FIELD_OFFSET(user_bstr_t
, data
[wb
->n
]);
1077 unsigned char * __RPC_USER
1078 bstr_t_UserUnmarshal(ULONG
*flags
, unsigned char *buffer
, bstr_t
*b
)
1080 wire_bstr_t wb
= (wire_bstr_t
) buffer
;
1081 short *data
= HeapAlloc(GetProcessHeap(), 0, (wb
->n
+ 1) * sizeof *data
);
1083 memcpy(&data
[1], wb
->data
, wb
->n
* sizeof data
[1]);
1085 return buffer
+ FIELD_OFFSET(user_bstr_t
, data
[wb
->n
]);
1089 bstr_t_UserFree(ULONG
*flags
, bstr_t
*b
)
1091 HeapFree(GetProcessHeap(), 0, &((*b
)[-1]));
1097 int a
[] = {1, 2, 3, 4};
1099 test_list_t
*list
= make_list(make_list(make_list(null_list())));
1100 test_us_t tus
= {{p1
}};
1104 short bstr_data
[] = { 5, 'H', 'e', 'l', 'l', 'o' };
1105 bstr_t bstr
= &bstr_data
[1];
1112 ok(test_list_length(list
) == 3, "RPC test_list_length\n");
1113 ok(square_puint(p1
) == 121, "RPC square_puint\n");
1115 pus
.ps
= HeapAlloc(GetProcessHeap(), 0, pus
.n
* sizeof pus
.ps
[0]);
1116 pus
.ps
[0] = xstrdup("5");
1117 pus
.ps
[1] = xstrdup("6");
1118 pus
.ps
[2] = xstrdup("7");
1119 pus
.ps
[3] = xstrdup("8");
1120 ok(sum_puints(&pus
) == 26, "RPC sum_puints\n");
1121 HeapFree(GetProcessHeap(), 0, pus
.ps
[0]);
1122 HeapFree(GetProcessHeap(), 0, pus
.ps
[1]);
1123 HeapFree(GetProcessHeap(), 0, pus
.ps
[2]);
1124 HeapFree(GetProcessHeap(), 0, pus
.ps
[3]);
1125 HeapFree(GetProcessHeap(), 0, pus
.ps
);
1127 cpus
.ps
= HeapAlloc(GetProcessHeap(), 0, cpus
.n
* sizeof cpus
.ps
[0]);
1128 cpus
.ps
[0] = xstrdup("5");
1129 cpus
.ps
[1] = xstrdup("6");
1130 cpus
.ps
[2] = xstrdup("7");
1131 cpus
.ps
[3] = xstrdup("8");
1132 ok(sum_cpuints(&cpus
) == 26, "RPC sum_puints\n");
1133 HeapFree(GetProcessHeap(), 0, cpus
.ps
[0]);
1134 HeapFree(GetProcessHeap(), 0, cpus
.ps
[1]);
1135 HeapFree(GetProcessHeap(), 0, cpus
.ps
[2]);
1136 HeapFree(GetProcessHeap(), 0, cpus
.ps
[3]);
1137 HeapFree(GetProcessHeap(), 0, cpus
.ps
);
1138 ok(square_test_us(&tus
) == 121, "RPC square_test_us\n");
1143 ok(sum_parr(pa
) == 6, "RPC sum_parr\n");
1149 ok(sum_pcarr(pa
, 4) == 10, "RPC sum_pcarr\n");
1151 ok(hash_bstr(bstr
) == s_hash_bstr(bstr
), "RPC hash_bstr_data\n");
1155 if (!old_windows_version
)
1158 name
.name
= buffer
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, name
.size
);
1160 ok(name
.name
== buffer
, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name
.name
, buffer
);
1161 ok(!strcmp(name
.name
, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name
.name
);
1162 HeapFree(GetProcessHeap(), 0, name
.name
);
1166 ok(sum_pcarr2(4, &pa2
) == 10, "RPC sum_pcarr2\n");
1169 ok(s123
->f1
== 1 && s123
->f2
== 2 && s123
->f3
== 3, "RPC get_s123\n");
1170 MIDL_user_free(s123
);
1172 full_pointer_test(&val
, &val
);
1173 full_pointer_null_test(&val
, NULL
);
1177 check_pyramid_doub_carr(doub_carr_t
*dc
)
1180 for (i
= 0; i
< dc
->n
; ++i
)
1181 for (j
= 0; j
< dc
->a
[i
]->n
; ++j
)
1182 if (dc
->a
[i
]->a
[j
] != j
+ 1)
1188 free_pyramid_doub_carr(doub_carr_t
*dc
)
1191 for (i
= 0; i
< dc
->n
; ++i
)
1192 MIDL_user_free(dc
->a
[i
]);
1201 {{1, 2, 3, 4}, {-1, -3, -5, -7}, {0, 2, 4, 6}},
1202 {{1, -2, 3, -4}, {2, 3, 5, 7}, {-4, -1, -14, 4114}}
1204 int c
[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
1205 int c2
[] = {10, 100, 200};
1206 vector_t vs
[2] = {{1, -2, 3}, {4, -5, -6}};
1211 int ca
[5] = {1, -2, 3, -4, 5};
1215 numbers_struct_t
*ns
;
1217 if (!old_windows_version
)
1219 const char str1
[25] = "Hello";
1220 ok(cstr_length(str1
, sizeof str1
) == strlen(str1
), "RPC cstr_length\n");
1223 ok(sum_fixed_int_3d(m
) == 4116, "RPC sum_fixed_int_3d\n");
1225 ok(sum_conf_array(c
, 10) == 45, "RPC sum_conf_array\n");
1226 ok(sum_conf_array(&c
[5], 2) == 11, "RPC sum_conf_array\n");
1227 ok(sum_conf_array(&c
[7], 1) == 7, "RPC sum_conf_array\n");
1228 ok(sum_conf_array(&c
[2], 0) == 0, "RPC sum_conf_array\n");
1230 ok(sum_conf_ptr_by_conf_ptr(1, c2
, c
) == 45, "RPC sum_conf_ptr_by_conf_ptr\n");
1231 ok(sum_conf_ptr_by_conf_ptr(3, c2
, c
) == 345, "RPC sum_conf_ptr_by_conf_ptr\n");
1233 ok(sum_conf_ptr_by_conf_ptr(3, c2
, c
) == 300, "RPC sum_conf_ptr_by_conf_ptr\n");
1235 ok(sum_unique_conf_array(ca
, 4) == -2, "RPC sum_unique_conf_array\n");
1236 ok(sum_unique_conf_ptr(ca
, 5) == 3, "RPC sum_unique_conf_array\n");
1237 ok(sum_unique_conf_ptr(NULL
, 10) == 0, "RPC sum_unique_conf_array\n");
1239 ok(sum_var_array(c
, 10) == 45, "RPC sum_conf_array\n");
1240 ok(sum_var_array(&c
[5], 2) == 11, "RPC sum_conf_array\n");
1241 ok(sum_var_array(&c
[7], 1) == 7, "RPC sum_conf_array\n");
1242 ok(sum_var_array(&c
[2], 0) == 0, "RPC sum_conf_array\n");
1244 ok(dot_two_vectors(vs
) == -4, "RPC dot_two_vectors\n");
1245 cs
= HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(cs_t
, ca
[5]));
1252 ok(sum_cs(cs
) == 1, "RPC sum_cs\n");
1253 HeapFree(GetProcessHeap(), 0, cs
);
1260 ok(sum_cps(&cps
) == 53, "RPC sum_cps\n");
1266 ok(sum_cpsc(&cpsc
) == 6, "RPC sum_cpsc\n");
1271 ok(sum_cpsc(&cpsc
) == 10, "RPC sum_cpsc\n");
1273 ok(sum_toplev_conf_2n(c
, 3) == 15, "RPC sum_toplev_conf_2n\n");
1274 ok(sum_toplev_conf_cond(c
, 5, 6, 1) == 10, "RPC sum_toplev_conf_cond\n");
1275 ok(sum_toplev_conf_cond(c
, 5, 6, 0) == 15, "RPC sum_toplev_conf_cond\n");
1277 dc
= HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_t
, a
[2]));
1279 dc
->a
[0] = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_1_t
, a
[3]));
1284 dc
->a
[1] = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_1_t
, a
[2]));
1288 ok(sum_doub_carr(dc
) == 19, "RPC sum_doub_carr\n");
1289 HeapFree(GetProcessHeap(), 0, dc
->a
[0]);
1290 HeapFree(GetProcessHeap(), 0, dc
->a
[1]);
1291 HeapFree(GetProcessHeap(), 0, dc
);
1294 make_pyramid_doub_carr(4, &dc
);
1295 ok(check_pyramid_doub_carr(dc
), "RPC make_pyramid_doub_carr\n");
1296 free_pyramid_doub_carr(dc
);
1298 ok(sum_L1_norms(2, vs
) == 21, "RPC sum_L1_norms\n");
1300 memset(api
, 0, sizeof(api
));
1301 pi
= HeapAlloc(GetProcessHeap(), 0, sizeof(*pi
));
1304 get_numbers(1, 1, api
);
1305 ok(api
[0].pi
== pi
, "RPC conformant varying array [out] pointer changed from %p to %p\n", pi
, api
[0].pi
);
1306 ok(*api
[0].pi
== 0, "pi unmarshalled incorrectly %d\n", *api
[0].pi
);
1308 if (!old_windows_version
)
1310 ns
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, FIELD_OFFSET(numbers_struct_t
, numbers
[5]));
1313 ns
->numbers
[0].pi
= pi
;
1314 get_numbers_struct(&ns
);
1315 ok(ns
->numbers
[0].pi
== pi
, "RPC conformant varying struct embedded pointer changed from %p to %p\n", pi
, ns
->numbers
[0].pi
);
1316 ok(*ns
->numbers
[0].pi
== 5, "pi unmarshalled incorrectly %d\n", *ns
->numbers
[0].pi
);
1317 HeapFree(GetProcessHeap(), 0, ns
);
1319 HeapFree(GetProcessHeap(), 0, pi
);
1323 s_authinfo_test(unsigned int protseq
, int secure
)
1325 RPC_BINDING_HANDLE binding
;
1327 ULONG level
, authnsvc
;
1328 RPC_AUTHZ_HANDLE privs
;
1329 unsigned char *principal
;
1331 binding
= I_RpcGetCurrentCallHandle();
1332 ok(binding
!= NULL
, "I_RpcGetCurrentCallHandle returned NULL\n");
1334 level
= authnsvc
= 0xdeadbeef;
1335 privs
= (RPC_AUTHZ_HANDLE
)0xdeadbeef;
1336 principal
= (unsigned char *)0xdeadbeef;
1338 if (secure
|| protseq
== RPC_PROTSEQ_LRPC
)
1340 status
= RpcBindingInqAuthClientA(binding
, &privs
, &principal
, &level
, &authnsvc
, NULL
);
1341 if (status
== RPC_S_CANNOT_SUPPORT
)
1343 win_skip("RpcBindingInqAuthClientA not supported\n");
1346 ok(status
== RPC_S_OK
, "expected RPC_S_OK got %u\n", status
);
1347 ok(privs
!= (RPC_AUTHZ_HANDLE
)0xdeadbeef, "privs unchanged\n");
1348 ok(principal
!= (unsigned char *)0xdeadbeef, "principal unchanged\n");
1349 if (protseq
!= RPC_PROTSEQ_LRPC
)
1352 ok(principal
!= NULL
, "NULL principal\n");
1354 if (protseq
== RPC_PROTSEQ_LRPC
&& principal
&& pGetUserNameExA
)
1359 len
= WideCharToMultiByte(CP_ACP
, 0, (const WCHAR
*)privs
, -1, NULL
, 0, NULL
, NULL
);
1360 spn
= HeapAlloc( GetProcessHeap(), 0, len
);
1361 WideCharToMultiByte(CP_ACP
, 0, (const WCHAR
*)privs
, -1, spn
, len
, NULL
, NULL
);
1363 ok(!strcmp(domain_and_user
, spn
), "expected %s got %s\n", domain_and_user
, spn
);
1364 HeapFree( GetProcessHeap(), 0, spn
);
1366 ok(level
== RPC_C_AUTHN_LEVEL_PKT_PRIVACY
, "level unchanged\n");
1367 ok(authnsvc
== RPC_C_AUTHN_WINNT
, "authnsvc unchanged\n");
1369 status
= RpcImpersonateClient(NULL
);
1370 ok(status
== RPC_S_OK
, "expected RPC_S_OK got %u\n", status
);
1371 status
= RpcRevertToSelf();
1372 ok(status
== RPC_S_OK
, "expected RPC_S_OK got %u\n", status
);
1377 status
= RpcBindingInqAuthClientA(binding
, &privs
, &principal
, &level
, &authnsvc
, NULL
);
1378 ok(status
== RPC_S_BINDING_HAS_NO_AUTH
, "expected RPC_S_BINDING_HAS_NO_AUTH got %u\n", status
);
1379 ok(privs
== (RPC_AUTHZ_HANDLE
)0xdeadbeef, "got %p\n", privs
);
1380 ok(principal
== (unsigned char *)0xdeadbeef, "got %s\n", principal
);
1381 ok(level
== 0xdeadbeef, "got %u\n", level
);
1382 ok(authnsvc
== 0xdeadbeef, "got %u\n", authnsvc
);
1393 context_handle_test();
1397 set_auth_info(RPC_BINDING_HANDLE handle
)
1400 RPC_SECURITY_QOS qos
;
1402 if (!pGetUserNameExA
)
1406 qos
.Capabilities
= RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH
;
1407 qos
.IdentityTracking
= RPC_C_QOS_IDENTITY_STATIC
;
1408 qos
.ImpersonationType
= RPC_C_IMP_LEVEL_IMPERSONATE
;
1410 status
= pRpcBindingSetAuthInfoExA(handle
, (RPC_CSTR
)domain_and_user
, RPC_C_AUTHN_LEVEL_PKT_PRIVACY
,
1411 RPC_C_AUTHN_WINNT
, NULL
, 0, &qos
);
1412 ok(status
== RPC_S_OK
, "RpcBindingSetAuthInfoExA failed %d\n", status
);
1416 client(const char *test
)
1418 static unsigned char iptcp
[] = "ncacn_ip_tcp";
1419 static unsigned char np
[] = "ncacn_np";
1420 static unsigned char ncalrpc
[] = "ncalrpc";
1421 static unsigned char address
[] = "127.0.0.1";
1422 static unsigned char address_np
[] = "\\\\.";
1423 static unsigned char port
[] = PORT
;
1424 static unsigned char pipe
[] = PIPE
;
1425 static unsigned char guid
[] = "00000000-4114-0704-2301-000000000000";
1427 unsigned char *binding
;
1429 if (strcmp(test
, "tcp_basic") == 0)
1431 ok(RPC_S_OK
== RpcStringBindingCompose(NULL
, iptcp
, address
, port
, NULL
, &binding
), "RpcStringBindingCompose\n");
1432 ok(RPC_S_OK
== RpcBindingFromStringBinding(binding
, &IServer_IfHandle
), "RpcBindingFromStringBinding\n");
1435 authinfo_test(RPC_PROTSEQ_TCP
, 0);
1437 ok(RPC_S_OK
== RpcStringFree(&binding
), "RpcStringFree\n");
1438 ok(RPC_S_OK
== RpcBindingFree(&IServer_IfHandle
), "RpcBindingFree\n");
1440 else if (strcmp(test
, "tcp_secure") == 0)
1442 ok(RPC_S_OK
== RpcStringBindingCompose(NULL
, iptcp
, address
, port
, NULL
, &binding
), "RpcStringBindingCompose\n");
1443 ok(RPC_S_OK
== RpcBindingFromStringBinding(binding
, &IServer_IfHandle
), "RpcBindingFromStringBinding\n");
1445 set_auth_info(IServer_IfHandle
);
1446 authinfo_test(RPC_PROTSEQ_TCP
, 1);
1448 ok(RPC_S_OK
== RpcStringFree(&binding
), "RpcStringFree\n");
1449 ok(RPC_S_OK
== RpcBindingFree(&IServer_IfHandle
), "RpcBindingFree\n");
1451 else if (strcmp(test
, "ncalrpc_basic") == 0)
1453 ok(RPC_S_OK
== RpcStringBindingCompose(NULL
, ncalrpc
, NULL
, guid
, NULL
, &binding
), "RpcStringBindingCompose\n");
1454 ok(RPC_S_OK
== RpcBindingFromStringBinding(binding
, &IServer_IfHandle
), "RpcBindingFromStringBinding\n");
1456 run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */
1457 authinfo_test(RPC_PROTSEQ_LRPC
, 0);
1459 ok(RPC_S_OK
== RpcStringFree(&binding
), "RpcStringFree\n");
1460 ok(RPC_S_OK
== RpcBindingFree(&IServer_IfHandle
), "RpcBindingFree\n");
1462 else if (strcmp(test
, "ncalrpc_secure") == 0)
1464 ok(RPC_S_OK
== RpcStringBindingCompose(NULL
, ncalrpc
, NULL
, guid
, NULL
, &binding
), "RpcStringBindingCompose\n");
1465 ok(RPC_S_OK
== RpcBindingFromStringBinding(binding
, &IServer_IfHandle
), "RpcBindingFromStringBinding\n");
1467 set_auth_info(IServer_IfHandle
);
1468 authinfo_test(RPC_PROTSEQ_LRPC
, 1);
1470 ok(RPC_S_OK
== RpcStringFree(&binding
), "RpcStringFree\n");
1471 ok(RPC_S_OK
== RpcBindingFree(&IServer_IfHandle
), "RpcBindingFree\n");
1473 else if (strcmp(test
, "np_basic") == 0)
1475 ok(RPC_S_OK
== RpcStringBindingCompose(NULL
, np
, address_np
, pipe
, NULL
, &binding
), "RpcStringBindingCompose\n");
1476 ok(RPC_S_OK
== RpcBindingFromStringBinding(binding
, &IServer_IfHandle
), "RpcBindingFromStringBinding\n");
1479 authinfo_test(RPC_PROTSEQ_NMP
, 0);
1482 ok(RPC_S_OK
== RpcStringFree(&binding
), "RpcStringFree\n");
1483 ok(RPC_S_OK
== RpcBindingFree(&IServer_IfHandle
), "RpcBindingFree\n");
1490 static unsigned char iptcp
[] = "ncacn_ip_tcp";
1491 static unsigned char port
[] = PORT
;
1492 static unsigned char np
[] = "ncacn_np";
1493 static unsigned char pipe
[] = PIPE
;
1494 static unsigned char ncalrpc
[] = "ncalrpc";
1495 static unsigned char guid
[] = "00000000-4114-0704-2301-000000000000";
1496 RPC_STATUS status
, iptcp_status
, np_status
, ncalrpc_status
;
1499 iptcp_status
= RpcServerUseProtseqEp(iptcp
, 20, port
, NULL
);
1500 ok(iptcp_status
== RPC_S_OK
, "RpcServerUseProtseqEp(ncacn_ip_tcp) failed with status %d\n", iptcp_status
);
1502 ncalrpc_status
= RpcServerUseProtseqEp(ncalrpc
, 0, guid
, NULL
);
1503 ok(ncalrpc_status
== RPC_S_OK
, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", ncalrpc_status
);
1505 np_status
= RpcServerUseProtseqEp(np
, 0, pipe
, NULL
);
1506 if (np_status
== RPC_S_PROTSEQ_NOT_SUPPORTED
)
1507 skip("Protocol sequence ncacn_np is not supported\n");
1509 ok(np_status
== RPC_S_OK
, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", np_status
);
1511 if (pRpcServerRegisterIfEx
)
1513 trace("Using RpcServerRegisterIfEx\n");
1514 status
= pRpcServerRegisterIfEx(s_IServer_v0_0_s_ifspec
, NULL
, NULL
,
1515 RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH
,
1516 RPC_C_LISTEN_MAX_CALLS_DEFAULT
, NULL
);
1519 status
= RpcServerRegisterIf(s_IServer_v0_0_s_ifspec
, NULL
, NULL
);
1520 ok(status
== RPC_S_OK
, "RpcServerRegisterIf failed with status %d\n", status
);
1521 status
= RpcServerListen(1, 20, TRUE
);
1522 ok(status
== RPC_S_OK
, "RpcServerListen failed with status %d\n", status
);
1523 stop_event
= CreateEvent(NULL
, FALSE
, FALSE
, NULL
);
1524 ok(stop_event
!= NULL
, "CreateEvent failed with error %d\n", GetLastError());
1526 if (iptcp_status
== RPC_S_OK
)
1527 run_client("tcp_basic");
1529 skip("tcp tests skipped due to earlier failure\n");
1531 if (ncalrpc_status
== RPC_S_OK
)
1533 run_client("ncalrpc_basic");
1534 if (pGetUserNameExA
)
1536 /* we don't need to register RPC_C_AUTHN_WINNT for ncalrpc */
1537 run_client("ncalrpc_secure");
1541 skip("lrpc tests skipped due to earlier failure\n");
1543 if (np_status
== RPC_S_OK
)
1544 run_client("np_basic");
1547 skip("np_basic tests skipped due to earlier failure\n");
1548 /* np client is what signals stop_event, so bail out if we didn't run do it */
1552 ret
= WaitForSingleObject(stop_event
, 1000);
1553 ok(WAIT_OBJECT_0
== ret
, "WaitForSingleObject\n");
1554 /* if the stop event didn't fire then RpcMgmtWaitServerListen will wait
1555 * forever, so don't bother calling it in this case */
1556 if (ret
== WAIT_OBJECT_0
)
1558 status
= RpcMgmtWaitServerListen();
1560 ok(status
== RPC_S_OK
, "RpcMgmtWaitServerListening failed with status %d\n", status
);
1570 InitFunctionPointers();
1572 if (pGetUserNameExA
)
1575 ok(!pGetUserNameExA(NameSamCompatible
, NULL
, &size
), "GetUserNameExA\n");
1576 domain_and_user
= HeapAlloc(GetProcessHeap(), 0, size
);
1577 ok(pGetUserNameExA(NameSamCompatible
, domain_and_user
, &size
), "GetUserNameExA\n");
1580 win_skip("GetUserNameExA is needed for some authentication tests\n");
1582 argc
= winetest_get_mainargs(&argv
);
1593 trace("Exception %d\n", RpcExceptionCode());
1600 HeapFree(GetProcessHeap(), 0, domain_and_user
);