Exemple #1
0
    static void TestRPInvokeStructPointerInOut()
    {
        DelMarshalPointer_Struct_InOut d = new DelMarshalPointer_Struct_InOut(Call_StructPointer_Delegate_InOut);

        if (!PInvokeDef.RPInvoke_DelMarshalStructPointer_InOut(d))
        {
            ReportFailure("Method PInvokeDef.RPInvoke_DelMarshalStructPointer_InOut[Managed Side], The Return value is wrong");
        }
    }
Exemple #2
0
    static void TestRPInvokeStructIn()
    {
        DelMarshal_Struct_In d = new DelMarshal_Struct_In(Call_Struct_Delegate_In);

        if (!PInvokeDef.RPInvoke_DelMarshal_Struct_In(d))
        {
            ReportFailure("Method PInvokeDef.RPInvoke_DelMarshal_Struct_In[Managed Side],The Return value is wrong");
        }
    }
Exemple #3
0
    static void TestStructIn()
    {
        string strManaged = "Managed\0String\0";
        Person person     = new Person();

        person.age  = 12;
        person.name = strManaged;
        if (!PInvokeDef.Marshal_Struct_In(person))
        {
            ReportFailure("Method PInvokeDef.Marshal_Struct_In[Managed Side],The native return false");
        }
    }
Exemple #4
0
    static void TestStructPointerInOut()
    {
        string strManaged = "Managed\0String\0";
        Person person     = new Person();

        person.age  = 12;
        person.name = strManaged;

        if (!PInvokeDef.MarshalPointer_Struct_InOut(ref person))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Struct_InOut[Managed Side],The native return false");
        }

        if (person.age != 21 || person.name != " Native")
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Struct_InOut[Managed Side],The Return struct is wrong");
        }
    }
