Ejemplo n.º 1
0
    private static void MarshalStructAsParam_AsExpByRefOut(StructID id)
    {
        try
        {
            switch (id)
            {
                case StructID.INNER2Id:
                    INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
                    INNER2 changeINNER2 = Helper.NewINNER2(77, 77.0F, "changed string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutINNER2...");
                    if (!MarshalStructAsParam_AsExpByRefOutINNER2(out sourceINNER2))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutINNER2.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateINNER2(sourceINNER2, changeINNER2, "MarshalStructAsParam_AsExpByRefOutINNER2"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.InnerExplicitId:
                    InnerExplicit sourceInnerExplicit = new InnerExplicit();
                    sourceInnerExplicit.f1 = 1;
                    sourceInnerExplicit.f3 = "some string";
                    InnerExplicit changeInnerExplicit = new InnerExplicit();
                    changeInnerExplicit.f1 = 77;
                    changeInnerExplicit.f3 = "changed string";

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutInnerExplicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutInnerExplicit(out sourceInnerExplicit))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutInnerExplicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "MarshalStructAsParam_AsExpByRefOutInnerExplicit"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.InnerArrayExplicitId:
                    InnerArrayExplicit sourceInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
                    InnerArrayExplicit changeInnerArrayExplicit = Helper.NewInnerArrayExplicit(77, 77.0F, "change string1", "change string2");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit(out sourceInnerArrayExplicit))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.OUTER3Id:
                    OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
                    OUTER3 changeOUTER3 = Helper.NewOUTER3(77, 77.0F, "changed string", "changed string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutOUTER3...");
                    if (!MarshalStructAsParam_AsExpByRefOutOUTER3(out sourceOUTER3))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutOUTER3.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "MarshalStructAsParam_AsExpByRefOutOUTER3"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.UId:
                    U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue, byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
                    U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue, byte.MaxValue, sbyte.MinValue, long.MaxValue, ulong.MinValue, 64.0F, 6.4);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutU...");
                    if (!MarshalStructAsParam_AsExpByRefOutU(out sourceU))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutU.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateU(sourceU, changeU, "MarshalStructAsParam_AsExpByRefOutU"))
                    {
                        failures++;
                    }
                    break;   
                case StructID.ByteStructPack2ExplicitId:
                    ByteStructPack2Explicit source_bspe = Helper.NewByteStructPack2Explicit(32, 32);
                    ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit(out source_bspe))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit"))
                    {
                        failures++;
                    }
                    break; 
                case StructID.ShortStructPack4ExplicitId:
                    ShortStructPack4Explicit source_sspe = Helper.NewShortStructPack4Explicit(32, 32);
                    ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit(out source_sspe))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit"))
                    {
                        failures++;
                    }
                    break;
                case StructID.IntStructPack8ExplicitId:
                    IntStructPack8Explicit source_ispe = Helper.NewIntStructPack8Explicit(32, 32);
                    IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit(out source_ispe))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit"))
                    {
                        failures++;
                    }
                    break;
                case StructID.LongStructPack16ExplicitId:
                    LongStructPack16Explicit sourceLongStructPack16Explicit = Helper.NewLongStructPack16Explicit(32, 32);
                    LongStructPack16Explicit changeLongStructPack16Explicit = Helper.NewLongStructPack16Explicit(64, 64);
                    Console.WriteLine("\tCalling MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit...");
                    if (!MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit(out sourceLongStructPack16Explicit))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateLongStructPack16Explicit(sourceLongStructPack16Explicit, changeLongStructPack16Explicit, "MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit"))
                    {
                        failures++;
                    }
                    break;   
                default:
                    Console.WriteLine("\tThere is not the struct id");
                    failures++;
                    break;
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Unexpected Exception:" + e.ToString());
            failures++;
        }
    }
