summaryrefslogtreecommitdiff
path: root/testprogs/win32/midltests/valid/midltests_union_align_09.idl
blob: 358a5983df73995fed3e2b818d32ef493d5f3349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef MIDLTESTS_C_CODE

/*
 * For midltests_tcp.exe you may want to
 * redirect the traffic via rinetd
 * with a /etc/rinetd.conf like this:
 *
 * 172.31.9.1 5032 172.31.9.8 5032
 * 172.31.9.1 5064 172.31.9.8 5064
 *
 * This is useful to watch the traffic with
 * a network sniffer.
 */
/*
cpp_quote("#define LISTEN_IP \"0.0.0.0\"")
cpp_quote("#define FORWARD_IP \"127.0.0.1\"")
cpp_quote("#define CONNECT_IP \"172.31.9.1\"")
*/

/*
 * With midltests_tcp.exe NDR64 is enforced by default.
 * For testing it might be needed to allow downgrades
 * to NDR32. This is needed when you use 'pipe'.
 */
//cpp_quote("#define DONOT_FORCE_NDR64 1")

[
  uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
  ms_union,
  pointer_default(unique)
]
interface midltests
{
	[switch_type(char)] union u {
		[case(0)];
		[case(1)] char c;
		[case(2)] short s;
		[case(4)] long l;
		[case(8)] hyper h;
	};

	long midltests_fn(
		[in] char level,
		[in,switch_is(level)] union u u
	);
}

#elif MIDLTESTS_C_CODE

static void midltests(void)
{
	union u u;
	u.h = 0xFFFFFFFFFFFFFFFFLL;

	cli_midltests_fn(0, u);
	cli_midltests_fn(1, u);
	cli_midltests_fn(2, u);
	cli_midltests_fn(4, u);
	cli_midltests_fn(8, u);
}

long srv_midltests_fn(char level, union u u)
{
	printf("srv_midltests_fn: Start\n");
	printf("srv_midltests_fn: End\n");
	return 0x65757254;
}

#endif