diff options
Diffstat (limited to 'testprogs/win32/midltests')
11 files changed, 221 insertions, 1 deletions
diff --git a/testprogs/win32/midltests/invalid/README.txt b/testprogs/win32/midltests/invalid/README.txt new file mode 100644 index 0000000000..f10cc1574c --- /dev/null +++ b/testprogs/win32/midltests/invalid/README.txt @@ -0,0 +1,3 @@ +This directory contains IDL files which give errors, +when they're compiled as midltests.idl. + diff --git a/testprogs/win32/midltests/midltests.idl b/testprogs/win32/midltests/midltests.idl index 1932549c56..b327657496 100644 --- a/testprogs/win32/midltests/midltests.idl +++ b/testprogs/win32/midltests/midltests.idl @@ -24,4 +24,4 @@ long srv_midltests_fn(void) return 0x65757254; } -#endif
\ No newline at end of file +#endif diff --git a/testprogs/win32/midltests/valid/README.txt b/testprogs/win32/midltests/valid/README.txt new file mode 100644 index 0000000000..9208faeaf6 --- /dev/null +++ b/testprogs/win32/midltests/valid/README.txt @@ -0,0 +1,6 @@ +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. diff --git a/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl b/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl new file mode 100644 index 0000000000..170b147953 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl @@ -0,0 +1,29 @@ +#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 diff --git a/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt b/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt new file mode 100644 index 0000000000..8903c4cf89 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt @@ -0,0 +1,6 @@ +[in] Buffer[8/24]
+[000] 01 00 00 00 02 00 00 00 ........
+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_strings_array_01.err.txt b/testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt new file mode 100644 index 0000000000..dbbc89af51 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt @@ -0,0 +1,13 @@ +[in] Buffer[53/53]
+[000] 03 00 00 00 03 00 00 00 00 00 02 00 04 00 02 00 ........ ........
+[010] 00 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 ........ ........
+[020] 66 6F 6F 00 05 00 00 00 00 00 00 00 05 00 00 00 foo..... ........
+[030] 62 61 72 32 00 bar2.
+srv_midltests_fn: Start
+srv_midltests_fn: End
+[out] Buffer[60]
+[000] 03 00 00 00 03 00 00 00 00 00 02 00 04 00 02 00 ........ ........
+[010] 00 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 ........ ........
+[020] 66 6F 6F 00 05 00 00 00 00 00 00 00 05 00 00 00 foo..... ........
+[030] 62 61 72 32 00 00 00 00 54 72 75 65 bar2.... True
+Runtime error 0x6f7
diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_01.idl b/testprogs/win32/midltests/valid/midltests_strings_array_01.idl new file mode 100644 index 0000000000..db05bb2735 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_strings_array_01.idl @@ -0,0 +1,44 @@ +#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 diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_02.idl b/testprogs/win32/midltests/valid/midltests_strings_array_02.idl new file mode 100644 index 0000000000..46154c967a --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_strings_array_02.idl @@ -0,0 +1,44 @@ +#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 diff --git a/testprogs/win32/midltests/valid/midltests_strings_array_02.txt b/testprogs/win32/midltests/valid/midltests_strings_array_02.txt new file mode 100644 index 0000000000..2bec6a0402 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_strings_array_02.txt @@ -0,0 +1,9 @@ +[in] Buffer[53/53]
+[000] 03 00 00 00 03 00 00 00 00 00 02 00 04 00 02 00 ........ ........
+[010] 00 00 00 00 04 00 00 00 00 00 00 00 04 00 00 00 ........ ........
+[020] 66 6F 6F 00 05 00 00 00 00 00 00 00 05 00 00 00 foo..... ........
+[030] 62 61 72 32 00 bar2.
+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_01.idl b/testprogs/win32/midltests/valid/midltests_union_align_01.idl new file mode 100644 index 0000000000..fcea0729b0 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_union_align_01.idl @@ -0,0 +1,42 @@ +#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 diff --git a/testprogs/win32/midltests/valid/midltests_union_align_01.txt b/testprogs/win32/midltests/valid/midltests_union_align_01.txt new file mode 100644 index 0000000000..a7f737c1f8 --- /dev/null +++ b/testprogs/win32/midltests/valid/midltests_union_align_01.txt @@ -0,0 +1,24 @@ +[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
|