Exemple #5
0
    public static int Main(string[] args)
    {
        string strManaged = "Managed";
        string strRet     = "a";

        StringBuilder strBRet    = new StringBuilder("a", 1);
        string        strNative  = " Native";
        StringBuilder strBNative = new StringBuilder(" Native", 7);

        Console.WriteLine("[Calling PInvokeDef.Marshal_InOut]");
        //since the out attributes doesnt work for string, so i dont check the out value.
        string strPara2 = new string(strManaged.ToCharArray());
        string strRet2  = PInvokeDef.Marshal_InOut(strPara2);

        if (!strRet2.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.Marshal_InOut[Managed Side],The Return string is wrong", strRet, strRet2);
        }

        //TestMethod3
        Console.WriteLine("[Calling PInvokeDef.Marshal_Out]");
        string strPara3 = strManaged;
        string strRet3  = PInvokeDef.Marshal_Out(strPara3);

        if (!strRet.Equals(strRet3))
        {
            ReportFailure("Method PInvokeDef.Marshal_Out[Managed Side],The Return string is wrong", strRet, strRet3);
        }
        if (!strManaged.Equals(strPara3))
        {
            ReportFailure("Method PInvokeDef.Marshal_Out[Managed Side],The Parameter string is Changed", strManaged, strPara3);
        }

        //TestMethod5
        Console.WriteLine("[Calling PInvokeDef.MarshalPointer_InOut]");
        string strPara5 = strManaged;
        string strRet5  = PInvokeDef.MarshalPointer_InOut(ref strPara5);

        if (!strRet5.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Return string is wrong", strRet, strRet5);
        }
        if (!strPara5.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Passed string is wrong", strNative, strPara5);
        }

        //TestMethod6
        Console.WriteLine("[Calling PInvokeDef.MarshalPointer_Out]");
        string strPara6;// = String.Copy(strManaged);
        string strRet6 = PInvokeDef.MarshalPointer_Out(out strPara6);

        if (!strRet6.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Return string is wrong", strRet, strRet6);
        }
        if (!strPara6.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Passed string is wrong", strNative, strPara6);
        }


        //TestMethod7
        Console.WriteLine("[Calling PInvokeDef.MarshalStrB_InOut]");
        StringBuilder strPara7 = new StringBuilder(strManaged);
        StringBuilder strRet7  = PInvokeDef.MarshalStrB_InOut(strPara7);

        if (!IsEqual(strRet7, strBRet))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_InOut[Managed Side],The Return string is wrong", strRet, strRet7.ToString());
        }
        if (!strPara7.Equals(new StringBuilder(strNative)))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_InOut[Managed Side],The Passed string is wrong", strNative, strPara7.ToString());
        }

        //TestMethod8
        Console.WriteLine("[Calling PInvokeDef.MarshalStrB_Out]");
        StringBuilder strPara8;// = new StringBuilder(strManaged);
        StringBuilder strRet8 = PInvokeDef.MarshalStrB_Out(out strPara8);

        if (!IsEqual(strRet8, strBRet))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_Out[Managed Side],The Return string is wrong", strRet, strRet8.ToString());
        }
        if (!IsEqual(strPara8, strBNative))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_Out[Managed Side],The Passed string is wrong", strNative, strPara8.ToString());
        }

        //TestMethod9
        Console.WriteLine("[Calling PInvokeDef.MarshalStrWB_InOut]");
        StringBuilder strPara9 = new StringBuilder(strManaged, strManaged.Length);
        StringBuilder strRet9  = PInvokeDef.MarshalStrWB_InOut(strPara9);

        if (!IsEqual(strRet9, strBRet))
        {
            ReportFailure("Method PInvokeDef.MarshalStrWB_InOut[Managed Side],The Return string is wrong", strRet, strRet9.ToString());
        }
        if (!IsEqual(strPara9, strBNative))
        {
            ReportFailure("Method PInvokeDef.MarshalStrWB_InOut[Managed Side],The Passed string is wrong", strNative, strPara9.ToString());
        }

        #region DelegatePinvoke
        //TestMethod11
        Del_MarshalPointer_InOut d1 = new Del_MarshalPointer_InOut(PInvokeDef.MarshalPointer_InOut);
        string strPara11            = new string(strManaged.ToCharArray());
        string strRet11             = d1(ref strPara11);
        if (!strRet11.Equals(strRet))
        {
            ReportFailure("Method Del_MarshalPointer_InOut[Managed Side],The Return string is wrong", strRet, strRet11);
        }
        if (!strPara11.Equals(strNative))
        {
            ReportFailure("Method Del_MarshalPointer_InOut[Managed Side],The Passed string is wrong", strNative, strPara11);
        }

        Del_Marshal_Out d2        = new Del_Marshal_Out(PInvokeDef.Marshal_Out);
        string          strPara12 = strManaged;
        string          strRet12  = d2(strPara12);
        if (!strRet.Equals(strRet12))
        {
            ReportFailure("Method Del_Marshal_Out[Managed Side],The Return string is wrong", strRet, strRet12);
        }
        if (!strManaged.Equals(strPara12))
        {
            ReportFailure("Method Del_Marshal_Out[Managed Side],The Parameter string is Changed", strManaged, strPara12);
        }
        #endregion

        #region ReversePInvoke
        Del_MarshalStrB_InOut d3 = new Del_MarshalStrB_InOut(Call_Del_MarshalStrB_InOut);
        if (!PInvokeDef.ReverseP_MarshalStrB_InOut(d3, "ă"))
        {
            ReportFailure("Method ReverseP_MarshalStrB_InOut[Managed Side],return value is false");
        }

        Del_MarshalStrB_Out d4 = new Del_MarshalStrB_Out(Call_Del_MarshalStrB_Out);
        if (!PInvokeDef.ReverseP_MarshalStrB_Out(d4))
        {
            ReportFailure("Method ReverseP_MarshalStrB_Out[Managed Side],return value is false");
        }

        #endregion

        int           length = 10;
        StringBuilder nullTerminatorBuilder = new StringBuilder(length);
        if (!PInvokeDef.Verify_NullTerminators_PastEnd(nullTerminatorBuilder, length))
        {
            ReportFailure("Null terminators for StringBuilder not set for [In] semantics");
        }
        if (!PInvokeDef.Verify_NullTerminators_PastEnd_Out(nullTerminatorBuilder, length))
        {
            ReportFailure("Null terminators for StringBuilder not set for [Out] semantics");
        }

        return(ExitTest());
    }
