forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLPTStrTestNative.cs
More file actions
62 lines (52 loc) · 2.46 KB
/
Copy pathLPTStrTestNative.cs
File metadata and controls
62 lines (52 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.InteropServices;
using System.Text;
class LPTStrTestNative
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct ByValStringInStructAnsi
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string str;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct ByValStringInStructSplitAnsi
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string str1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string str2;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ByValStringInStructUnicode
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string str;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ByValStringInStructSplitUnicode
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string str1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
public string str2;
}
[DllImport(nameof(LPTStrTestNative), CharSet = CharSet.Unicode)]
public static extern bool Verify_NullTerminators_PastEnd(StringBuilder builder, int length);
[DllImport(nameof(LPTStrTestNative), EntryPoint = "Verify_NullTerminators_PastEnd", CharSet = CharSet.Unicode)]
public static extern bool Verify_NullTerminators_PastEnd_Out([Out] StringBuilder builder, int length);
[DllImport(nameof(LPTStrTestNative))]
public static extern bool MatchFuncNameAnsi(ByValStringInStructAnsi str);
[DllImport(nameof(LPTStrTestNative))]
public static extern bool MatchFuncNameUni(ByValStringInStructUnicode str);
[DllImport(nameof(LPTStrTestNative))]
public static extern void ReverseByValStringAnsi(ref ByValStringInStructAnsi str);
[DllImport(nameof(LPTStrTestNative))]
public static extern void ReverseByValStringUni(ref ByValStringInStructUnicode str);
[DllImport(nameof(LPTStrTestNative))]
public static extern void ReverseCopyByValStringAnsi(ByValStringInStructAnsi str, out ByValStringInStructSplitAnsi strOut);
[DllImport(nameof(LPTStrTestNative))]
public static extern void ReverseCopyByValStringUni(ByValStringInStructUnicode str, out ByValStringInStructSplitUnicode strOut);
}