1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | #include "ExpStructAsParamNative.h" |
6 | #include <stdio.h> |
7 | #include <stdlib.h> |
8 | #include <xplatform.h> |
9 | |
10 | const char* NativeStr = "Native" ; |
11 | const size_t size=strlen(NativeStr); |
12 | |
13 | #define PRINT_ERR_INFO() \ |
14 | printf("\t%s : unexpected error \n",__FUNCTION__) |
15 | |
16 | //----------method called byref----------// |
17 | ///// |
18 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefINNER2_Cdecl(INNER2* inner) |
19 | { |
20 | if(!IsCorrectINNER2(inner)) |
21 | { |
22 | PRINT_ERR_INFO(); |
23 | PrintINNER2(inner,"inner" ); |
24 | return FALSE; |
25 | } |
26 | ChangeINNER2(inner); |
27 | return TRUE; |
28 | } |
29 | |
30 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefINNER2_Stdcall(INNER2* inner) |
31 | { |
32 | if(!IsCorrectINNER2(inner)) |
33 | { |
34 | PRINT_ERR_INFO(); |
35 | PrintINNER2(inner,"inner" ); |
36 | return FALSE; |
37 | } |
38 | ChangeINNER2(inner); |
39 | return TRUE; |
40 | } |
41 | |
42 | ///// |
43 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl(InnerExplicit* inner) |
44 | { |
45 | if(inner->f1 != 1 || memcmp(inner->f3, "some string" ,11*sizeof(char)) != 0) |
46 | { |
47 | PRINT_ERR_INFO(); |
48 | PrintInnerExplicit(inner,"inner" ); |
49 | return FALSE; |
50 | } |
51 | ChangeInnerExplicit(inner); |
52 | return TRUE; |
53 | } |
54 | |
55 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall(InnerExplicit* inner) |
56 | { |
57 | if(inner->f1 != 1 || memcmp(inner->f3, "some string" ,11*sizeof(char)) != 0) |
58 | { |
59 | PRINT_ERR_INFO(); |
60 | PrintInnerExplicit(inner,"inner" ); |
61 | return FALSE; |
62 | } |
63 | ChangeInnerExplicit(inner); |
64 | return TRUE; |
65 | } |
66 | |
67 | ///// |
68 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl(InnerArrayExplicit* outer2) |
69 | { |
70 | for(int i = 0;i<NumArrElements;i++) |
71 | { |
72 | if(outer2->arr[i].f1 != 1) |
73 | { |
74 | PRINT_ERR_INFO(); |
75 | return FALSE; |
76 | } |
77 | } |
78 | if(memcmp(outer2->f4,"some string2" ,12) != 0) |
79 | { |
80 | PRINT_ERR_INFO(); |
81 | return FALSE; |
82 | } |
83 | for(int i =0;i<NumArrElements;i++) |
84 | { |
85 | outer2->arr[i].f1 = 77; |
86 | } |
87 | const char* temp = "change string2" ; |
88 | size_t len = strlen(temp); |
89 | LPCSTR str = (LPCSTR)CoreClrAlloc( sizeof(char)*(len+1) ); |
90 | strcpy_s((char*)str,len+1,temp); |
91 | outer2->f4 = str; |
92 | return TRUE; |
93 | } |
94 | |
95 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall(InnerArrayExplicit* outer2) |
96 | { |
97 | for(int i = 0;i<NumArrElements;i++) |
98 | { |
99 | if(outer2->arr[i].f1 != 1) |
100 | { |
101 | PRINT_ERR_INFO(); |
102 | return FALSE; |
103 | } |
104 | } |
105 | if(memcmp(outer2->f4,"some string2" ,12) != 0) |
106 | { |
107 | PRINT_ERR_INFO(); |
108 | return FALSE; |
109 | } |
110 | for(int i =0;i<NumArrElements;i++) |
111 | { |
112 | outer2->arr[i].f1 = 77; |
113 | } |
114 | const char* temp = "change string2" ; |
115 | size_t len = strlen(temp); |
116 | LPCSTR str = (LPCSTR)CoreClrAlloc( sizeof(char)*(len+1) ); |
117 | strcpy_s((char*)str,len+1,temp); |
118 | outer2->f4 = str; |
119 | return TRUE; |
120 | } |
121 | |
122 | ///// |
123 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefOUTER3_Cdecl(OUTER3* outer3) |
124 | { |
125 | if(!IsCorrectOUTER3(outer3)) |
126 | { |
127 | PRINT_ERR_INFO(); |
128 | PrintOUTER3(outer3,"OUTER3" ); |
129 | return FALSE; |
130 | } |
131 | ChangeOUTER3(outer3); |
132 | return TRUE; |
133 | } |
134 | |
135 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefOUTER3_Stdcall(OUTER3* outer3) |
136 | { |
137 | if(!IsCorrectOUTER3(outer3)) |
138 | { |
139 | PRINT_ERR_INFO(); |
140 | PrintOUTER3(outer3,"OUTER3" ); |
141 | return FALSE; |
142 | } |
143 | ChangeOUTER3(outer3); |
144 | return TRUE; |
145 | } |
146 | |
147 | ///// |
148 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefU_Cdecl(U* str1) |
149 | { |
150 | if(!IsCorrectU(str1)) |
151 | { |
152 | PRINT_ERR_INFO(); |
153 | PrintU(str1, "str1" ); |
154 | return FALSE; |
155 | } |
156 | ChangeU(str1); |
157 | return TRUE; |
158 | } |
159 | |
160 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefU_Stdcall(U* str1) |
161 | { |
162 | if(!IsCorrectU(str1)) |
163 | { |
164 | PRINT_ERR_INFO(); |
165 | PrintU(str1, "str1" ); |
166 | return FALSE; |
167 | } |
168 | ChangeU(str1); |
169 | return TRUE; |
170 | } |
171 | |
172 | ///// |
173 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl(ByteStructPack2Explicit* str1) |
174 | { |
175 | if(!IsCorrectByteStructPack2Explicit(str1)) |
176 | { |
177 | PRINT_ERR_INFO(); |
178 | PrintByteStructPack2Explicit(str1, "str1" ); |
179 | return FALSE; |
180 | } |
181 | ChangeByteStructPack2Explicit(str1); |
182 | return TRUE; |
183 | } |
184 | |
185 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall(ByteStructPack2Explicit* str1) |
186 | { |
187 | if(!IsCorrectByteStructPack2Explicit(str1)) |
188 | { |
189 | PRINT_ERR_INFO(); |
190 | PrintByteStructPack2Explicit(str1, "str1" ); |
191 | return FALSE; |
192 | } |
193 | ChangeByteStructPack2Explicit(str1); |
194 | return TRUE; |
195 | } |
196 | |
197 | ///// |
198 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl(ShortStructPack4Explicit* str1) |
199 | { |
200 | if(!IsCorrectShortStructPack4Explicit(str1)) |
201 | { |
202 | PRINT_ERR_INFO(); |
203 | PrintShortStructPack4Explicit(str1, "str1" ); |
204 | return FALSE; |
205 | } |
206 | ChangeShortStructPack4Explicit(str1); |
207 | return TRUE; |
208 | } |
209 | |
210 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall(ShortStructPack4Explicit* str1) |
211 | { |
212 | if(!IsCorrectShortStructPack4Explicit(str1)) |
213 | { |
214 | PRINT_ERR_INFO(); |
215 | PrintShortStructPack4Explicit(str1, "str1" ); |
216 | return FALSE; |
217 | } |
218 | ChangeShortStructPack4Explicit(str1); |
219 | return TRUE; |
220 | } |
221 | |
222 | ///// |
223 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl(IntStructPack8Explicit* str1) |
224 | { |
225 | if(!IsCorrectIntStructPack8Explicit(str1)) |
226 | { |
227 | PRINT_ERR_INFO(); |
228 | PrintIntStructPack8Explicit(str1, "str1" ); |
229 | return FALSE; |
230 | } |
231 | ChangeIntStructPack8Explicit(str1); |
232 | return TRUE; |
233 | } |
234 | |
235 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall(IntStructPack8Explicit* str1) |
236 | { |
237 | if(!IsCorrectIntStructPack8Explicit(str1)) |
238 | { |
239 | PRINT_ERR_INFO(); |
240 | PrintIntStructPack8Explicit(str1, "str1" ); |
241 | return FALSE; |
242 | } |
243 | ChangeIntStructPack8Explicit(str1); |
244 | return TRUE; |
245 | } |
246 | |
247 | ///// |
248 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl(LongStructPack16Explicit* str1) |
249 | { |
250 | if(!IsCorrectLongStructPack16Explicit(str1)) |
251 | { |
252 | PRINT_ERR_INFO(); |
253 | PrintLongStructPack16Explicit(str1, "str1" ); |
254 | return FALSE; |
255 | } |
256 | ChangeLongStructPack16Explicit(str1); |
257 | return TRUE; |
258 | } |
259 | |
260 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall(LongStructPack16Explicit* str1) |
261 | { |
262 | if(!IsCorrectLongStructPack16Explicit(str1)) |
263 | { |
264 | PRINT_ERR_INFO(); |
265 | PrintLongStructPack16Explicit(str1, "str1" ); |
266 | return FALSE; |
267 | } |
268 | ChangeLongStructPack16Explicit(str1); |
269 | return TRUE; |
270 | } |
271 | ///// |
272 | //---------------------------- ----------// |
273 | |
274 | |
275 | //----------method called byval----------// |
276 | ///// |
277 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValINNER2_Cdecl(INNER2 str1) |
278 | { |
279 | return MarshalStructAsParam_AsExpByRefINNER2_Cdecl(&str1); |
280 | } |
281 | |
282 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValINNER2_Stdcall(INNER2 str1) |
283 | { |
284 | return MarshalStructAsParam_AsExpByRefINNER2_Stdcall(&str1); |
285 | } |
286 | ///// |
287 | |
288 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl(InnerExplicit str1) |
289 | { |
290 | return MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl(&str1); |
291 | } |
292 | |
293 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall(InnerExplicit str1) |
294 | { |
295 | return MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall(&str1); |
296 | } |
297 | |
298 | ///// |
299 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl(InnerArrayExplicit str1) |
300 | { |
301 | return MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl(&str1); |
302 | } |
303 | |
304 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall(InnerArrayExplicit str1) |
305 | { |
306 | return MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall(&str1); |
307 | } |
308 | ///// |
309 | |
310 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValOUTER3_Cdecl(OUTER3 str1) |
311 | { |
312 | return MarshalStructAsParam_AsExpByRefOUTER3_Cdecl(&str1); |
313 | } |
314 | |
315 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValOUTER3_Stdcall(OUTER3 str1) |
316 | { |
317 | return MarshalStructAsParam_AsExpByRefOUTER3_Stdcall( &str1); |
318 | } |
319 | |
320 | ///// |
321 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValU_Cdecl(U str1) |
322 | { |
323 | return MarshalStructAsParam_AsExpByRefU_Cdecl(&str1); |
324 | } |
325 | |
326 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValU_Stdcall(U str1) |
327 | { |
328 | return MarshalStructAsParam_AsExpByRefU_Stdcall(&str1); |
329 | } |
330 | ///// |
331 | |
332 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl(ByteStructPack2Explicit str1) |
333 | { |
334 | return MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl(&str1); |
335 | } |
336 | |
337 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall(ByteStructPack2Explicit str1) |
338 | { |
339 | return MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall(&str1); |
340 | } |
341 | |
342 | ///// |
343 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl(ShortStructPack4Explicit str1) |
344 | { |
345 | return MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl(&str1); |
346 | } |
347 | |
348 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall(ShortStructPack4Explicit str1) |
349 | { |
350 | return MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall(&str1); |
351 | } |
352 | ///// |
353 | |
354 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl(IntStructPack8Explicit str1) |
355 | { |
356 | return MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl(&str1); |
357 | } |
358 | |
359 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall(IntStructPack8Explicit str1) |
360 | { |
361 | return MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall(&str1); |
362 | } |
363 | |
364 | ///// |
365 | extern "C" DLL_EXPORT BOOL _cdecl MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl(LongStructPack16Explicit str1) |
366 | { |
367 | return MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl(&str1); |
368 | } |
369 | |
370 | extern "C" DLL_EXPORT BOOL __stdcall MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall(LongStructPack16Explicit str1) |
371 | { |
372 | return MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall(&str1); |
373 | } |
374 | ///// |
375 | //---------------------------- ----------// |
376 | |
377 | |
378 | //----------Delegate Pinvoke. PassByRef----------// |
379 | ///// |
380 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_INNER2)(INNER2* inner); |
381 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_INNER2 _cdecl Get_MarshalStructAsParam_AsExpByRefINNER2_Cdecl_FuncPtr() |
382 | { |
383 | return MarshalStructAsParam_AsExpByRefINNER2_Cdecl; |
384 | } |
385 | |
386 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_INNER2)(INNER2* inner); |
387 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_INNER2 __stdcall Get_MarshalStructAsParam_AsExpByRefINNER2_Stdcall_FuncPtr() |
388 | { |
389 | return MarshalStructAsParam_AsExpByRefINNER2_Stdcall; |
390 | } |
391 | ///// |
392 | |
393 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_InnerExplicit)(InnerExplicit* ie); |
394 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_InnerExplicit _cdecl Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl_FuncPtr() |
395 | { |
396 | return MarshalStructAsParam_AsExpByRefInnerExplicit_Cdecl; |
397 | } |
398 | |
399 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_InnerExplicit)(InnerExplicit* ie); |
400 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_InnerExplicit __stdcall Get_MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall_FuncPtr() |
401 | { |
402 | return MarshalStructAsParam_AsExpByRefInnerExplicit_Stdcall; |
403 | } |
404 | |
405 | ///// |
406 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_InnerArrayExplicit)(InnerArrayExplicit* iae); |
407 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_InnerArrayExplicit _cdecl Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl_FuncPtr() |
408 | { |
409 | return MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Cdecl; |
410 | } |
411 | |
412 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_InnerArrayExplicit)(InnerArrayExplicit* iae); |
413 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_InnerArrayExplicit __stdcall Get_MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall_FuncPtr() |
414 | { |
415 | return MarshalStructAsParam_AsExpByRefInnerArrayExplicit_Stdcall; |
416 | } |
417 | ///// |
418 | |
419 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_OUTER3)(OUTER3* outer); |
420 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_OUTER3 _cdecl Get_MarshalStructAsParam_AsExpByRefOUTER3_Cdecl_FuncPtr() |
421 | { |
422 | return MarshalStructAsParam_AsExpByRefOUTER3_Cdecl; |
423 | } |
424 | |
425 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_OUTER3)(OUTER3* outer); |
426 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_OUTER3 __stdcall Get_MarshalStructAsParam_AsExpByRefOUTER3_Stdcall_FuncPtr() |
427 | { |
428 | return MarshalStructAsParam_AsExpByRefOUTER3_Stdcall; |
429 | } |
430 | |
431 | ///// |
432 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_U)(U* inner); |
433 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_U _cdecl Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr() |
434 | { |
435 | return MarshalStructAsParam_AsExpByRefU_Cdecl; |
436 | } |
437 | |
438 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_U)(U* inner); |
439 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_U __stdcall Get_MarshalStructAsParam_AsExpByRefU_Stdcall_FuncPtr() |
440 | { |
441 | return MarshalStructAsParam_AsExpByRefU_Stdcall; |
442 | } |
443 | ///// |
444 | |
445 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit* bspe); |
446 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_ByteStructPack2Explicit _cdecl Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl_FuncPtr() |
447 | { |
448 | return MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Cdecl; |
449 | } |
450 | |
451 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit* bspe); |
452 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_ByteStructPack2Explicit __stdcall Get_MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall_FuncPtr() |
453 | { |
454 | return MarshalStructAsParam_AsExpByRefByteStructPack2Explicit_Stdcall; |
455 | } |
456 | |
457 | ///// |
458 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit* sspe); |
459 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_ShortStructPack4Explicit _cdecl Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl_FuncPtr() |
460 | { |
461 | return MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Cdecl; |
462 | } |
463 | |
464 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit* sspe); |
465 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_ShortStructPack4Explicit __stdcall Get_MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall_FuncPtr() |
466 | { |
467 | return MarshalStructAsParam_AsExpByRefShortStructPack4Explicit_Stdcall; |
468 | } |
469 | ///// |
470 | |
471 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_IntStructPack8Explicit)(IntStructPack8Explicit* ispe); |
472 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_IntStructPack8Explicit _cdecl Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl_FuncPtr() |
473 | { |
474 | return MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Cdecl; |
475 | } |
476 | |
477 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_IntStructPack8Explicit)(IntStructPack8Explicit* ispe); |
478 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_IntStructPack8Explicit __stdcall Get_MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall_FuncPtr() |
479 | { |
480 | return MarshalStructAsParam_AsExpByRefIntStructPack8Explicit_Stdcall; |
481 | } |
482 | |
483 | ///// |
484 | typedef BOOL(_cdecl *DelegatePinvokeByRefCdeclCaller_LongStructPack16Explicit)(LongStructPack16Explicit* ispe); |
485 | extern "C" DLL_EXPORT DelegatePinvokeByRefCdeclCaller_LongStructPack16Explicit _cdecl Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl_FuncPtr() |
486 | { |
487 | return MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Cdecl; |
488 | } |
489 | |
490 | typedef BOOL(__stdcall *DelegatePinvokeByRefStdcallCaller_LongStructPack16Explicit)(LongStructPack16Explicit* ispe); |
491 | extern "C" DLL_EXPORT DelegatePinvokeByRefStdcallCaller_LongStructPack16Explicit __stdcall Get_MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall_FuncPtr() |
492 | { |
493 | return MarshalStructAsParam_AsExpByRefLongStructPack16Explicit_Stdcall; |
494 | } |
495 | ///// |
496 | //---------------------------- ----------// |
497 | |
498 | |
499 | //----------Delegate Pinvoke. PassByVal----------// |
500 | ///// |
501 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_INNER2)(INNER2 inner); |
502 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_INNER2 _cdecl Get_MarshalStructAsParam_AsExpByValINNER2_Cdecl_FuncPtr() |
503 | { |
504 | return MarshalStructAsParam_AsExpByValINNER2_Cdecl; |
505 | } |
506 | |
507 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_INNER2)(INNER2 inner); |
508 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_INNER2 __stdcall Get_MarshalStructAsParam_AsExpByValINNER2_Stdcall_FuncPtr() |
509 | { |
510 | return MarshalStructAsParam_AsExpByValINNER2_Stdcall; |
511 | } |
512 | ///// |
513 | |
514 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_InnerExplicit)(InnerExplicit ie); |
515 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_InnerExplicit _cdecl Get_MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl_FuncPtr() |
516 | { |
517 | return MarshalStructAsParam_AsExpByValInnerExplicit_Cdecl; |
518 | } |
519 | |
520 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_InnerExplicit)(InnerExplicit ie); |
521 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_InnerExplicit __stdcall Get_MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall_FuncPtr() |
522 | { |
523 | return MarshalStructAsParam_AsExpByValInnerExplicit_Stdcall; |
524 | } |
525 | |
526 | ///// |
527 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_InnerArrayExplicit)(InnerArrayExplicit iae); |
528 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_InnerArrayExplicit _cdecl Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl_FuncPtr() |
529 | { |
530 | return MarshalStructAsParam_AsExpByValInnerArrayExplicit_Cdecl; |
531 | } |
532 | |
533 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_InnerArrayExplicit)(InnerArrayExplicit iae); |
534 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_InnerArrayExplicit __stdcall Get_MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall_FuncPtr() |
535 | { |
536 | return MarshalStructAsParam_AsExpByValInnerArrayExplicit_Stdcall; |
537 | } |
538 | ///// |
539 | |
540 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_OUTER3)(OUTER3 outer); |
541 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_OUTER3 _cdecl Get_MarshalStructAsParam_AsExpByValOUTER3_Cdecl_FuncPtr() |
542 | { |
543 | return MarshalStructAsParam_AsExpByValOUTER3_Cdecl; |
544 | } |
545 | |
546 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_OUTER3)(OUTER3 outer); |
547 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_OUTER3 __stdcall Get_MarshalStructAsParam_AsExpByValOUTER3_Stdcall_FuncPtr() |
548 | { |
549 | return MarshalStructAsParam_AsExpByValOUTER3_Stdcall; |
550 | } |
551 | |
552 | ///// |
553 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_U)(U inner); |
554 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_U _cdecl Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr() |
555 | { |
556 | return MarshalStructAsParam_AsExpByValU_Cdecl; |
557 | } |
558 | |
559 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_U)(U inner); |
560 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_U __stdcall Get_MarshalStructAsParam_AsExpByValU_Stdcall_FuncPtr() |
561 | { |
562 | return MarshalStructAsParam_AsExpByValU_Stdcall; |
563 | } |
564 | ///// |
565 | |
566 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit bspe); |
567 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_ByteStructPack2Explicit _cdecl Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl_FuncPtr() |
568 | { |
569 | return MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Cdecl; |
570 | } |
571 | |
572 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit bspe); |
573 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_ByteStructPack2Explicit __stdcall Get_MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall_FuncPtr() |
574 | { |
575 | return MarshalStructAsParam_AsExpByValByteStructPack2Explicit_Stdcall; |
576 | } |
577 | |
578 | ///// |
579 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit sspe); |
580 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_ShortStructPack4Explicit _cdecl Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl_FuncPtr() |
581 | { |
582 | return MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Cdecl; |
583 | } |
584 | |
585 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit sspe); |
586 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_ShortStructPack4Explicit __stdcall Get_MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall_FuncPtr() |
587 | { |
588 | return MarshalStructAsParam_AsExpByValShortStructPack4Explicit_Stdcall; |
589 | } |
590 | ///// |
591 | |
592 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_IntStructPack8Explicit)(IntStructPack8Explicit ispe); |
593 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_IntStructPack8Explicit _cdecl Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl_FuncPtr() |
594 | { |
595 | return MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Cdecl; |
596 | } |
597 | |
598 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_IntStructPack8Explicit)(IntStructPack8Explicit ispe); |
599 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_IntStructPack8Explicit __stdcall Get_MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall_FuncPtr() |
600 | { |
601 | return MarshalStructAsParam_AsExpByValIntStructPack8Explicit_Stdcall; |
602 | } |
603 | |
604 | ///// |
605 | typedef BOOL(_cdecl *DelegatePinvokeByValCdeclCaller_LongStructPack16Explicit)(LongStructPack16Explicit ispe); |
606 | extern "C" DLL_EXPORT DelegatePinvokeByValCdeclCaller_LongStructPack16Explicit _cdecl Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl_FuncPtr() |
607 | { |
608 | return MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Cdecl; |
609 | } |
610 | |
611 | typedef BOOL(__stdcall *DelegatePinvokeByValStdcallCaller_LongStructPack16Explicit)(LongStructPack16Explicit ispe); |
612 | extern "C" DLL_EXPORT DelegatePinvokeByValStdcallCaller_LongStructPack16Explicit __stdcall Get_MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall_FuncPtr() |
613 | { |
614 | return MarshalStructAsParam_AsExpByValLongStructPack16Explicit_Stdcall; |
615 | } |
616 | ///// |
617 | //---------------------------- ----------// |
618 | |
619 | |
620 | //----------Reverse Pinvoke. PassByRef----------// |
621 | ///// |
622 | typedef BOOL (_cdecl *ByRefCdeclCaller_INNER2)(INNER2* inner2); |
623 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_INNER2(ByRefCdeclCaller_INNER2 caller) |
624 | { |
625 | //init |
626 | INNER2 inner2; |
627 | inner2.f1 = 77; |
628 | inner2.f2 = 77.0; |
629 | |
630 | char* pstr = GetNativeString(); |
631 | inner2.f3 = pstr; |
632 | |
633 | if(!caller(&inner2)) |
634 | { |
635 | PRINT_ERR_INFO(); |
636 | return FALSE; |
637 | } |
638 | |
639 | if(!IsCorrectINNER2(&inner2)) |
640 | { |
641 | PRINT_ERR_INFO(); |
642 | return FALSE; |
643 | } |
644 | |
645 | //TP_CoreClrFree((void*)inner2.f3); |
646 | return TRUE; |
647 | } |
648 | |
649 | typedef BOOL (__stdcall *ByRefStdcallCaller_INNER2)(INNER2* inner2); |
650 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_INNER2(ByRefStdcallCaller_INNER2 caller) |
651 | { |
652 | const char* lNativeStr = "Native" ; |
653 | const size_t lsize = strlen(lNativeStr); |
654 | |
655 | //init |
656 | INNER2 inner2; |
657 | inner2.f1 = 77; |
658 | inner2.f2 = 77.0; |
659 | |
660 | char* pstr = (char*)CoreClrAlloc(lsize + 1); |
661 | memset(pstr,0,lsize+1); |
662 | strncpy_s(pstr,lsize+1,lNativeStr,lsize); |
663 | |
664 | inner2.f3 = pstr; |
665 | |
666 | if(!caller(&inner2)) |
667 | { |
668 | PRINT_ERR_INFO(); |
669 | return FALSE; |
670 | } |
671 | |
672 | if(!IsCorrectINNER2(&inner2)) |
673 | { |
674 | PRINT_ERR_INFO(); |
675 | return FALSE; |
676 | } |
677 | |
678 | //TP_CoreClrFree((void*)inner2.f3); |
679 | return TRUE; |
680 | } |
681 | ///// |
682 | |
683 | typedef BOOL (_cdecl *ByRefCdeclCaller_InnerExplicit)(InnerExplicit* inner2); |
684 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_InnerExplicit(ByRefCdeclCaller_InnerExplicit caller) |
685 | { |
686 | |
687 | const char* lNativeStr = "Native" ; |
688 | const size_t lsize = strlen(lNativeStr); |
689 | |
690 | //init |
691 | InnerExplicit ie; |
692 | ie.f1 = 77; |
693 | |
694 | char* pstr = (char*)CoreClrAlloc(lsize + 1); |
695 | memset(pstr,0,lsize+1); |
696 | strncpy_s(pstr,lsize+1,lNativeStr,lsize); |
697 | ie.f3 = pstr; |
698 | |
699 | if(!caller(&ie)) |
700 | { |
701 | PRINT_ERR_INFO(); |
702 | return FALSE; |
703 | } |
704 | |
705 | if( ie.f1 != 1 || 0 != strcmp((char*)ie.f3, "some string" ) ) |
706 | { |
707 | PRINT_ERR_INFO(); |
708 | return FALSE; |
709 | } |
710 | |
711 | return TRUE; |
712 | } |
713 | |
714 | typedef BOOL (__stdcall *ByRefStdcallCaller_InnerExplicit)(InnerExplicit* inner2); |
715 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_InnerExplicit(ByRefStdcallCaller_InnerExplicit caller) |
716 | { |
717 | const char* lNativeStr = "Native" ; |
718 | const size_t lsize = strlen(lNativeStr); |
719 | |
720 | //init |
721 | InnerExplicit ie; |
722 | ie.f1 = 77; |
723 | |
724 | char* pstr = (char*)CoreClrAlloc(lsize + 1); |
725 | memset(pstr,0,lsize+1); |
726 | strncpy_s(pstr,lsize+1,lNativeStr,lsize); |
727 | ie.f3 = pstr; |
728 | |
729 | if(!caller(&ie)) |
730 | { |
731 | PRINT_ERR_INFO(); |
732 | return FALSE; |
733 | } |
734 | |
735 | if( ie.f1 != 1 || 0 != strcmp((char*)ie.f3, "some string" ) ) |
736 | { |
737 | PRINT_ERR_INFO(); |
738 | return FALSE; |
739 | } |
740 | |
741 | return TRUE; |
742 | } |
743 | |
744 | ///// |
745 | typedef BOOL (_cdecl *ByRefCdeclCaller_InnerArrayExplicit)(InnerArrayExplicit* iae); |
746 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_InnerArrayExplicit(ByRefCdeclCaller_InnerArrayExplicit caller) |
747 | { |
748 | const char* lNativeStr = "Native" ; |
749 | const size_t lsize = strlen(lNativeStr); |
750 | |
751 | //init |
752 | InnerArrayExplicit iae; |
753 | LPSTR str = NULL; |
754 | for( size_t i = 0; i < NumArrElements; i++ ) |
755 | { |
756 | iae.arr[i].f1 = 77; |
757 | str = (LPSTR)CoreClrAlloc( lsize+1 ); |
758 | memset(str,0,lsize+1); |
759 | strncpy_s((char*)str,lsize+1,lNativeStr,lsize); |
760 | |
761 | iae.arr[i].f3 = str; |
762 | str = NULL; |
763 | } |
764 | |
765 | str = (LPSTR)CoreClrAlloc( lsize+1 ); |
766 | memset(str,0,lsize+1); |
767 | strncpy_s((char*)str,lsize+1,lNativeStr,lsize); |
768 | iae.f4 = str; |
769 | |
770 | if(!caller(&iae)) |
771 | { |
772 | PRINT_ERR_INFO(); |
773 | return FALSE; |
774 | } |
775 | |
776 | for( size_t i = 0; i < NumArrElements; i++ ) |
777 | { |
778 | if( iae.arr[i].f1 != 1 || 0 != strcmp((char*)iae.arr[i].f3, "some string" )) |
779 | { |
780 | PRINT_ERR_INFO(); |
781 | return FALSE; |
782 | } |
783 | } |
784 | if( 0 != strcmp((char*)iae.f4, "some string" ) ) |
785 | { |
786 | PRINT_ERR_INFO(); |
787 | return FALSE; |
788 | } |
789 | |
790 | return TRUE; |
791 | } |
792 | |
793 | typedef BOOL (__stdcall *ByRefStdcallCaller_InnerArrayExplicit)(InnerArrayExplicit* iae); |
794 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_InnerArrayExplicit(ByRefStdcallCaller_InnerArrayExplicit caller) |
795 | { |
796 | //init |
797 | InnerArrayExplicit iae; |
798 | LPSTR str = NULL; |
799 | for( size_t i = 0; i < NumArrElements; i++ ) |
800 | { |
801 | iae.arr[i].f1 = 77; |
802 | str = GetNativeString(); |
803 | iae.arr[i].f3 = str; |
804 | str = NULL; |
805 | } |
806 | |
807 | str = GetNativeString(); |
808 | iae.f4 = str; |
809 | |
810 | if(!caller(&iae)) |
811 | { |
812 | PRINT_ERR_INFO(); |
813 | return FALSE; |
814 | } |
815 | |
816 | for( size_t i = 0; i < NumArrElements; i++ ) |
817 | { |
818 | if( iae.arr[i].f1 != 1 || 0 != strcmp((char*)iae.arr[i].f3, "some string" )) |
819 | { |
820 | PRINT_ERR_INFO(); |
821 | return FALSE; |
822 | } |
823 | } |
824 | if( 0 != strcmp((char*)iae.f4, "some string" ) ) |
825 | { |
826 | PRINT_ERR_INFO(); |
827 | return FALSE; |
828 | } |
829 | |
830 | return TRUE; |
831 | } |
832 | ///// |
833 | |
834 | typedef BOOL (_cdecl *ByRefCdeclCaller_OUTER3)(OUTER3* outer3); |
835 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_OUTER3(ByRefCdeclCaller_OUTER3 caller) |
836 | { |
837 | //init |
838 | OUTER3 outer3; |
839 | LPSTR str = NULL; |
840 | for( size_t i = 0; i < NumArrElements; i++ ) |
841 | { |
842 | outer3.arr[i].f1 = 77; |
843 | outer3.arr[i].f2 = 77.0; |
844 | str = GetNativeString(); |
845 | outer3.arr[i].f3 = (LPCSTR)str; |
846 | str = NULL; |
847 | } |
848 | |
849 | str = GetNativeString(); |
850 | outer3.f4 = (LPCSTR)str; |
851 | |
852 | if(!caller(&outer3)) |
853 | { |
854 | PRINT_ERR_INFO(); |
855 | return FALSE; |
856 | } |
857 | |
858 | if( !IsCorrectOUTER3( &outer3 ) ) |
859 | { |
860 | PRINT_ERR_INFO(); |
861 | return FALSE; |
862 | } |
863 | |
864 | return TRUE; |
865 | } |
866 | |
867 | typedef BOOL (__stdcall *ByRefStdcallCaller_OUTER3)(OUTER3* outer3); |
868 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_OUTER3(ByRefStdcallCaller_OUTER3 caller) |
869 | { |
870 | |
871 | //init |
872 | OUTER3 outer3; |
873 | LPSTR str = NULL; |
874 | for( size_t i = 0; i < NumArrElements; i++ ) |
875 | { |
876 | outer3.arr[i].f1 = 77; |
877 | outer3.arr[i].f2 = 77.0; |
878 | str = GetNativeString(); |
879 | outer3.arr[i].f3 = (LPCSTR)str; |
880 | str = NULL; |
881 | } |
882 | |
883 | str = GetNativeString(); |
884 | outer3.f4 = (LPCSTR)str; |
885 | |
886 | if(!caller(&outer3)) |
887 | { |
888 | PRINT_ERR_INFO(); |
889 | return FALSE; |
890 | } |
891 | |
892 | if( !IsCorrectOUTER3( &outer3 ) ) |
893 | { |
894 | PRINT_ERR_INFO(); |
895 | return FALSE; |
896 | } |
897 | |
898 | return TRUE; |
899 | } |
900 | |
901 | ///// |
902 | typedef BOOL (_cdecl *ByRefCdeclCaller_U)(U* u); |
903 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_U(ByRefCdeclCaller_U caller) |
904 | { |
905 | U u; |
906 | u.d = 1.23; |
907 | |
908 | if(!caller(&u)) |
909 | { |
910 | PRINT_ERR_INFO(); |
911 | return FALSE; |
912 | } |
913 | |
914 | if( !IsCorrectU( &u ) ) |
915 | { |
916 | PRINT_ERR_INFO(); |
917 | return FALSE; |
918 | } |
919 | |
920 | return TRUE; |
921 | } |
922 | |
923 | typedef BOOL (__stdcall *ByRefStdcallCaller_U)(U* u); |
924 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_U(ByRefStdcallCaller_U caller) |
925 | { |
926 | U u; |
927 | u.d = 1.23; |
928 | |
929 | if(!caller(&u)) |
930 | { |
931 | PRINT_ERR_INFO(); |
932 | return FALSE; |
933 | } |
934 | |
935 | if( !IsCorrectU( &u ) ) |
936 | { |
937 | PRINT_ERR_INFO(); |
938 | return FALSE; |
939 | } |
940 | |
941 | return TRUE; |
942 | } |
943 | ///// |
944 | |
945 | typedef BOOL (_cdecl *ByRefCdeclCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit* bspe); |
946 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_ByteStructPack2Explicit(ByRefCdeclCaller_ByteStructPack2Explicit caller) |
947 | { |
948 | ByteStructPack2Explicit bspe; |
949 | bspe.b1 = 64; |
950 | bspe.b2 = 64; |
951 | |
952 | if(!caller(&bspe)) |
953 | { |
954 | PRINT_ERR_INFO(); |
955 | return FALSE; |
956 | } |
957 | |
958 | if( !IsCorrectByteStructPack2Explicit( &bspe ) ) |
959 | { |
960 | PRINT_ERR_INFO(); |
961 | return FALSE; |
962 | } |
963 | |
964 | return TRUE; |
965 | } |
966 | |
967 | typedef BOOL (__stdcall *ByRefStdcallCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit* bspe); |
968 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_ByteStructPack2Explicit(ByRefStdcallCaller_ByteStructPack2Explicit caller) |
969 | { |
970 | ByteStructPack2Explicit bspe; |
971 | bspe.b1 = 64; |
972 | bspe.b2 = 64; |
973 | |
974 | if(!caller(&bspe)) |
975 | { |
976 | PRINT_ERR_INFO(); |
977 | return FALSE; |
978 | } |
979 | |
980 | if( !IsCorrectByteStructPack2Explicit( &bspe ) ) |
981 | { |
982 | PRINT_ERR_INFO(); |
983 | return FALSE; |
984 | } |
985 | |
986 | return TRUE; |
987 | } |
988 | |
989 | ///// |
990 | typedef BOOL (_cdecl *ByRefCdeclCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit* sspe); |
991 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_ShortStructPack4Explicit(ByRefCdeclCaller_ShortStructPack4Explicit caller) |
992 | { |
993 | ShortStructPack4Explicit sspe; |
994 | sspe.s1 = 64; |
995 | sspe.s2 = 64; |
996 | |
997 | if(!caller(&sspe)) |
998 | { |
999 | PRINT_ERR_INFO(); |
1000 | return FALSE; |
1001 | } |
1002 | |
1003 | if( !IsCorrectShortStructPack4Explicit( &sspe ) ) |
1004 | { |
1005 | PRINT_ERR_INFO(); |
1006 | return FALSE; |
1007 | } |
1008 | |
1009 | return TRUE; |
1010 | } |
1011 | |
1012 | typedef BOOL (__stdcall *ByRefStdcallCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit* sspe); |
1013 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_ShortStructPack4Explicit(ByRefStdcallCaller_ShortStructPack4Explicit caller) |
1014 | { |
1015 | ShortStructPack4Explicit sspe; |
1016 | sspe.s1 = 64; |
1017 | sspe.s2 = 64; |
1018 | |
1019 | if(!caller(&sspe)) |
1020 | { |
1021 | PRINT_ERR_INFO(); |
1022 | return FALSE; |
1023 | } |
1024 | |
1025 | if( !IsCorrectShortStructPack4Explicit( &sspe ) ) |
1026 | { |
1027 | PRINT_ERR_INFO(); |
1028 | return FALSE; |
1029 | } |
1030 | |
1031 | return TRUE; |
1032 | } |
1033 | ///// |
1034 | |
1035 | typedef BOOL (_cdecl *ByRefCdeclCaller_IntStructPack8Explicit)(IntStructPack8Explicit* ispe); |
1036 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_IntStructPack8Explicit(ByRefCdeclCaller_IntStructPack8Explicit caller) |
1037 | { |
1038 | IntStructPack8Explicit ispe; |
1039 | ispe.i1 = 64; |
1040 | ispe.i2 = 64; |
1041 | |
1042 | if(!caller(&ispe)) |
1043 | { |
1044 | PRINT_ERR_INFO(); |
1045 | return FALSE; |
1046 | } |
1047 | |
1048 | if( !IsCorrectIntStructPack8Explicit( &ispe ) ) |
1049 | { |
1050 | PRINT_ERR_INFO(); |
1051 | return FALSE; |
1052 | } |
1053 | |
1054 | return TRUE; |
1055 | } |
1056 | |
1057 | typedef BOOL (__stdcall *ByRefStdcallCaller_IntStructPack8Explicit)(IntStructPack8Explicit* ispe); |
1058 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_IntStructPack8Explicit(ByRefStdcallCaller_IntStructPack8Explicit caller) |
1059 | { |
1060 | IntStructPack8Explicit ispe; |
1061 | ispe.i1 = 64; |
1062 | ispe.i2 = 64; |
1063 | |
1064 | if(!caller(&ispe)) |
1065 | { |
1066 | PRINT_ERR_INFO(); |
1067 | return FALSE; |
1068 | } |
1069 | |
1070 | if( !IsCorrectIntStructPack8Explicit( &ispe ) ) |
1071 | { |
1072 | PRINT_ERR_INFO(); |
1073 | return FALSE; |
1074 | } |
1075 | |
1076 | return TRUE; |
1077 | } |
1078 | |
1079 | ///// |
1080 | typedef BOOL (_cdecl *ByRefCdeclCaller_LongStructPack16Explicit)(LongStructPack16Explicit* lspe); |
1081 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByRefStruct_Cdecl_LongStructPack16Explicit(ByRefCdeclCaller_LongStructPack16Explicit caller) |
1082 | { |
1083 | LongStructPack16Explicit lspe; |
1084 | lspe.l1 = 64; |
1085 | lspe.l2 = 64; |
1086 | |
1087 | if(!caller(&lspe)) |
1088 | { |
1089 | PRINT_ERR_INFO(); |
1090 | return FALSE; |
1091 | } |
1092 | |
1093 | if( !IsCorrectLongStructPack16Explicit( &lspe ) ) |
1094 | { |
1095 | PRINT_ERR_INFO(); |
1096 | return FALSE; |
1097 | } |
1098 | |
1099 | return TRUE; |
1100 | } |
1101 | |
1102 | typedef BOOL (__stdcall *ByRefStdcallCaller_LongStructPack16Explicit)(LongStructPack16Explicit* lspe); |
1103 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByRefStruct_Stdcall_LongStructPack16Explicit(ByRefStdcallCaller_LongStructPack16Explicit caller) |
1104 | { |
1105 | LongStructPack16Explicit lspe; |
1106 | lspe.l1 = 64; |
1107 | lspe.l2 = 64; |
1108 | |
1109 | if(!caller(&lspe)) |
1110 | { |
1111 | PRINT_ERR_INFO(); |
1112 | return FALSE; |
1113 | } |
1114 | |
1115 | if( !IsCorrectLongStructPack16Explicit( &lspe ) ) |
1116 | { |
1117 | PRINT_ERR_INFO(); |
1118 | return FALSE; |
1119 | } |
1120 | |
1121 | return TRUE; |
1122 | } |
1123 | ///// |
1124 | //---------------------------- ----------// |
1125 | |
1126 | |
1127 | //----------Reverse Pinvoke. PassByVal---------// |
1128 | ///// |
1129 | typedef BOOL (_cdecl *ByValCdeclCaller_INNER2)(INNER2 inner2); |
1130 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_INNER2(ByValCdeclCaller_INNER2 caller) |
1131 | { |
1132 | //init |
1133 | INNER2 inner2; |
1134 | inner2.f1 = 1; |
1135 | inner2.f2 = 1.0; |
1136 | |
1137 | char* pstr = GetSomeString(); |
1138 | inner2.f3 = pstr; |
1139 | |
1140 | if(!caller(inner2)) |
1141 | { |
1142 | PRINT_ERR_INFO(); |
1143 | return FALSE; |
1144 | } |
1145 | |
1146 | if(!IsCorrectINNER2(&inner2)) |
1147 | { |
1148 | PRINT_ERR_INFO(); |
1149 | return FALSE; |
1150 | } |
1151 | |
1152 | return TRUE; |
1153 | } |
1154 | |
1155 | typedef BOOL (__stdcall *ByValStdcallCaller_INNER2)(INNER2 inner2); |
1156 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_INNER2(ByValStdcallCaller_INNER2 caller) |
1157 | { |
1158 | //init |
1159 | INNER2 inner2; |
1160 | inner2.f1 = 1; |
1161 | inner2.f2 = 1.0; |
1162 | |
1163 | char* pstr = GetSomeString(); |
1164 | inner2.f3 = pstr; |
1165 | |
1166 | if(!caller(inner2)) |
1167 | { |
1168 | PRINT_ERR_INFO(); |
1169 | return FALSE; |
1170 | } |
1171 | |
1172 | if(!IsCorrectINNER2(&inner2)) |
1173 | { |
1174 | PRINT_ERR_INFO(); |
1175 | return FALSE; |
1176 | } |
1177 | |
1178 | return TRUE; |
1179 | } |
1180 | ///// |
1181 | |
1182 | typedef BOOL (_cdecl *ByValCdeclCaller_InnerExplicit)(InnerExplicit inner2); |
1183 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_InnerExplicit(ByValCdeclCaller_InnerExplicit caller) |
1184 | { |
1185 | //init |
1186 | InnerExplicit ie; |
1187 | ie.f1 = 1; |
1188 | |
1189 | char* pstr = GetNativeString(); |
1190 | ie.f3 = pstr; |
1191 | |
1192 | if(!caller(ie)) |
1193 | { |
1194 | PRINT_ERR_INFO(); |
1195 | return FALSE; |
1196 | } |
1197 | |
1198 | if( ie.f1 != 1 || 0 != strcmp((char*)ie.f3, (char*)NativeStr) ) |
1199 | { |
1200 | PRINT_ERR_INFO(); |
1201 | return FALSE; |
1202 | } |
1203 | |
1204 | return TRUE; |
1205 | } |
1206 | |
1207 | typedef BOOL (__stdcall *ByValStdcallCaller_InnerExplicit)(InnerExplicit inner2); |
1208 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_InnerExplicit(ByValStdcallCaller_InnerExplicit caller) |
1209 | { |
1210 | //init |
1211 | InnerExplicit ie; |
1212 | ie.f1 = 1; |
1213 | |
1214 | char* pstr = GetNativeString(); |
1215 | ie.f3 = pstr; |
1216 | |
1217 | if(!caller(ie)) |
1218 | { |
1219 | PRINT_ERR_INFO(); |
1220 | return FALSE; |
1221 | } |
1222 | |
1223 | if( ie.f1 != 1 || 0 != strcmp((char*)ie.f3, (char*)NativeStr) ) |
1224 | { |
1225 | PRINT_ERR_INFO(); |
1226 | return FALSE; |
1227 | } |
1228 | |
1229 | return TRUE; |
1230 | } |
1231 | |
1232 | ///// |
1233 | typedef BOOL (_cdecl *ByValCdeclCaller_InnerArrayExplicit)(InnerArrayExplicit iae); |
1234 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_InnerArrayExplicit(ByValCdeclCaller_InnerArrayExplicit caller) |
1235 | { |
1236 | //init |
1237 | InnerArrayExplicit iae; |
1238 | LPSTR str = NULL; |
1239 | for( size_t i = 0; i < NumArrElements; i++ ) |
1240 | { |
1241 | iae.arr[i].f1 = 1; |
1242 | str = GetSomeString(); |
1243 | iae.arr[i].f3 = str; |
1244 | str = NULL; |
1245 | } |
1246 | |
1247 | str = GetSomeString(); |
1248 | iae.f4 = str; |
1249 | |
1250 | if(!caller(iae)) |
1251 | { |
1252 | PRINT_ERR_INFO(); |
1253 | return FALSE; |
1254 | } |
1255 | |
1256 | for( size_t i = 0; i < NumArrElements; i++ ) |
1257 | { |
1258 | if( iae.arr[i].f1 != 1 || 0 != strcmp((char*)iae.arr[i].f3, "some string" )) |
1259 | { |
1260 | PRINT_ERR_INFO(); |
1261 | return FALSE; |
1262 | } |
1263 | } |
1264 | if( 0 != strcmp((char*)iae.f4, "some string" ) ) |
1265 | { |
1266 | PRINT_ERR_INFO(); |
1267 | return FALSE; |
1268 | } |
1269 | |
1270 | return TRUE; |
1271 | } |
1272 | |
1273 | typedef BOOL (__stdcall *ByValStdcallCaller_InnerArrayExplicit)(InnerArrayExplicit iae); |
1274 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_InnerArrayExplicit(ByValStdcallCaller_InnerArrayExplicit caller) |
1275 | { |
1276 | //init |
1277 | InnerArrayExplicit iae; |
1278 | LPSTR str = NULL; |
1279 | |
1280 | for( size_t i = 0; i < NumArrElements; i++ ) |
1281 | { |
1282 | iae.arr[i].f1 = 1; |
1283 | |
1284 | str = GetSomeString(); |
1285 | iae.arr[i].f3 = str; |
1286 | str = NULL; |
1287 | } |
1288 | |
1289 | str = GetSomeString(); |
1290 | iae.f4 = str; |
1291 | |
1292 | if(!caller(iae)) |
1293 | { |
1294 | PRINT_ERR_INFO(); |
1295 | return FALSE; |
1296 | } |
1297 | |
1298 | for( size_t i = 0; i < NumArrElements; i++ ) |
1299 | { |
1300 | if( iae.arr[i].f1 != 1 || 0 != strcmp((char*)iae.arr[i].f3, "some string" )) |
1301 | { |
1302 | PRINT_ERR_INFO(); |
1303 | return FALSE; |
1304 | } |
1305 | } |
1306 | if( 0 != strcmp((char*)iae.f4, "some string" ) ) |
1307 | { |
1308 | PRINT_ERR_INFO(); |
1309 | return FALSE; |
1310 | } |
1311 | |
1312 | return TRUE; |
1313 | } |
1314 | ///// |
1315 | |
1316 | typedef BOOL (_cdecl *ByValCdeclCaller_OUTER3)(OUTER3 outer3); |
1317 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_OUTER3(ByValCdeclCaller_OUTER3 caller) |
1318 | { |
1319 | //init |
1320 | OUTER3 outer3; |
1321 | LPSTR str = NULL; |
1322 | |
1323 | for( size_t i = 0; i < NumArrElements; i++ ) |
1324 | { |
1325 | outer3.arr[i].f1 = 1; |
1326 | outer3.arr[i].f2 = 1.0; |
1327 | str = GetSomeString(); |
1328 | outer3.arr[i].f3 = (LPCSTR)str; |
1329 | str = NULL; |
1330 | } |
1331 | |
1332 | str = GetSomeString(); |
1333 | outer3.f4 = (LPCSTR)str; |
1334 | |
1335 | if(!caller(outer3)) |
1336 | { |
1337 | PRINT_ERR_INFO(); |
1338 | return FALSE; |
1339 | } |
1340 | |
1341 | if( !IsCorrectOUTER3( &outer3 ) ) |
1342 | { |
1343 | PRINT_ERR_INFO(); |
1344 | return FALSE; |
1345 | } |
1346 | |
1347 | return TRUE; |
1348 | } |
1349 | |
1350 | typedef BOOL (__stdcall *ByValStdcallCaller_OUTER3)(OUTER3 outer3); |
1351 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_OUTER3(ByValStdcallCaller_OUTER3 caller) |
1352 | { |
1353 | //init |
1354 | OUTER3 outer3; |
1355 | LPSTR str = NULL; |
1356 | for( size_t i = 0; i < NumArrElements; i++ ) |
1357 | { |
1358 | outer3.arr[i].f1 = 1; |
1359 | outer3.arr[i].f2 = 1.0; |
1360 | str = GetSomeString(); |
1361 | outer3.arr[i].f3 = (LPCSTR)str; |
1362 | str = NULL; |
1363 | } |
1364 | |
1365 | str = GetSomeString(); |
1366 | outer3.f4 = (LPCSTR)str; |
1367 | |
1368 | if(!caller(outer3)) |
1369 | { |
1370 | PRINT_ERR_INFO(); |
1371 | return FALSE; |
1372 | } |
1373 | |
1374 | if( !IsCorrectOUTER3( &outer3 ) ) |
1375 | { |
1376 | PRINT_ERR_INFO(); |
1377 | return FALSE; |
1378 | } |
1379 | |
1380 | return TRUE; |
1381 | } |
1382 | |
1383 | ///// |
1384 | typedef BOOL (_cdecl *ByValCdeclCaller_U)(U u); |
1385 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_U(ByValCdeclCaller_U caller) |
1386 | { |
1387 | U u; |
1388 | u.d = 3.2; |
1389 | |
1390 | if(!caller(u)) |
1391 | { |
1392 | PRINT_ERR_INFO(); |
1393 | return FALSE; |
1394 | } |
1395 | |
1396 | if( !IsCorrectU( &u ) ) |
1397 | { |
1398 | PRINT_ERR_INFO(); |
1399 | return FALSE; |
1400 | } |
1401 | |
1402 | return TRUE; |
1403 | } |
1404 | |
1405 | typedef BOOL (__stdcall *ByValStdcallCaller_U)(U u); |
1406 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_U(ByValStdcallCaller_U caller) |
1407 | { |
1408 | U u; |
1409 | u.d = 3.2; |
1410 | |
1411 | if(!caller(u)) |
1412 | { |
1413 | PRINT_ERR_INFO(); |
1414 | return FALSE; |
1415 | } |
1416 | |
1417 | if( !IsCorrectU( &u ) ) |
1418 | { |
1419 | PRINT_ERR_INFO(); |
1420 | return FALSE; |
1421 | } |
1422 | |
1423 | return TRUE; |
1424 | } |
1425 | ///// |
1426 | |
1427 | typedef BOOL (_cdecl *ByValCdeclCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit bspe); |
1428 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_ByteStructPack2Explicit(ByValCdeclCaller_ByteStructPack2Explicit caller) |
1429 | { |
1430 | ByteStructPack2Explicit bspe; |
1431 | bspe.b1 = 32; |
1432 | bspe.b2 = 32; |
1433 | |
1434 | if(!caller(bspe)) |
1435 | { |
1436 | PRINT_ERR_INFO(); |
1437 | return FALSE; |
1438 | } |
1439 | |
1440 | if( !IsCorrectByteStructPack2Explicit( &bspe ) ) |
1441 | { |
1442 | PRINT_ERR_INFO(); |
1443 | return FALSE; |
1444 | } |
1445 | |
1446 | return TRUE; |
1447 | } |
1448 | |
1449 | typedef BOOL (__stdcall *ByValStdcallCaller_ByteStructPack2Explicit)(ByteStructPack2Explicit bspe); |
1450 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_ByteStructPack2Explicit(ByValStdcallCaller_ByteStructPack2Explicit caller) |
1451 | { |
1452 | ByteStructPack2Explicit bspe; |
1453 | bspe.b1 = 32; |
1454 | bspe.b2 = 32; |
1455 | |
1456 | if(!caller(bspe)) |
1457 | { |
1458 | PRINT_ERR_INFO(); |
1459 | return FALSE; |
1460 | } |
1461 | |
1462 | if( !IsCorrectByteStructPack2Explicit( &bspe ) ) |
1463 | { |
1464 | PRINT_ERR_INFO(); |
1465 | return FALSE; |
1466 | } |
1467 | |
1468 | return TRUE; |
1469 | } |
1470 | |
1471 | ///// |
1472 | typedef BOOL (_cdecl *ByValCdeclCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit sspe); |
1473 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_ShortStructPack4Explicit(ByValCdeclCaller_ShortStructPack4Explicit caller) |
1474 | { |
1475 | ShortStructPack4Explicit sspe; |
1476 | sspe.s1 = 32; |
1477 | sspe.s2 = 32; |
1478 | |
1479 | if(!caller(sspe)) |
1480 | { |
1481 | PRINT_ERR_INFO(); |
1482 | return FALSE; |
1483 | } |
1484 | |
1485 | if( !IsCorrectShortStructPack4Explicit( &sspe ) ) |
1486 | { |
1487 | PRINT_ERR_INFO(); |
1488 | return FALSE; |
1489 | } |
1490 | |
1491 | return TRUE; |
1492 | } |
1493 | |
1494 | typedef BOOL (__stdcall *ByValStdcallCaller_ShortStructPack4Explicit)(ShortStructPack4Explicit sspe); |
1495 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_ShortStructPack4Explicit(ByValStdcallCaller_ShortStructPack4Explicit caller) |
1496 | { |
1497 | ShortStructPack4Explicit sspe; |
1498 | sspe.s1 = 32; |
1499 | sspe.s2 = 32; |
1500 | |
1501 | if(!caller(sspe)) |
1502 | { |
1503 | PRINT_ERR_INFO(); |
1504 | return FALSE; |
1505 | } |
1506 | |
1507 | if( !IsCorrectShortStructPack4Explicit( &sspe ) ) |
1508 | { |
1509 | PRINT_ERR_INFO(); |
1510 | return FALSE; |
1511 | } |
1512 | |
1513 | return TRUE; |
1514 | } |
1515 | ///// |
1516 | |
1517 | typedef BOOL (_cdecl *ByValCdeclCaller_IntStructPack8Explicit)(IntStructPack8Explicit ispe); |
1518 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_IntStructPack8Explicit(ByValCdeclCaller_IntStructPack8Explicit caller) |
1519 | { |
1520 | IntStructPack8Explicit ispe; |
1521 | ispe.i1 = 32; |
1522 | ispe.i2 = 32; |
1523 | |
1524 | if(!caller(ispe)) |
1525 | { |
1526 | PRINT_ERR_INFO(); |
1527 | return FALSE; |
1528 | } |
1529 | |
1530 | if( !IsCorrectIntStructPack8Explicit( &ispe ) ) |
1531 | { |
1532 | PRINT_ERR_INFO(); |
1533 | return FALSE; |
1534 | } |
1535 | |
1536 | return TRUE; |
1537 | } |
1538 | |
1539 | typedef BOOL (__stdcall *ByValStdcallCaller_IntStructPack8Explicit)(IntStructPack8Explicit ispe); |
1540 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_IntStructPack8Explicit(ByValStdcallCaller_IntStructPack8Explicit caller) |
1541 | { |
1542 | IntStructPack8Explicit ispe; |
1543 | ispe.i1 = 32; |
1544 | ispe.i2 = 32; |
1545 | |
1546 | if(!caller(ispe)) |
1547 | { |
1548 | PRINT_ERR_INFO(); |
1549 | return FALSE; |
1550 | } |
1551 | |
1552 | if( !IsCorrectIntStructPack8Explicit( &ispe ) ) |
1553 | { |
1554 | PRINT_ERR_INFO(); |
1555 | return FALSE; |
1556 | } |
1557 | |
1558 | return TRUE; |
1559 | } |
1560 | |
1561 | ///// |
1562 | typedef BOOL (_cdecl *ByValCdeclCaller_LongStructPack16Explicit)(LongStructPack16Explicit lspe); |
1563 | extern "C" DLL_EXPORT BOOL _cdecl DoCallBack_MarshalByValStruct_Cdecl_LongStructPack16Explicit(ByValCdeclCaller_LongStructPack16Explicit caller) |
1564 | { |
1565 | LongStructPack16Explicit lspe; |
1566 | lspe.l1 = 32; |
1567 | lspe.l2 = 32; |
1568 | |
1569 | if(!caller(lspe)) |
1570 | { |
1571 | PRINT_ERR_INFO(); |
1572 | return FALSE; |
1573 | } |
1574 | |
1575 | if( !IsCorrectLongStructPack16Explicit( &lspe ) ) |
1576 | { |
1577 | PRINT_ERR_INFO(); |
1578 | return FALSE; |
1579 | } |
1580 | |
1581 | return TRUE; |
1582 | } |
1583 | |
1584 | typedef BOOL (__stdcall *ByValStdcallCaller_LongStructPack16Explicit)(LongStructPack16Explicit lspe); |
1585 | extern "C" DLL_EXPORT BOOL __stdcall DoCallBack_MarshalByValStruct_Stdcall_LongStructPack16Explicit(ByValStdcallCaller_LongStructPack16Explicit caller) |
1586 | { |
1587 | LongStructPack16Explicit lspe; |
1588 | lspe.l1 = 32; |
1589 | lspe.l2 = 32; |
1590 | |
1591 | if(!caller(lspe)) |
1592 | { |
1593 | PRINT_ERR_INFO(); |
1594 | return FALSE; |
1595 | } |
1596 | |
1597 | if( !IsCorrectLongStructPack16Explicit( &lspe ) ) |
1598 | { |
1599 | PRINT_ERR_INFO(); |
1600 | return FALSE; |
1601 | } |
1602 | |
1603 | return TRUE; |
1604 | } |
1605 | ///// |
1606 | //---------------------------- ----------// |
1607 | |