midltests: add more union_align examples
authorStefan Metzmacher <metze@samba.org>
Sun, 24 Oct 2010 16:54:46 +0000 (18:54 +0200)
committerStefan Metzmacher <metze@samba.org>
Sun, 24 Oct 2010 17:04:08 +0000 (19:04 +0200)
This demonstrates the difference between NDR32 and NDR64

metze

15 files changed:
testprogs/win32/midltests/valid/midltests_union_align_01.txt
testprogs/win32/midltests/valid/midltests_union_align_02.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_02.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_03.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_03.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_04.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_04.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_05.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_05.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_06.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_06.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_07.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_07.txt [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_08.idl [new file with mode: 0644]
testprogs/win32/midltests/valid/midltests_union_align_08.txt [new file with mode: 0644]

index a7f737c1f864c63e08ad28281a9ca004028ddfc2..cc372c8134782808de149e78344dc90ee065d539 100644 (file)
@@ -1,24 +1,24 @@
-[in] Buffer[4/8]\r
-[000] 00 00 00 00                                       .... \r
-srv_midltests_fn: Start\r
-srv_midltests_fn: End\r
-[out] Buffer[4]\r
-[000] 54 72 75 65                                       True \r
-[in] Buffer[6/10]\r
-[000] 02 00 02 00 FF FF                                 ...... \r
-srv_midltests_fn: Start\r
-srv_midltests_fn: End\r
-[out] Buffer[4]\r
-[000] 54 72 75 65                                       True \r
-[in] Buffer[8/12]\r
-[000] 04 00 04 00 FF FF FF FF                           ........ \r
-srv_midltests_fn: Start\r
-srv_midltests_fn: End\r
-[out] Buffer[4]\r
-[000] 54 72 75 65                                       True \r
-[in] Buffer[16/16]\r
-[000] 08 00 08 00 00 00 00 00  FF FF FF FF FF FF FF FF  ........ ........\r
-srv_midltests_fn: Start\r
-srv_midltests_fn: End\r
-[out] Buffer[4]\r
-[000] 54 72 75 65                                       True \r
+[in] Buffer[4/8]
+[000] 00 00 00 00                                       .... 
+srv_midltests_fn: Start
+srv_midltests_fn: End
+[out] Buffer[4]
+[000] 54 72 75 65                                       True 
+[in] Buffer[6/10]
+[000] 02 00 02 00 FF FF                                 ...... 
+srv_midltests_fn: Start
+srv_midltests_fn: End
+[out] Buffer[4]
+[000] 54 72 75 65                                       True 
+[in] Buffer[8/12]
+[000] 04 00 04 00 FF FF FF FF                           ........ 
+srv_midltests_fn: Start
+srv_midltests_fn: End
+[out] Buffer[4]
+[000] 54 72 75 65                                       True 
+[in] Buffer[16/16]
+[000] 08 00 08 00 00 00 00 00  FF FF FF FF FF FF FF FF  ........ ........
+srv_midltests_fn: Start
+srv_midltests_fn: End
+[out] Buffer[4]
+[000] 54 72 75 65                                       True 
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_02.idl b/testprogs/win32/midltests/valid/midltests_union_align_02.idl
new file mode 100644 (file)
index 0000000..dc2d84d
--- /dev/null
@@ -0,0 +1,61 @@
+#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
+{
+       typedef [switch_type(char)] union {
+               [case(1)] char c;
+       } u;
+       long midltests_fn(
+               [in] char l,
+               [in,switch_is(l)] u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       char l;
+       u u;
+
+       l = 1;
+       u.c = 'A';
+       cli_midltests_fn(l,u);
+}
+
+long srv_midltests_fn(char l, u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_02.txt b/testprogs/win32/midltests/valid/midltests_union_align_02.txt
new file mode 100644 (file)
index 0000000..16186ea
--- /dev/null
@@ -0,0 +1,37 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[27] plen[3] ahint[3]
+
+[000] 01 01 41                                          ..A 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[27] plen[3] ahint[3]
+
+[000] 01 01 41                                          ..A 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_03.idl b/testprogs/win32/midltests/valid/midltests_union_align_03.idl
new file mode 100644 (file)
index 0000000..699dd6c
--- /dev/null
@@ -0,0 +1,64 @@
+#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
+{
+       typedef [switch_type(short)] union {
+               [case(1)] char c;
+       } u;
+       long midltests_fn(
+               [in] short l,
+               [in] char v,
+               [in,switch_is(l)] u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       short l;
+       char v;
+       u u;
+
+       l = 1;
+       v = 'V';
+       u.c = 'C';
+       cli_midltests_fn(l, v, u);
+}
+
+long srv_midltests_fn(short l, char v, u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_03.txt b/testprogs/win32/midltests/valid/midltests_union_align_03.txt
new file mode 100644 (file)
index 0000000..7078dd3
--- /dev/null
@@ -0,0 +1,37 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[31] plen[7] ahint[7]
+
+[000] 01 00 56 00 01 00 43                              ..V...C 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[31] plen[7] ahint[7]
+
+[000] 01 00 56 00 01 00 43                              ..V...C 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_04.idl b/testprogs/win32/midltests/valid/midltests_union_align_04.idl
new file mode 100644 (file)
index 0000000..a7c6ad7
--- /dev/null
@@ -0,0 +1,64 @@
+#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
+{
+       typedef [switch_type(long)] union {
+               [case(1)] char c;
+       } u;
+       long midltests_fn(
+               [in] long l,
+               [in] char v,
+               [in,switch_is(l)] u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       long l;
+       char v;
+       u u;
+
+       l = 1;
+       v = 'V';
+       u.c = 'C';
+       cli_midltests_fn(l, v, u);
+}
+
+long srv_midltests_fn(long l, char v, u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_04.txt b/testprogs/win32/midltests/valid/midltests_union_align_04.txt
new file mode 100644 (file)
index 0000000..d323860
--- /dev/null
@@ -0,0 +1,37 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[37] plen[13] ahint[13]
+
+[000] 01 00 00 00 56 00 00 00  01 00 00 00 43           ....V... ....C
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[37] plen[13] ahint[13]
+
+[000] 01 00 00 00 56 00 00 00  01 00 00 00 43           ....V... ....C
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_05.idl b/testprogs/win32/midltests/valid/midltests_union_align_05.idl
new file mode 100644 (file)
index 0000000..da46bab
--- /dev/null
@@ -0,0 +1,61 @@
+#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
+{
+       typedef [switch_type(char)] union {
+               [case(1)] short c;
+       } u;
+       long midltests_fn(
+               [in] char l,
+               [in,switch_is(l)] u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       char l;
+       u u;
+
+       l = 1;
+       u.c = 'C';
+       cli_midltests_fn(l, u);
+}
+
+long srv_midltests_fn(hyper l, u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_05.txt b/testprogs/win32/midltests/valid/midltests_union_align_05.txt
new file mode 100644 (file)
index 0000000..1938b0a
--- /dev/null
@@ -0,0 +1,37 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[28] plen[4] ahint[4]
+
+[000] 01 01 43 00                                       ..C. 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[30] plen[6] ahint[6]
+
+[000] 01 00 01 00 43 00                                 ....C. 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_06.idl b/testprogs/win32/midltests/valid/midltests_union_align_06.idl
new file mode 100644 (file)
index 0000000..63fb310
--- /dev/null
@@ -0,0 +1,61 @@
+#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
+{
+       typedef [switch_type(char)] union {
+               [case(1)] long c;
+       } u;
+       long midltests_fn(
+               [in] char l,
+               [in,switch_is(l)] u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       char l;
+       u u;
+
+       l = 1;
+       u.c = 'C';
+       cli_midltests_fn(l, u);
+}
+
+long srv_midltests_fn(hyper l, u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_06.txt b/testprogs/win32/midltests/valid/midltests_union_align_06.txt
new file mode 100644 (file)
index 0000000..c864e51
--- /dev/null
@@ -0,0 +1,37 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[32] plen[8] ahint[8]
+
+[000] 01 01 00 00 43 00 00 00                           ....C... 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[36] plen[12] ahint[12]
+
+[000] 01 00 00 00 01 00 00 00  43 00 00 00              ........ C...
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_07.idl b/testprogs/win32/midltests/valid/midltests_union_align_07.idl
new file mode 100644 (file)
index 0000000..892460d
--- /dev/null
@@ -0,0 +1,61 @@
+#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
+{
+       typedef [switch_type(char)] union {
+               [case(1)] hyper c;
+       } u;
+       long midltests_fn(
+               [in] char l,
+               [in,switch_is(l)] u u
+       );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+       char l;
+       u u;
+
+       l = 1;
+       u.c = 'C';
+       cli_midltests_fn(l, u);
+}
+
+long srv_midltests_fn(hyper l, u u)
+{
+       printf("srv_midltests_fn: Start\n");
+       printf("srv_midltests_fn: End\n");
+       return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_07.txt b/testprogs/win32/midltests/valid/midltests_union_align_07.txt
new file mode 100644 (file)
index 0000000..88b44ec
--- /dev/null
@@ -0,0 +1,38 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[40] plen[16] ahint[16]
+
+[000] 01 01 00 00 00 00 00 00  43 00 00 00 00 00 00 00  ........ C.......
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[48] plen[24] ahint[24]
+
+[000] 01 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  ........ ........
+[010] 43 00 00 00 00 00 00 00                           C....... 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_08.idl b/testprogs/win32/midltests/valid/midltests_union_align_08.idl
new file mode 100644 (file)
index 0000000..0cbdbfe
--- /dev/null
@@ -0,0 +1,68 @@
+#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
+{
+       [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
diff --git a/testprogs/win32/midltests/valid/midltests_union_align_08.txt b/testprogs/win32/midltests/valid/midltests_union_align_08.txt
new file mode 100644 (file)
index 0000000..1bf5cd9
--- /dev/null
@@ -0,0 +1,129 @@
+Wait for setup of server threads
+
+Test NDR32
+
+ndr32: disable NDR64
+
+ndr32:in => out: ptype[request] flen[26] plen[2] ahint[2]
+
+[000] 00 00                                             .. 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr32:in => out: ptype[request] flen[27] plen[3] ahint[3]
+
+[000] 01 01 FF                                          ... 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr32:in => out: ptype[request] flen[28] plen[4] ahint[4]
+
+[000] 02 02 FF FF                                       .... 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr32:in => out: ptype[request] flen[32] plen[8] ahint[8]
+
+[000] 04 04 00 00 FF FF FF FF                           ........ 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr32:in => out: ptype[request] flen[40] plen[16] ahint[16]
+
+[000] 08 08 00 00 00 00 00 00  FF FF FF FF FF FF FF FF  ........ ........
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr32:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr32] stop
+
+Test NDR64
+
+ndr64: got NDR64
+
+ndr64:in => out: ptype[request] flen[40] plen[16] ahint[16]
+
+[000] 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ........ ........
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr64:in => out: ptype[request] flen[41] plen[17] ahint[17]
+
+[000] 01 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  ........ ........
+[010] FF                                                . 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr64:in => out: ptype[request] flen[42] plen[18] ahint[18]
+
+[000] 02 00 00 00 00 00 00 00  02 00 00 00 00 00 00 00  ........ ........
+[010] FF FF                                             .. 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr64:in => out: ptype[request] flen[44] plen[20] ahint[20]
+
+[000] 04 00 00 00 00 00 00 00  04 00 00 00 00 00 00 00  ........ ........
+[010] FF FF FF FF                                       .... 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+ndr64:in => out: ptype[request] flen[48] plen[24] ahint[24]
+
+[000] 08 00 00 00 00 00 00 00  08 00 00 00 00 00 00 00  ........ ........
+[010] FF FF FF FF FF FF FF FF                           ........ 
+
+srv_midltests_fn: Start
+srv_midltests_fn: End
+
+ndr64:out => in: ptype[response] flen[28] plen[4] ahint[4]
+
+[000] 54 72 75 65                                       True 
+
+NDRTcpThread[ndr64] stop
+
+Test OK