Ejemplo n.º 2
0
    private static void TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID structid)
    {
        Console.WriteLine("Delegate,Pinvoke,By Ref,Cdecl");

        switch (structid)
        {
        case StructID.INNER2Id:
            INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
            INNER2 changeINNER2 = Helper.NewINNER2(77, 77.0F, "changed string");
            DelegateCdeclByRef_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_INNER2(ref sourceINNER2));
            Assert.IsTrue(Helper.ValidateINNER2(sourceINNER2, changeINNER2, "Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr"));
            break;

        case StructID.InnerExplicitId:
            InnerExplicit sourceInnerExplicit = new InnerExplicit();
            sourceInnerExplicit.f1 = 1;
            sourceInnerExplicit.f3 = "some string";
            InnerExplicit changeInnerExplicit = new InnerExplicit();
            changeInnerExplicit.f1 = 77;
            changeInnerExplicit.f3 = "changed string";
            DelegateCdeclByRef_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_InnerExplicit(ref sourceInnerExplicit));
            Assert.IsTrue(Helper.ValidateInnerExplicit(sourceInnerExplicit, changeInnerExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr"));
            break;

        case StructID.InnerArrayExplicitId:
            InnerArrayExplicit sourceInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
            InnerArrayExplicit changeInnerArrayExplicit = Helper.NewInnerArrayExplicit(77, 77.0F, "change string1", "change string2");
            DelegateCdeclByRef_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_InnerArrayExplicit(ref sourceInnerArrayExplicit));
            Assert.IsTrue(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, changeInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr"));
            break;

        case StructID.OUTER3Id:
            OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
            OUTER3 changeOUTER3 = Helper.NewOUTER3(77, 77.0F, "changed string", "changed string");
            DelegateCdeclByRef_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_OUTER3(ref sourceOUTER3));
            Assert.IsTrue(Helper.ValidateOUTER3(sourceOUTER3, changeOUTER3, "Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr"));
            break;

        case StructID.UId:
            U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
                                    byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
            U changeU = Helper.NewU(Int32.MaxValue, UInt32.MinValue, new IntPtr(-64), new UIntPtr(64), short.MaxValue, ushort.MinValue,
                                    byte.MaxValue, sbyte.MinValue, long.MaxValue, ulong.MinValue, 64.0F, 6.4);
            DelegateCdeclByRef_U caller_U = Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_U(ref sourceU));
            Assert.IsTrue(Helper.ValidateU(sourceU, changeU, "Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr"));
            break;

        case StructID.ByteStructPack2ExplicitId:
            ByteStructPack2Explicit source_bspe = Helper.NewByteStructPack2Explicit(32, 32);
            ByteStructPack2Explicit change_bspe = Helper.NewByteStructPack2Explicit(64, 64);
            DelegateCdeclByRef_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_ByteStructPack2Explicit(ref source_bspe));
            Assert.IsTrue(Helper.ValidateByteStructPack2Explicit(source_bspe, change_bspe, "Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr"));
            break;

        case StructID.ShortStructPack4ExplicitId:
            ShortStructPack4Explicit source_sspe = Helper.NewShortStructPack4Explicit(32, 32);
            ShortStructPack4Explicit change_sspe = Helper.NewShortStructPack4Explicit(64, 64);
            DelegateCdeclByRef_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_ShortStructPack4Explicit(ref source_sspe));
            Assert.IsTrue(Helper.ValidateShortStructPack4Explicit(source_sspe, change_sspe, "Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr"));
            break;

        case StructID.IntStructPack8ExplicitId:
            IntStructPack8Explicit source_ispe = Helper.NewIntStructPack8Explicit(32, 32);
            IntStructPack8Explicit change_ispe = Helper.NewIntStructPack8Explicit(64, 64);
            DelegateCdeclByRef_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_IntStructPack8Explicit(ref source_ispe));
            Assert.IsTrue(Helper.ValidateIntStructPack8Explicit(source_ispe, change_ispe, "Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr"));
            break;

        case StructID.LongStructPack16ExplicitId:
            LongStructPack16Explicit source_lspe = Helper.NewLongStructPack16Explicit(32, 32);
            LongStructPack16Explicit change_lspe = Helper.NewLongStructPack16Explicit(64, 64);
            DelegateCdeclByRef_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr...");
            Assert.IsTrue(caller_LongStructPack16Explicit(ref source_lspe));
            Assert.IsTrue(Helper.ValidateLongStructPack16Explicit(source_lspe, change_lspe, "Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr"));
            break;

        default:
            Assert.Fail("TestMethod_DelegatePInvoke_MarshalByRef_Cdecl:The structid (Managed Side) is wrong");
            break;
        }
    }
