Skip to content

Commit 3bf8b7c

Browse files
committed
embeddable-dll-service: csharp: ensure double \0 termination
Signed-off-by: Simon Rozman <[email protected]>
1 parent 1a3f183 commit 3bf8b7c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

embeddable-dll-service/csharp/TunnelDll/Service.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static void Add(string configFile, bool ephemeral)
4545
Win32.CloseServiceHandle(service);
4646
Remove(configFile, true);
4747
}
48-
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);
48+
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);
4949
if (service == IntPtr.Zero)
5050
throw new Win32Exception(Marshal.GetLastWin32Error());
5151
try
@@ -87,10 +87,7 @@ public static void Remove(string configFile, bool waitForStop)
8787
{
8888
var service = Win32.OpenService(scm, shortName, Win32.ServiceAccessRights.AllAccess);
8989
if (service == IntPtr.Zero)
90-
{
91-
Win32.CloseServiceHandle(service);
9290
return;
93-
}
9491
try
9592
{
9693
var serviceStatus = new Win32.ServiceStatus();

0 commit comments

Comments
 (0)