2 using System
.Runtime
.InteropServices
;
4 public class marshalbool
6 [DllImport ("libtest")]
7 static extern int mono_test_marshal_bool_in (int arg
, uint expected
,
9 [MarshalAs (UnmanagedType
.Bool
)] bool bBoolCustMarsh
,
10 [MarshalAs (UnmanagedType
.I1
)] bool bI1CustMarsh
,
11 [MarshalAs (UnmanagedType
.U1
)] bool bU1CustMarsh
,
12 [MarshalAs (UnmanagedType
.VariantBool
)] bool bVBCustMarsh
);
14 [DllImport ("libtest")]
15 static extern int mono_test_marshal_bool_out (int arg
, uint testVal
,
16 out bool bDefaultMarsh
,
17 [MarshalAs (UnmanagedType
.Bool
)] out bool bBoolCustMarsh
,
18 [MarshalAs (UnmanagedType
.I1
)] out bool bI1CustMarsh
,
19 [MarshalAs (UnmanagedType
.U1
)] out bool bU1CustMarsh
,
20 [MarshalAs (UnmanagedType
.VariantBool
)] out bool bVBCustMarsh
);
22 [DllImport ("libtest")]
23 static extern int mono_test_marshal_bool_ref (int arg
, uint expected
, uint testVal
,
24 ref bool bDefaultMarsh
,
25 [MarshalAs (UnmanagedType
.Bool
)] ref bool bBoolCustMarsh
,
26 [MarshalAs (UnmanagedType
.I1
)] ref bool bI1CustMarsh
,
27 [MarshalAs (UnmanagedType
.U1
)] ref bool bU1CustMarsh
,
28 [MarshalAs (UnmanagedType
.VariantBool
)] ref bool bVBCustMarsh
);
30 delegate int MarshalBoolInDelegate (int arg
, uint expected
,
32 [MarshalAs (UnmanagedType
.Bool
)] bool bBoolCustMarsh
,
33 [MarshalAs (UnmanagedType
.I1
)] bool bI1CustMarsh
,
34 [MarshalAs (UnmanagedType
.U1
)] bool bU1CustMarsh
,
35 [MarshalAs (UnmanagedType
.VariantBool
)] bool bVBCustMarsh
);
37 delegate int MarshalBoolOutDelegate (int arg
, uint testVal
,
38 out bool bDefaultMarsh
,
39 [MarshalAs (UnmanagedType
.Bool
)] out bool bBoolCustMarsh
,
40 [MarshalAs (UnmanagedType
.I1
)] out bool bI1CustMarsh
,
41 [MarshalAs (UnmanagedType
.U1
)] out bool bU1CustMarsh
,
42 [MarshalAs (UnmanagedType
.VariantBool
)] out bool bVBCustMarsh
);
44 delegate int MarshalBoolRefDelegate (int arg
, uint expected
, uint testVal
,
45 ref bool bDefaultMarsh
,
46 [MarshalAs (UnmanagedType
.Bool
)] ref bool bBoolCustMarsh
,
47 [MarshalAs (UnmanagedType
.I1
)] ref bool bI1CustMarsh
,
48 [MarshalAs (UnmanagedType
.U1
)] ref bool bU1CustMarsh
,
49 [MarshalAs (UnmanagedType
.VariantBool
)] ref bool bVBCustMarsh
);
51 [DllImport ("libtest")]
52 static extern int mono_test_managed_marshal_bool_in (int arg
, uint expected
, uint testVal
, MarshalBoolInDelegate fcn
);
54 [DllImport ("libtest")]
55 static extern int mono_test_managed_marshal_bool_out (int arg
, uint expected
, uint testVal
, MarshalBoolOutDelegate fcn
);
57 [DllImport ("libtest")]
58 static extern int mono_test_managed_marshal_bool_ref (int arg
, uint expected
, uint testVal
,
59 uint outExpected
, uint outTestVal
, MarshalBoolRefDelegate fcn
);
61 static int Main (string[] args
)
63 return TestDriver
.RunTests (typeof (marshalbool
), args
);
66 unsafe public static int test_0_Default_In_Native ()
70 ret
= mono_test_marshal_bool_in (1, 0, false, false, false, false, false);
73 ret
= mono_test_marshal_bool_in (1, 1, true, false, false, false, false);
78 bool* ptestVal
= &testVal
;
80 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
81 ret
= mono_test_marshal_bool_in (1, 1, testVal
, false, false, false, false);
88 unsafe public static int test_0_Bool_In_Native ()
92 ret
= mono_test_marshal_bool_in (2, 0, false, false, false, false, false);
95 ret
= mono_test_marshal_bool_in (2, 1, false, true, false, false, false);
100 bool* ptestVal
= &testVal
;
102 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
103 ret
= mono_test_marshal_bool_in (2, 1, false, testVal
, false, false, false);
110 unsafe public static int test_0_I1_In_Native ()
114 ret
= mono_test_marshal_bool_in (3, 0, false, false, false, false, false);
117 ret
= mono_test_marshal_bool_in (3, 1, false, false, true, false, false);
121 bool testVal
= false;
122 bool* ptestVal
= &testVal
;
124 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
125 ret
= mono_test_marshal_bool_in (3, 1, false, false, testVal
, false, false);
132 unsafe public static int test_0_U1_In_Native ()
136 ret
= mono_test_marshal_bool_in (4, 0, false, false, false, false, false);
139 ret
= mono_test_marshal_bool_in (4, 1, false, false, false, true, false);
143 bool testVal
= false;
144 bool* ptestVal
= &testVal
;
146 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
147 ret
= mono_test_marshal_bool_in (4, 1, false, false, false, testVal
, false);
154 unsafe public static int test_0_VariantBool_In_Native ()
159 ret
= mono_test_marshal_bool_in (5, 0, false, false, false, false, false);
162 ret
= mono_test_marshal_bool_in (5, (uint)m1
, false, false, false, false, true);
166 bool testVal
= false;
167 bool* ptestVal
= &testVal
;
169 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
170 ret
= mono_test_marshal_bool_in (5, (uint)m1
, false, false, false, false, testVal
);
177 unsafe public static int test_0_Default_Out_Native ()
179 bool testVal
= false;
180 bool* ptestVal
= &testVal
;
184 ret
= mono_test_marshal_bool_out (1, 0, out testVal
, out d
, out d
, out d
, out d
);
190 ret
= mono_test_marshal_bool_out (1, 1, out testVal
, out d
, out d
, out d
, out d
);
193 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
196 ret
= mono_test_marshal_bool_out (1, 0x22000000, out testVal
, out d
, out d
, out d
, out d
);
199 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
205 unsafe public static int test_0_Bool_Out_Native ()
207 bool testVal
= false;
208 bool* ptestVal
= &testVal
;
212 ret
= mono_test_marshal_bool_out (2, 0, out d
, out testVal
, out d
, out d
, out d
);
218 ret
= mono_test_marshal_bool_out (2, 1, out d
, out testVal
, out d
, out d
, out d
);
221 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
224 ret
= mono_test_marshal_bool_out (2, 0x22000000, out d
, out testVal
, out d
, out d
, out d
);
227 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
233 unsafe public static int test_0_I1_Out_Native ()
235 bool testVal
= false;
236 bool* ptestVal
= &testVal
;
240 ret
= mono_test_marshal_bool_out (3, 0, out d
, out d
, out testVal
, out d
, out d
);
246 ret
= mono_test_marshal_bool_out (3, 1, out d
, out d
, out testVal
, out d
, out d
);
249 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
252 ret
= mono_test_marshal_bool_out (3, 0x22, out d
, out d
, out testVal
, out d
, out d
);
255 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
261 unsafe public static int test_0_U1_Out_Native ()
263 bool testVal
= false;
264 bool* ptestVal
= &testVal
;
268 ret
= mono_test_marshal_bool_out (4, 0, out d
, out d
, out d
, out testVal
, out d
);
274 ret
= mono_test_marshal_bool_out (4, 1, out d
, out d
, out d
, out testVal
, out d
);
277 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
280 ret
= mono_test_marshal_bool_out (4, 0x22, out d
, out d
, out d
, out testVal
, out d
);
283 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
289 unsafe public static int test_0_VariantBool_Out_Native ()
291 bool testVal
= false;
292 bool* ptestVal
= &testVal
;
296 ret
= mono_test_marshal_bool_out (5, 0, out d
, out d
, out d
, out d
, out testVal
);
302 ret
= mono_test_marshal_bool_out (5, 1, out d
, out d
, out d
, out d
, out testVal
);
305 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
308 ret
= mono_test_marshal_bool_out (5, 0x2200, out d
, out d
, out d
, out d
, out testVal
);
311 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
317 unsafe public static int test_0_Default_Ref_Native ()
319 bool testVal
= false;
320 bool* ptestVal
= &testVal
;
324 ret
= mono_test_marshal_bool_ref (1, 0, 0, ref testVal
, ref d
, ref d
, ref d
, ref d
);
330 ret
= mono_test_marshal_bool_ref (1, 0, 1, ref testVal
, ref d
, ref d
, ref d
, ref d
);
333 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
336 ret
= mono_test_marshal_bool_ref (1, 1, 0, ref testVal
, ref d
, ref d
, ref d
, ref d
);
343 ret
= mono_test_marshal_bool_ref (1, 1, 1, ref testVal
, ref d
, ref d
, ref d
, ref d
);
346 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
350 ret
= mono_test_marshal_bool_ref (1, 0, 0x22000000, ref testVal
, ref d
, ref d
, ref d
, ref d
);
353 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
356 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
357 ret
= mono_test_marshal_bool_ref (1, 1, 0, ref testVal
, ref d
, ref d
, ref d
, ref d
);
363 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
364 ret
= mono_test_marshal_bool_ref (1, 1, 0x22000000, ref testVal
, ref d
, ref d
, ref d
, ref d
);
367 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
373 unsafe public static int test_0_Bool_Ref_Native ()
375 bool testVal
= false;
376 bool* ptestVal
= &testVal
;
380 ret
= mono_test_marshal_bool_ref (2, 0, 0, ref d
, ref testVal
, ref d
, ref d
, ref d
);
386 ret
= mono_test_marshal_bool_ref (2, 0, 1, ref d
, ref testVal
, ref d
, ref d
, ref d
);
389 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
392 ret
= mono_test_marshal_bool_ref (2, 1, 0, ref d
, ref testVal
, ref d
, ref d
, ref d
);
399 ret
= mono_test_marshal_bool_ref (2, 1, 1, ref d
, ref testVal
, ref d
, ref d
, ref d
);
402 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
406 ret
= mono_test_marshal_bool_ref (2, 0, 0x22000000, ref d
, ref testVal
, ref d
, ref d
, ref d
);
409 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
412 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
413 ret
= mono_test_marshal_bool_ref (2, 1, 0, ref d
, ref testVal
, ref d
, ref d
, ref d
);
419 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
420 ret
= mono_test_marshal_bool_ref (2, 1, 0x22000000, ref d
, ref testVal
, ref d
, ref d
, ref d
);
423 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
429 unsafe public static int test_0_I1_Ref_Native ()
431 bool testVal
= false;
432 bool* ptestVal
= &testVal
;
436 ret
= mono_test_marshal_bool_ref (3, 0, 0, ref d
, ref d
, ref testVal
, ref d
, ref d
);
442 ret
= mono_test_marshal_bool_ref (3, 0, 1, ref d
, ref d
, ref testVal
, ref d
, ref d
);
445 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
448 ret
= mono_test_marshal_bool_ref (3, 1, 0, ref d
, ref d
, ref testVal
, ref d
, ref d
);
455 ret
= mono_test_marshal_bool_ref (3, 1, 1, ref d
, ref d
, ref testVal
, ref d
, ref d
);
458 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
462 ret
= mono_test_marshal_bool_ref (3, 0, 0x22, ref d
, ref d
, ref testVal
, ref d
, ref d
);
465 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
468 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
469 ret
= mono_test_marshal_bool_ref (3, 1, 0, ref d
, ref d
, ref testVal
, ref d
, ref d
);
475 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
476 ret
= mono_test_marshal_bool_ref (3, 1, 0x22, ref d
, ref d
, ref testVal
, ref d
, ref d
);
479 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
485 unsafe public static int test_0_U1_Ref_Native ()
487 bool testVal
= false;
488 bool* ptestVal
= &testVal
;
492 ret
= mono_test_marshal_bool_ref (4, 0, 0, ref d
, ref d
, ref d
, ref testVal
, ref d
);
498 ret
= mono_test_marshal_bool_ref (4, 0, 1, ref d
, ref d
, ref d
, ref testVal
, ref d
);
501 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
504 ret
= mono_test_marshal_bool_ref (4, 1, 0, ref d
, ref d
, ref d
, ref testVal
, ref d
);
511 ret
= mono_test_marshal_bool_ref (4, 1, 1, ref d
, ref d
, ref d
, ref testVal
, ref d
);
514 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
518 ret
= mono_test_marshal_bool_ref (4, 0, 0x22, ref d
, ref d
, ref d
, ref testVal
, ref d
);
521 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
524 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
525 ret
= mono_test_marshal_bool_ref (4, 1, 0, ref d
, ref d
, ref d
, ref testVal
, ref d
);
531 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
532 ret
= mono_test_marshal_bool_ref (4, 1, 0x22, ref d
, ref d
, ref d
, ref testVal
, ref d
);
535 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
541 unsafe public static int test_0_VariantBool_Ref_Native ()
543 bool testVal
= false;
544 bool* ptestVal
= &testVal
;
548 ret
= mono_test_marshal_bool_ref (5, 0, 0, ref d
, ref d
, ref d
, ref d
, ref testVal
);
554 ret
= mono_test_marshal_bool_ref (5, 0, 1, ref d
, ref d
, ref d
, ref d
, ref testVal
);
557 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
560 ret
= mono_test_marshal_bool_ref (5, 0xFFFF, 0, ref d
, ref d
, ref d
, ref d
, ref testVal
);
567 ret
= mono_test_marshal_bool_ref (5, 0xFFFF, 1, ref d
, ref d
, ref d
, ref d
, ref testVal
);
570 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
574 ret
= mono_test_marshal_bool_ref (5, 0, 0x2200, ref d
, ref d
, ref d
, ref d
, ref testVal
);
577 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
580 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
581 ret
= mono_test_marshal_bool_ref (5, 0xFFFF, 0, ref d
, ref d
, ref d
, ref d
, ref testVal
);
587 Marshal
.WriteByte ((IntPtr
)ptestVal
, 0x22);
588 ret
= mono_test_marshal_bool_ref (5, 0xFFFF, 0x2200, ref d
, ref d
, ref d
, ref d
, ref testVal
);
591 if (1 != Marshal
.ReadByte ((IntPtr
)ptestVal
))
597 public static int test_0_Default_In_Managed ()
599 MarshalBoolInDelegate fcn
= new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper
);
602 ret
= mono_test_managed_marshal_bool_in (1, 0, 0, fcn
);
605 ret
= mono_test_managed_marshal_bool_in (1, 1, 1, fcn
);
608 ret
= mono_test_managed_marshal_bool_in (1, 1, 0x22000000, fcn
);
614 public static int test_0_Bool_In_Managed ()
616 MarshalBoolInDelegate fcn
= new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper
);
619 ret
= mono_test_managed_marshal_bool_in (2, 0, 0, fcn
);
622 ret
= mono_test_managed_marshal_bool_in (2, 1, 1, fcn
);
625 ret
= mono_test_managed_marshal_bool_in (2, 1, 0x22000000, fcn
);
631 public static int test_0_I1_In_Managed ()
633 MarshalBoolInDelegate fcn
= new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper
);
636 ret
= mono_test_managed_marshal_bool_in (3, 0, 0, fcn
);
639 ret
= mono_test_managed_marshal_bool_in (3, 1, 1, fcn
);
642 ret
= mono_test_managed_marshal_bool_in (3, 1, 0x22, fcn
);
648 public static int test_0_U1_In_Managed ()
650 MarshalBoolInDelegate fcn
= new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper
);
653 ret
= mono_test_managed_marshal_bool_in (4, 0, 0, fcn
);
656 ret
= mono_test_managed_marshal_bool_in (4, 1, 1, fcn
);
659 ret
= mono_test_managed_marshal_bool_in (4, 1, 0x22, fcn
);
665 public static int test_0_VariantBool_In_Managed ()
667 MarshalBoolInDelegate fcn
= new MarshalBoolInDelegate (new marshalbool ().MarshalBoolInHelper
);
670 ret
= mono_test_managed_marshal_bool_in (5, 0, 0, fcn
);
673 ret
= mono_test_managed_marshal_bool_in (5, 1, 0xFFFF, fcn
);
676 ret
= mono_test_managed_marshal_bool_in (5, 1, 0x22, fcn
);
682 public static int test_0_Default_Out_Managed ()
684 MarshalBoolOutDelegate fcn
= new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper
);
687 ret
= mono_test_managed_marshal_bool_out (1, 0, 0, fcn
);
689 return 0x010000 + ret
;
690 ret
= mono_test_managed_marshal_bool_out (1, 1, 1, fcn
);
692 return 0x020000 + ret
;
693 ret
= mono_test_managed_marshal_bool_out (1, 1, 0x22, fcn
);
695 return 0x030000 + ret
;
699 public static int test_0_Bool_Out_Managed ()
701 MarshalBoolOutDelegate fcn
= new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper
);
704 ret
= mono_test_managed_marshal_bool_out (2, 0, 0, fcn
);
706 return 0x010000 + ret
;
707 ret
= mono_test_managed_marshal_bool_out (2, 1, 1, fcn
);
709 return 0x020000 + ret
;
710 ret
= mono_test_managed_marshal_bool_out (2, 1, 0x22, fcn
);
712 return 0x030000 + ret
;
716 public static int test_0_I1_Out_Managed ()
718 MarshalBoolOutDelegate fcn
= new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper
);
721 ret
= mono_test_managed_marshal_bool_out (3, 0, 0, fcn
);
723 return 0x010000 + ret
;
724 ret
= mono_test_managed_marshal_bool_out (3, 1, 1, fcn
);
726 return 0x020000 + ret
;
727 ret
= mono_test_managed_marshal_bool_out (3, 1, 0x22, fcn
);
729 return 0x030000 + ret
;
733 public static int test_0_U1_Out_Managed ()
735 MarshalBoolOutDelegate fcn
= new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper
);
738 ret
= mono_test_managed_marshal_bool_out (4, 0, 0, fcn
);
740 return 0x010000 + ret
;
741 ret
= mono_test_managed_marshal_bool_out (4, 1, 1, fcn
);
743 return 0x020000 + ret
;
744 ret
= mono_test_managed_marshal_bool_out (4, 1, 0x22, fcn
);
746 return 0x030000 + ret
;
750 public static int test_0_VariantBool_Out_Managed ()
752 MarshalBoolOutDelegate fcn
= new MarshalBoolOutDelegate (new marshalbool ().MarshalBoolOutHelper
);
755 ret
= mono_test_managed_marshal_bool_out (5, 0, 0, fcn
);
757 return 0x010000 + ret
;
758 ret
= mono_test_managed_marshal_bool_out (5, 0xFFFF, 1, fcn
);
760 return 0x020000 + ret
;
761 ret
= mono_test_managed_marshal_bool_out (5, 0xFFFF, 0x22, fcn
);
763 return 0x030000 + ret
;
767 public static int test_0_Default_Ref_Managed ()
769 MarshalBoolRefDelegate fcn
= new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper
);
772 ret
= mono_test_managed_marshal_bool_ref (1, 0, 0, 0, 0, fcn
);
774 return 0x010000 + ret
;
775 ret
= mono_test_managed_marshal_bool_ref (1, 1, 1, 0, 0, fcn
);
777 return 0x020000 + ret
;
778 ret
= mono_test_managed_marshal_bool_ref (1, 0, 0, 1, 1, fcn
);
780 return 0x030000 + ret
;
781 ret
= mono_test_managed_marshal_bool_ref (1, 1, 1, 1, 1, fcn
);
783 return 0x040000 + ret
;
784 ret
= mono_test_managed_marshal_bool_ref (1, 1, 0x22000000, 0, 0, fcn
);
786 return 0x050000 + ret
;
787 ret
= mono_test_managed_marshal_bool_ref (1, 0, 0, 1, 0x22, fcn
);
789 return 0x060000 + ret
;
790 ret
= mono_test_managed_marshal_bool_ref (1, 1, 0x22000000, 1, 0x22, fcn
);
792 return 0x070000 + ret
;
796 public static int test_0_Bool_Ref_Managed ()
798 MarshalBoolRefDelegate fcn
= new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper
);
801 ret
= mono_test_managed_marshal_bool_ref (2, 0, 0, 0, 0, fcn
);
803 return 0x010000 + ret
;
804 ret
= mono_test_managed_marshal_bool_ref (2, 1, 1, 0, 0, fcn
);
806 return 0x020000 + ret
;
807 ret
= mono_test_managed_marshal_bool_ref (2, 0, 0, 1, 1, fcn
);
809 return 0x030000 + ret
;
810 ret
= mono_test_managed_marshal_bool_ref (2, 1, 1, 1, 1, fcn
);
812 return 0x040000 + ret
;
813 ret
= mono_test_managed_marshal_bool_ref (2, 1, 0x22000000, 0, 0, fcn
);
815 return 0x050000 + ret
;
816 ret
= mono_test_managed_marshal_bool_ref (2, 0, 0, 1, 0x22, fcn
);
818 return 0x060000 + ret
;
819 ret
= mono_test_managed_marshal_bool_ref (2, 1, 0x22000000, 1, 0x22, fcn
);
821 return 0x070000 + ret
;
825 public static int test_0_I1_Ref_Managed ()
827 MarshalBoolRefDelegate fcn
= new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper
);
830 ret
= mono_test_managed_marshal_bool_ref (3, 0, 0, 0, 0, fcn
);
832 return 0x010000 + ret
;
833 ret
= mono_test_managed_marshal_bool_ref (3, 1, 1, 0, 0, fcn
);
835 return 0x020000 + ret
;
836 ret
= mono_test_managed_marshal_bool_ref (3, 0, 0, 1, 1, fcn
);
838 return 0x030000 + ret
;
839 ret
= mono_test_managed_marshal_bool_ref (3, 1, 1, 1, 1, fcn
);
841 return 0x040000 + ret
;
842 ret
= mono_test_managed_marshal_bool_ref (3, 1, 0x22, 0, 0, fcn
);
844 return 0x050000 + ret
;
845 ret
= mono_test_managed_marshal_bool_ref (3, 0, 0, 1, 0x22, fcn
);
847 return 0x060000 + ret
;
848 ret
= mono_test_managed_marshal_bool_ref (3, 1, 0x22, 1, 0x22, fcn
);
850 return 0x070000 + ret
;
854 public static int test_0_U1_Ref_Managed ()
856 MarshalBoolRefDelegate fcn
= new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper
);
859 ret
= mono_test_managed_marshal_bool_ref (4, 0, 0, 0, 0, fcn
);
861 return 0x010000 + ret
;
862 ret
= mono_test_managed_marshal_bool_ref (4, 1, 1, 0, 0, fcn
);
864 return 0x020000 + ret
;
865 ret
= mono_test_managed_marshal_bool_ref (4, 0, 0, 1, 1, fcn
);
867 return 0x030000 + ret
;
868 ret
= mono_test_managed_marshal_bool_ref (4, 1, 1, 1, 1, fcn
);
870 return 0x040000 + ret
;
871 ret
= mono_test_managed_marshal_bool_ref (4, 1, 0x22, 0, 0, fcn
);
873 return 0x050000 + ret
;
874 ret
= mono_test_managed_marshal_bool_ref (4, 0, 0, 1, 0x22, fcn
);
876 return 0x060000 + ret
;
877 ret
= mono_test_managed_marshal_bool_ref (4, 1, 0x22, 1, 0x22, fcn
);
879 return 0x070000 + ret
;
883 public static int test_0_VariantBool_Ref_Managed ()
885 MarshalBoolRefDelegate fcn
= new MarshalBoolRefDelegate (new marshalbool ().MarshalBoolRefHelper
);
888 ret
= mono_test_managed_marshal_bool_ref (5, 0, 0, 0, 0, fcn
);
890 return 0x010000 + ret
;
891 ret
= mono_test_managed_marshal_bool_ref (5, 1, 0xFFFF, 0, 0, fcn
);
893 return 0x020000 + ret
;
894 ret
= mono_test_managed_marshal_bool_ref (5, 0, 0, 0xFFFF, 1, fcn
);
896 return 0x030000 + ret
;
897 ret
= mono_test_managed_marshal_bool_ref (5, 1, 0xFFFF, 0xFFFF, 1, fcn
);
899 return 0x040000 + ret
;
900 ret
= mono_test_managed_marshal_bool_ref (5, 1, 0x2200, 0, 0, fcn
);
902 return 0x050000 + ret
;
903 ret
= mono_test_managed_marshal_bool_ref (5, 0, 0, 0xFFFF, 0x22, fcn
);
905 return 0x060000 + ret
;
906 ret
= mono_test_managed_marshal_bool_ref (5, 1, 0x2200, 0xFFFF, 0x22, fcn
);
908 return 0x070000 + ret
;
912 ///////////////////////////////////////////////////////////////////
914 unsafe int MarshalBoolInHelper (int arg
, uint expected
, bool bDefaultMarsh
, bool bBoolCustMarsh
, bool bI1CustMarsh
,
915 bool bU1CustMarsh
, bool bVBCustMarsh
)
920 ptestVal
= &bDefaultMarsh
;
921 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
925 ptestVal
= &bBoolCustMarsh
;
926 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
930 ptestVal
= &bI1CustMarsh
;
931 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
935 ptestVal
= &bU1CustMarsh
;
936 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
940 ptestVal
= &bVBCustMarsh
;
941 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
950 unsafe int MarshalBoolOutHelper (int arg
, uint testVal
, out bool bDefaultMarsh
, out bool bBoolCustMarsh
,
951 out bool bI1CustMarsh
, out bool bU1CustMarsh
, out bool bVBCustMarsh
)
953 bDefaultMarsh
= bBoolCustMarsh
= bI1CustMarsh
= bU1CustMarsh
= bVBCustMarsh
= false;
956 fixed (bool*ptestVal
= &bDefaultMarsh
)
958 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
962 fixed (bool*ptestVal
= &bBoolCustMarsh
)
964 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
968 fixed (bool*ptestVal
= &bI1CustMarsh
)
970 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
974 fixed (bool*ptestVal
= &bU1CustMarsh
)
976 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
980 fixed (bool*ptestVal
= &bVBCustMarsh
)
982 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
991 unsafe int MarshalBoolRefHelper (int arg
, uint expected
, uint testVal
, ref bool bDefaultMarsh
, ref bool bBoolCustMarsh
,
992 ref bool bI1CustMarsh
, ref bool bU1CustMarsh
, ref bool bVBCustMarsh
)
996 fixed (bool*ptestVal
= &bDefaultMarsh
)
998 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
1000 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
1004 fixed (bool*ptestVal
= &bBoolCustMarsh
)
1006 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
1008 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
1012 fixed (bool*ptestVal
= &bI1CustMarsh
)
1014 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
1016 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
1020 fixed (bool*ptestVal
= &bU1CustMarsh
)
1022 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
1024 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);
1028 fixed (bool*ptestVal
= &bVBCustMarsh
)
1030 if (expected
!= Marshal
.ReadByte ((IntPtr
)ptestVal
))
1032 Marshal
.WriteByte ((IntPtr
)ptestVal
, (byte)testVal
);