diff options
author | Simon Rozman <simon@rozman.si> | 2022-03-28 12:38:29 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2022-03-28 12:40:20 +0200 |
commit | 3bf8b7c4389b94e79f297334821fa79901b94a23 (patch) | |
tree | 39cfef14c2f9bd53e2b04f85ea6e7534d133ec6b | |
parent | embeddable-dll-service: correctness in README (diff) | |
download | wireguard-windows-3bf8b7c4389b94e79f297334821fa79901b94a23.tar.xz wireguard-windows-3bf8b7c4389b94e79f297334821fa79901b94a23.zip |
embeddable-dll-service: csharp: ensure double \0 termination
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to '')
-rw-r--r-- | embeddable-dll-service/csharp/TunnelDll/Service.cs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/embeddable-dll-service/csharp/TunnelDll/Service.cs b/embeddable-dll-service/csharp/TunnelDll/Service.cs index 2a8358ff..74e1a888 100644 --- a/embeddable-dll-service/csharp/TunnelDll/Service.cs +++ b/embeddable-dll-service/csharp/TunnelDll/Service.cs @@ -45,7 +45,7 @@ namespace Tunnel Win32.CloseServiceHandle(service); Remove(configFile, true); } - service = Win32.CreateService(scm, shortName, longName, Win32.ServiceAccessRights.AllAccess, Win32.ServiceType.Win32OwnProcess, Win32.ServiceStartType.Demand, Win32.ServiceError.Normal, pathAndArgs, null, IntPtr.Zero, "Nsi\0TcpIp", null, null); + service = Win32.CreateService(scm, shortName, longName, Win32.ServiceAccessRights.AllAccess, Win32.ServiceType.Win32OwnProcess, Win32.ServiceStartType.Demand, Win32.ServiceError.Normal, pathAndArgs, null, IntPtr.Zero, "Nsi\0TcpIp\0", null, null); if (service == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error()); try @@ -87,10 +87,7 @@ namespace Tunnel { var service = Win32.OpenService(scm, shortName, Win32.ServiceAccessRights.AllAccess); if (service == IntPtr.Zero) - { - Win32.CloseServiceHandle(service); return; - } try { var serviceStatus = new Win32.ServiceStatus(); |