Exemple #6
0
    public static int Main(string[] args)
    {
#pragma warning disable 0219
        string        strManaged = "Managed\0String\0";
        string        strRet     = "a";
        StringBuilder strBRet    = new StringBuilder("a", 1);
        string        strNative  = " Native";
        StringBuilder strBNative = new StringBuilder(" Native", 7);
#pragma warning restore 0219

        //since the out attributes doesnt work for string, so i dont check the out value.
        string strPara2 = strManaged;
        string strRet2  = PInvokeDef.Marshal_InOut(strPara2);
        if (!strRet2.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.Marshal_InOut[Managed Side],The Return string is wrong", strRet, strRet2);
        }
        if (!strPara2.Equals(strManaged))
        {
            ReportFailure("Method PInvokeDef.Marshal_InOut[Managed Side],The Parameter string is Changed", strManaged, strPara2);
        }

        //TestMethod3
        string strPara3 = strManaged;
        string strRet3  = PInvokeDef.Marshal_Out(strPara3);
        if (!strRet.Equals(strRet3))
        {
            ReportFailure("Method PInvokeDef.Marshal_Out[Managed Side],The Return string is wrong", strRet, strRet3);
        }
        if (!strPara3.Equals(strManaged))
        {
            ReportFailure("Method PInvokeDef.Marshal_Out[Managed Side],The Parameter string is not Changed", strManaged, strPara3);
        }

        //TestMethod5
        string strPara5 = strManaged;
        string strRet5  = PInvokeDef.MarshalPointer_InOut(ref strPara5);

        if (!strRet5.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Return string is wrong", strRet, strRet5);
        }
        if (!strPara5.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Passed string is wrong", strNative, strPara5);
        }

        //TestMethod6
        string strPara6 = strManaged;
        string strRet6  = PInvokeDef.MarshalPointer_Out(out strPara6);
        if (!strRet6.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Return string is wrong", strRet, strRet6);
        }
        if (!strPara6.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Passed string is wrong", strNative, strPara6);
        }

        #region ReversePinvoke
        DelMarshal_InOut d1 = new DelMarshal_InOut(Call_DelMarshal_InOut);
        if (!PInvokeDef.RPinvoke_DelMarshal_InOut(d1, "\u0148"))
        {
            ReportFailure("Method RPinvoke_DelMarshal_InOut[Managed Side],Return value is false");
        }

        DelMarshalPointer_Out d2 = new DelMarshalPointer_Out(Call_DelMarshalPointer_Out);
        if (!PInvokeDef.RPinvoke_DelMarshalPointer_Out(d2))
        {
            ReportFailure("Method RPinvoke_DelMarshal_Out[Managed Side],Return value is false");
        }

        #endregion
        #region DelegatePInvoke

        Del_Marshal_InOut d3       = new Del_Marshal_InOut(PInvokeDef.Marshal_InOut);
        string            strPara9 = strManaged;
        string            strRet9  = d3(strPara9);
        if (!strRet9.Equals(strRet))
        {
            ReportFailure("Method Del_Marshal_InOut[Managed Side],The Return string is wrong", strRet, strRet9);
        }
        if (!strPara9.Equals(strManaged))
        {
            ReportFailure("Method Del_Marshal_InOut[Managed Side],The Parameter string is Changed", strManaged, strPara9);
        }

        Del_MarshalPointer_Out d4 = new Del_MarshalPointer_Out(PInvokeDef.MarshalPointer_Out);
        string strPara10          = strManaged;
        string strRet10           = d4(out strPara10);
        if (!strRet10.Equals(strRet))
        {
            ReportFailure("Method Del_MarshalPointer_Out[Managed Side],The Return string is wrong", strRet, strRet10);
        }
        if (!strPara10.Equals(strNative))
        {
            ReportFailure("Method Del_MarshalPointer_Out[Managed Side],The Passed string is wrong", strNative, strPara10);
        }

        #endregion
        return(ExitTest());
    }
