From 1f2f7fda830c46cd6856ec5d8e52e9a28804e6ea Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 31 Jan 2011 11:50:01 +0100 Subject: midltests: unions with enum vs. long metze --- .../midltests/valid/midltests_union_align_11.idl | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 testprogs/win32/midltests/valid/midltests_union_align_11.idl (limited to 'testprogs/win32/midltests/valid/midltests_union_align_11.idl') diff --git a/testprogs/win32/midltests/valid/midltests_union_align_11.idl b/testprogs/win32/midltests/valid/midltests_union_align_11.idl new file mode 100644 index 0000000000..1036abe9d6 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_union_align_11.idl @@ -0,0 +1,70 @@ +#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"), + pointer_default(unique) +] +interface midltests +{ + enum level_enum { ZERO = 0, ONE = 1, TWO = 2, FOUR = 4, EIGHT = 8 }; + + [switch_type(long)] union u { + [case(ZERO)]; + [case(ONE)] char c; + [case(TWO)] short s; + [case(FOUR)] long l; + [case(EIGHT)] hyper h; + }; + + long midltests_fn( + [in] enum level_enum 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(ZERO, u); + cli_midltests_fn(ONE, u); + cli_midltests_fn(TWO, u); + cli_midltests_fn(FOUR, u); + cli_midltests_fn(EIGHT, 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 -- cgit