Ejemplo n.º 1
0
    public static int Main()
    {
        bool isWindows = !(((int)Environment.OSVersion.Platform == 4) ||
                           ((int)Environment.OSVersion.Platform == 128));

        if (mono_cominterop_is_supported() || isWindows)
        {
            #region BSTR Tests

            string str;
            if (mono_test_marshal_bstr_in("mono_test_marshal_bstr_in") != 0)
            {
                return(1);
            }
            if (mono_test_marshal_bstr_out(out str) != 0 || str != "mono_test_marshal_bstr_out")
            {
                return(2);
            }
            if (mono_test_marshal_bstr_in_null(null) != 0)
            {
                return(1);
            }
            if (mono_test_marshal_bstr_out_null(out str) != 0 || str != null)
            {
                return(2);
            }

            #endregion             // BSTR Tests

            #region VARIANT Tests

            object obj;
            if (mono_test_marshal_variant_in_sbyte((sbyte)100) != 0)
            {
                return(13);
            }
            if (mono_test_marshal_variant_in_byte((byte)100) != 0)
            {
                return(14);
            }
            if (mono_test_marshal_variant_in_short((short)314) != 0)
            {
                return(15);
            }
            if (mono_test_marshal_variant_in_ushort((ushort)314) != 0)
            {
                return(16);
            }
            if (mono_test_marshal_variant_in_int((int)314) != 0)
            {
                return(17);
            }
            if (mono_test_marshal_variant_in_uint((uint)314) != 0)
            {
                return(18);
            }
            if (mono_test_marshal_variant_in_long((long)314) != 0)
            {
                return(19);
            }
            if (mono_test_marshal_variant_in_ulong((ulong)314) != 0)
            {
                return(20);
            }
            if (mono_test_marshal_variant_in_float((float)3.14) != 0)
            {
                return(21);
            }
            if (mono_test_marshal_variant_in_double((double)3.14) != 0)
            {
                return(22);
            }
            if (mono_test_marshal_variant_in_bstr("PI") != 0)
            {
                return(23);
            }
            if (mono_test_marshal_variant_out_sbyte(out obj) != 0 || (sbyte)obj != 100)
            {
                return(24);
            }
            if (mono_test_marshal_variant_out_byte(out obj) != 0 || (byte)obj != 100)
            {
                return(25);
            }
            if (mono_test_marshal_variant_out_short(out obj) != 0 || (short)obj != 314)
            {
                return(26);
            }
            if (mono_test_marshal_variant_out_ushort(out obj) != 0 || (ushort)obj != 314)
            {
                return(27);
            }
            if (mono_test_marshal_variant_out_int(out obj) != 0 || (int)obj != 314)
            {
                return(28);
            }
            if (mono_test_marshal_variant_out_uint(out obj) != 0 || (uint)obj != 314)
            {
                return(29);
            }
            if (mono_test_marshal_variant_out_long(out obj) != 0 || (long)obj != 314)
            {
                return(30);
            }
            if (mono_test_marshal_variant_out_ulong(out obj) != 0 || (ulong)obj != 314)
            {
                return(31);
            }
            if (mono_test_marshal_variant_out_float(out obj) != 0 || ((float)obj - 3.14) / 3.14 > .001)
            {
                return(32);
            }
            if (mono_test_marshal_variant_out_double(out obj) != 0 || ((double)obj - 3.14) / 3.14 > .001)
            {
                return(33);
            }
            if (mono_test_marshal_variant_out_bstr(out obj) != 0 || (string)obj != "PI")
            {
                return(34);
            }

            VarFunc func = new VarFunc(mono_test_marshal_variant_in_callback);
            if (mono_test_marshal_variant_in_sbyte_unmanaged(func) != 0)
            {
                return(35);
            }
            if (mono_test_marshal_variant_in_byte_unmanaged(func) != 0)
            {
                return(36);
            }
            if (mono_test_marshal_variant_in_short_unmanaged(func) != 0)
            {
                return(37);
            }
            if (mono_test_marshal_variant_in_ushort_unmanaged(func) != 0)
            {
                return(38);
            }
            if (mono_test_marshal_variant_in_int_unmanaged(func) != 0)
            {
                return(39);
            }
            if (mono_test_marshal_variant_in_uint_unmanaged(func) != 0)
            {
                return(40);
            }
            if (mono_test_marshal_variant_in_long_unmanaged(func) != 0)
            {
                return(41);
            }
            if (mono_test_marshal_variant_in_ulong_unmanaged(func) != 0)
            {
                return(42);
            }
            if (mono_test_marshal_variant_in_float_unmanaged(func) != 0)
            {
                return(43);
            }
            if (mono_test_marshal_variant_in_double_unmanaged(func) != 0)
            {
                return(44);
            }
            if (mono_test_marshal_variant_in_bstr_unmanaged(func) != 0)
            {
                return(45);
            }
            if (mono_test_marshal_variant_in_bool_true_unmanaged(func) != 0)
            {
                return(46);
            }

            VarRefFunc reffunc = new VarRefFunc(mono_test_marshal_variant_out_callback);
            if (mono_test_marshal_variant_out_sbyte_unmanaged(reffunc) != 0)
            {
                return(50);
            }
            if (mono_test_marshal_variant_out_byte_unmanaged(reffunc) != 0)
            {
                return(51);
            }
            if (mono_test_marshal_variant_out_short_unmanaged(reffunc) != 0)
            {
                return(52);
            }
            if (mono_test_marshal_variant_out_ushort_unmanaged(reffunc) != 0)
            {
                return(53);
            }
            if (mono_test_marshal_variant_out_int_unmanaged(reffunc) != 0)
            {
                return(54);
            }
            if (mono_test_marshal_variant_out_uint_unmanaged(reffunc) != 0)
            {
                return(55);
            }
            if (mono_test_marshal_variant_out_long_unmanaged(reffunc) != 0)
            {
                return(56);
            }
            if (mono_test_marshal_variant_out_ulong_unmanaged(reffunc) != 0)
            {
                return(57);
            }
            if (mono_test_marshal_variant_out_float_unmanaged(reffunc) != 0)
            {
                return(58);
            }
            if (mono_test_marshal_variant_out_double_unmanaged(reffunc) != 0)
            {
                return(59);
            }
            if (mono_test_marshal_variant_out_bstr_unmanaged(reffunc) != 0)
            {
                return(60);
            }
            if (mono_test_marshal_variant_out_bool_true_unmanaged(reffunc) != 0)
            {
                return(61);
            }

            #endregion             // VARIANT Tests

            #region Runtime Callable Wrapper Tests

            IntPtr pUnk;
            if (mono_test_marshal_com_object_create(out pUnk) != 0)
            {
                return(145);
            }

            if (mono_test_marshal_com_object_ref_count(pUnk) != 1)
            {
                return(146);
            }

            if (Marshal.AddRef(pUnk) != 2)
            {
                return(147);
            }

            if (mono_test_marshal_com_object_ref_count(pUnk) != 2)
            {
                return(148);
            }

            if (Marshal.Release(pUnk) != 1)
            {
                return(149);
            }

            if (mono_test_marshal_com_object_ref_count(pUnk) != 1)
            {
                return(150);
            }

            object com_obj = Marshal.GetObjectForIUnknown(pUnk);

            if (com_obj == null)
            {
                return(151);
            }

            ITest itest = com_obj as ITest;

            if (itest == null)
            {
                return(152);
            }

            IntPtr pUnk2;
            if (mono_test_marshal_com_object_same(out pUnk2) != 0)
            {
                return(153);
            }

            object com_obj2 = Marshal.GetObjectForIUnknown(pUnk2);

            if (com_obj != com_obj2)
            {
                return(154);
            }

            if (!com_obj.Equals(com_obj2))
            {
                return(155);
            }

            IntPtr pUnk3;
            if (mono_test_marshal_com_object_create(out pUnk3) != 0)
            {
                return(156);
            }

            object com_obj3 = Marshal.GetObjectForIUnknown(pUnk3);
            if (com_obj == com_obj3)
            {
                return(157);
            }

            if (com_obj.Equals(com_obj3))
            {
                return(158);
            }

            // com_obj & com_obj2 share a RCW
            if (Marshal.ReleaseComObject(com_obj2) != 1)
            {
                return(159);
            }

            // com_obj3 should only have one RCW
            if (Marshal.ReleaseComObject(com_obj3) != 0)
            {
                return(160);
            }

            IntPtr iunknown = Marshal.GetIUnknownForObject(com_obj);
            if (iunknown == IntPtr.Zero)
            {
                return(170);
            }

            if (pUnk != iunknown)
            {
                return(171);
            }

            if (TestITest(itest) != 0)
            {
                return(172);
            }

            if (TestITestPresSig(itest as ITestPresSig) != 0)
            {
                return(173);
            }

            if (TestITestDelegate(itest) != 0)
            {
                return(174);
            }

            #endregion             // Runtime Callable Wrapper Tests

            #region COM Callable Wrapper Tests

            ManagedTest test = new ManagedTest();

            mono_test_marshal_ccw_itest(test);

            if (test.Status != 0)
            {
                return(200);
            }

            ManagedTestPresSig test_pres_sig = new ManagedTestPresSig();

            mono_test_marshal_ccw_itest(test_pres_sig);

            #endregion             // COM Callable Wrapper Tests

            #region SAFEARRAY tests

            if (isWindows)
            {
                /* out */

                Array array;
                if ((mono_test_marshal_safearray_out_1dim_vt_bstr_empty(out array) != 0) || (array.Rank != 1) || (array.Length != 0))
                {
                    return(62);
                }

                if ((mono_test_marshal_safearray_out_1dim_vt_bstr(out array) != 0) || (array.Rank != 1) || (array.Length != 10))
                {
                    return(63);
                }
                for (int i = 0; i < 10; ++i)
                {
                    if (i != Convert.ToInt32(array.GetValue(i)))
                    {
                        return(64);
                    }
                }

                if ((mono_test_marshal_safearray_out_2dim_vt_i4(out array) != 0) || (array.Rank != 2))
                {
                    return(65);
                }
                if ((array.GetLowerBound(0) != 0) || (array.GetUpperBound(0) != 3) ||
                    (array.GetLowerBound(1) != 0) || (array.GetUpperBound(1) != 2))
                {
                    return(66);
                }
                for (int i = array.GetLowerBound(0); i <= array.GetUpperBound(0); ++i)
                {
                    for (int j = array.GetLowerBound(1); j <= array.GetUpperBound(1); ++j)
                    {
                        if ((i + 1) * 10 + (j + 1) != (int)array.GetValue(new long[] { i, j }))
                        {
                            return(67);
                        }
                    }
                }

                if ((mono_test_marshal_safearray_out_4dim_vt_i4(out array) != 0) || (array.Rank != 4))
                {
                    return(68);
                }
                if ((array.GetLowerBound(0) != 15) || (array.GetUpperBound(0) != 24) ||
                    (array.GetLowerBound(1) != 20) || (array.GetUpperBound(1) != 22) ||
                    (array.GetLowerBound(2) != 5) || (array.GetUpperBound(2) != 10) ||
                    (array.GetLowerBound(3) != 12) || (array.GetUpperBound(3) != 18))
                {
                    return(69);
                }

                int index = 0;
                for (int i = array.GetLowerBound(3); i <= array.GetUpperBound(3); ++i)
                {
                    for (int j = array.GetLowerBound(2); j <= array.GetUpperBound(2); ++j)
                    {
                        for (int k = array.GetLowerBound(1); k <= array.GetUpperBound(1); ++k)
                        {
                            for (int l = array.GetLowerBound(0); l <= array.GetUpperBound(0); ++l)
                            {
                                if (index != (int)array.GetValue(new long[] { l, k, j, i }))
                                {
                                    return(70);
                                }
                                ++index;
                            }
                        }
                    }
                }

                /* in */

                array = new object[] { };
                if (mono_test_marshal_safearray_in_byval_1dim_empty(array) != 0)
                {
                    return(71);
                }

                array = new object[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
                if (mono_test_marshal_safearray_in_byval_1dim_vt_i4(array) != 0)
                {
                    return(72);
                }

                array = new object[] { 0, "1", 2, "3", 4, "5", 6, "7", 8, "9", 10, "11", 12 };
                if (mono_test_marshal_safearray_in_byval_1dim_vt_mixed(array) != 0)
                {
                    return(73);
                }
                if ((int)array.GetValue(0) != 0)
                {
                    return(74);
                }

                array = new object[, ] {
                    { 11, 12, 13, 14 }, { 21, 22, 23, 24 }
                };
                if (mono_test_marshal_safearray_in_byval_2dim_vt_i4(array) != 0)
                {
                    return(75);
                }
                if ((int)array.GetValue(new int[] { 0, 0 }) != 11)
                {
                    return(76);
                }

                array = new object[, , ] {
                    { { "111", "112", "113" }, { "121", "122", "123" } }, { { "211", "212", "213" }, { "221", "222", "223" } }
                };
                if (mono_test_marshal_safearray_in_byval_3dim_vt_bstr(array) != 0)
                {
                    return(77);
                }
                if ((string)array.GetValue(new int[] { 0, 0, 0 }) != "111")
                {
                    return(78);
                }

                array = new object[, , ] {
                    { { "111", "112", "113" }, { "121", "122", "123" } }, { { "211", "212", "213" }, { "221", "222", "223" } }
                };
                if ((mono_test_marshal_safearray_in_byref_3dim_vt_bstr(ref array) != 0) || (array.Rank != 3) || (array.Length != 12))
                {
                    return(79);
                }
                if ((string)array.GetValue(new int[] { 0, 0, 0 }) != "111")
                {
                    return(80);
                }

                /* in, out, byref */

                array = new object[] { };
                if ((mono_test_marshal_safearray_in_out_byref_1dim_empty(ref array) != 0) || (array.Rank != 1) || (array.Length != 8))
                {
                    return(81);
                }
                for (int i = 0; i < 8; ++i)
                {
                    if (i != Convert.ToInt32(array.GetValue(i)))
                    {
                        return(82);
                    }
                }

                array = new object[, , ] {
                    { { "111", "112", "113" }, { "121", "122", "123" } }, { { "211", "212", "213" }, { "221", "222", "223" } }
                };
                if ((mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr(ref array) != 0) || (array.Rank != 1) || (array.Length != 8))
                {
                    return(83);
                }
                for (int i = 0; i < 8; ++i)
                {
                    if (i != Convert.ToInt32(array.GetValue(i)))
                    {
                        return(84);
                    }
                }

                array = new object[] { 1 };
                if ((mono_test_marshal_safearray_in_out_byref_1dim_vt_i4(ref array) != 0) || (array.Rank != 1) || (array.Length != 1))
                {
                    return(85);
                }
                if (Convert.ToInt32(array.GetValue(0)) != -1)
                {
                    return(86);
                }

                /* in, out, byval */

                array = new object[] { 1 };
                if ((mono_test_marshal_safearray_in_out_byval_1dim_vt_i4(array) != 0) || (array.Rank != 1) || (array.Length != 1))
                {
                    return(87);
                }
                if (Convert.ToInt32(array.GetValue(0)) != 12345)
                {
                    return(88);
                }

                array = new object[, , ] {
                    { { "111", "112", "113" }, { "121", "122", "123" } }, { { "211", "212", "213" }, { "221", "222", "223" } }
                };
                if ((mono_test_marshal_safearray_in_out_byval_3dim_vt_bstr(array) != 0) || (array.Rank != 3) || (array.Length != 12))
                {
                    return(89);
                }
                if (Convert.ToInt32(array.GetValue(new int[] { 1, 1, 1 })) != 111)
                {
                    return(90);
                }
                if (Convert.ToInt32(array.GetValue(new int[] { 1, 1, 2 })) != 333)
                {
                    return(91);
                }
                if (Convert.ToString(array.GetValue(new int[] { 0, 1, 0 })) != "ABCDEFG")
                {
                    return(92);
                }

                /* Multiple safearray parameters with various types and options */

                Array array1 = new object[] { 1 };
                Array array2 = new object[, ] {
                    { 11, 12, 13, 14 }, { 21, 22, 23, 24 }
                };
                Array array3 = new object[] { 0, "1", 2, "3", 4, "5", 6, "7", 8, "9", 10, "11", 12 };
                Array array4 = new object[, , ] {
                    { { "111", "112", "113" }, { "121", "122", "123" } }, { { "211", "212", "213" }, { "221", "222", "223" } }
                };
                if ((mono_test_marshal_safearray_mixed(array1, out array2, array3, ref array4) != 0) ||
                    (array1.Rank != 1) || (array1.Length != 1) || (Convert.ToInt32(array1.GetValue(0)) != 12345) ||
                    (array2.Rank != 1) || (array2.Length != 10) ||
                    (array4.Rank != 1) || (array4.Length != 8)
                    )
                {
                    return(93);
                }
                for (int i = 0; i < 10; ++i)
                {
                    if (i != Convert.ToInt32(array2.GetValue(i)))
                    {
                        return(94);
                    }
                }
                if ((int)array3.GetValue(0) != 0)
                {
                    return(95);
                }
                for (int i = 0; i < 8; ++i)
                {
                    if (i != Convert.ToInt32(array4.GetValue(i)))
                    {
                        return(96);
                    }
                }
            }
            #endregion             // SafeArray Tests
        }

        return(0);
    }
Ejemplo n.º 2
0
 public static extern int mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc func);