Exemple #7
0
    public static int Main(string[] args)
    {
#if BUG750509
        if ((args != null) && (args.Length == 1) && (args[0] == "/mb"))
        {
            MessageBox(new IntPtr(0), "Hello World!", "Hello Dialog", 0);
        }
#endif

#pragma warning disable 0219
        string        strManaged = "Managed";
        string        strRet     = "a";
        StringBuilder strBRet    = new StringBuilder("a", 1);
        string        strNative  = " Native";
        StringBuilder strBNative = new StringBuilder(" Native", 7);
#pragma warning restore 0219

        PInvokeDef.Writeline("Format i=%d c=%c d=%f, s=%d, u=%d", 100, 'A', 3.1415926, 32767, 32768);

        //since the out attributes doesnt work for string, so i dont check the out value.
        string strPara2 = strManaged;
        string strRet2  = PInvokeDef.Marshal_InOut(strPara2);
        if (!strRet2.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.Marshal_InOut[Managed Side],The Return string is wrong", strRet, strRet2);
        }
        if (!strPara2.Equals(strManaged))
        {
            ReportFailure("Method PInvokeDef.Marshal_InOut[Managed Side],The Parameter string is Changed", strManaged, strPara2);
        }

        //TestMethod3
        string strPara3 = strManaged;
        string strRet3  = PInvokeDef.Marshal_Out(strPara3);
        if (!strRet.Equals(strRet3))
        {
            ReportFailure("Method PInvokeDef.Marshal_Out[Managed Side],The Return string is wrong", strRet, strRet3);
        }
        if (!strPara3.Equals(strManaged))
        {
            ReportFailure("Method PInvokeDef.Marshal_Out[Managed Side],The Parameter string is not Changed", strManaged, strPara3);
        }

        //TestMethod5
        string strPara5 = strManaged;
        string strRet5  = PInvokeDef.MarshalPointer_InOut(ref strPara5);

        if (!strRet5.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Return string is wrong", strRet, strRet5);
        }
        if (!strPara5.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Passed string is wrong", strNative, strPara5);
        }


        //TestMethod6
        string strPara6 = strManaged;
        string strRet6  = PInvokeDef.MarshalPointer_Out(out strPara6);
        if (!strRet6.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Return string is wrong", strRet, strRet6);
        }
        if (!strPara6.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Passed string is wrong", strNative, strPara6);
        }

        //TestMethod7
        StringBuilder strPara7 = new StringBuilder(strManaged, strManaged.Length);
        StringBuilder strRet7  = PInvokeDef.MarshalStrB_InOut(strPara7);

        if (!strRet7.ToString().Equals(strBRet.ToString()))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_InOut[Managed Side],The Return string is wrong", strRet, strRet7.ToString());
        }
        if (!strPara7.ToString().Equals(strBNative.ToString()))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_InOut[Managed Side],The Passed string is wrong", strNative, strPara7.ToString());
        }

        //TestMethod8
        StringBuilder strPara8;// = new StringBuilder(strManaged);
        StringBuilder strRet8 = PInvokeDef.MarshalStrB_Out(out strPara8);
        if (!strRet8.ToString().Equals(strBRet.ToString()))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_Out[Managed Side],The Return string is wrong", strRet, strRet8.ToString());
        }
        if (!strPara8.ToString().Equals(strBNative.ToString()))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_Out[Managed Side],The Passed string is wrong", strNative, strPara8.ToString());
        }

        #region ReversePinvoke
        DelMarshal_InOut d1 = new DelMarshal_InOut(Call_DelMarshal_InOut);
        if (!PInvokeDef.RPinvoke_DelMarshal_InOut(d1, "ň"))
        {
            ReportFailure("Method RPinvoke_DelMarshal_InOut[Managed Side],Return value is false");
        }

        DelMarshalPointer_Out d2 = new DelMarshalPointer_Out(Call_DelMarshalPointer_Out);
        if (!PInvokeDef.RPinvoke_DelMarshalPointer_Out(d2))
        {
            ReportFailure("Method RPinvoke_DelMarshal_Out[Managed Side],Return value is false");
        }

        #endregion
        #region DelegatePInvoke

        Del_Marshal_InOut d3       = new Del_Marshal_InOut(PInvokeDef.Marshal_InOut);
        string            strPara9 = strManaged;
        string            strRet9  = d3(strPara9);
        if (!strRet9.Equals(strRet))
        {
            ReportFailure("Method Del_Marshal_InOut[Managed Side],The Return string is wrong", strRet, strRet9);
        }
        if (!strPara9.Equals(strManaged))
        {
            ReportFailure("Method Del_Marshal_InOut[Managed Side],The Parameter string is Changed", strManaged, strPara9);
        }

        Del_MarshalPointer_Out d4 = new Del_MarshalPointer_Out(PInvokeDef.MarshalPointer_Out);
        string strPara10          = strManaged;
        string strRet10           = d4(out strPara10);
        if (!strRet10.Equals(strRet))
        {
            ReportFailure("Method Del_MarshalPointer_Out[Managed Side],The Return string is wrong", strRet, strRet10);
        }
        if (!strPara10.Equals(strNative))
        {
            ReportFailure("Method Del_MarshalPointer_Out[Managed Side],The Passed string is wrong", strNative, strPara10);
        }

        Del_MarshalStrB_InOut d5 = new Del_MarshalStrB_InOut(Call_Del_MarshalStrB_InOut);

        if (!PInvokeDef.ReverseP_MarshalStrB_InOut(d5, new string('a', 1)))
        {
            ReportFailure("Method ReverseP_MarshalStrB_InOut[Managed Side],return value is false");
        }
        #endregion
        return(ExitTest());
    }
