2007-04-26 03:18:29 +02:00
|
|
|
/*
|
|
|
|
* Tests for WIDL and RPC server/clients.
|
|
|
|
*
|
|
|
|
* Copyright (C) Google 2007 (Dan Hipschman)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <windows.h>
|
2009-12-14 11:54:36 +01:00
|
|
|
#include <secext.h>
|
|
|
|
#include <rpcdce.h>
|
2007-04-26 03:18:29 +02:00
|
|
|
#include "wine/test.h"
|
|
|
|
#include "server.h"
|
2007-05-19 01:53:27 +02:00
|
|
|
#include "server_defines.h"
|
2007-04-26 03:18:29 +02:00
|
|
|
|
2007-06-06 03:52:24 +02:00
|
|
|
#include <stddef.h>
|
2007-04-26 03:18:29 +02:00
|
|
|
#include <stdio.h>
|
2007-05-25 02:48:39 +02:00
|
|
|
#include <stdlib.h>
|
2007-04-26 03:18:29 +02:00
|
|
|
|
|
|
|
#define PORT "4114"
|
|
|
|
#define PIPE "\\pipe\\wine_rpcrt4_test"
|
|
|
|
|
|
|
|
#define INT_CODE 4198
|
|
|
|
|
|
|
|
static const char *progname;
|
2009-05-28 22:27:51 +02:00
|
|
|
static BOOL old_windows_version;
|
2007-04-26 03:18:29 +02:00
|
|
|
|
|
|
|
static HANDLE stop_event;
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
static void (WINAPI *pNDRSContextMarshall2)(RPC_BINDING_HANDLE, NDR_SCONTEXT, void*, NDR_RUNDOWN, void*, ULONG);
|
|
|
|
static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*, ULONG, void*, ULONG);
|
2008-12-15 15:06:37 +01:00
|
|
|
static RPC_STATUS (WINAPI *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, RPC_MGR_EPV*, unsigned int,
|
|
|
|
unsigned int,RPC_IF_CALLBACK_FN*);
|
2009-12-14 11:54:36 +01:00
|
|
|
static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
|
|
|
|
static RPC_STATUS (WINAPI *pRpcBindingSetAuthInfoExA)(RPC_BINDING_HANDLE, RPC_CSTR, ULONG, ULONG,
|
|
|
|
RPC_AUTH_IDENTITY_HANDLE, ULONG, RPC_SECURITY_QOS *);
|
|
|
|
static RPC_STATUS (WINAPI *pRpcServerRegisterAuthInfoA)(RPC_CSTR, ULONG, RPC_AUTH_KEY_RETRIEVAL_FN, LPVOID);
|
|
|
|
|
|
|
|
static char *domain_and_user;
|
2008-02-28 12:30:36 +01:00
|
|
|
|
2009-11-07 15:55:13 +01:00
|
|
|
/* type check statements generated in header file */
|
|
|
|
fnprintf *p_printf = printf;
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
static void InitFunctionPointers(void)
|
|
|
|
{
|
|
|
|
HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll");
|
2009-12-14 11:54:36 +01:00
|
|
|
HMODULE hsecur32 = LoadLibraryA("secur32.dll");
|
2008-02-28 12:30:36 +01:00
|
|
|
|
|
|
|
pNDRSContextMarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextMarshall2");
|
|
|
|
pNDRSContextUnmarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextUnmarshall2");
|
2008-12-15 15:06:37 +01:00
|
|
|
pRpcServerRegisterIfEx = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterIfEx");
|
2009-12-14 11:54:36 +01:00
|
|
|
pRpcBindingSetAuthInfoExA = (void *)GetProcAddress(hrpcrt4, "RpcBindingSetAuthInfoExA");
|
|
|
|
pRpcServerRegisterAuthInfoA = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterAuthInfoA");
|
|
|
|
pGetUserNameExA = (void *)GetProcAddress(hsecur32, "GetUserNameExA");
|
2009-05-28 22:27:51 +02:00
|
|
|
|
|
|
|
if (!pNDRSContextMarshall2) old_windows_version = TRUE;
|
2008-02-28 12:30:36 +01:00
|
|
|
}
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
void __RPC_FAR *__RPC_USER
|
2009-01-30 14:46:17 +01:00
|
|
|
midl_user_allocate(SIZE_T n)
|
2007-04-26 03:18:29 +02:00
|
|
|
{
|
2009-06-15 11:04:57 +02:00
|
|
|
return HeapAlloc(GetProcessHeap(), 0, n);
|
2007-04-26 03:18:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
midl_user_free(void __RPC_FAR *p)
|
|
|
|
{
|
2009-06-15 11:04:57 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, p);
|
2007-04-26 03:18:29 +02:00
|
|
|
}
|
|
|
|
|
2007-10-18 03:06:26 +02:00
|
|
|
static char *
|
|
|
|
xstrdup(const char *s)
|
|
|
|
{
|
|
|
|
char *d = HeapAlloc(GetProcessHeap(), 0, strlen(s) + 1);
|
|
|
|
strcpy(d, s);
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
int
|
|
|
|
s_int_return(void)
|
|
|
|
{
|
|
|
|
return INT_CODE;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_square(int x)
|
|
|
|
{
|
|
|
|
return x * x;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_sum(int x, int y)
|
|
|
|
{
|
|
|
|
return x + y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
s_square_out(int x, int *y)
|
|
|
|
{
|
|
|
|
*y = s_square(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
s_square_ref(int *x)
|
|
|
|
{
|
|
|
|
*x = s_square(*x);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_str_length(const char *s)
|
|
|
|
{
|
|
|
|
return strlen(s);
|
|
|
|
}
|
|
|
|
|
2008-02-22 00:46:51 +01:00
|
|
|
int
|
|
|
|
s_str_t_length(str_t s)
|
|
|
|
{
|
|
|
|
return strlen(s);
|
|
|
|
}
|
|
|
|
|
2007-09-05 00:46:30 +02:00
|
|
|
int
|
|
|
|
s_cstr_length(const char *s, int n)
|
|
|
|
{
|
|
|
|
int len = 0;
|
|
|
|
while (0 < n-- && *s++)
|
|
|
|
++len;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
int
|
|
|
|
s_dot_self(vector_t *v)
|
|
|
|
{
|
|
|
|
return s_square(v->x) + s_square(v->y) + s_square(v->z);
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
s_square_half(double x, double *y)
|
|
|
|
{
|
|
|
|
*y = x / 2.0;
|
|
|
|
return x * x;
|
|
|
|
}
|
|
|
|
|
|
|
|
float
|
|
|
|
s_square_half_float(float x, float *y)
|
|
|
|
{
|
|
|
|
*y = x / 2.0f;
|
|
|
|
return x * x;
|
|
|
|
}
|
|
|
|
|
2009-03-12 23:04:35 +01:00
|
|
|
LONG
|
|
|
|
s_square_half_long(LONG x, LONG *y)
|
2007-04-26 03:18:29 +02:00
|
|
|
{
|
|
|
|
*y = x / 2;
|
|
|
|
return x * x;
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:22:10 +02:00
|
|
|
int
|
|
|
|
s_sum_fixed_array(int a[5])
|
|
|
|
{
|
|
|
|
return a[0] + a[1] + a[2] + a[3] + a[4];
|
|
|
|
}
|
|
|
|
|
2007-05-10 05:50:49 +02:00
|
|
|
int
|
|
|
|
s_pints_sum(pints_t *pints)
|
|
|
|
{
|
|
|
|
return *pints->pi + **pints->ppi + ***pints->pppi;
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
s_ptypes_sum(ptypes_t *pt)
|
|
|
|
{
|
|
|
|
return *pt->pc + *pt->ps + *pt->pl + *pt->pf + *pt->pd;
|
|
|
|
}
|
|
|
|
|
2007-05-12 02:27:40 +02:00
|
|
|
int
|
|
|
|
s_dot_pvectors(pvectors_t *p)
|
|
|
|
{
|
|
|
|
return p->pu->x * (*p->pv)->x + p->pu->y * (*p->pv)->y + p->pu->z * (*p->pv)->z;
|
|
|
|
}
|
|
|
|
|
2007-05-16 02:48:20 +02:00
|
|
|
int
|
|
|
|
s_sum_sp(sp_t *sp)
|
|
|
|
{
|
|
|
|
return sp->x + sp->s->x;
|
|
|
|
}
|
|
|
|
|
2007-05-19 01:53:27 +02:00
|
|
|
double
|
2007-05-31 03:00:45 +02:00
|
|
|
s_square_sun(sun_t *su)
|
2007-05-19 01:53:27 +02:00
|
|
|
{
|
2007-05-31 03:00:45 +02:00
|
|
|
switch (su->s)
|
2007-05-19 01:53:27 +02:00
|
|
|
{
|
2007-05-31 03:00:45 +02:00
|
|
|
case SUN_I: return su->u.i * su->u.i;
|
2007-05-19 01:53:27 +02:00
|
|
|
case SUN_F1:
|
2007-05-31 03:00:45 +02:00
|
|
|
case SUN_F2: return su->u.f * su->u.f;
|
|
|
|
case SUN_PI: return (*su->u.pi) * (*su->u.pi);
|
2007-05-19 01:53:27 +02:00
|
|
|
default:
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-25 02:50:02 +02:00
|
|
|
int
|
|
|
|
s_test_list_length(test_list_t *list)
|
|
|
|
{
|
|
|
|
return (list->t == TL_LIST
|
|
|
|
? 1 + s_test_list_length(list->u.tail)
|
|
|
|
: 0);
|
|
|
|
}
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
int
|
|
|
|
s_sum_fixed_int_3d(int m[2][3][4])
|
|
|
|
{
|
|
|
|
int i, j, k;
|
|
|
|
int sum = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < 2; ++i)
|
|
|
|
for (j = 0; j < 3; ++j)
|
|
|
|
for (k = 0; k < 4; ++k)
|
|
|
|
sum += m[i][j][k];
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_sum_conf_array(int x[], int n)
|
|
|
|
{
|
|
|
|
int *p = x, *end = p + n;
|
|
|
|
int sum = 0;
|
|
|
|
|
|
|
|
while (p < end)
|
|
|
|
sum += *p++;
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2009-01-11 15:00:18 +01:00
|
|
|
int
|
|
|
|
s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int sum = 0;
|
|
|
|
if(n1 == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for(i = 1; i < n1; ++i)
|
|
|
|
sum += n2_then_x1[i];
|
|
|
|
|
|
|
|
for(i = 0; i < *n2_then_x1; ++i)
|
|
|
|
sum += x2[i];
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2007-09-26 20:32:08 +02:00
|
|
|
int
|
|
|
|
s_sum_unique_conf_array(int x[], int n)
|
|
|
|
{
|
|
|
|
return s_sum_conf_array(x, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_sum_unique_conf_ptr(int *x, int n)
|
|
|
|
{
|
|
|
|
return x ? s_sum_conf_array(x, n) : 0;
|
|
|
|
}
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
int
|
|
|
|
s_sum_var_array(int x[20], int n)
|
|
|
|
{
|
|
|
|
ok(0 <= n, "RPC sum_var_array\n");
|
|
|
|
ok(n <= 20, "RPC sum_var_array\n");
|
|
|
|
|
|
|
|
return s_sum_conf_array(x, n);
|
|
|
|
}
|
|
|
|
|
2010-03-19 15:50:15 +01:00
|
|
|
int
|
|
|
|
s_sum_complex_array(int n, refpint_t pi[])
|
|
|
|
{
|
|
|
|
int total = 0;
|
|
|
|
for (; n > 0; n--)
|
|
|
|
total += *pi[n - 1];
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
int
|
|
|
|
s_dot_two_vectors(vector_t vs[2])
|
|
|
|
{
|
|
|
|
return vs[0].x * vs[1].x + vs[0].y * vs[1].y + vs[0].z * vs[1].z;
|
|
|
|
}
|
|
|
|
|
2010-03-23 14:33:13 +01:00
|
|
|
void
|
|
|
|
s_get_number_array(int x[20], int *n)
|
|
|
|
{
|
|
|
|
int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
|
|
|
memcpy(x, c, sizeof(c));
|
|
|
|
*n = sizeof(c)/sizeof(c[0]);
|
|
|
|
}
|
|
|
|
|
2007-06-06 03:52:24 +02:00
|
|
|
int
|
|
|
|
s_sum_cs(cs_t *cs)
|
|
|
|
{
|
|
|
|
return s_sum_conf_array(cs->ca, cs->n);
|
|
|
|
}
|
|
|
|
|
2007-06-12 03:51:41 +02:00
|
|
|
int
|
|
|
|
s_sum_cps(cps_t *cps)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < *cps->pn; ++i)
|
|
|
|
sum += cps->ca1[i];
|
|
|
|
|
|
|
|
for (i = 0; i < 2 * cps->n; ++i)
|
|
|
|
sum += cps->ca2[i];
|
|
|
|
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2007-09-04 18:33:23 +02:00
|
|
|
int
|
|
|
|
s_sum_cpsc(cpsc_t *cpsc)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < (cpsc->c ? cpsc->a : cpsc->b); ++i)
|
|
|
|
sum += cpsc->ca[i];
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2007-06-14 01:13:04 +02:00
|
|
|
int
|
|
|
|
s_square_puint(puint_t p)
|
|
|
|
{
|
|
|
|
int n = atoi(p);
|
|
|
|
return n * n;
|
|
|
|
}
|
|
|
|
|
2007-10-18 03:06:26 +02:00
|
|
|
int
|
|
|
|
s_sum_puints(puints_t *p)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < p->n; ++i)
|
|
|
|
sum += atoi(p->ps[i]);
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_sum_cpuints(cpuints_t *p)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < p->n; ++i)
|
|
|
|
sum += atoi(p->ps[i]);
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2007-06-14 01:14:08 +02:00
|
|
|
int
|
|
|
|
s_dot_copy_vectors(vector_t u, vector_t v)
|
|
|
|
{
|
|
|
|
return u.x * v.x + u.y * v.y + u.z * v.z;
|
|
|
|
}
|
|
|
|
|
2007-06-14 01:15:41 +02:00
|
|
|
int
|
|
|
|
s_square_test_us(test_us_t *tus)
|
|
|
|
{
|
|
|
|
int n = atoi(tus->us.x);
|
|
|
|
return n * n;
|
|
|
|
}
|
|
|
|
|
2007-06-19 03:36:14 +02:00
|
|
|
double
|
|
|
|
s_square_encu(encu_t *eu)
|
|
|
|
{
|
|
|
|
switch (eu->t)
|
|
|
|
{
|
|
|
|
case ENCU_I: return eu->tagged_union.i * eu->tagged_union.i;
|
|
|
|
case ENCU_F: return eu->tagged_union.f * eu->tagged_union.f;
|
|
|
|
default:
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-01 12:25:44 +02:00
|
|
|
double
|
|
|
|
s_square_unencu(int t, unencu_t *eu)
|
|
|
|
{
|
|
|
|
switch (t)
|
|
|
|
{
|
|
|
|
case ENCU_I: return eu->i * eu->i;
|
|
|
|
case ENCU_F: return eu->f * eu->f;
|
|
|
|
default:
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-21 00:06:14 +01:00
|
|
|
void
|
|
|
|
s_check_se2(se_t *s)
|
|
|
|
{
|
|
|
|
ok(s->f == E2, "check_se2\n");
|
|
|
|
}
|
|
|
|
|
2007-06-21 01:50:44 +02:00
|
|
|
int
|
|
|
|
s_sum_parr(int *a[3])
|
|
|
|
{
|
|
|
|
return s_sum_pcarr(a, 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_sum_pcarr(int *a[], int n)
|
|
|
|
{
|
|
|
|
int i, s = 0;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
s += *a[i];
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2007-06-26 03:24:11 +02:00
|
|
|
int
|
|
|
|
s_enum_ord(e_t e)
|
|
|
|
{
|
|
|
|
switch (e)
|
|
|
|
{
|
|
|
|
case E1: return 1;
|
|
|
|
case E2: return 2;
|
|
|
|
case E3: return 3;
|
|
|
|
case E4: return 4;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-26 03:27:24 +02:00
|
|
|
double
|
|
|
|
s_square_encue(encue_t *eue)
|
|
|
|
{
|
|
|
|
switch (eue->t)
|
|
|
|
{
|
|
|
|
case E1: return eue->tagged_union.i1 * eue->tagged_union.i1;
|
|
|
|
case E2: return eue->tagged_union.f2 * eue->tagged_union.f2;
|
|
|
|
default:
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-04 18:33:23 +02:00
|
|
|
int
|
|
|
|
s_sum_toplev_conf_2n(int *x, int n)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < 2 * n; ++i)
|
|
|
|
sum += x[i];
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_sum_toplev_conf_cond(int *x, int a, int b, int c)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int n = c ? a : b;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
sum += x[i];
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2007-09-04 20:04:37 +02:00
|
|
|
double
|
|
|
|
s_sum_aligns(aligns_t *a)
|
|
|
|
{
|
|
|
|
return a->c + a->i + a->s + a->d;
|
|
|
|
}
|
|
|
|
|
2007-09-14 03:04:32 +02:00
|
|
|
int
|
|
|
|
s_sum_padded(padded_t *p)
|
|
|
|
{
|
|
|
|
return p->i + p->c;
|
|
|
|
}
|
|
|
|
|
2007-09-19 00:29:59 +02:00
|
|
|
int
|
|
|
|
s_sum_padded2(padded_t ps[2])
|
|
|
|
{
|
|
|
|
return s_sum_padded(&ps[0]) + s_sum_padded(&ps[1]);
|
|
|
|
}
|
|
|
|
|
2007-09-20 02:05:38 +02:00
|
|
|
int
|
|
|
|
s_sum_padded_conf(padded_t *ps, int n)
|
|
|
|
{
|
|
|
|
int sum = 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
sum += s_sum_padded(&ps[i]);
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2007-09-19 00:28:49 +02:00
|
|
|
int
|
|
|
|
s_sum_bogus(bogus_t *b)
|
|
|
|
{
|
|
|
|
return *b->h.p1 + *b->p2 + *b->p3 + b->c;
|
|
|
|
}
|
|
|
|
|
2007-09-20 02:04:49 +02:00
|
|
|
void
|
|
|
|
s_check_null(int *null)
|
|
|
|
{
|
|
|
|
ok(!null, "RPC check_null\n");
|
|
|
|
}
|
|
|
|
|
2007-09-26 20:32:47 +02:00
|
|
|
int
|
|
|
|
s_str_struct_len(str_struct_t *s)
|
|
|
|
{
|
|
|
|
return lstrlenA(s->s);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
s_wstr_struct_len(wstr_struct_t *s)
|
|
|
|
{
|
|
|
|
return lstrlenW(s->s);
|
|
|
|
}
|
|
|
|
|
2007-10-11 00:29:54 +02:00
|
|
|
int
|
|
|
|
s_sum_doub_carr(doub_carr_t *dc)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
int sum = 0;
|
|
|
|
for (i = 0; i < dc->n; ++i)
|
|
|
|
for (j = 0; j < dc->a[i]->n; ++j)
|
|
|
|
sum += dc->a[i]->a[j];
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc)
|
|
|
|
{
|
|
|
|
doub_carr_t *t;
|
|
|
|
int i, j;
|
|
|
|
t = MIDL_user_allocate(FIELD_OFFSET(doub_carr_t, a[n]));
|
|
|
|
t->n = n;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
{
|
|
|
|
int v = i + 1;
|
|
|
|
t->a[i] = MIDL_user_allocate(FIELD_OFFSET(doub_carr_1_t, a[v]));
|
|
|
|
t->a[i]->n = v;
|
|
|
|
for (j = 0; j < v; ++j)
|
|
|
|
t->a[i]->a[j] = j + 1;
|
|
|
|
}
|
|
|
|
*dc = t;
|
|
|
|
}
|
|
|
|
|
2007-10-20 00:30:12 +02:00
|
|
|
unsigned
|
|
|
|
s_hash_bstr(bstr_t b)
|
|
|
|
{
|
|
|
|
short n = b[-1];
|
|
|
|
short *s = b;
|
|
|
|
unsigned hash = 0;
|
|
|
|
short i;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
hash = 5 * hash + (unsigned) s[i];
|
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
|
2007-11-01 23:04:43 +01:00
|
|
|
void
|
|
|
|
s_get_name(name_t *name)
|
|
|
|
{
|
|
|
|
const char bossman[] = "Jeremy White";
|
|
|
|
memcpy(name->name, bossman, min(name->size, sizeof(bossman)));
|
|
|
|
/* ensure nul-termination */
|
|
|
|
if (name->size < sizeof(bossman))
|
|
|
|
name->name[name->size - 1] = 0;
|
|
|
|
}
|
|
|
|
|
2007-11-02 23:24:08 +01:00
|
|
|
int
|
|
|
|
s_sum_pcarr2(int n, int **pa)
|
|
|
|
{
|
|
|
|
return s_sum_conf_array(*pa, n);
|
|
|
|
}
|
|
|
|
|
2007-11-06 02:23:26 +01:00
|
|
|
int
|
|
|
|
s_sum_L1_norms(int n, vector_t *vs)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int sum = 0;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
sum += abs(vs[i].x) + abs(vs[i].y) + abs(vs[i].z);
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2008-02-22 00:46:51 +01:00
|
|
|
s123_t *
|
|
|
|
s_get_s123(void)
|
|
|
|
{
|
|
|
|
s123_t *s = MIDL_user_allocate(sizeof *s);
|
|
|
|
s->f1 = 1;
|
|
|
|
s->f2 = 2;
|
|
|
|
s->f3 = 3;
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2007-12-10 15:24:11 +01:00
|
|
|
str_t
|
|
|
|
s_get_filename(void)
|
|
|
|
{
|
|
|
|
return (char *)__FILE__;
|
|
|
|
}
|
|
|
|
|
2009-11-07 15:54:28 +01:00
|
|
|
int s_echo_ranged_int(int n)
|
|
|
|
{
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
void s_get_ranged_enum(renum_t *re)
|
|
|
|
{
|
|
|
|
*re = RE3;
|
|
|
|
}
|
|
|
|
|
2007-12-25 20:08:07 +01:00
|
|
|
void
|
|
|
|
s_context_handle_test(void)
|
|
|
|
{
|
|
|
|
NDR_SCONTEXT h;
|
|
|
|
RPC_BINDING_HANDLE binding;
|
|
|
|
RPC_STATUS status;
|
|
|
|
unsigned char buf[20];
|
|
|
|
static RPC_SERVER_INTERFACE server_if =
|
|
|
|
{
|
|
|
|
sizeof(RPC_SERVER_INTERFACE),
|
|
|
|
{{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
|
|
|
|
{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
};
|
|
|
|
|
|
|
|
binding = I_RpcGetCurrentCallHandle();
|
|
|
|
ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n");
|
|
|
|
|
2009-04-07 13:27:13 +02:00
|
|
|
if (!pNDRSContextMarshall2 || !pNDRSContextUnmarshall2)
|
|
|
|
{
|
|
|
|
win_skip("NDRSContextMarshall2 or NDRSContextUnmarshall2 not exported from rpcrt4.dll\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
|
|
|
|
|
|
|
|
/* marshal a context handle with NULL userContext */
|
|
|
|
memset(buf, 0xcc, sizeof(buf));
|
2008-02-28 12:30:36 +01:00
|
|
|
pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
|
|
|
|
ok(UuidIsNil((UUID *)&buf[4], &status), "uuid should have been nil\n");
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
|
|
|
|
|
|
|
|
/* marshal a context handle with non-NULL userContext */
|
|
|
|
memset(buf, 0xcc, sizeof(buf));
|
|
|
|
h->userContext = (void *)0xdeadbeef;
|
2008-02-28 12:30:36 +01:00
|
|
|
pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
|
|
|
|
ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
|
|
|
|
|
2009-05-28 22:27:51 +02:00
|
|
|
/* raises ERROR_INVALID_HANDLE exception on Vista upwards */
|
|
|
|
if (0)
|
|
|
|
{
|
2008-02-28 12:30:36 +01:00
|
|
|
h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
|
|
|
|
ok(h->userContext == (void *)0xdeadbeef, "userContext of interface didn't unmarshal properly: %p\n", h->userContext);
|
|
|
|
|
|
|
|
/* marshal a context handle with an interface specified */
|
2008-02-28 12:30:36 +01:00
|
|
|
h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
|
|
|
|
|
|
|
|
memset(buf, 0xcc, sizeof(buf));
|
|
|
|
h->userContext = (void *)0xcafebabe;
|
2008-02-28 12:30:36 +01:00
|
|
|
pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
|
|
|
|
ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n");
|
|
|
|
ok(h->userContext == (void *)0xcafebabe, "userContext of interface didn't unmarshal properly: %p\n", h->userContext);
|
2009-04-07 13:27:13 +02:00
|
|
|
}
|
2007-12-25 20:08:07 +01:00
|
|
|
|
|
|
|
/* test same interface data, but different pointer */
|
|
|
|
/* raises ERROR_INVALID_HANDLE exception */
|
|
|
|
if (0)
|
|
|
|
{
|
|
|
|
RPC_SERVER_INTERFACE server_if_clone = server_if;
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if_clone.InterfaceId, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* test different interface data, but different pointer */
|
|
|
|
/* raises ERROR_INVALID_HANDLE exception */
|
|
|
|
if (0)
|
|
|
|
{
|
|
|
|
static RPC_SERVER_INTERFACE server_if2 =
|
|
|
|
{
|
|
|
|
sizeof(RPC_SERVER_INTERFACE),
|
|
|
|
{{0x00000000,0x4114,0x0704,{0x23,0x01,0x00,0x00,0x00,0x00,0x00,0x00}},{1,0}},
|
|
|
|
{{0x8a885d04,0x1ceb,0x11c9,{0x9f,0xe8,0x08,0x00,0x2b,0x10,0x48,0x60}},{2,0}},
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
};
|
2008-02-28 12:30:36 +01:00
|
|
|
pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if2.InterfaceId, 0);
|
2007-12-25 20:08:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-24 18:01:20 +01:00
|
|
|
void
|
|
|
|
s_get_numbers(int length, int size, pints_t n[])
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
n[i].pi = midl_user_allocate(sizeof(*n[i].pi));
|
|
|
|
*n[i].pi = i;
|
|
|
|
n[i].ppi = NULL;
|
|
|
|
n[i].pppi = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-23 10:25:25 +02:00
|
|
|
void
|
|
|
|
s_get_numbers_struct(numbers_struct_t **ns)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
*ns = midl_user_allocate(FIELD_OFFSET(numbers_struct_t, numbers[5]));
|
|
|
|
if (!*ns) return;
|
|
|
|
(*ns)->length = 5;
|
|
|
|
(*ns)->size = 5;
|
|
|
|
for (i = 0; i < (*ns)->length; i++)
|
|
|
|
{
|
|
|
|
(*ns)->numbers[i].pi = NULL;
|
|
|
|
(*ns)->numbers[i].ppi = NULL;
|
|
|
|
(*ns)->numbers[i].pppi = NULL;
|
|
|
|
}
|
|
|
|
(*ns)->numbers[0].pi = midl_user_allocate(sizeof(*(*ns)->numbers[i].pi));
|
|
|
|
*(*ns)->numbers[0].pi = 5;
|
|
|
|
}
|
|
|
|
|
2009-11-18 01:25:53 +01:00
|
|
|
void
|
|
|
|
s_full_pointer_test(int *a, int *b)
|
|
|
|
{
|
|
|
|
ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a);
|
|
|
|
ok(*b == 42, "Expected *b to be 42 instead of %d\n", *a);
|
|
|
|
ok(a == b, "Expected a (%p) to point to the same memory as b (%p)\n", a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
s_full_pointer_null_test(int *a, int *b)
|
|
|
|
{
|
|
|
|
ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a);
|
|
|
|
ok(b == NULL, "Expected b to be NULL instead of %p\n", b);
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
void
|
|
|
|
s_stop(void)
|
|
|
|
{
|
|
|
|
ok(RPC_S_OK == RpcMgmtStopServerListening(NULL), "RpcMgmtStopServerListening\n");
|
|
|
|
ok(RPC_S_OK == RpcServerUnregisterIf(NULL, NULL, FALSE), "RpcServerUnregisterIf\n");
|
|
|
|
ok(SetEvent(stop_event), "SetEvent\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
make_cmdline(char buffer[MAX_PATH], const char *test)
|
|
|
|
{
|
|
|
|
sprintf(buffer, "%s server %s", progname, test);
|
|
|
|
}
|
|
|
|
|
2008-02-07 12:56:00 +01:00
|
|
|
static void
|
2007-04-26 03:18:29 +02:00
|
|
|
run_client(const char *test)
|
|
|
|
{
|
|
|
|
char cmdline[MAX_PATH];
|
|
|
|
PROCESS_INFORMATION info;
|
|
|
|
STARTUPINFOA startup;
|
|
|
|
|
|
|
|
memset(&startup, 0, sizeof startup);
|
|
|
|
startup.cb = sizeof startup;
|
|
|
|
|
|
|
|
make_cmdline(cmdline, test);
|
|
|
|
ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
|
2008-02-07 12:56:00 +01:00
|
|
|
winetest_wait_child_process( info.hProcess );
|
2007-04-26 03:18:29 +02:00
|
|
|
ok(CloseHandle(info.hProcess), "CloseHandle\n");
|
|
|
|
ok(CloseHandle(info.hThread), "CloseHandle\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
basic_tests(void)
|
|
|
|
{
|
2007-09-26 20:32:47 +02:00
|
|
|
char string[] = "I am a string";
|
|
|
|
WCHAR wstring[] = {'I',' ','a','m',' ','a',' ','w','s','t','r','i','n','g', 0};
|
2007-09-27 20:13:21 +02:00
|
|
|
int f[5] = {1, 3, 0, -2, -4};
|
|
|
|
vector_t a = {1, 3, 7};
|
|
|
|
vector_t vec1 = {4, -2, 1}, vec2 = {-5, 2, 3}, *pvec2 = &vec2;
|
|
|
|
pvectors_t pvecs = {&vec1, &pvec2};
|
|
|
|
sp_inner_t spi = {42};
|
|
|
|
sp_t sp = {-13, &spi};
|
2007-12-19 15:53:30 +01:00
|
|
|
aligns_t aligns;
|
2007-05-10 05:50:49 +02:00
|
|
|
pints_t pints;
|
|
|
|
ptypes_t ptypes;
|
2007-09-14 03:04:32 +02:00
|
|
|
padded_t padded;
|
2007-09-19 00:29:59 +02:00
|
|
|
padded_t padded2[2];
|
2007-09-19 00:28:49 +02:00
|
|
|
bogus_t bogus;
|
2007-05-10 05:50:49 +02:00
|
|
|
int i1, i2, i3, *pi2, *pi3, **ppi3;
|
2007-04-26 03:18:29 +02:00
|
|
|
double u, v;
|
|
|
|
float s, t;
|
2009-03-12 23:04:35 +01:00
|
|
|
LONG q, r;
|
2007-05-10 05:50:49 +02:00
|
|
|
short h;
|
|
|
|
char c;
|
2007-04-26 03:18:29 +02:00
|
|
|
int x;
|
2007-09-26 20:32:47 +02:00
|
|
|
str_struct_t ss = {string};
|
|
|
|
wstr_struct_t ws = {wstring};
|
2007-12-10 15:24:11 +01:00
|
|
|
str_t str;
|
2008-03-21 00:06:14 +01:00
|
|
|
se_t se;
|
2009-11-12 11:31:38 +01:00
|
|
|
renum_t re;
|
2007-04-26 03:18:29 +02:00
|
|
|
|
|
|
|
ok(int_return() == INT_CODE, "RPC int_return\n");
|
|
|
|
|
|
|
|
ok(square(7) == 49, "RPC square\n");
|
|
|
|
ok(sum(23, -4) == 19, "RPC sum\n");
|
|
|
|
|
|
|
|
x = 0;
|
|
|
|
square_out(11, &x);
|
|
|
|
ok(x == 121, "RPC square_out\n");
|
|
|
|
|
|
|
|
x = 5;
|
|
|
|
square_ref(&x);
|
|
|
|
ok(x == 25, "RPC square_ref\n");
|
|
|
|
|
|
|
|
ok(str_length(string) == strlen(string), "RPC str_length\n");
|
2008-02-22 00:46:51 +01:00
|
|
|
ok(str_t_length(string) == strlen(string), "RPC str_length\n");
|
2007-04-26 03:18:29 +02:00
|
|
|
ok(dot_self(&a) == 59, "RPC dot_self\n");
|
|
|
|
|
2007-09-26 20:32:47 +02:00
|
|
|
ok(str_struct_len(&ss) == lstrlenA(string), "RPC str_struct_len\n");
|
|
|
|
ok(wstr_struct_len(&ws) == lstrlenW(wstring), "RPC str_struct_len\n");
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
v = 0.0;
|
|
|
|
u = square_half(3.0, &v);
|
|
|
|
ok(u == 9.0, "RPC square_half\n");
|
|
|
|
ok(v == 1.5, "RPC square_half\n");
|
|
|
|
|
|
|
|
t = 0.0f;
|
|
|
|
s = square_half_float(3.0f, &t);
|
|
|
|
ok(s == 9.0f, "RPC square_half_float\n");
|
|
|
|
ok(t == 1.5f, "RPC square_half_float\n");
|
|
|
|
|
|
|
|
r = 0;
|
|
|
|
q = square_half_long(3, &r);
|
|
|
|
ok(q == 9, "RPC square_half_long\n");
|
|
|
|
ok(r == 1, "RPC square_half_long\n");
|
2007-04-26 03:22:10 +02:00
|
|
|
|
2007-05-10 05:50:49 +02:00
|
|
|
i1 = 19;
|
|
|
|
i2 = -3;
|
|
|
|
i3 = -29;
|
|
|
|
pi2 = &i2;
|
|
|
|
pi3 = &i3;
|
|
|
|
ppi3 = &pi3;
|
|
|
|
pints.pi = &i1;
|
|
|
|
pints.ppi = &pi2;
|
|
|
|
pints.pppi = &ppi3;
|
|
|
|
ok(pints_sum(&pints) == -13, "RPC pints_sum\n");
|
|
|
|
|
|
|
|
c = 10;
|
|
|
|
h = 3;
|
|
|
|
q = 14;
|
|
|
|
s = -5.0f;
|
|
|
|
u = 11.0;
|
|
|
|
ptypes.pc = &c;
|
|
|
|
ptypes.ps = &h;
|
|
|
|
ptypes.pl = &q;
|
|
|
|
ptypes.pf = &s;
|
|
|
|
ptypes.pd = &u;
|
|
|
|
ok(ptypes_sum(&ptypes) == 33.0, "RPC ptypes_sum\n");
|
|
|
|
|
2007-05-12 02:27:40 +02:00
|
|
|
ok(dot_pvectors(&pvecs) == -21, "RPC dot_pvectors\n");
|
2007-06-14 01:14:08 +02:00
|
|
|
ok(dot_copy_vectors(vec1, vec2) == -21, "RPC dot_copy_vectors\n");
|
2007-04-26 03:22:10 +02:00
|
|
|
ok(sum_fixed_array(f) == -2, "RPC sum_fixed_array\n");
|
2007-05-16 02:48:20 +02:00
|
|
|
ok(sum_sp(&sp) == 29, "RPC sum_sp\n");
|
2007-06-26 03:24:11 +02:00
|
|
|
|
|
|
|
ok(enum_ord(E1) == 1, "RPC enum_ord\n");
|
|
|
|
ok(enum_ord(E2) == 2, "RPC enum_ord\n");
|
|
|
|
ok(enum_ord(E3) == 3, "RPC enum_ord\n");
|
|
|
|
ok(enum_ord(E4) == 4, "RPC enum_ord\n");
|
2007-09-04 20:04:37 +02:00
|
|
|
|
2008-03-21 00:06:14 +01:00
|
|
|
se.f = E2;
|
|
|
|
check_se2(&se);
|
|
|
|
|
2007-12-19 15:53:30 +01:00
|
|
|
memset(&aligns, 0, sizeof(aligns));
|
|
|
|
aligns.c = 3;
|
|
|
|
aligns.i = 4;
|
|
|
|
aligns.s = 5;
|
|
|
|
aligns.d = 6.0;
|
2007-09-04 20:04:37 +02:00
|
|
|
ok(sum_aligns(&aligns) == 18.0, "RPC sum_aligns\n");
|
2007-09-14 03:04:32 +02:00
|
|
|
|
|
|
|
padded.i = -3;
|
|
|
|
padded.c = 8;
|
|
|
|
ok(sum_padded(&padded) == 5, "RPC sum_padded\n");
|
2007-09-19 00:29:59 +02:00
|
|
|
padded2[0].i = -5;
|
|
|
|
padded2[0].c = 1;
|
|
|
|
padded2[1].i = 3;
|
|
|
|
padded2[1].c = 7;
|
|
|
|
ok(sum_padded2(padded2) == 6, "RPC sum_padded2\n");
|
2007-09-20 02:05:38 +02:00
|
|
|
padded2[0].i = -5;
|
|
|
|
padded2[0].c = 1;
|
|
|
|
padded2[1].i = 3;
|
|
|
|
padded2[1].c = 7;
|
|
|
|
ok(sum_padded_conf(padded2, 2) == 6, "RPC sum_padded_conf\n");
|
2007-09-19 00:28:49 +02:00
|
|
|
|
|
|
|
i1 = 14;
|
|
|
|
i2 = -7;
|
|
|
|
i3 = -4;
|
|
|
|
bogus.h.p1 = &i1;
|
|
|
|
bogus.p2 = &i2;
|
|
|
|
bogus.p3 = &i3;
|
|
|
|
bogus.c = 9;
|
|
|
|
ok(sum_bogus(&bogus) == 12, "RPC sum_bogus\n");
|
2007-09-20 02:04:49 +02:00
|
|
|
|
|
|
|
check_null(NULL);
|
2007-12-10 15:24:11 +01:00
|
|
|
|
|
|
|
str = get_filename();
|
|
|
|
ok(!strcmp(str, __FILE__), "get_filename() returned %s instead of %s\n", str, __FILE__);
|
2007-12-20 19:01:21 +01:00
|
|
|
midl_user_free(str);
|
2009-11-07 15:54:28 +01:00
|
|
|
|
|
|
|
x = echo_ranged_int(0);
|
|
|
|
ok(x == 0, "echo_ranged_int() returned %d instead of 0\n", x);
|
|
|
|
x = echo_ranged_int(100);
|
|
|
|
ok(x == 100, "echo_ranged_int() returned %d instead of 100\n", x);
|
2009-11-12 11:31:38 +01:00
|
|
|
|
2009-12-04 12:56:04 +01:00
|
|
|
if (!old_windows_version)
|
|
|
|
{
|
|
|
|
get_ranged_enum(&re);
|
|
|
|
ok(re == RE3, "get_ranged_enum() returned %d instead of RE3\n", re);
|
|
|
|
}
|
2007-04-26 03:18:29 +02:00
|
|
|
}
|
|
|
|
|
2007-05-19 01:53:27 +02:00
|
|
|
static void
|
|
|
|
union_tests(void)
|
|
|
|
{
|
2007-06-26 03:27:24 +02:00
|
|
|
encue_t eue;
|
2007-06-19 03:36:14 +02:00
|
|
|
encu_t eu;
|
2008-07-01 12:25:44 +02:00
|
|
|
unencu_t uneu;
|
2007-05-31 03:00:45 +02:00
|
|
|
sun_t su;
|
2007-05-25 02:48:39 +02:00
|
|
|
int i;
|
2007-05-19 01:53:27 +02:00
|
|
|
|
2007-05-31 03:00:45 +02:00
|
|
|
su.s = SUN_I;
|
|
|
|
su.u.i = 9;
|
|
|
|
ok(square_sun(&su) == 81.0, "RPC square_sun\n");
|
2007-05-19 01:53:27 +02:00
|
|
|
|
2007-05-31 03:00:45 +02:00
|
|
|
su.s = SUN_F1;
|
|
|
|
su.u.f = 5.0;
|
|
|
|
ok(square_sun(&su) == 25.0, "RPC square_sun\n");
|
2007-05-19 01:53:27 +02:00
|
|
|
|
2007-05-31 03:00:45 +02:00
|
|
|
su.s = SUN_F2;
|
|
|
|
su.u.f = -2.0;
|
|
|
|
ok(square_sun(&su) == 4.0, "RPC square_sun\n");
|
2007-05-25 02:48:39 +02:00
|
|
|
|
2007-05-31 03:00:45 +02:00
|
|
|
su.s = SUN_PI;
|
|
|
|
su.u.pi = &i;
|
2007-05-25 02:48:39 +02:00
|
|
|
i = 11;
|
2007-05-31 03:00:45 +02:00
|
|
|
ok(square_sun(&su) == 121.0, "RPC square_sun\n");
|
2007-06-19 03:36:14 +02:00
|
|
|
|
|
|
|
eu.t = ENCU_I;
|
|
|
|
eu.tagged_union.i = 7;
|
|
|
|
ok(square_encu(&eu) == 49.0, "RPC square_encu\n");
|
|
|
|
|
|
|
|
eu.t = ENCU_F;
|
|
|
|
eu.tagged_union.f = 3.0;
|
|
|
|
ok(square_encu(&eu) == 9.0, "RPC square_encu\n");
|
2007-06-26 03:27:24 +02:00
|
|
|
|
2008-07-01 12:25:44 +02:00
|
|
|
uneu.i = 4;
|
|
|
|
ok(square_unencu(ENCU_I, &uneu) == 16.0, "RPC square_unencu\n");
|
|
|
|
|
|
|
|
uneu.f = 5.0;
|
|
|
|
ok(square_unencu(ENCU_F, &uneu) == 25.0, "RPC square_unencu\n");
|
|
|
|
|
2007-06-26 03:27:24 +02:00
|
|
|
eue.t = E1;
|
|
|
|
eue.tagged_union.i1 = 8;
|
|
|
|
ok(square_encue(&eue) == 64.0, "RPC square_encue\n");
|
|
|
|
|
|
|
|
eue.t = E2;
|
|
|
|
eue.tagged_union.f2 = 10.0;
|
|
|
|
ok(square_encue(&eue) == 100.0, "RPC square_encue\n");
|
2007-06-19 03:36:14 +02:00
|
|
|
}
|
2007-05-19 01:53:27 +02:00
|
|
|
|
2007-05-25 02:50:02 +02:00
|
|
|
static test_list_t *
|
|
|
|
null_list(void)
|
|
|
|
{
|
|
|
|
test_list_t *n = HeapAlloc(GetProcessHeap(), 0, sizeof *n);
|
|
|
|
n->t = TL_NULL;
|
2007-12-19 15:53:30 +01:00
|
|
|
n->u.x = 0;
|
2007-05-25 02:50:02 +02:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static test_list_t *
|
|
|
|
make_list(test_list_t *tail)
|
|
|
|
{
|
|
|
|
test_list_t *n = HeapAlloc(GetProcessHeap(), 0, sizeof *n);
|
|
|
|
n->t = TL_LIST;
|
|
|
|
n->u.tail = tail;
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_list(test_list_t *list)
|
|
|
|
{
|
|
|
|
if (list->t == TL_LIST)
|
|
|
|
free_list(list->u.tail);
|
|
|
|
HeapFree(GetProcessHeap(), 0, list);
|
|
|
|
}
|
|
|
|
|
2007-06-14 01:13:04 +02:00
|
|
|
ULONG __RPC_USER
|
|
|
|
puint_t_UserSize(ULONG *flags, ULONG start, puint_t *p)
|
|
|
|
{
|
|
|
|
return start + sizeof(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * __RPC_USER
|
|
|
|
puint_t_UserMarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
|
|
|
|
{
|
|
|
|
int n = atoi(*p);
|
|
|
|
memcpy(buffer, &n, sizeof n);
|
|
|
|
return buffer + sizeof n;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * __RPC_USER
|
|
|
|
puint_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, puint_t *p)
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
memcpy(&n, buffer, sizeof n);
|
|
|
|
*p = HeapAlloc(GetProcessHeap(), 0, 10);
|
|
|
|
sprintf(*p, "%d", n);
|
|
|
|
return buffer + sizeof n;
|
|
|
|
}
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
puint_t_UserFree(ULONG *flags, puint_t *p)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, *p);
|
|
|
|
}
|
|
|
|
|
2007-06-14 01:15:41 +02:00
|
|
|
ULONG __RPC_USER
|
|
|
|
us_t_UserSize(ULONG *flags, ULONG start, us_t *pus)
|
|
|
|
{
|
|
|
|
return start + sizeof(struct wire_us);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * __RPC_USER
|
|
|
|
us_t_UserMarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
|
|
|
|
{
|
|
|
|
struct wire_us wus;
|
|
|
|
wus.x = atoi(pus->x);
|
|
|
|
memcpy(buffer, &wus, sizeof wus);
|
|
|
|
return buffer + sizeof wus;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * __RPC_USER
|
|
|
|
us_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, us_t *pus)
|
|
|
|
{
|
|
|
|
struct wire_us wus;
|
|
|
|
memcpy(&wus, buffer, sizeof wus);
|
|
|
|
pus->x = HeapAlloc(GetProcessHeap(), 0, 10);
|
|
|
|
sprintf(pus->x, "%d", wus.x);
|
|
|
|
return buffer + sizeof wus;
|
|
|
|
}
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
us_t_UserFree(ULONG *flags, us_t *pus)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, pus->x);
|
|
|
|
}
|
|
|
|
|
2007-10-20 00:30:12 +02:00
|
|
|
ULONG __RPC_USER
|
|
|
|
bstr_t_UserSize(ULONG *flags, ULONG start, bstr_t *b)
|
|
|
|
{
|
2008-10-14 00:36:17 +02:00
|
|
|
return start + FIELD_OFFSET(user_bstr_t, data[(*b)[-1]]);
|
2007-10-20 00:30:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * __RPC_USER
|
|
|
|
bstr_t_UserMarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
|
|
|
|
{
|
2008-10-14 00:36:17 +02:00
|
|
|
wire_bstr_t wb = (wire_bstr_t) buffer;
|
2007-10-20 00:30:12 +02:00
|
|
|
wb->n = (*b)[-1];
|
|
|
|
memcpy(&wb->data, *b, wb->n * sizeof wb->data[0]);
|
2008-10-14 00:36:17 +02:00
|
|
|
return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
|
2007-10-20 00:30:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char * __RPC_USER
|
|
|
|
bstr_t_UserUnmarshal(ULONG *flags, unsigned char *buffer, bstr_t *b)
|
|
|
|
{
|
2008-10-14 00:36:17 +02:00
|
|
|
wire_bstr_t wb = (wire_bstr_t) buffer;
|
2007-10-20 00:30:12 +02:00
|
|
|
short *data = HeapAlloc(GetProcessHeap(), 0, (wb->n + 1) * sizeof *data);
|
|
|
|
data[0] = wb->n;
|
|
|
|
memcpy(&data[1], wb->data, wb->n * sizeof data[1]);
|
|
|
|
*b = &data[1];
|
2008-10-14 00:36:17 +02:00
|
|
|
return buffer + FIELD_OFFSET(user_bstr_t, data[wb->n]);
|
2007-10-20 00:30:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void __RPC_USER
|
|
|
|
bstr_t_UserFree(ULONG *flags, bstr_t *b)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, &((*b)[-1]));
|
|
|
|
}
|
|
|
|
|
2007-05-25 02:50:02 +02:00
|
|
|
static void
|
|
|
|
pointer_tests(void)
|
|
|
|
{
|
2007-09-27 20:13:21 +02:00
|
|
|
int a[] = {1, 2, 3, 4};
|
|
|
|
char p1[] = "11";
|
2007-05-25 02:50:02 +02:00
|
|
|
test_list_t *list = make_list(make_list(make_list(null_list())));
|
2007-09-27 20:13:21 +02:00
|
|
|
test_us_t tus = {{p1}};
|
2007-06-21 01:50:44 +02:00
|
|
|
int *pa[4];
|
2007-10-18 03:06:26 +02:00
|
|
|
puints_t pus;
|
|
|
|
cpuints_t cpus;
|
2007-10-20 00:30:12 +02:00
|
|
|
short bstr_data[] = { 5, 'H', 'e', 'l', 'l', 'o' };
|
|
|
|
bstr_t bstr = &bstr_data[1];
|
2007-11-01 23:04:43 +01:00
|
|
|
name_t name;
|
|
|
|
void *buffer;
|
2007-11-02 23:24:08 +01:00
|
|
|
int *pa2;
|
2008-02-22 00:46:51 +01:00
|
|
|
s123_t *s123;
|
2009-11-18 01:25:53 +01:00
|
|
|
int val = 42;
|
2007-05-25 02:50:02 +02:00
|
|
|
|
|
|
|
ok(test_list_length(list) == 3, "RPC test_list_length\n");
|
2007-06-14 01:13:04 +02:00
|
|
|
ok(square_puint(p1) == 121, "RPC square_puint\n");
|
2007-10-18 03:06:26 +02:00
|
|
|
pus.n = 4;
|
|
|
|
pus.ps = HeapAlloc(GetProcessHeap(), 0, pus.n * sizeof pus.ps[0]);
|
|
|
|
pus.ps[0] = xstrdup("5");
|
|
|
|
pus.ps[1] = xstrdup("6");
|
|
|
|
pus.ps[2] = xstrdup("7");
|
|
|
|
pus.ps[3] = xstrdup("8");
|
|
|
|
ok(sum_puints(&pus) == 26, "RPC sum_puints\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, pus.ps[0]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pus.ps[1]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pus.ps[2]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pus.ps[3]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pus.ps);
|
|
|
|
cpus.n = 4;
|
|
|
|
cpus.ps = HeapAlloc(GetProcessHeap(), 0, cpus.n * sizeof cpus.ps[0]);
|
|
|
|
cpus.ps[0] = xstrdup("5");
|
|
|
|
cpus.ps[1] = xstrdup("6");
|
|
|
|
cpus.ps[2] = xstrdup("7");
|
|
|
|
cpus.ps[3] = xstrdup("8");
|
|
|
|
ok(sum_cpuints(&cpus) == 26, "RPC sum_puints\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, cpus.ps[0]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, cpus.ps[1]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, cpus.ps[2]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, cpus.ps[3]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, cpus.ps);
|
2007-10-05 22:52:20 +02:00
|
|
|
ok(square_test_us(&tus) == 121, "RPC square_test_us\n");
|
2007-05-25 02:50:02 +02:00
|
|
|
|
2007-06-21 01:50:44 +02:00
|
|
|
pa[0] = &a[0];
|
|
|
|
pa[1] = &a[1];
|
|
|
|
pa[2] = &a[2];
|
|
|
|
ok(sum_parr(pa) == 6, "RPC sum_parr\n");
|
|
|
|
|
|
|
|
pa[0] = &a[0];
|
|
|
|
pa[1] = &a[1];
|
|
|
|
pa[2] = &a[2];
|
|
|
|
pa[3] = &a[3];
|
|
|
|
ok(sum_pcarr(pa, 4) == 10, "RPC sum_pcarr\n");
|
|
|
|
|
2007-10-20 00:30:12 +02:00
|
|
|
ok(hash_bstr(bstr) == s_hash_bstr(bstr), "RPC hash_bstr_data\n");
|
|
|
|
|
2007-05-25 02:50:02 +02:00
|
|
|
free_list(list);
|
2007-11-01 23:04:43 +01:00
|
|
|
|
2009-05-28 22:27:51 +02:00
|
|
|
if (!old_windows_version)
|
|
|
|
{
|
|
|
|
name.size = 10;
|
|
|
|
name.name = buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, name.size);
|
|
|
|
get_name(&name);
|
|
|
|
ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer);
|
|
|
|
ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name);
|
|
|
|
HeapFree(GetProcessHeap(), 0, name.name);
|
|
|
|
}
|
2007-11-02 23:24:08 +01:00
|
|
|
|
|
|
|
pa2 = a;
|
|
|
|
ok(sum_pcarr2(4, &pa2) == 10, "RPC sum_pcarr2\n");
|
2008-02-22 00:46:51 +01:00
|
|
|
|
|
|
|
s123 = get_s123();
|
|
|
|
ok(s123->f1 == 1 && s123->f2 == 2 && s123->f3 == 3, "RPC get_s123\n");
|
|
|
|
MIDL_user_free(s123);
|
2009-11-18 01:25:53 +01:00
|
|
|
|
|
|
|
full_pointer_test(&val, &val);
|
|
|
|
full_pointer_null_test(&val, NULL);
|
2007-05-25 02:50:02 +02:00
|
|
|
}
|
|
|
|
|
2007-10-11 00:29:54 +02:00
|
|
|
static int
|
|
|
|
check_pyramid_doub_carr(doub_carr_t *dc)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
for (i = 0; i < dc->n; ++i)
|
|
|
|
for (j = 0; j < dc->a[i]->n; ++j)
|
|
|
|
if (dc->a[i]->a[j] != j + 1)
|
|
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_pyramid_doub_carr(doub_carr_t *dc)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < dc->n; ++i)
|
|
|
|
MIDL_user_free(dc->a[i]);
|
2007-10-13 01:24:47 +02:00
|
|
|
MIDL_user_free(dc);
|
2007-10-11 00:29:54 +02:00
|
|
|
}
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
static void
|
|
|
|
array_tests(void)
|
|
|
|
{
|
2007-09-27 20:13:21 +02:00
|
|
|
int m[2][3][4] =
|
2007-06-06 03:50:31 +02:00
|
|
|
{
|
|
|
|
{{1, 2, 3, 4}, {-1, -3, -5, -7}, {0, 2, 4, 6}},
|
|
|
|
{{1, -2, 3, -4}, {2, 3, 5, 7}, {-4, -1, -14, 4114}}
|
|
|
|
};
|
2007-09-27 20:13:21 +02:00
|
|
|
int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
2009-01-11 15:00:18 +01:00
|
|
|
int c2[] = {10, 100, 200};
|
2010-03-23 14:33:13 +01:00
|
|
|
int c3[20];
|
2007-09-27 20:13:21 +02:00
|
|
|
vector_t vs[2] = {{1, -2, 3}, {4, -5, -6}};
|
2007-06-12 03:51:41 +02:00
|
|
|
cps_t cps;
|
2007-09-04 18:33:23 +02:00
|
|
|
cpsc_t cpsc;
|
2007-06-06 03:52:24 +02:00
|
|
|
cs_t *cs;
|
2007-06-12 03:51:41 +02:00
|
|
|
int n;
|
2007-09-26 20:32:08 +02:00
|
|
|
int ca[5] = {1, -2, 3, -4, 5};
|
2007-10-11 00:29:54 +02:00
|
|
|
doub_carr_t *dc;
|
2007-12-24 18:01:20 +01:00
|
|
|
int *pi;
|
|
|
|
pints_t api[5];
|
2008-06-23 10:25:25 +02:00
|
|
|
numbers_struct_t *ns;
|
2010-03-19 15:50:15 +01:00
|
|
|
refpint_t rpi[5];
|
2007-06-06 03:50:31 +02:00
|
|
|
|
2009-05-28 22:27:51 +02:00
|
|
|
if (!old_windows_version)
|
|
|
|
{
|
|
|
|
const char str1[25] = "Hello";
|
|
|
|
ok(cstr_length(str1, sizeof str1) == strlen(str1), "RPC cstr_length\n");
|
|
|
|
}
|
2007-09-05 00:46:30 +02:00
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
ok(sum_fixed_int_3d(m) == 4116, "RPC sum_fixed_int_3d\n");
|
|
|
|
|
|
|
|
ok(sum_conf_array(c, 10) == 45, "RPC sum_conf_array\n");
|
|
|
|
ok(sum_conf_array(&c[5], 2) == 11, "RPC sum_conf_array\n");
|
|
|
|
ok(sum_conf_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
|
|
|
|
ok(sum_conf_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
|
|
|
|
|
2009-01-14 14:15:26 +01:00
|
|
|
ok(sum_conf_ptr_by_conf_ptr(1, c2, c) == 45, "RPC sum_conf_ptr_by_conf_ptr\n");
|
|
|
|
ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 345, "RPC sum_conf_ptr_by_conf_ptr\n");
|
2009-01-11 15:00:18 +01:00
|
|
|
c2[0] = 0;
|
2009-01-14 14:15:26 +01:00
|
|
|
ok(sum_conf_ptr_by_conf_ptr(3, c2, c) == 300, "RPC sum_conf_ptr_by_conf_ptr\n");
|
2009-01-11 15:00:18 +01:00
|
|
|
|
2007-09-26 20:32:08 +02:00
|
|
|
ok(sum_unique_conf_array(ca, 4) == -2, "RPC sum_unique_conf_array\n");
|
|
|
|
ok(sum_unique_conf_ptr(ca, 5) == 3, "RPC sum_unique_conf_array\n");
|
|
|
|
ok(sum_unique_conf_ptr(NULL, 10) == 0, "RPC sum_unique_conf_array\n");
|
|
|
|
|
2010-03-23 14:33:13 +01:00
|
|
|
get_number_array(c3, &n);
|
|
|
|
ok(n == 10, "RPC get_num_array\n");
|
|
|
|
for (; n > 0; n--)
|
|
|
|
ok(c3[n-1] == c[n-1], "get_num_array returned wrong value %d @ %d\n",
|
|
|
|
c3[n-1], n);
|
2007-06-06 03:50:31 +02:00
|
|
|
ok(sum_var_array(c, 10) == 45, "RPC sum_conf_array\n");
|
|
|
|
ok(sum_var_array(&c[5], 2) == 11, "RPC sum_conf_array\n");
|
|
|
|
ok(sum_var_array(&c[7], 1) == 7, "RPC sum_conf_array\n");
|
|
|
|
ok(sum_var_array(&c[2], 0) == 0, "RPC sum_conf_array\n");
|
|
|
|
|
|
|
|
ok(dot_two_vectors(vs) == -4, "RPC dot_two_vectors\n");
|
2007-06-25 15:21:20 +02:00
|
|
|
cs = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(cs_t, ca[5]));
|
2007-06-06 03:52:24 +02:00
|
|
|
cs->n = 5;
|
|
|
|
cs->ca[0] = 3;
|
|
|
|
cs->ca[1] = 5;
|
|
|
|
cs->ca[2] = -2;
|
|
|
|
cs->ca[3] = -1;
|
|
|
|
cs->ca[4] = -4;
|
|
|
|
ok(sum_cs(cs) == 1, "RPC sum_cs\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, cs);
|
2007-06-12 03:51:41 +02:00
|
|
|
|
|
|
|
n = 5;
|
|
|
|
cps.pn = &n;
|
|
|
|
cps.ca1 = &c[2];
|
|
|
|
cps.n = 3;
|
|
|
|
cps.ca2 = &c[3];
|
2007-10-11 00:29:54 +02:00
|
|
|
ok(sum_cps(&cps) == 53, "RPC sum_cps\n");
|
2007-09-04 18:33:23 +02:00
|
|
|
|
|
|
|
cpsc.a = 4;
|
|
|
|
cpsc.b = 5;
|
|
|
|
cpsc.c = 1;
|
|
|
|
cpsc.ca = c;
|
2007-10-11 00:29:54 +02:00
|
|
|
ok(sum_cpsc(&cpsc) == 6, "RPC sum_cpsc\n");
|
2007-09-04 18:33:23 +02:00
|
|
|
cpsc.a = 4;
|
|
|
|
cpsc.b = 5;
|
|
|
|
cpsc.c = 0;
|
|
|
|
cpsc.ca = c;
|
2007-10-11 00:29:54 +02:00
|
|
|
ok(sum_cpsc(&cpsc) == 10, "RPC sum_cpsc\n");
|
2007-09-04 18:33:23 +02:00
|
|
|
|
|
|
|
ok(sum_toplev_conf_2n(c, 3) == 15, "RPC sum_toplev_conf_2n\n");
|
|
|
|
ok(sum_toplev_conf_cond(c, 5, 6, 1) == 10, "RPC sum_toplev_conf_cond\n");
|
|
|
|
ok(sum_toplev_conf_cond(c, 5, 6, 0) == 15, "RPC sum_toplev_conf_cond\n");
|
2007-10-11 00:29:54 +02:00
|
|
|
|
2009-06-15 11:04:57 +02:00
|
|
|
dc = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_t, a[2]));
|
2007-10-11 00:29:54 +02:00
|
|
|
dc->n = 2;
|
2009-06-15 11:04:57 +02:00
|
|
|
dc->a[0] = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_1_t, a[3]));
|
2007-10-11 00:29:54 +02:00
|
|
|
dc->a[0]->n = 3;
|
|
|
|
dc->a[0]->a[0] = 5;
|
|
|
|
dc->a[0]->a[1] = 1;
|
|
|
|
dc->a[0]->a[2] = 8;
|
2009-06-15 11:04:57 +02:00
|
|
|
dc->a[1] = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(doub_carr_1_t, a[2]));
|
2007-10-11 00:29:54 +02:00
|
|
|
dc->a[1]->n = 2;
|
|
|
|
dc->a[1]->a[0] = 2;
|
|
|
|
dc->a[1]->a[1] = 3;
|
|
|
|
ok(sum_doub_carr(dc) == 19, "RPC sum_doub_carr\n");
|
2009-06-15 11:04:57 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, dc->a[0]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, dc->a[1]);
|
|
|
|
HeapFree(GetProcessHeap(), 0, dc);
|
2007-10-11 00:29:54 +02:00
|
|
|
|
|
|
|
dc = NULL;
|
|
|
|
make_pyramid_doub_carr(4, &dc);
|
|
|
|
ok(check_pyramid_doub_carr(dc), "RPC make_pyramid_doub_carr\n");
|
|
|
|
free_pyramid_doub_carr(dc);
|
2007-11-06 02:23:26 +01:00
|
|
|
|
|
|
|
ok(sum_L1_norms(2, vs) == 21, "RPC sum_L1_norms\n");
|
2007-12-24 18:01:20 +01:00
|
|
|
|
|
|
|
memset(api, 0, sizeof(api));
|
|
|
|
pi = HeapAlloc(GetProcessHeap(), 0, sizeof(*pi));
|
|
|
|
*pi = -1;
|
|
|
|
api[0].pi = pi;
|
|
|
|
get_numbers(1, 1, api);
|
|
|
|
ok(api[0].pi == pi, "RPC conformant varying array [out] pointer changed from %p to %p\n", pi, api[0].pi);
|
2008-06-23 10:25:25 +02:00
|
|
|
ok(*api[0].pi == 0, "pi unmarshalled incorrectly %d\n", *api[0].pi);
|
|
|
|
|
2009-05-28 22:27:51 +02:00
|
|
|
if (!old_windows_version)
|
|
|
|
{
|
|
|
|
ns = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(numbers_struct_t, numbers[5]));
|
|
|
|
ns->length = 5;
|
|
|
|
ns->size = 5;
|
|
|
|
ns->numbers[0].pi = pi;
|
|
|
|
get_numbers_struct(&ns);
|
|
|
|
ok(ns->numbers[0].pi == pi, "RPC conformant varying struct embedded pointer changed from %p to %p\n", pi, ns->numbers[0].pi);
|
|
|
|
ok(*ns->numbers[0].pi == 5, "pi unmarshalled incorrectly %d\n", *ns->numbers[0].pi);
|
|
|
|
HeapFree(GetProcessHeap(), 0, ns);
|
|
|
|
}
|
2007-12-24 18:01:20 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, pi);
|
2010-03-19 15:50:15 +01:00
|
|
|
|
|
|
|
pi = HeapAlloc(GetProcessHeap(), 0, 5 * sizeof(*pi));
|
|
|
|
pi[0] = 3; rpi[0] = &pi[0];
|
|
|
|
pi[1] = 5; rpi[1] = &pi[1];
|
|
|
|
pi[2] = -2; rpi[2] = &pi[2];
|
|
|
|
pi[3] = -1; rpi[3] = &pi[3];
|
|
|
|
pi[4] = -4; rpi[4] = &pi[4];
|
|
|
|
ok(sum_complex_array(5, rpi) == 1, "RPC sum_complex_array\n");
|
|
|
|
HeapFree(GetProcessHeap(), 0, pi);
|
2007-06-06 03:50:31 +02:00
|
|
|
}
|
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
void
|
|
|
|
s_authinfo_test(unsigned int protseq, int secure)
|
|
|
|
{
|
|
|
|
RPC_BINDING_HANDLE binding;
|
|
|
|
RPC_STATUS status;
|
|
|
|
ULONG level, authnsvc;
|
|
|
|
RPC_AUTHZ_HANDLE privs;
|
|
|
|
unsigned char *principal;
|
|
|
|
|
|
|
|
binding = I_RpcGetCurrentCallHandle();
|
|
|
|
ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n");
|
|
|
|
|
|
|
|
level = authnsvc = 0xdeadbeef;
|
|
|
|
privs = (RPC_AUTHZ_HANDLE)0xdeadbeef;
|
|
|
|
principal = (unsigned char *)0xdeadbeef;
|
|
|
|
|
|
|
|
if (secure || protseq == RPC_PROTSEQ_LRPC)
|
|
|
|
{
|
|
|
|
status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
|
2009-12-16 09:09:01 +01:00
|
|
|
if (status == RPC_S_CANNOT_SUPPORT)
|
|
|
|
{
|
|
|
|
win_skip("RpcBindingInqAuthClientA not supported\n");
|
|
|
|
return;
|
|
|
|
}
|
2009-12-14 11:54:36 +01:00
|
|
|
ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
|
|
|
|
ok(privs != (RPC_AUTHZ_HANDLE)0xdeadbeef, "privs unchanged\n");
|
|
|
|
ok(principal != (unsigned char *)0xdeadbeef, "principal unchanged\n");
|
|
|
|
if (protseq != RPC_PROTSEQ_LRPC)
|
|
|
|
{
|
|
|
|
todo_wine
|
|
|
|
ok(principal != NULL, "NULL principal\n");
|
|
|
|
}
|
2009-12-16 09:00:30 +01:00
|
|
|
if (protseq == RPC_PROTSEQ_LRPC && principal && pGetUserNameExA)
|
2009-12-14 11:54:36 +01:00
|
|
|
{
|
|
|
|
int len;
|
|
|
|
char *spn;
|
|
|
|
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, NULL, 0, NULL, NULL);
|
|
|
|
spn = HeapAlloc( GetProcessHeap(), 0, len );
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, spn, len, NULL, NULL);
|
|
|
|
|
|
|
|
ok(!strcmp(domain_and_user, spn), "expected %s got %s\n", domain_and_user, spn);
|
|
|
|
HeapFree( GetProcessHeap(), 0, spn );
|
|
|
|
}
|
|
|
|
ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "level unchanged\n");
|
|
|
|
ok(authnsvc == RPC_C_AUTHN_WINNT, "authnsvc unchanged\n");
|
2009-12-15 09:50:10 +01:00
|
|
|
|
|
|
|
status = RpcImpersonateClient(NULL);
|
|
|
|
ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
|
|
|
|
status = RpcRevertToSelf();
|
|
|
|
ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
|
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
|
|
|
|
ok(status == RPC_S_BINDING_HAS_NO_AUTH, "expected RPC_S_BINDING_HAS_NO_AUTH got %u\n", status);
|
|
|
|
ok(privs == (RPC_AUTHZ_HANDLE)0xdeadbeef, "got %p\n", privs);
|
|
|
|
ok(principal == (unsigned char *)0xdeadbeef, "got %s\n", principal);
|
|
|
|
ok(level == 0xdeadbeef, "got %u\n", level);
|
|
|
|
ok(authnsvc == 0xdeadbeef, "got %u\n", authnsvc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
static void
|
|
|
|
run_tests(void)
|
|
|
|
{
|
|
|
|
basic_tests();
|
|
|
|
union_tests();
|
|
|
|
pointer_tests();
|
|
|
|
array_tests();
|
2007-12-25 20:08:07 +01:00
|
|
|
context_handle_test();
|
2007-06-06 03:50:31 +02:00
|
|
|
}
|
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
static void
|
|
|
|
set_auth_info(RPC_BINDING_HANDLE handle)
|
|
|
|
{
|
|
|
|
RPC_STATUS status;
|
|
|
|
RPC_SECURITY_QOS qos;
|
|
|
|
|
2009-12-16 09:00:30 +01:00
|
|
|
if (!pGetUserNameExA)
|
|
|
|
return;
|
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
qos.Version = 1;
|
|
|
|
qos.Capabilities = RPC_C_QOS_CAPABILITIES_MUTUAL_AUTH;
|
|
|
|
qos.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;
|
|
|
|
qos.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;
|
|
|
|
|
|
|
|
status = pRpcBindingSetAuthInfoExA(handle, (RPC_CSTR)domain_and_user, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
|
|
|
|
RPC_C_AUTHN_WINNT, NULL, 0, &qos);
|
|
|
|
ok(status == RPC_S_OK, "RpcBindingSetAuthInfoExA failed %d\n", status);
|
|
|
|
}
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
static void
|
|
|
|
client(const char *test)
|
|
|
|
{
|
2009-12-14 11:54:36 +01:00
|
|
|
static unsigned char iptcp[] = "ncacn_ip_tcp";
|
|
|
|
static unsigned char np[] = "ncacn_np";
|
|
|
|
static unsigned char ncalrpc[] = "ncalrpc";
|
|
|
|
static unsigned char address[] = "127.0.0.1";
|
|
|
|
static unsigned char address_np[] = "\\\\.";
|
|
|
|
static unsigned char port[] = PORT;
|
|
|
|
static unsigned char pipe[] = PIPE;
|
|
|
|
static unsigned char guid[] = "00000000-4114-0704-2301-000000000000";
|
|
|
|
|
|
|
|
unsigned char *binding;
|
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
if (strcmp(test, "tcp_basic") == 0)
|
|
|
|
{
|
|
|
|
ok(RPC_S_OK == RpcStringBindingCompose(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFromStringBinding(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
run_tests();
|
2009-12-14 11:54:36 +01:00
|
|
|
authinfo_test(RPC_PROTSEQ_TCP, 0);
|
|
|
|
|
|
|
|
ok(RPC_S_OK == RpcStringFree(&binding), "RpcStringFree\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
|
|
|
|
}
|
|
|
|
else if (strcmp(test, "tcp_secure") == 0)
|
|
|
|
{
|
|
|
|
ok(RPC_S_OK == RpcStringBindingCompose(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFromStringBinding(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
|
|
|
|
|
|
|
|
set_auth_info(IServer_IfHandle);
|
|
|
|
authinfo_test(RPC_PROTSEQ_TCP, 1);
|
2007-04-26 03:18:29 +02:00
|
|
|
|
|
|
|
ok(RPC_S_OK == RpcStringFree(&binding), "RpcStringFree\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
|
|
|
|
}
|
2009-11-04 09:10:50 +01:00
|
|
|
else if (strcmp(test, "ncalrpc_basic") == 0)
|
|
|
|
{
|
2009-12-14 11:54:36 +01:00
|
|
|
ok(RPC_S_OK == RpcStringBindingCompose(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFromStringBinding(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
|
|
|
|
|
|
|
|
run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */
|
|
|
|
authinfo_test(RPC_PROTSEQ_LRPC, 0);
|
2009-11-04 09:10:50 +01:00
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
ok(RPC_S_OK == RpcStringFree(&binding), "RpcStringFree\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
|
|
|
|
}
|
|
|
|
else if (strcmp(test, "ncalrpc_secure") == 0)
|
|
|
|
{
|
2009-11-04 09:10:50 +01:00
|
|
|
ok(RPC_S_OK == RpcStringBindingCompose(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFromStringBinding(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
|
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
set_auth_info(IServer_IfHandle);
|
|
|
|
authinfo_test(RPC_PROTSEQ_LRPC, 1);
|
2009-11-04 09:10:50 +01:00
|
|
|
|
|
|
|
ok(RPC_S_OK == RpcStringFree(&binding), "RpcStringFree\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
|
|
|
|
}
|
2007-04-26 03:18:29 +02:00
|
|
|
else if (strcmp(test, "np_basic") == 0)
|
|
|
|
{
|
2009-12-14 11:54:36 +01:00
|
|
|
ok(RPC_S_OK == RpcStringBindingCompose(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
|
2007-04-26 03:18:29 +02:00
|
|
|
ok(RPC_S_OK == RpcBindingFromStringBinding(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
|
|
|
|
|
2007-06-06 03:50:31 +02:00
|
|
|
run_tests();
|
2009-12-14 11:54:36 +01:00
|
|
|
authinfo_test(RPC_PROTSEQ_NMP, 0);
|
2007-04-26 03:18:29 +02:00
|
|
|
stop();
|
|
|
|
|
|
|
|
ok(RPC_S_OK == RpcStringFree(&binding), "RpcStringFree\n");
|
|
|
|
ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
server(void)
|
|
|
|
{
|
|
|
|
static unsigned char iptcp[] = "ncacn_ip_tcp";
|
|
|
|
static unsigned char port[] = PORT;
|
|
|
|
static unsigned char np[] = "ncacn_np";
|
|
|
|
static unsigned char pipe[] = PIPE;
|
2009-11-04 09:10:50 +01:00
|
|
|
static unsigned char ncalrpc[] = "ncalrpc";
|
|
|
|
static unsigned char guid[] = "00000000-4114-0704-2301-000000000000";
|
|
|
|
RPC_STATUS status, iptcp_status, np_status, ncalrpc_status;
|
2008-06-14 17:42:32 +02:00
|
|
|
DWORD ret;
|
2007-04-26 03:18:29 +02:00
|
|
|
|
2008-05-07 12:11:09 +02:00
|
|
|
iptcp_status = RpcServerUseProtseqEp(iptcp, 20, port, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(iptcp_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_ip_tcp) failed with status %d\n", iptcp_status);
|
2009-11-04 09:10:50 +01:00
|
|
|
|
|
|
|
ncalrpc_status = RpcServerUseProtseqEp(ncalrpc, 0, guid, NULL);
|
|
|
|
ok(ncalrpc_status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", ncalrpc_status);
|
|
|
|
|
2008-05-07 12:11:09 +02:00
|
|
|
np_status = RpcServerUseProtseqEp(np, 0, pipe, NULL);
|
2008-08-28 08:23:24 +02:00
|
|
|
if (np_status == RPC_S_PROTSEQ_NOT_SUPPORTED)
|
|
|
|
skip("Protocol sequence ncacn_np is not supported\n");
|
|
|
|
else
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(np_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", np_status);
|
2007-04-26 03:18:29 +02:00
|
|
|
|
2008-06-09 23:36:43 +02:00
|
|
|
if (pRpcServerRegisterIfEx)
|
|
|
|
{
|
|
|
|
trace("Using RpcServerRegisterIfEx\n");
|
|
|
|
status = pRpcServerRegisterIfEx(s_IServer_v0_0_s_ifspec, NULL, NULL,
|
|
|
|
RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,
|
|
|
|
RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
status = RpcServerRegisterIf(s_IServer_v0_0_s_ifspec, NULL, NULL);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
|
2008-05-07 12:11:09 +02:00
|
|
|
status = RpcServerListen(1, 20, TRUE);
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
|
2007-04-26 03:18:29 +02:00
|
|
|
stop_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
2008-05-07 12:11:09 +02:00
|
|
|
ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
|
2007-04-26 03:18:29 +02:00
|
|
|
|
2008-05-07 12:11:09 +02:00
|
|
|
if (iptcp_status == RPC_S_OK)
|
|
|
|
run_client("tcp_basic");
|
|
|
|
else
|
2009-12-14 11:54:36 +01:00
|
|
|
skip("tcp tests skipped due to earlier failure\n");
|
2009-11-04 09:10:50 +01:00
|
|
|
|
|
|
|
if (ncalrpc_status == RPC_S_OK)
|
2009-12-14 11:54:36 +01:00
|
|
|
{
|
2009-11-04 09:10:50 +01:00
|
|
|
run_client("ncalrpc_basic");
|
2009-12-14 11:54:36 +01:00
|
|
|
if (pGetUserNameExA)
|
|
|
|
{
|
|
|
|
/* we don't need to register RPC_C_AUTHN_WINNT for ncalrpc */
|
|
|
|
run_client("ncalrpc_secure");
|
|
|
|
}
|
|
|
|
}
|
2009-11-04 09:10:50 +01:00
|
|
|
else
|
2009-12-14 11:54:36 +01:00
|
|
|
skip("lrpc tests skipped due to earlier failure\n");
|
2007-04-26 03:18:29 +02:00
|
|
|
|
2008-05-07 12:11:09 +02:00
|
|
|
if (np_status == RPC_S_OK)
|
|
|
|
run_client("np_basic");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
skip("np_basic tests skipped due to earlier failure\n");
|
|
|
|
/* np client is what signals stop_event, so bail out if we didn't run do it */
|
|
|
|
return;
|
|
|
|
}
|
2007-04-26 03:18:29 +02:00
|
|
|
|
2008-06-14 17:42:32 +02:00
|
|
|
ret = WaitForSingleObject(stop_event, 1000);
|
|
|
|
ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
|
|
|
|
/* if the stop event didn't fire then RpcMgmtWaitServerListen will wait
|
|
|
|
* forever, so don't bother calling it in this case */
|
|
|
|
if (ret == WAIT_OBJECT_0)
|
|
|
|
{
|
|
|
|
status = RpcMgmtWaitServerListen();
|
|
|
|
todo_wine {
|
2009-01-04 01:49:14 +01:00
|
|
|
ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
|
2008-06-14 17:42:32 +02:00
|
|
|
}
|
2007-04-26 03:18:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
START_TEST(server)
|
|
|
|
{
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
|
2008-02-28 12:30:36 +01:00
|
|
|
InitFunctionPointers();
|
|
|
|
|
2009-12-14 11:54:36 +01:00
|
|
|
if (pGetUserNameExA)
|
|
|
|
{
|
|
|
|
ULONG size = 0;
|
|
|
|
ok(!pGetUserNameExA(NameSamCompatible, NULL, &size), "GetUserNameExA\n");
|
|
|
|
domain_and_user = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
ok(pGetUserNameExA(NameSamCompatible, domain_and_user, &size), "GetUserNameExA\n");
|
|
|
|
}
|
2009-12-16 09:00:30 +01:00
|
|
|
else
|
|
|
|
win_skip("GetUserNameExA is needed for some authentication tests\n");
|
2009-12-14 11:54:36 +01:00
|
|
|
|
2007-04-26 03:18:29 +02:00
|
|
|
argc = winetest_get_mainargs(&argv);
|
|
|
|
progname = argv[0];
|
|
|
|
|
|
|
|
if (argc == 3)
|
2007-06-26 03:25:57 +02:00
|
|
|
{
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
|
|
|
client(argv[2]);
|
|
|
|
}
|
|
|
|
RpcExcept(TRUE)
|
|
|
|
{
|
|
|
|
trace("Exception %d\n", RpcExceptionCode());
|
|
|
|
}
|
|
|
|
RpcEndExcept
|
|
|
|
}
|
2007-04-26 03:18:29 +02:00
|
|
|
else
|
|
|
|
server();
|
2009-12-14 11:54:36 +01:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, domain_and_user);
|
2007-04-26 03:18:29 +02:00
|
|
|
}
|