--- /dev/null
+This directory contains IDL files which give errors,
+when they're compiled as midltests.idl.
+
return 0x65757254;
}
-#endif
\ No newline at end of file
+#endif
--- /dev/null
+This directory contains IDL files which demonstrate
+the relationship between IDL definitions and NDR representation.
+
+In order to test them, you can compile them as midltests.idl.
+
+Note: some examples trigger runtime errors.
--- /dev/null
+#ifndef MIDLTESTS_C_CODE
+
+[
+ uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+ pointer_default(unique)
+]
+interface midltests
+{
+ long midltests_fn(
+ [in] long a[2]
+ );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+ long a[2] = { 1, 2 };
+ cli_midltests_fn(a);
+}
+
+long srv_midltests_fn(long a[2])
+{
+ printf("srv_midltests_fn: Start\n");
+ printf("srv_midltests_fn: End\n");
+ return 0x65757254;
+}
+
+#endif
--- /dev/null
+[in] Buffer[8/24]\r
+[000] 01 00 00 00 02 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
--- /dev/null
+[in] Buffer[53/53]\r
+[000] 03 00 00 00 03 00 00 00 00 00 02 00 04 00 02 00 ........ ........\r
+[010] 00 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 ........ ........\r
+[020] 66 6F 6F 00 05 00 00 00 00 00 00 00 05 00 00 00 foo..... ........\r
+[030] 62 61 72 32 00 bar2. \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[60]\r
+[000] 03 00 00 00 03 00 00 00 00 00 02 00 04 00 02 00 ........ ........\r
+[010] 00 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 ........ ........\r
+[020] 66 6F 6F 00 05 00 00 00 00 00 00 00 05 00 00 00 foo..... ........\r
+[030] 62 61 72 32 00 00 00 00 54 72 75 65 bar2.... True\r
+Runtime error 0x6f7\r
--- /dev/null
+#ifndef MIDLTESTS_C_CODE
+
+[
+ uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+ pointer_default(unique)
+]
+interface midltests
+{
+ struct strings {
+ long count;
+ [size_is(count),string] char *val[];
+ };
+
+ long midltests_fn(
+ [in,out,ref] struct strings *s
+ );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+ const char *s1 = "foo";
+ const char *s2 = "bar";
+ char *a[] = { "foo", "bar2", NULL };
+ char buffer[1024];
+ struct strings *s = buffer;
+
+ s->count = 3;
+ s->val[0] = "foo";
+ s->val[1] = "bar2";
+ s->val[2] = NULL;
+
+ cli_midltests_fn(s);
+}
+
+long srv_midltests_fn(struct strings *a)
+{
+ printf("srv_midltests_fn: Start\n");
+ printf("srv_midltests_fn: End\n");
+ return 0x65757254;
+}
+
+#endif
--- /dev/null
+#ifndef MIDLTESTS_C_CODE
+
+[
+ uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+ pointer_default(unique)
+]
+interface midltests
+{
+ struct strings {
+ long count;
+ [size_is(count),string] char *val[];
+ };
+
+ long midltests_fn(
+ [in,ref] struct strings *s
+ );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+ const char *s1 = "foo";
+ const char *s2 = "bar";
+ char *a[] = { "foo", "bar2", NULL };
+ char buffer[1024];
+ struct strings *s = buffer;
+
+ s->count = 3;
+ s->val[0] = "foo";
+ s->val[1] = "bar2";
+ s->val[2] = NULL;
+
+ cli_midltests_fn(s);
+}
+
+long srv_midltests_fn(struct strings *a)
+{
+ printf("srv_midltests_fn: Start\n");
+ printf("srv_midltests_fn: End\n");
+ return 0x65757254;
+}
+
+#endif
--- /dev/null
+[in] Buffer[53/53]\r
+[000] 03 00 00 00 03 00 00 00 00 00 02 00 04 00 02 00 ........ ........\r
+[010] 00 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 ........ ........\r
+[020] 66 6F 6F 00 05 00 00 00 00 00 00 00 05 00 00 00 foo..... ........\r
+[030] 62 61 72 32 00 bar2. \r
+srv_midltests_fn: Start\r
+srv_midltests_fn: End\r
+[out] Buffer[4]\r
+[000] 54 72 75 65 True \r
--- /dev/null
+#ifndef MIDLTESTS_C_CODE
+
+[
+ uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+ pointer_default(unique)
+]
+interface midltests
+{
+ [switch_type(short)] union u {
+ [case(0)];
+ [case(2)] short s;
+ [case(4)] long l;
+ [case(8)] hyper h;
+ };
+
+ long midltests_fn(
+ [in] short 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(2, u);
+ cli_midltests_fn(4, u);
+ cli_midltests_fn(8, u);
+}
+
+long srv_midltests_fn(short level, union u u)
+{
+ printf("srv_midltests_fn: Start\n");
+ printf("srv_midltests_fn: End\n");
+ return 0x65757254;
+}
+
+#endif
--- /dev/null
+[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