Ejemplo n.º 3
0
 public static extern int mono_test_marshal_variant_out_float_unmanaged(VarRefFunc func);
Ejemplo n.º 4
0
 public static int Main()
 {
     bool
     isWindows
     =
     !(((int)Environment.OSVersion.Platform
     ==
     4)
     ||
     ((int)Environment.OSVersion.Platform
     ==
     128));
     if
     (isWindows)
     {
     string
     str;
     if
     (mono_test_marshal_bstr_in
     ("mono_test_marshal_bstr_in")
     !=
     0)
     return
     1;
     if
     (mono_test_marshal_bstr_out
     (out
     str)
     !=
     0
     ||
     str
     !=
     "mono_test_marshal_bstr_out")
     return
     2;
     if
     (mono_test_marshal_bstr_in_null
     (null)
     !=
     0)
     return
     1;
     if
     (mono_test_marshal_bstr_out_null
     (out
     str)
     !=
     0
     ||
     str
     !=
     null)
     return
     2;
     object
     obj;
     if
     (mono_test_marshal_variant_in_sbyte
     ((sbyte)100)
     !=
     0)
     return
     13;
     if
     (mono_test_marshal_variant_in_byte
     ((byte)100)
     !=
     0)
     return
     14;
     if
     (mono_test_marshal_variant_in_short
     ((short)314)
     !=
     0)
     return
     15;
     if
     (mono_test_marshal_variant_in_ushort
     ((ushort)314)
     !=
     0)
     return
     16;
     if
     (mono_test_marshal_variant_in_int
     ((int)314)
     !=
     0)
     return
     17;
     if
     (mono_test_marshal_variant_in_uint
     ((uint)314)
     !=
     0)
     return
     18;
     if
     (mono_test_marshal_variant_in_long
     ((long)314)
     !=
     0)
     return
     19;
     if
     (mono_test_marshal_variant_in_ulong
     ((ulong)314)
     !=
     0)
     return
     20;
     if
     (mono_test_marshal_variant_in_float
     ((float)3.14)
     !=
     0)
     return
     21;
     if
     (mono_test_marshal_variant_in_double
     ((double)3.14)
     !=
     0)
     return
     22;
     if
     (mono_test_marshal_variant_in_bstr
     ("PI")
     !=
     0)
     return
     23;
     if
     (mono_test_marshal_variant_out_sbyte
     (out
     obj)
     !=
     0
     ||
     (sbyte)obj
     !=
     100)
     return
     24;
     if
     (mono_test_marshal_variant_out_byte
     (out
     obj)
     !=
     0
     ||
     (byte)obj
     !=
     100)
     return
     25;
     if
     (mono_test_marshal_variant_out_short
     (out
     obj)
     !=
     0
     ||
     (short)obj
     !=
     314)
     return
     26;
     if
     (mono_test_marshal_variant_out_ushort
     (out
     obj)
     !=
     0
     ||
     (ushort)obj
     !=
     314)
     return
     27;
     if
     (mono_test_marshal_variant_out_int
     (out
     obj)
     !=
     0
     ||
     (int)obj
     !=
     314)
     return
     28;
     if
     (mono_test_marshal_variant_out_uint
     (out
     obj)
     !=
     0
     ||
     (uint)obj
     !=
     314)
     return
     29;
     if
     (mono_test_marshal_variant_out_long
     (out
     obj)
     !=
     0
     ||
     (long)obj
     !=
     314)
     return
     30;
     if
     (mono_test_marshal_variant_out_ulong
     (out
     obj)
     !=
     0
     ||
     (ulong)obj
     !=
     314)
     return
     31;
     if
     (mono_test_marshal_variant_out_float
     (out
     obj)
     !=
     0
     ||
     ((float)obj
     -
     3.14)
     /
     3.14
     >
     .001)
     return
     32;
     if
     (mono_test_marshal_variant_out_double
     (out
     obj)
     !=
     0
     ||
     ((double)obj
     -
     3.14)
     /
     3.14
     >
     .001)
     return
     33;
     if
     (mono_test_marshal_variant_out_bstr
     (out
     obj)
     !=
     0
     ||
     (string)obj
     !=
     "PI")
     return
     34;
     VarFunc
     func
     =
     new
     VarFunc
     (mono_test_marshal_variant_in_callback);
     if
     (mono_test_marshal_variant_in_sbyte_unmanaged
     (func)
     !=
     0)
     return
     35;
     if
     (mono_test_marshal_variant_in_byte_unmanaged
     (func)
     !=
     0)
     return
     36;
     if
     (mono_test_marshal_variant_in_short_unmanaged
     (func)
     !=
     0)
     return
     37;
     if
     (mono_test_marshal_variant_in_ushort_unmanaged
     (func)
     !=
     0)
     return
     38;
     if
     (mono_test_marshal_variant_in_int_unmanaged
     (func)
     !=
     0)
     return
     39;
     if
     (mono_test_marshal_variant_in_uint_unmanaged
     (func)
     !=
     0)
     return
     40;
     if
     (mono_test_marshal_variant_in_long_unmanaged
     (func)
     !=
     0)
     return
     41;
     if
     (mono_test_marshal_variant_in_ulong_unmanaged
     (func)
     !=
     0)
     return
     42;
     if
     (mono_test_marshal_variant_in_float_unmanaged
     (func)
     !=
     0)
     return
     43;
     if
     (mono_test_marshal_variant_in_double_unmanaged
     (func)
     !=
     0)
     return
     44;
     if
     (mono_test_marshal_variant_in_bstr_unmanaged
     (func)
     !=
     0)
     return
     45;
     if
     (mono_test_marshal_variant_in_bool_true_unmanaged
     (func)
     !=
     0)
     return
     46;
     VarRefFunc
     reffunc
     =
     new
     VarRefFunc
     (mono_test_marshal_variant_out_callback);
     if
     (mono_test_marshal_variant_out_sbyte_unmanaged
     (reffunc)
     !=
     0)
     return
     50;
     if
     (mono_test_marshal_variant_out_byte_unmanaged
     (reffunc)
     !=
     0)
     return
     51;
     if
     (mono_test_marshal_variant_out_short_unmanaged
     (reffunc)
     !=
     0)
     return
     52;
     if
     (mono_test_marshal_variant_out_ushort_unmanaged
     (reffunc)
     !=
     0)
     return
     53;
     if
     (mono_test_marshal_variant_out_int_unmanaged
     (reffunc)
     !=
     0)
     return
     54;
     if
     (mono_test_marshal_variant_out_uint_unmanaged
     (reffunc)
     !=
     0)
     return
     55;
     if
     (mono_test_marshal_variant_out_long_unmanaged
     (reffunc)
     !=
     0)
     return
     56;
     if
     (mono_test_marshal_variant_out_ulong_unmanaged
     (reffunc)
     !=
     0)
     return
     57;
     if
     (mono_test_marshal_variant_out_float_unmanaged
     (reffunc)
     !=
     0)
     return
     58;
     if
     (mono_test_marshal_variant_out_double_unmanaged
     (reffunc)
     !=
     0)
     return
     59;
     if
     (mono_test_marshal_variant_out_bstr_unmanaged
     (reffunc)
     !=
     0)
     return
     60;
     if
     (mono_test_marshal_variant_out_bool_true_unmanaged
     (reffunc)
     !=
     0)
     return
     61;
     IntPtr
     pUnk;
     if
     (mono_test_marshal_com_object_create
     (out
     pUnk)
     !=
     0)
     return
     145;
     if
     (mono_test_marshal_com_object_ref_count
     (pUnk)
     !=
     1)
     return
     146;
     if
     (Marshal.AddRef
     (pUnk)
     !=
     2)
     return
     147;
     if
     (mono_test_marshal_com_object_ref_count
     (pUnk)
     !=
     2)
     return
     148;
     if
     (Marshal.Release
     (pUnk)
     !=
     1)
     return
     149;
     if
     (mono_test_marshal_com_object_ref_count
     (pUnk)
     !=
     1)
     return
     150;
     object
     com_obj
     =
     Marshal.GetObjectForIUnknown
     (pUnk);
     if
     (com_obj
     ==
     null)
     return
     151;
     ITest
     itest
     =
     com_obj
     as
     ITest;
     if
     (itest
     ==
     null)
     return
     152;
     IntPtr
     pUnk2;
     if
     (mono_test_marshal_com_object_same
     (out
     pUnk2)
     !=
     0)
     return
     153;
     object
     com_obj2
     =
     Marshal.GetObjectForIUnknown
     (pUnk2);
     if
     (com_obj
     !=
     com_obj2)
     return
     154;
     if
     (!com_obj.Equals
     (com_obj2))
     return
     155;
     IntPtr
     pUnk3;
     if
     (mono_test_marshal_com_object_create
     (out
     pUnk3)
     !=
     0)
     return
     156;
     object
     com_obj3
     =
     Marshal.GetObjectForIUnknown
     (pUnk3);
     if
     (com_obj
     ==
     com_obj3)
     return
     157;
     if
     (com_obj.Equals
     (com_obj3))
     return
     158;
     if
     (Marshal.ReleaseComObject
     (com_obj2)
     !=
     1)
     return
     159;
     if
     (Marshal.ReleaseComObject
     (com_obj3)
     !=
     0)
     return
     160;
     IntPtr
     iunknown
     =
     Marshal.GetIUnknownForObject
     (com_obj);
     if
     (iunknown
     ==
     IntPtr.Zero)
     return
     170;
     if
     (pUnk
     !=
     iunknown)
     return
     171;
     if
     (TestITest
     (itest)
     !=
     0)
     return
     172;
     if
     (TestITestPresSig
     (itest
     as
     ITestPresSig)
     !=
     0)
     return
     173;
     ManagedTest
     test
     =
     new
     ManagedTest
     ();
     mono_test_marshal_ccw_itest
     (test);
     if
     (test.Status
     !=
     0)
     return
     200;
     ManagedTestPresSig
     test_pres_sig
     =
     new
     ManagedTestPresSig
     ();
     mono_test_marshal_ccw_itest
     (test_pres_sig);
     }
     return
     0;
 }
Ejemplo n.º 5
0
    public static extern int mono_test_marshal_variant_out_ushort_unmanaged(VarRefFunc
func);
Ejemplo n.º 6
0
    public static extern int mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc
func);