Exemple #8
0
    public static int Main(string[] args)
    {
        string strManaged = "Managed";
        string strRet     = "a";

        StringBuilder strBRet    = new StringBuilder("a", 1);
        string        strNative  = " Native";
        StringBuilder strBNative = new StringBuilder(" Native", 7);

        Console.WriteLine("[Calling PInvokeDef.Marshal_In]");
        string strPara1 = strManaged;
        string strRet1  = PInvokeDef.Marshal_In(strPara1);

        if (!strRet1.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.Marshal_InOut[Managed Side],The Return string is wrong", strRet, strRet1);
        }

        Console.WriteLine("[Calling PInvokeDef.Marshal_InOut]");
        bool outByValueFails = false;

        try
        {
            string strPara2 = strManaged;
            PInvokeDef.Marshal_InOut(strPara2);
        }
        catch (MarshalDirectiveException)
        {
            outByValueFails = true;
        }

        if (!outByValueFails)
        {
            ReportFailure("Method PInvokeDef.Marshal_Out did not throw a MarshalDirectiveException.");
        }

        //TestMethod3
        Console.WriteLine("[Calling PInvokeDef.Marshal_Out]");
        outByValueFails = false;
        try
        {
            string strPara3 = strManaged;
            PInvokeDef.Marshal_Out(strPara3);
        }
        catch (MarshalDirectiveException)
        {
            outByValueFails = true;
        }

        if (!outByValueFails)
        {
            ReportFailure("Method PInvokeDef.Marshal_Out did not throw a MarshalDirectiveException.");
        }

        //TestMethod5
        Console.WriteLine("[Calling PInvokeDef.MarshalPointer_InOut]");
        string strPara5 = strManaged;
        string strRet5  = PInvokeDef.MarshalPointer_InOut(ref strPara5);

        if (!strRet5.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Return string is wrong", strRet, strRet5);
        }
        if (!strPara5.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_InOut[Managed Side],The Passed string is wrong", strNative, strPara5);
        }

        //TestMethod6
        Console.WriteLine("[Calling PInvokeDef.MarshalPointer_Out]");
        string strPara6;// = String.Copy(strManaged);
        string strRet6 = PInvokeDef.MarshalPointer_Out(out strPara6);

        if (!strRet6.Equals(strRet))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Return string is wrong", strRet, strRet6);
        }
        if (!strPara6.Equals(strNative))
        {
            ReportFailure("Method PInvokeDef.MarshalPointer_Out[Managed Side],The Passed string is wrong", strNative, strPara6);
        }


        //TestMethod7
        Console.WriteLine("[Calling PInvokeDef.MarshalStrB_InOut]");
        StringBuilder strPara7 = new StringBuilder(strManaged);
        StringBuilder strRet7  = PInvokeDef.MarshalStrB_InOut(strPara7);

        if (!IsEqual(strRet7, strBRet))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_InOut[Managed Side],The Return string is wrong", strRet, strRet7.ToString());
        }
        if (!strPara7.Equals(new StringBuilder(strNative)))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_InOut[Managed Side],The Passed string is wrong", strNative, strPara7.ToString());
        }

        //TestMethod8
        Console.WriteLine("[Calling PInvokeDef.MarshalStrB_Out]");
        StringBuilder strPara8;// = new StringBuilder(strManaged);
        StringBuilder strRet8 = PInvokeDef.MarshalStrB_Out(out strPara8);

        if (!IsEqual(strRet8, strBRet))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_Out[Managed Side],The Return string is wrong", strRet, strRet8.ToString());
        }
        if (!IsEqual(strPara8, strBNative))
        {
            ReportFailure("Method PInvokeDef.MarshalStrB_Out[Managed Side],The Passed string is wrong", strNative, strPara8.ToString());
        }

        //TestMethod9
        Console.WriteLine("[Calling PInvokeDef.MarshalStrWB_InOut]");
        StringBuilder strPara9 = new StringBuilder(strManaged, strManaged.Length);
        StringBuilder strRet9  = PInvokeDef.MarshalStrWB_InOut(strPara9);

        if (!IsEqual(strRet9, strBRet))
        {
            ReportFailure("Method PInvokeDef.MarshalStrWB_InOut[Managed Side],The Return string is wrong", strRet, strRet9.ToString());
        }
        if (!IsEqual(strPara9, strBNative))
        {
            ReportFailure("Method PInvokeDef.MarshalStrWB_InOut[Managed Side],The Passed string is wrong", strNative, strPara9.ToString());
        }

        #region DelegatePinvoke
        //TestMethod11
        Del_MarshalPointer_InOut d1 = new Del_MarshalPointer_InOut(PInvokeDef.MarshalPointer_InOut);
        string strPara11            = new string(strManaged.ToCharArray());
        string strRet11             = d1(ref strPara11);
        if (!strRet11.Equals(strRet))
        {
            ReportFailure("Method Del_MarshalPointer_InOut[Managed Side],The Return string is wrong", strRet, strRet11);
        }
        if (!strPara11.Equals(strNative))
        {
            ReportFailure("Method Del_MarshalPointer_InOut[Managed Side],The Passed string is wrong", strNative, strPara11);
        }

        outByValueFails = false;
        Del_Marshal_Out d2 = new Del_Marshal_Out(PInvokeDef.Marshal_Out);
        try
        {
            string strPara12 = strManaged;
            d2(strPara12);
        }
        catch (MarshalDirectiveException)
        {
            outByValueFails = true;
        }

        if (!outByValueFails)
        {
            ReportFailure("Method PInvokeDef.Marshal_Out did not throw a MarshalDirectiveException.");
        }
        #endregion

        #region ReversePInvoke
        Del_MarshalStrB_InOut d3 = new Del_MarshalStrB_InOut(Call_Del_MarshalStrB_InOut);
        if (!PInvokeDef.ReverseP_MarshalStrB_InOut(d3, "ă"))
        {
            ReportFailure("Method ReverseP_MarshalStrB_InOut[Managed Side],return value is false");
        }

        Del_MarshalStrB_Out d4 = new Del_MarshalStrB_Out(Call_Del_MarshalStrB_Out);
        if (!PInvokeDef.ReverseP_MarshalStrB_Out(d4))
        {
            ReportFailure("Method ReverseP_MarshalStrB_Out[Managed Side],return value is false");
        }

        #endregion

        int           length = 10;
        StringBuilder nullTerminatorBuilder = new StringBuilder(length);
        if (!PInvokeDef.Verify_NullTerminators_PastEnd(nullTerminatorBuilder, length))
        {
            ReportFailure("Null terminators for StringBuilder not set for [In] semantics");
        }
        if (!PInvokeDef.Verify_NullTerminators_PastEnd_Out(nullTerminatorBuilder, length))
        {
            ReportFailure("Null terminators for StringBuilder not set for [Out] semantics");
        }

        return(ExitTest());
    }