From 6fe216642a1003a2fda2b8332199ff84c8712984 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 12 Aug 2010 09:31:38 +0200 Subject: [PATCH] testprogs/midltests: add some example IDL files and there midltests.exe output metze --- testprogs/win32/midltests/invalid/README.txt | 3 ++ testprogs/win32/midltests/midltests.idl | 2 +- testprogs/win32/midltests/valid/README.txt | 6 +++ .../midltests_fixed_size_in_array_01.idl | 29 ++++++++++++ .../midltests_fixed_size_in_array_01.txt | 6 +++ .../valid/midltests_strings_array_01.err.txt | 13 ++++++ .../valid/midltests_strings_array_01.idl | 44 +++++++++++++++++++ .../valid/midltests_strings_array_02.idl | 44 +++++++++++++++++++ .../valid/midltests_strings_array_02.txt | 9 ++++ .../valid/midltests_union_align_01.idl | 42 ++++++++++++++++++ .../valid/midltests_union_align_01.txt | 24 ++++++++++ 11 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 testprogs/win32/midltests/invalid/README.txt create mode 100644 testprogs/win32/midltests/valid/README.txt create mode 100644 testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl create mode 100644 testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt create mode 100644 testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt create mode 100644 testprogs/win32/midltests/valid/midltests_strings_array_01.idl create mode 100644 testprogs/win32/midltests/valid/midltests_strings_array_02.idl create mode 100644 testprogs/win32/midltests/valid/midltests_strings_array_02.txt create mode 100644 testprogs/win32/midltests/valid/midltests_union_align_01.idl create mode 100644 testprogs/win32/midltests/valid/midltests_union_align_01.txt diff --git a/testprogs/win32/midltests/invalid/README.txt b/testprogs/win32/midltests/invalid/README.txt new file mode 100644 index 00000000000..f10cc1574ce --- /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 1932549c565..b3276574969 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 00000000000..9208faeaf60 --- /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 00000000000..170b1479533 --- /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 00000000000..8903c4cf891 --- /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 00000000000..dbbc89af518 --- /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 00000000000..db05bb27359 --- /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 00000000000..46154c967a5 --- /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 00000000000..2bec6a04021 --- /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 00000000000..fcea0729b0e --- /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 00000000000..a7f737c1f86 --- /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 -- 2.34.1