1#include "MarshalStructAsParamDLL.h"
2
3///////////////////////////////////////////////////////////////////////////////////
4// EXPORTED METHODS
5///////////////////////////////////////////////////////////////////////////////////
6extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal(InnerSequential inner)
7{
8 if(!IsCorrectInnerSequential(&inner))
9 {
10 printf("\tMarshalStructAsParam_AsSeqByVal: InnerSequential param not as expected\n");
11 PrintInnerSequential(&inner,"inner");
12 return FALSE;
13 }
14 ChangeInnerSequential(&inner);
15 return TRUE;
16}
17
18extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef(InnerSequential* inner)
19{
20 if(!IsCorrectInnerSequential(inner))
21 {
22 printf("\tMarshalStructAsParam_AsSeqByRef: InnerSequential param not as expected\n");
23 PrintInnerSequential(inner,"inner");
24 return FALSE;
25 }
26 ChangeInnerSequential(inner);
27 return TRUE;
28}
29extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn(InnerSequential* inner)
30{
31 if(!IsCorrectInnerSequential(inner))
32 {
33 printf("\tMarshalStructAsParam_AsSeqByRefIn: InnerSequential param not as expected\n");
34 PrintInnerSequential(inner,"inner");
35 return FALSE;
36 }
37 ChangeInnerSequential(inner);
38 return TRUE;
39}
40
41extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut(InnerSequential inner)
42{
43 if(!IsCorrectInnerSequential(&inner))
44 {
45 printf("\tMarshalStructAsParam_AsSeqByValOut:NNER param not as expected\n");
46 PrintInnerSequential(&inner,"inner");
47 return FALSE;
48 }
49 ChangeInnerSequential(&inner);
50 return TRUE;
51}
52
53extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut(InnerSequential* inner)
54{
55 ChangeInnerSequential(inner);
56 return TRUE;
57}
58
59///////////////////////////////////////////////////////////////////////////////////////////
60extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal2(InnerArraySequential outer)
61{
62 if(!IsCorrectInnerArraySequential(&outer))
63 {
64 printf("\tMarshalStructAsParam_AsSeqByVal2: InnerArraySequential param not as expected\n");
65 PrintInnerArraySequential(&outer,"outer");
66 return FALSE;
67 }
68 ChangeInnerArraySequential(&outer);
69 return TRUE;
70}
71
72extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef2(InnerArraySequential* outer)
73{
74 if(!IsCorrectInnerArraySequential(outer))
75 {
76 printf("\tMarshalStructAsParam_AsSeqByRef2: InnerArraySequential param not as expected\n");
77 PrintInnerArraySequential(outer,"outer");
78 return FALSE;
79 }
80 ChangeInnerArraySequential(outer);
81 return TRUE;
82}
83extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn2(InnerArraySequential* outer)
84{
85 if(!IsCorrectInnerArraySequential(outer))
86 {
87 printf("\tMarshalStructAsParam_AsSeqByRefIn2: InnerArraySequential param not as expected\n");
88 PrintInnerArraySequential(outer,"inner");
89 return FALSE;
90 }
91 ChangeInnerArraySequential(outer);
92 return TRUE;
93}
94extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut2(InnerArraySequential outer)
95{
96 if(!IsCorrectInnerArraySequential(&outer))
97 {
98 printf("\tMarshalStructAsParam_AsSeqByVal2:InnerArraySequential param not as expected\n");
99 PrintInnerArraySequential(&outer,"outer");
100 return FALSE;
101 }
102 for(int i = 0; i < NumArrElements; i++)
103 {
104 outer.arr[i].f1 = 77;
105 outer.arr[i].f2 = 77.0;
106 }
107 return TRUE;
108}
109extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut2(InnerArraySequential* outer)
110{
111 for(int i = 0;i<NumArrElements;i++)
112 {
113 if(outer->arr[i].f1 != 0 || outer->arr[i].f2 != 0.0)
114 {
115 printf("\tMarshalStructAsParam_AsSeqByRefOut2: InnerArraySequential param not as expected\n");
116 return FALSE;
117 }
118 }
119 ChangeInnerArraySequential(outer);
120 return TRUE;
121}
122
123////////////////////////////////////////////////////////////////////////////////////////////////
124extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal3(CharSetAnsiSequential str1)
125{
126 if(!IsCorrectCharSetAnsiSequential(&str1))
127 {
128 printf("\tMarshalStructAsParam_AsSeqByVal3:strCharStr param not as expected\n");
129 PrintCharSetAnsiSequential(&str1,"CharSetAnsiSequential");
130 return FALSE;
131 }
132 ChangeCharSetAnsiSequential(&str1);
133 return TRUE;
134}
135extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef3(CharSetAnsiSequential* str1)
136{
137 if(!IsCorrectCharSetAnsiSequential(str1))
138 {
139 printf("\tMarshalStructAsParam_AsSeqByRef3:strCharStr param not as expected\n");
140 PrintCharSetAnsiSequential(str1,"CharSetAnsiSequential");
141 return FALSE;
142 }
143 ChangeCharSetAnsiSequential(str1);
144 return TRUE;
145}
146extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn3(CharSetAnsiSequential* str1)
147{
148 if(!IsCorrectCharSetAnsiSequential(str1))
149 {
150 printf("\tMarshalStructAsParam_AsSeqByRefIn3:strCharStr param not as expected\n");
151 PrintCharSetAnsiSequential(str1,"CharSetAnsiSequential");
152 return FALSE;
153 }
154 ChangeCharSetAnsiSequential(str1);
155 return TRUE;
156}
157extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut3(CharSetAnsiSequential str1)
158{
159 if(!IsCorrectCharSetAnsiSequential(&str1))
160 {
161 printf("\tMarshalStructAsParam_AsSeqByVal3:strCharStr param not as expected\n");
162 PrintCharSetAnsiSequential(&str1,"CharSetAnsiSequential");
163 return FALSE;
164 }
165 str1.f2 = 'n';
166 return TRUE;
167}
168extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut3(CharSetAnsiSequential* str1)
169{
170 CoreClrFree((void*)(str1->f1));
171 str1->f1 = CoStrDup("change string");
172 str1->f2 = 'n';
173 return TRUE;
174}
175
176////////////////////////////////////////////////////////////////////////////////////////////////
177extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal4(CharSetUnicodeSequential str1)
178{
179 if(!IsCorrectCharSetUnicodeSequential(&str1))
180 {
181 printf("\tMarshalStructAsParam_AsSeqByVal4:CharSetUnicodeSequential param not as expected\n");
182 PrintCharSetUnicodeSequential(&str1,"CharSetUnicodeSequential");
183 return FALSE;
184 }
185 ChangeCharSetUnicodeSequential(&str1);
186 return TRUE;
187}
188extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef4(CharSetUnicodeSequential* str1)
189{
190 if(!IsCorrectCharSetUnicodeSequential(str1))
191 {
192 printf("\tMarshalStructAsParam_AsSeqByRef4:strCharStr param not as expected\n");
193 PrintCharSetUnicodeSequential(str1,"CharSetUnicodeSequential");
194 return FALSE;
195 }
196 ChangeCharSetUnicodeSequential(str1);
197 return TRUE;
198}
199extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn4(CharSetUnicodeSequential* str1)
200{
201 if(!IsCorrectCharSetUnicodeSequential(str1))
202 {
203 printf("\tMarshalStructAsParam_AsSeqByRefIn4:strCharStr param not as expected\n");
204 PrintCharSetUnicodeSequential(str1,"CharSetUnicodeSequential");
205 return FALSE;
206 }
207 ChangeCharSetUnicodeSequential(str1);
208 return TRUE;
209}
210extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut4(CharSetUnicodeSequential str1)
211{
212 if(!IsCorrectCharSetUnicodeSequential(&str1))
213 {
214 printf("\tMarshalStructAsParam_AsSeqByVal4:strCharStrOut2 param not as expected\n");
215 PrintCharSetUnicodeSequential(&str1,"CharSetUnicodeSequential");
216 return FALSE;
217 }
218 str1.f2 = L'n';
219 return TRUE;
220}
221extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut4(CharSetUnicodeSequential* str1)
222{
223 if(str1->f1 != 0 || str1->f2 != 0)
224 return false;
225 ChangeCharSetUnicodeSequential(str1);
226 return true;
227}
228
229////////////////////////////////////////////////////////////////////////////////////////////////////////
230extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal6(NumberSequential str1)
231{
232 if(!IsCorrectNumberSequential(&str1))
233 {
234 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByVal6:NumberSequential param not as expected\n");
235 PrintNumberSequential(&str1, "str1");
236 return FALSE;
237 }
238 ChangeNumberSequential(&str1);
239 return TRUE;
240}
241extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef6(NumberSequential* str1)
242{
243 if(!IsCorrectNumberSequential(str1))
244 {
245 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByRef6:NumberSequential param not as expected\n");
246 PrintNumberSequential(str1, "str1");
247 return FALSE;
248 }
249 ChangeNumberSequential(str1);
250 return TRUE;
251}
252extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn6(NumberSequential* str1)
253{
254 if(!IsCorrectNumberSequential(str1))
255 {
256 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByRefIn6:NumberSequential param not as expected\n");
257 PrintNumberSequential(str1, "str1");
258 return FALSE;
259 }
260 ChangeNumberSequential(str1);
261 return TRUE;
262}
263
264extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut6(NumberSequential str1)
265{
266 if(!IsCorrectNumberSequential(&str1))
267 {
268 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByValOut6:NumberSequential param not as expected\n");
269 PrintNumberSequential(&str1, "str1");
270 return FALSE;
271 }
272 return TRUE;
273}
274extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut6(NumberSequential* str1)
275{
276 ChangeNumberSequential(str1);
277 return TRUE;
278}
279
280////////////////////////////////////////////////////////////////////////////////////
281extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal7(S3 str1)
282{
283 if(!IsCorrectS3(&str1))
284 {
285 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByVal7:S3 param not as expected\n");
286 PrintS3(&str1, "str1");
287 return FALSE;
288 }
289 ChangeS3(&str1);
290 return TRUE;
291}
292
293extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef7(S3* str1)
294{
295 if(!IsCorrectS3(str1))
296 {
297 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByRef7:S3 param not as expected\n");
298 return FALSE;
299 }
300 ChangeS3(str1);
301 return TRUE;
302}
303extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn7(S3* str1)
304{
305 if(!IsCorrectS3(str1))
306 {
307 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByRef7:S3 param not as expected\n");
308 PrintS3(str1, "str1");
309 return FALSE;
310 }
311 ChangeS3(str1);
312 return TRUE;
313}
314
315extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut7(S3 str1)
316{
317 if(!IsCorrectS3(&str1))
318 {
319 printf("\tManaged to Native failed in MarshalStructAsParam_AsSeqByValOut7:S3 param not as expected\n");
320 PrintS3(&str1, "str1");
321 return FALSE;
322 }
323 str1.flag = false;
324 return TRUE;
325
326}
327extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut7(S3* str1)
328{
329 ChangeS3(str1);
330 return TRUE;
331}
332////////////////////////////////////////////////////////////////////////////////////////
333extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal8(S5 str1)
334{
335 if(!IsCorrectS5(&str1))
336 {
337 printf("\tMarshalStructAsParam_AsSeqByVal8:S5 param not as expected\n");
338 PrintS5(&str1, "str1");
339 return FALSE;
340 }
341 ChangeS5(&str1);
342 return TRUE;
343}
344extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef8(S5* str1)
345{
346 if(!IsCorrectS5(str1))
347 {
348 printf("\tMarshalStructAsParam_AsSeqByRef8:S5 param not as expected\n");
349 PrintS5(str1, "str1");
350 return FALSE;
351 }
352 ChangeS5(str1);
353 return TRUE;
354}
355
356extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn8(S5* str1)
357{
358 if(!IsCorrectS5(str1))
359 {
360 printf("\tMarshalStructAsParam_AsSeqByRefIn8:S5 param not as expected\n");
361 PrintS5(str1, "str1");
362 return FALSE;
363 }
364 ChangeS5(str1);
365 return TRUE;
366}
367extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut8(S5* str1)
368{
369 ChangeS5(str1);
370 return TRUE;
371}
372
373
374/////////////////////////////////////////////////////////////////////////////////////////////////////////////
375extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal9(StringStructSequentialAnsi str1)
376{
377 if(!IsCorrectStringStructSequentialAnsi(&str1))
378 {
379 printf("\tMarshalStructAsParam_AsSeqByVal9:StringStructSequentialAnsi param not as expected\n");
380 PrintStringStructSequentialAnsi(&str1, "str1");
381 return FALSE;
382 }
383 ChangeStringStructSequentialAnsi(&str1);
384 return TRUE;
385}
386extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef9(StringStructSequentialAnsi* str1)
387{
388 if(!IsCorrectStringStructSequentialAnsi(str1))
389 {
390 printf("\tMarshalStructAsParam_AsSeqByRef9:StringStructSequentialAnsi param not as expected\n");
391 PrintStringStructSequentialAnsi(str1, "str1");
392 return FALSE;
393 }
394 ChangeStringStructSequentialAnsi(str1);
395 return TRUE;
396}
397
398extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn9(StringStructSequentialAnsi* str1)
399{
400 if(!IsCorrectStringStructSequentialAnsi(str1))
401 {
402 printf("\tMarshalStructAsParam_AsSeqByRefIn9:StringStructSequentialAnsi param not as expected\n");
403 PrintStringStructSequentialAnsi(str1, "str1");
404 return FALSE;
405 }
406 ChangeStringStructSequentialAnsi(str1);
407 return TRUE;
408}
409extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut9(StringStructSequentialAnsi str1)
410{
411 if(!IsCorrectStringStructSequentialAnsi(&str1))
412 {
413 printf("\tMarshalStructAsParam_AsSeqByVal9:StringStructSequentialAnsi param not as expected\n");
414 PrintStringStructSequentialAnsi(&str1, "str1");
415 return FALSE;
416 }
417 return TRUE;
418}
419extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut9(StringStructSequentialAnsi* str1)
420{
421 ChangeStringStructSequentialAnsi(str1);
422
423 return TRUE;
424}
425
426
427/////////////////////////////////////////////////////////////////////////////////////////////////////////////
428extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal10(StringStructSequentialUnicode str1)
429{
430 if(!IsCorrectStringStructSequentialUnicode(&str1))
431 {
432 printf("\tMarshalStructAsParam_AsSeqByVal10:StringStructSequentialUnicode param not as expected\n");
433 PrintStringStructSequentialUnicode(&str1, "str1");
434 return FALSE;
435 }
436 ChangeStringStructSequentialUnicode(&str1);
437 return TRUE;
438}
439extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef10(StringStructSequentialUnicode* str1)
440{
441 if(!IsCorrectStringStructSequentialUnicode(str1))
442 {
443 printf("\tMarshalStructAsParam_AsSeqByRef10:StringStructSequentialUnicode param not as expected\n");
444 PrintStringStructSequentialUnicode(str1, "str1");
445 return FALSE;
446 }
447 ChangeStringStructSequentialUnicode(str1);
448 return TRUE;
449}
450
451extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn10(StringStructSequentialUnicode* str1)
452{
453 if(!IsCorrectStringStructSequentialUnicode(str1))
454 {
455 printf("\tMarshalStructAsParam_AsSeqByRefIn10:StringStructSequentialUnicode param not as expected\n");
456 PrintStringStructSequentialUnicode(str1, "str1");
457 return FALSE;
458 }
459 ChangeStringStructSequentialUnicode(str1);
460 return TRUE;
461}
462extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut10(StringStructSequentialUnicode str1)
463{
464 if(!IsCorrectStringStructSequentialUnicode(&str1))
465 {
466 printf("\tMarshalStructAsParam_AsSeqByValOut10:StringStructSequentialUnicode param not as expected\n");
467 PrintStringStructSequentialUnicode(&str1, "str1");
468 return FALSE;
469 }
470 return TRUE;
471}
472extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut10(StringStructSequentialUnicode* str1)
473{
474 ChangeStringStructSequentialUnicode(str1);
475
476 return TRUE;
477}
478
479////////////////////////////////////////////////////////////////////////////////////////////////////////////
480extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal11(S8 str1)
481{
482 if(!IsCorrectS8(&str1))
483 {
484 printf("\tMarshalStructAsParam_AsSeqByVal11:S8 param not as expected\n");
485 PrintS8(&str1,"str1");
486 return FALSE;
487 }
488 ChangeS8(&str1);
489 return TRUE;
490}
491extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef11(S8* str1)
492{
493 if(!IsCorrectS8(str1))
494 {
495 printf("\tMarshalStructAsParam_AsSeqByRef11:S8 param not as expected\n");
496 PrintS8(str1,"str1");
497 return FALSE;
498 }
499 ChangeS8(str1);
500 return TRUE;
501}
502
503extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn11(S8* str1)
504{
505 if(!IsCorrectS8(str1))
506 {
507 printf("\tMarshalStructAsParam_AsSeqByRefIn11:S8 param not as expected\n");
508 PrintS8(str1,"str1");
509 return FALSE;
510 }
511 ChangeS8(str1);
512 return TRUE;
513}
514extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut11(S8 str1)
515{
516 if(!IsCorrectS8(&str1))
517 {
518 printf("\tMarshalStructAsParam_AsSeqByValOut11:S8 param not as expected\n");
519 PrintS8(&str1,"str1");
520 return FALSE;
521 }
522 str1.i32 = 256;
523 str1.ui32 = 256;
524 return TRUE;
525}
526extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut11(S8* str1)
527{
528 ChangeS8(str1);
529
530 return TRUE;
531}
532
533///////////////////////////////////////////////////////////////////////////////////////////////////////////
534extern "C" void NtestMethod(S9 str1)
535{
536 printf("\tAction of the delegate");
537}
538extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal12(S9 str1)
539{
540 if(str1.i32 != 128 ||
541 str1.myDelegate1 == NULL)
542 {
543 return FALSE;
544 }
545 str1.i32 = 256;
546 str1.myDelegate1 = NULL;
547 return TRUE;
548}
549extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef12(S9* str1)
550{
551 if(str1->i32 != 128 ||
552 str1->myDelegate1 == NULL)
553 {
554 return FALSE;
555 }
556 else
557 {
558 str1->i32 = 256;
559 str1->myDelegate1 = NULL;
560 }
561 return TRUE;
562}
563extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn12(S9* str1)
564{
565 if(str1->i32 != 128 ||
566 str1->myDelegate1 == NULL)
567 {
568 return FALSE;
569 }
570 else
571 {
572 str1->i32 = 256;
573 str1->myDelegate1 = NULL;
574 }
575 return TRUE;
576}
577extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut12(S9 str1)
578{
579 if(str1.i32 != 128 ||
580 str1.myDelegate1 == NULL)
581 {
582 return FALSE;
583 }
584 str1.i32 = 256;
585 str1.myDelegate1 = NULL;
586 return TRUE;
587}
588extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut12(S9* str1)
589{
590 str1->i32 = 256;
591 str1->myDelegate1 = NtestMethod;
592 return TRUE;
593}
594
595
596///////////////////////////////////////////////////////////////////////////////////////////////////////////
597extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal13(S10 str1)
598{
599 if(!IsCorrectS10(&str1))
600 {
601 printf("\tMarshalStructAsParam_AsSeqByVal13:S10 param not as expected\n");
602 PrintS10(&str1, "str1");
603 return FALSE;
604 }
605 ChangeS10(&str1);
606 return TRUE;
607}
608extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef13(S10* str1)
609{
610 if(!IsCorrectS10(str1))
611 {
612 printf("\tMarshalStructAsParam_AsSeqByRef13:S10 param not as expected\n");
613 PrintS10(str1, "str1");
614 return FALSE;
615 }
616 ChangeS10(str1);
617 return TRUE;
618}
619
620extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn13(S10* str1)
621{
622 if(!IsCorrectS10(str1))
623 {
624 printf("\tMarshalStructAsParam_AsSeqByRefIn13:S10 param not as expected\n");
625 PrintS10(str1, "str1");
626 return FALSE;
627 }
628 ChangeS10(str1);
629 return TRUE;
630}
631extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut13(S10 str1)
632{
633 if(!IsCorrectS10(&str1))
634 {
635 printf("\tMarshalStructAsParam_AsSeqByValOut13:S10 param not as expected\n");
636 PrintS10(&str1, "str1");
637 return FALSE;
638 }
639 str1.s.i = 64;
640 return TRUE;
641}
642extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut13(S10* str1)
643{
644 ChangeS10(str1);
645
646 return TRUE;
647}
648
649//////////////////////////////////////////////////////////////////////////////////////////////////////////
650extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByVal14(S11 str1)
651{
652 if( str1.i32 != 0 || str1.i != 32 )
653 return FALSE;
654 str1.i32 = reinterpret_cast<LPINT>(static_cast<INT_PTR>(str1.i));
655 str1.i = 64;
656 return TRUE;
657}
658extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRef14(S11* str1)
659{
660 if(str1->i32 != 0 || str1->i != 32)
661 return FALSE;
662 else
663 {
664 str1->i32 = reinterpret_cast<LPINT>(static_cast<INT_PTR>(str1->i));
665 str1->i = 64;
666 return TRUE;
667 }
668}
669extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefIn14(S11* str1)
670{
671 if(str1->i32 != 0 || str1->i != 32)
672 return FALSE;
673 else
674 {
675 str1->i32 = reinterpret_cast<LPINT>(static_cast<INT_PTR>(str1->i));
676 str1->i = 64;
677 return TRUE;
678 }
679}
680extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByValOut14(S11 str1)
681{
682 if( str1.i32 != (LPINT)32 || str1.i != 32 )
683 return FALSE;
684 str1.i = 64;
685 return TRUE;
686}
687extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsSeqByRefOut14(S11* str1)
688{
689 str1->i32 = reinterpret_cast<LPINT>(static_cast<INT_PTR>(str1->i));
690 str1->i = 64;
691 return TRUE;
692}
693//////////////////////////////////////////////////////////////////////////////////////
694extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValINNER2(INNER2 inner)
695{
696 if(!IsCorrectINNER2(&inner))
697 {
698 printf("\tMarshalStructAsParam_AsSeqByVal: INNER param not as expected\n");
699 PrintINNER2(&inner,"inner");
700 return FALSE;
701 }
702 ChangeINNER2(&inner);
703 return TRUE;
704}
705
706extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefINNER2(INNER2* inner)
707{
708 if(!IsCorrectINNER2(inner))
709 {
710 printf("\tMarshalStructAsParam_AsSeqByRef: INNER param not as expected\n");
711 PrintINNER2(inner,"inner");
712 return FALSE;
713 }
714 ChangeINNER2(inner);
715 return TRUE;
716}
717extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInINNER2(INNER2* inner)
718{
719 if(!IsCorrectINNER2(inner))
720 {
721 printf("\tMarshalStructAsParam_AsSeqByRefIn: INNER param not as expected\n");
722 PrintINNER2(inner,"inner");
723 return FALSE;
724 }
725 ChangeINNER2(inner);
726 return TRUE;
727}
728
729extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValOutINNER2(INNER2 inner)
730{
731 if(!IsCorrectINNER2(&inner))
732 {
733 printf("\tMarshalStructAsParam_AsSeqByValOut:NNER param not as expected\n");
734 PrintINNER2(&inner,"inner");
735 return FALSE;
736 }
737 ChangeINNER2(&inner);
738 return TRUE;
739}
740
741extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutINNER2(INNER2* inner)
742{
743 //change struct
744 ChangeINNER2(inner);
745 return TRUE;
746}
747/////////////////////////////////////////////////////////////////////////////////////////////////////
748extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValInnerExplicit(InnerExplicit inner)
749{
750 if((&inner)->f1 != 1 || memcmp((&inner)->f3, "some string",11*sizeof(char)) != 0)
751 {
752 printf("\tMarshalStructAsParam_AsExpByVal: INNER param not as expected\n");
753 PrintInnerExplicit(&inner,"inner");
754 return FALSE;
755 }
756 ChangeInnerExplicit(&inner);
757 return TRUE;
758}
759
760extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInnerExplicit(InnerExplicit* inner)
761{
762 if(inner->f1 != 1 || memcmp(inner->f3, "some string",11*sizeof(char)) != 0)
763 {
764 printf("\tMarshalStructAsParam_AsExpByRef: INNER param not as expected\n");
765 PrintInnerExplicit(inner,"inner");
766 return FALSE;
767 }
768 ChangeInnerExplicit(inner);
769 return TRUE;
770}
771
772extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInInnerExplicit(InnerExplicit* inner)
773{
774 if(inner->f1 != 1 || memcmp(inner->f3, "some string",11*sizeof(char)) != 0)
775 {
776 printf("\tMarshalStructAsParam_AsExpByRefIn: INNER param not as expected\n");
777 PrintInnerExplicit(inner,"inner");
778 return FALSE;
779 }
780 ChangeInnerExplicit(inner);
781 return TRUE;
782}
783
784extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutInnerExplicit(InnerExplicit* inner)
785{
786 if(inner->f1 != 0 || inner->f2 != 0.0)
787 {
788 printf("\tMarshalStructAsParam_AsExpByRefOut: INNER param not as expected\n");
789 return FALSE;
790 }
791 ChangeInnerExplicit(inner);
792 return TRUE;
793}
794
795
796
797////////////////////////////////////////////////////////////////////////////////////////////////////
798extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValInnerArrayExplicit(InnerArrayExplicit outer2)
799{
800 for(int i = 0;i<NumArrElements;i++)
801 {
802 if((&outer2)->arr[i].f1 != 1)
803 {
804 printf("\tMarshalStructAsParam_AsExpByVal3:InnerArrayExplicit param not as expected\n");
805 return FALSE;
806 }
807 }
808 if(memcmp((&outer2)->s.f4,"some string2",12) != 0)
809 {
810 printf("\tMarshalStructAsParam_AsExpByVal3:InnerArrayExplicit param f4 not as expected\n");
811 return FALSE;
812 }
813 return TRUE;
814}
815
816extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInnerArrayExplicit(InnerArrayExplicit* outer2)
817{
818 for(int i = 0;i<NumArrElements;i++)
819 {
820 if(outer2->arr[i].f1 != 1)
821 {
822 printf("\tMarshalStructAsParam_AsExpByRef3:InnerArrayExplicit param not as expected\n");
823 return FALSE;
824 }
825 }
826 if(memcmp(outer2->s.f4,"some string2",12) != 0)
827 {
828 printf("\tMarshalStructAsParam_AsExpByRef3:InnerArrayExplicit param f4 not as expected\n");
829 return FALSE;
830 }
831 for(int i =0;i<NumArrElements;i++)
832 {
833 outer2->arr[i].f1 = 77;
834 }
835
836 outer2->s.f4 = CoStrDup("change string2");
837 return TRUE;
838}
839
840extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInInnerArrayExplicit(InnerArrayExplicit* outer2)
841{
842 for(int i = 0;i<NumArrElements;i++)
843 {
844 if(outer2->arr[i].f1 != 1)
845 {
846 printf("\tMarshalStructAsParam_AsExpByRefIn3:InnerArrayExplicit param not as expected\n");
847 return FALSE;
848 }
849 }
850 if(memcmp(outer2->s.f4, "some string2",12*(sizeof(char))) != 0)
851 {
852 printf("\tMarshalStructAsParam_AsExpByRefIn3:InnerArrayExplicit param f4 not as expected\n");
853 return FALSE;
854 }
855 for(int i =0;i<NumArrElements;i++)
856 {
857 outer2->arr[i].f1 = 77;
858 }
859 outer2->s.f4 = CoStrDup("change string2");
860 return TRUE;
861}
862extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutInnerArrayExplicit(InnerArrayExplicit* outer2)
863{
864 for(int i =0;i<NumArrElements;i++)
865 {
866 outer2->arr[i].f1 = 77;
867 }
868 outer2->s.f4 = CoStrDup("change string2");
869 return TRUE;
870}
871
872
873////////////////////////////////////////////////////////////////////////////////////////////////////////
874extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValOUTER3(OUTER3 outer3)
875{
876 if(!IsCorrectOUTER3(&outer3))
877 {
878 printf("\tMarshalStructAsParam_AsExoByVal4:OUTER3 param not as expected\n");
879 PrintOUTER3(&outer3,"OUTER3");
880 return FALSE;
881 }
882 ChangeOUTER3(&outer3);
883 return TRUE;
884}
885extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOUTER3(OUTER3* outer3)
886{
887 if(!IsCorrectOUTER3(outer3))
888 {
889 printf("\tMarshalStructAsParam_AsExoByRef4:OUTER3 param not as expected\n");
890 PrintOUTER3(outer3,"OUTER3");
891 return FALSE;
892 }
893 ChangeOUTER3(outer3);
894 return TRUE;
895}
896extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInOUTER3(OUTER3* outer3)
897{
898 if(!IsCorrectOUTER3(outer3))
899 {
900 printf("\tMarshalStructAsParam_AsExoByRefIn4:OUTER3 param not as expected\n");
901 PrintOUTER3(outer3,"OUTER3");
902 return FALSE;
903 }
904 ChangeOUTER3(outer3);
905 return TRUE;
906}
907extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutOUTER3(OUTER3* outer3)
908{
909 ChangeOUTER3(outer3);
910 return TRUE;
911}
912
913///////////////////////////////////////////////////////////////////////////////////////////////////////////
914extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValU(U str1)
915{
916 if(!IsCorrectU(&str1))
917 {
918 printf("\tMarshalStructAsParam_AsExpByVal6:U param not as expected\n");
919 PrintU(&str1, "str1");
920 return FALSE;
921 }
922 ChangeU(&str1);
923 return TRUE;
924}
925extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefU(U* str1)
926{
927 if(!IsCorrectU(str1))
928 {
929 printf("\tMarshalStructAsParam_AsExpByRef6:U param not as expected\n");
930 PrintU(str1, "str1");
931 return FALSE;
932 }
933 ChangeU(str1);
934 return TRUE;
935}
936
937extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInU(U* str1)
938{
939 if(!IsCorrectU(str1))
940 {
941 printf("\tMarshalStructAsParam_AsExpByRefIn6:U param not as expected\n");
942 PrintU(str1, "str1");
943 return FALSE;
944 }
945 ChangeU(str1);
946 return TRUE;
947}
948extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutU(U* str1)
949{
950 ChangeU(str1);
951
952 return TRUE;
953}
954
955//////////////////////////////////////////////////////////////////////////////////////////////////////////
956extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValByteStructPack2Explicit(ByteStructPack2Explicit str1)
957{
958 if(!IsCorrectByteStructPack2Explicit(&str1))
959 {
960 printf("\tMarshalStructAsParam_AsExpByVal7:ByteStructPack2Explicit param not as expected\n");
961 PrintByteStructPack2Explicit(&str1, "str1");
962 return FALSE;
963 }
964 ChangeByteStructPack2Explicit(&str1);
965 return TRUE;
966}
967extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefByteStructPack2Explicit(ByteStructPack2Explicit* str1)
968{
969 if(!IsCorrectByteStructPack2Explicit(str1))
970 {
971 printf("\tMarshalStructAsParam_AsExpByRef7:ByteStructPack2Explicit param not as expected\n");
972 PrintByteStructPack2Explicit(str1, "str1");
973 return FALSE;
974 }
975 ChangeByteStructPack2Explicit(str1);
976 return TRUE;
977}
978
979extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInByteStructPack2Explicit(ByteStructPack2Explicit* str1)
980{
981 if(!IsCorrectByteStructPack2Explicit(str1))
982 {
983 printf("\tMarshalStructAsParam_AsExpByRefIn7:ByteStructPack2Explicit param not as expected\n");
984 PrintByteStructPack2Explicit(str1, "str1");
985 return FALSE;
986 }
987 ChangeByteStructPack2Explicit(str1);
988 return TRUE;
989}
990extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutByteStructPack2Explicit(ByteStructPack2Explicit* str1)
991{
992 ChangeByteStructPack2Explicit(str1);
993
994 return TRUE;
995}
996
997//////////////////////////////////////////////////////////////////////////////////////////////////////////
998extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValShortStructPack4Explicit(ShortStructPack4Explicit str1)
999{
1000 if(!IsCorrectShortStructPack4Explicit(&str1))
1001 {
1002 printf("\tMarshalStructAsParam_AsExpByVal8:ShortStructPack4Explicit param not as expected\n");
1003 PrintShortStructPack4Explicit(&str1, "str1");
1004 return FALSE;
1005 }
1006 ChangeShortStructPack4Explicit(&str1);
1007 return TRUE;
1008}
1009extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefShortStructPack4Explicit(ShortStructPack4Explicit* str1)
1010{
1011 if(!IsCorrectShortStructPack4Explicit(str1))
1012 {
1013 printf("\tMarshalStructAsParam_AsExpByRef8:ShortStructPack4Explicit param not as expected\n");
1014 PrintShortStructPack4Explicit(str1, "str1");
1015 return FALSE;
1016 }
1017 ChangeShortStructPack4Explicit(str1);
1018 return TRUE;
1019}
1020
1021extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInShortStructPack4Explicit(ShortStructPack4Explicit* str1)
1022{
1023 if(!IsCorrectShortStructPack4Explicit(str1))
1024 {
1025 printf("\tMarshalStructAsParam_AsExpByRefIn8:ShortStructPack4Explicit param not as expected\n");
1026 PrintShortStructPack4Explicit(str1, "str1");
1027 return FALSE;
1028 }
1029 ChangeShortStructPack4Explicit(str1);
1030 return TRUE;
1031}
1032extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutShortStructPack4Explicit(ShortStructPack4Explicit* str1)
1033{
1034 ChangeShortStructPack4Explicit(str1);
1035
1036 return TRUE;
1037}
1038
1039//////////////////////////////////////////////////////////////////////////////////////////////////////////
1040extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValIntStructPack8Explicit(IntStructPack8Explicit str1)
1041{
1042 if(!IsCorrectIntStructPack8Explicit(&str1))
1043 {
1044 printf("\tMarshalStructAsParam_AsExpByVal9:IntStructPack8Explicit param not as expected\n");
1045 PrintIntStructPack8Explicit(&str1, "str1");
1046 return FALSE;
1047 }
1048 ChangeIntStructPack8Explicit(&str1);
1049 return TRUE;
1050}
1051extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefIntStructPack8Explicit(IntStructPack8Explicit* str1)
1052{
1053 if(!IsCorrectIntStructPack8Explicit(str1))
1054 {
1055 printf("\tMarshalStructAsParam_AsExpByRef9:IntStructPack8Explicit param not as expected\n");
1056 PrintIntStructPack8Explicit(str1, "str1");
1057 return FALSE;
1058 }
1059 ChangeIntStructPack8Explicit(str1);
1060 return TRUE;
1061}
1062
1063extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInIntStructPack8Explicit(IntStructPack8Explicit* str1)
1064{
1065 if(!IsCorrectIntStructPack8Explicit(str1))
1066 {
1067 printf("\tMarshalStructAsParam_AsExpByRefIn9:IntStructPack8Explicit param not as expected\n");
1068 PrintIntStructPack8Explicit(str1, "str1");
1069 return FALSE;
1070 }
1071 ChangeIntStructPack8Explicit(str1);
1072 return TRUE;
1073}
1074extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutIntStructPack8Explicit(IntStructPack8Explicit* str1)
1075{
1076 ChangeIntStructPack8Explicit(str1);
1077
1078 return TRUE;
1079}
1080
1081//////////////////////////////////////////////////////////////////////////////////////////////////////////
1082extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByValLongStructPack16Explicit(LongStructPack16Explicit str1)
1083{
1084 if(!IsCorrectLongStructPack16Explicit(&str1))
1085 {
1086 printf("\tMarshalStructAsParam_AsExpByVal10:LongStructPack16Explicit param not as expected\n");
1087 PrintLongStructPack16Explicit(&str1, "str1");
1088 return FALSE;
1089 }
1090 ChangeLongStructPack16Explicit(&str1);
1091 return TRUE;
1092}
1093extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefLongStructPack16Explicit(LongStructPack16Explicit* str1)
1094{
1095 if(!IsCorrectLongStructPack16Explicit(str1))
1096 {
1097 printf("\tMarshalStructAsParam_AsExpByRef10:LongStructPack16Explicit param not as expected\n");
1098 PrintLongStructPack16Explicit(str1, "str1");
1099 return FALSE;
1100 }
1101 ChangeLongStructPack16Explicit(str1);
1102 return TRUE;
1103}
1104
1105extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefInLongStructPack16Explicit(LongStructPack16Explicit* str1)
1106{
1107 if(!IsCorrectLongStructPack16Explicit(str1))
1108 {
1109 printf("\tMarshalStructAsParam_AsExpByRefIn10:LongStructPack16Explicit param not as expected\n");
1110 PrintLongStructPack16Explicit(str1, "str1");
1111 return FALSE;
1112 }
1113 ChangeLongStructPack16Explicit(str1);
1114 return TRUE;
1115}
1116extern "C" DLL_EXPORT BOOL STDMETHODCALLTYPE MarshalStructAsParam_AsExpByRefOutLongStructPack16Explicit(LongStructPack16Explicit* str1)
1117{
1118 ChangeLongStructPack16Explicit(str1);
1119
1120 return TRUE;
1121}
1122
1123