diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-10-08 10:59:06 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-10-09 09:44:03 +0200 |
commit | 7acf19c78f85dc0cc9572736585ec68f01ed9b60 (patch) | |
tree | dfec681d4b1129ee08e0383ea621ccee898028c7 /embeddable-dll-service/csharp | |
parent | tunnel: print wintun version in debug log (diff) | |
download | wireguard-windows-7acf19c78f85dc0cc9572736585ec68f01ed9b60.tar.xz wireguard-windows-7acf19c78f85dc0cc9572736585ec68f01ed9b60.zip |
embeddable-dll-service: do not marshall go strings
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'embeddable-dll-service/csharp')
-rw-r--r-- | embeddable-dll-service/csharp/Service.cs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/embeddable-dll-service/csharp/Service.cs b/embeddable-dll-service/csharp/Service.cs index 1375a3cb..4ad9fe47 100644 --- a/embeddable-dll-service/csharp/Service.cs +++ b/embeddable-dll-service/csharp/Service.cs @@ -19,20 +19,8 @@ namespace Tunnel private const string LongName = "Example WireGuard Tunnel Client"; private const string Description = "A WireGuard tunnel created by example code."; - [StructLayout(LayoutKind.Sequential)] - private struct GoString - { - public string str; - public long len; - } - [DllImport("tunnel.dll", EntryPoint = "WireGuardTunnelService", CallingConvention = CallingConvention.Cdecl)] - private static extern bool WireGuardTunnelService(GoString configFile); - - public static bool Run(string configFile) - { - return WireGuardTunnelService(new GoString { str = configFile, len = configFile.Length }); - } + public static extern bool Run([MarshalAs(UnmanagedType.LPWStr)] string configFile); public static NamedPipeClientStream GetPipe(string configFile) { |