Ejemplo n.º 3
0
    unsafe private static void MarshalStructAsParam_AsSeqByRefIn(StructID id)
    {
        try
        {
            switch (id)
            {
                case StructID.InnerSequentialId:
                    InnerSequential source_is = Helper.NewInnerSequential(1, 1.0F, "some string");
                    InnerSequential clone_is = Helper.NewInnerSequential(1, 1.0F, "some string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn...");
                    if (!MarshalStructAsParam_AsSeqByRefIn(ref source_is))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerSequential(source_is, clone_is, "MarshalStructAsParam_AsSeqByRefIn"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.InnerArraySequentialId:
                    InnerArraySequential source_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
                    InnerArraySequential clone_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn2...");
                    if (!MarshalStructAsParam_AsSeqByRefIn2(ref source_ias))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn2.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerArraySequential(source_ias, clone_ias, "MarshalStructAsParam_AsSeqByRefIn2"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.CharSetAnsiSequentialId:
                    CharSetAnsiSequential source_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
                    CharSetAnsiSequential clone_csas = Helper.NewCharSetAnsiSequential("some string", 'c');

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn3...");
                    if (!MarshalStructAsParam_AsSeqByRefIn3(ref source_csas))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn3.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateCharSetAnsiSequential(source_csas, clone_csas, "MarshalStructAsParam_AsSeqByRefIn3"))
                    {
                        failures++;
                    }
                    break; 
                case StructID.CharSetUnicodeSequentialId:
                    CharSetUnicodeSequential source_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
                    CharSetUnicodeSequential clone_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn4...");
                    if (!MarshalStructAsParam_AsSeqByRefIn4(ref source_csus))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn4.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateCharSetUnicodeSequential(source_csus, clone_csus, "MarshalStructAsParam_AsSeqByRefIn4"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.NumberSequentialId:
                    NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue, sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
                    NumberSequential change_ns = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn6...");
                    if (!MarshalStructAsParam_AsSeqByRefIn6(ref source_ns))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn6.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateNumberSequential(source_ns, change_ns, "MarshalStructAsParam_AsSeqByRefIn6"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S3Id:
                    int[] iarr = new int[256];
                    int[] icarr = new int[256];
                    InitialArray(iarr, icarr);

                    S3 sourceS3 = Helper.NewS3(true, "some string", iarr);
                    S3 cloneS3 = Helper.NewS3(true, "some string", iarr);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn7...");
                    if (!MarshalStructAsParam_AsSeqByRefIn7(ref sourceS3))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn7.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS3(sourceS3, cloneS3, "MarshalStructAsParam_AsSeqByRefIn7"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S5Id:
                    Enum1 enums = Enum1.e1;
                    Enum1 enumcl = Enum1.e1;
                    S5 sourceS5 = Helper.NewS5(32, "some string", enums);
                    S5 cloneS5 = Helper.NewS5(32, "some string", enumcl);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn8...");
                    if (!MarshalStructAsParam_AsSeqByRefIn8(ref sourceS5))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn8.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS5(sourceS5, cloneS5, "MarshalStructAsParam_AsSeqByRefIn8"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.StringStructSequentialAnsiId:
                    strOne = new String('a', 512);
                    strTwo = new String('b', 512);
                    StringStructSequentialAnsi source_sssa = Helper.NewStringStructSequentialAnsi(strOne, strTwo);
                    StringStructSequentialAnsi clone_sssa = Helper.NewStringStructSequentialAnsi(strOne, strTwo);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn9...");
                    if (!MarshalStructAsParam_AsSeqByRefIn9(ref source_sssa))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn9.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateStringStructSequentialAnsi(source_sssa, clone_sssa, "MarshalStructAsParam_AsSeqByRefIn9"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.StringStructSequentialUnicodeId:
                    strOne = new String('a', 256);
                    strTwo = new String('b', 256);
                    StringStructSequentialUnicode source_sssu = Helper.NewStringStructSequentialUnicode(strOne, strTwo);
                    StringStructSequentialUnicode clone_sssu = Helper.NewStringStructSequentialUnicode(strOne, strTwo);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn10...");
                    if (!MarshalStructAsParam_AsSeqByRefIn10(ref source_sssu))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn10.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateStringStructSequentialUnicode(source_sssu, clone_sssu, "MarshalStructAsParam_AsSeqByRefIn10"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S8Id:
                    S8 sourceS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
                    S8 cloneS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn11...");
                    if (!MarshalStructAsParam_AsSeqByRefIn11(ref sourceS8))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn11.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS8(sourceS8, cloneS8, "MarshalStructAsParam_AsSeqByRefIn11"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S9Id:
                    S9 sourceS9 = Helper.NewS9(128, new TestDelegate1(testMethod));
                    S9 cloneS9 = Helper.NewS9(128, new TestDelegate1(testMethod));

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn12...");
                    if (!MarshalStructAsParam_AsSeqByRefIn12(ref sourceS9))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn12.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS9(sourceS9, cloneS9, "MarshalStructAsParam_AsSeqByRefIn12"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.IncludeOuterIntergerStructSequentialId:
                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
                    IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn13...");
                    if (!MarshalStructAsParam_AsSeqByRefIn13(ref sourceIncludeOuterIntergerStructSequential))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn13.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, changeIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByRefIn13"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S11Id:
                    S11 sourceS11 = Helper.NewS11((int*)new Int32(), 32);
                    S11 changeS11 = Helper.NewS11((int*)(32), 64);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefIn14...");
                    if (!MarshalStructAsParam_AsSeqByRefIn14(ref sourceS11))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefIn14.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS11(sourceS11, changeS11, "MarshalStructAsParam_AsSeqByRefIn14"))
                    {
                        failures++;
                    }
                    break;    
                default:
                    Console.WriteLine("\tThere is not the struct id");
                    failures++;
                    break;    
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Unexpected Exception:" + e.ToString());
            failures++;
        }
    }
Ejemplo n.º 4
0
    private static void TestMethod_DelegatePInvoke_MarshalByVal_Stdcall(StructID structid)
    {
        Console.WriteLine("Delegate,Pinvoke,By Val,Stdcall");

        switch (structid)
        {
        case StructID.INNER2Id:
            INNER2 sourceINNER2 = Helper.NewINNER2(1, 1.0F, "some string");
            INNER2 cloneINNER2  = Helper.NewINNER2(1, 1.0F, "some string");
            DelegateStdcallByVal_INNER2 caller_INNER2 = Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr...");
            Assert.True(caller_INNER2(sourceINNER2));
            Assert.True(Helper.ValidateINNER2(sourceINNER2, cloneINNER2, "Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr"));
            break;

        case StructID.InnerExplicitId:
            InnerExplicit sourceInnerExplicit = new InnerExplicit();
            sourceInnerExplicit.f1 = 1;
            sourceInnerExplicit.f3 = "some string";
            InnerExplicit cloneInnerExplicit = new InnerExplicit();
            cloneInnerExplicit.f1 = 1;
            cloneInnerExplicit.f3 = "some string";
            DelegateStdcallByVal_InnerExplicit caller_InnerExplicit = Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr...");
            Assert.True(caller_InnerExplicit(sourceInnerExplicit));
            Assert.True(Helper.ValidateInnerExplicit(sourceInnerExplicit, cloneInnerExplicit, "Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr"));
            break;

        case StructID.InnerArrayExplicitId:
            InnerArrayExplicit sourceInnerArrayExplicit = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
            InnerArrayExplicit cloneInnerArrayExplicit  = Helper.NewInnerArrayExplicit(1, 1.0F, "some string1", "some string2");
            DelegateStdcallByVal_InnerArrayExplicit caller_InnerArrayExplicit = Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr...");
            Assert.True(caller_InnerArrayExplicit(sourceInnerArrayExplicit));
            Assert.True(Helper.ValidateInnerArrayExplicit(sourceInnerArrayExplicit, cloneInnerArrayExplicit, "Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr"));
            break;

        case StructID.OUTER3Id:
            OUTER3 sourceOUTER3 = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
            OUTER3 cloneOUTER3  = Helper.NewOUTER3(1, 1.0F, "some string", "some string");
            DelegateStdcallByVal_OUTER3 caller_OUTER3 = Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr...");
            Assert.True(caller_OUTER3(sourceOUTER3));
            Assert.True(Helper.ValidateOUTER3(sourceOUTER3, cloneOUTER3, "Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr"));
            break;

        case StructID.UId:
            U sourceU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
                                    byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
            U cloneU = Helper.NewU(Int32.MinValue, UInt32.MaxValue, new IntPtr(-32), new UIntPtr(32), short.MinValue, ushort.MaxValue,
                                   byte.MinValue, sbyte.MaxValue, long.MinValue, ulong.MaxValue, 32.0F, 3.2);
            DelegateStdcallByVal_U caller_U = Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr...");
            Assert.True(caller_U(sourceU));
            Assert.True(Helper.ValidateU(sourceU, cloneU, "Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr"));
            break;

        case StructID.ByteStructPack2ExplicitId:
            ByteStructPack2Explicit source_bspe = Helper.NewByteStructPack2Explicit(32, 32);
            ByteStructPack2Explicit clone_bspe  = Helper.NewByteStructPack2Explicit(32, 32);
            DelegateStdcallByVal_ByteStructPack2Explicit caller_ByteStructPack2Explicit = Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_ByteStructPack2Explicit(source_bspe));
            Assert.True(Helper.ValidateByteStructPack2Explicit(source_bspe, clone_bspe, "Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr"));
            break;

        case StructID.ShortStructPack4ExplicitId:
            ShortStructPack4Explicit source_sspe = Helper.NewShortStructPack4Explicit(32, 32);
            ShortStructPack4Explicit clone_sspe  = Helper.NewShortStructPack4Explicit(32, 32);
            DelegateStdcallByVal_ShortStructPack4Explicit caller_ShortStructPack4Explicit = Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_ShortStructPack4Explicit(source_sspe));
            Assert.True(Helper.ValidateShortStructPack4Explicit(source_sspe, clone_sspe, "Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr"));
            break;

        case StructID.IntStructPack8ExplicitId:
            IntStructPack8Explicit source_ispe = Helper.NewIntStructPack8Explicit(32, 32);
            IntStructPack8Explicit clone_ispe  = Helper.NewIntStructPack8Explicit(32, 32);
            DelegateStdcallByVal_IntStructPack8Explicit caller_IntStructPack8Explicit = Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_IntStructPack8Explicit(source_ispe));
            Assert.True(Helper.ValidateIntStructPack8Explicit(source_ispe, clone_ispe, "Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr"));
            break;

        case StructID.LongStructPack16ExplicitId:
            LongStructPack16Explicit source_lspe = Helper.NewLongStructPack16Explicit(32, 32);
            LongStructPack16Explicit clone_lspe  = Helper.NewLongStructPack16Explicit(32, 32);
            DelegateStdcallByVal_LongStructPack16Explicit caller_LongStructPack16Explicit = Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr();
            Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr...");
            Assert.True(caller_LongStructPack16Explicit(source_lspe));
            Assert.True(Helper.ValidateLongStructPack16Explicit(source_lspe, clone_lspe, "Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr"));
            break;

        default:
            Assert.True(false, "TestMethod_DelegatePInvoke_MarshalByRef_Stdcall:The structid (Managed Side) is wrong");
            break;
        }
    }
Ejemplo n.º 5
0
    unsafe private static void MarshalStructAsParam_AsSeqByRefOut(StructID id)
    {
        try
        {
            switch (id)
            {
                case StructID.InnerSequentialId:
                    InnerSequential source_is = Helper.NewInnerSequential(1, 1.0F, "some string");
                    InnerSequential change_is = Helper.NewInnerSequential(77, 77.0F, "changed string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut...");
                    if (!MarshalStructAsParam_AsSeqByRefOut(out source_is))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerSequential(source_is, change_is, "MarshalStructAsParam_AsSeqByRefOut"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.InnerArraySequentialId:
                    InnerArraySequential source_ias = Helper.NewInnerArraySequential(1, 1.0F, "some string");
                    InnerArraySequential change_ias = Helper.NewInnerArraySequential(77, 77.0F, "changed string");

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut2...");
                    if (!MarshalStructAsParam_AsSeqByRefOut2(out source_ias))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut2.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateInnerArraySequential(source_ias, change_ias, "MarshalStructAsParam_AsSeqByRefOut2"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.CharSetAnsiSequentialId:
                    CharSetAnsiSequential source_csas = Helper.NewCharSetAnsiSequential("some string", 'c');
                    CharSetAnsiSequential changeStr1 = Helper.NewCharSetAnsiSequential("change string", 'n');

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut3...");
                    if (!MarshalStructAsParam_AsSeqByRefOut3(out source_csas))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut3.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateCharSetAnsiSequential(source_csas, changeStr1, "MarshalStructAsParam_AsSeqByRefOut3"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.CharSetUnicodeSequentialId:
                    CharSetUnicodeSequential source_csus = Helper.NewCharSetUnicodeSequential("some string", 'c');
                    CharSetUnicodeSequential change_csus = Helper.NewCharSetUnicodeSequential("change string", 'n');

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut4...");
                    if (!MarshalStructAsParam_AsSeqByRefOut4(out source_csus))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut4.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateCharSetUnicodeSequential(source_csus, change_csus, "MarshalStructAsParam_AsSeqByRefOut4"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.NumberSequentialId:
                    NumberSequential source_ns = Helper.NewNumberSequential(Int32.MinValue, UInt32.MaxValue, short.MinValue, ushort.MaxValue, byte.MinValue, sbyte.MaxValue, Int16.MinValue, UInt16.MaxValue, -1234567890, 1234567890, 32.0F, 3.2);
                    NumberSequential change_ns = Helper.NewNumberSequential(0, 32, 0, 16, 0, 8, 0, 16, 0, 64, 64.0F, 6.4);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut6...");
                    if (!MarshalStructAsParam_AsSeqByRefOut6(out source_ns))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut6.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateNumberSequential(source_ns, change_ns, "MarshalStructAsParam_AsSeqByRefOut6"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S3Id:
                    int[] iarr = new int[256];
                    int[] icarr = new int[256];
                    InitialArray(iarr, icarr);

                    S3 sourceS3 = Helper.NewS3(true, "some string", iarr);
                    S3 changeS3 = Helper.NewS3(false, "change string", icarr);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut7...");
                    if (!MarshalStructAsParam_AsSeqByRefOut7(out sourceS3))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut7.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS3(sourceS3, changeS3, "MarshalStructAsParam_AsSeqByRefOut7"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S5Id:
                    Enum1 enums = Enum1.e1;
                    Enum1 enumch = Enum1.e2;
                    S5 sourceS5 = Helper.NewS5(32, "some string", enums);
                    S5 changeS5 = Helper.NewS5(64, "change string", enumch);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut8...");
                    if (!MarshalStructAsParam_AsSeqByRefOut8(out sourceS5))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut8.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS5(sourceS5, changeS5, "MarshalStructAsParam_AsSeqByRefOut8"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.StringStructSequentialAnsiId:
                    strOne = new String('a', 512);
                    strTwo = new String('b', 512);
                    StringStructSequentialAnsi source_sssa = Helper.NewStringStructSequentialAnsi(strOne, strTwo);
                    StringStructSequentialAnsi change_sssa = Helper.NewStringStructSequentialAnsi(strTwo, strOne);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut9...");
                    if (!MarshalStructAsParam_AsSeqByRefOut9(out source_sssa))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut9.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateStringStructSequentialAnsi(source_sssa, change_sssa, "MarshalStructAsParam_AsSeqByRefOut9"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.StringStructSequentialUnicodeId:
                    strOne = new String('a', 256);
                    strTwo = new String('b', 256);
                    StringStructSequentialUnicode source_sssu = Helper.NewStringStructSequentialUnicode(strOne, strTwo);
                    StringStructSequentialUnicode change_sssu = Helper.NewStringStructSequentialUnicode(strTwo, strOne);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut10...");
                    if (!MarshalStructAsParam_AsSeqByRefOut10(out source_sssu))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut10.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateStringStructSequentialUnicode(source_sssu, change_sssu, "MarshalStructAsParam_AsSeqByRefOut10"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S8Id:
                    S8 sourceS8 = Helper.NewS8("hello", true, 10, 128, 128, 32);
                    S8 changeS8 = Helper.NewS8("world", false, 1, 256, 256, 64);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut11...");
                    if (!MarshalStructAsParam_AsSeqByRefOut11(out sourceS8))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut11.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS8(sourceS8, changeS8, "MarshalStructAsParam_AsSeqByRefOut11"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S9Id:
                    S9 sourceS9 = Helper.NewS9(128, new TestDelegate1(testMethod));

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut12...");
                    if (!MarshalStructAsParam_AsSeqByRefOut12(out sourceS9))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut12.Expected:True;Actual:False");
                        failures++;
                    }
                    else if (sourceS9.i32 != 256 || sourceS9.myDelegate1 == null)
                    {
                        Console.WriteLine("\tFAILED! Native to Managed failed in MarshalStructAsParam_AsSeqByRefOut12.");
                        failures++;
                    }
                    else
                    {
                        Console.WriteLine("\tPASSED!");
                    }
                    break;    
                case StructID.IncludeOuterIntergerStructSequentialId:
                    IncludeOuterIntergerStructSequential sourceIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(32, 32);
                    IncludeOuterIntergerStructSequential changeIncludeOuterIntergerStructSequential = Helper.NewIncludeOuterIntergerStructSequential(64, 64);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut13...");
                    if (!MarshalStructAsParam_AsSeqByRefOut13(out sourceIncludeOuterIntergerStructSequential))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut13.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateIncludeOuterIntergerStructSequential(sourceIncludeOuterIntergerStructSequential, changeIncludeOuterIntergerStructSequential, "MarshalStructAsParam_AsSeqByRefOut13"))
                    {
                        failures++;
                    }
                    break;    
                case StructID.S11Id:
                    S11 sourceS11 = Helper.NewS11((int*)new Int32(), 32);
                    S11 changeS11 = Helper.NewS11((int*)(32), 64);

                    Console.WriteLine("\tCalling MarshalStructAsParam_AsSeqByRefOut14...");
                    if (!MarshalStructAsParam_AsSeqByRefOut14(out sourceS11))
                    {
                        Console.WriteLine("\tFAILED! Managed to Native failed in MarshalStructAsParam_AsSeqByRefOut14.Expected:True;Actual:False");
                        failures++;
                    }
                    if (!Helper.ValidateS11(sourceS11, changeS11, "MarshalStructAsParam_AsSeqByRefOut14"))
                    {
                        failures++;
                    }
                    break;  
                default:
                    Console.WriteLine("\tThere is not the struct id");
                    failures++;
                    break;
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Unexpected Exception:" + e.ToString());
            failures++;
        }
    }