From 4d6fc3c84815f09bde5df8f142a0e2669125f3eb Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 7 Apr 2017 10:52:52 -0700 Subject: [PATCH] src: dotnet: testing --- src/dotnet/Service.cs | 11 +++++++---- tst/passthrough-dotnet/Program.cs | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/dotnet/Service.cs b/src/dotnet/Service.cs index 32f82613..14b70d3c 100644 --- a/src/dotnet/Service.cs +++ b/src/dotnet/Service.cs @@ -47,24 +47,27 @@ namespace Fsp } /* control */ - public void Run() + public int Run() { if (IntPtr.Zero == _Service) { + const Int32 STATUS_INSUFFICIENT_RESOURCES = unchecked((Int32)0xc000009a); Log(EVENTLOG_ERROR_TYPE, String.Format("The service {0} cannot be created (Status={1:X}).", - GetType().FullName, unchecked((Int32)0xc000009a)/*STATUS_INSUFFICIENT_RESOURCES*/)); - return; + GetType().FullName, STATUS_INSUFFICIENT_RESOURCES)); + return (int)Api.FspWin32FromNtStatus(STATUS_INSUFFICIENT_RESOURCES); } Api.FspServiceAllowConsoleMode(_Service); Int32 Result = Api.FspServiceLoop(_Service); + int ExitCode = (int)Api.FspServiceGetExitCode(_Service); if (0 > Result) { Log(EVENTLOG_ERROR_TYPE, String.Format("The service {0} has failed to run (Status={1:X}).", GetType().FullName, Result)); - return; + return (int)Api.FspWin32FromNtStatus(Result); } + return ExitCode; } public void Stop() { diff --git a/tst/passthrough-dotnet/Program.cs b/tst/passthrough-dotnet/Program.cs index 154dde8e..f34c72a8 100644 --- a/tst/passthrough-dotnet/Program.cs +++ b/tst/passthrough-dotnet/Program.cs @@ -37,9 +37,9 @@ namespace passthrough class Program { - static void Main(string[] args) + static int Main(string[] args) { - new PtfsService().Run(); + return new PtfsService().Run(); } } }