src: dotnet: testing

This commit is contained in:
Bill Zissimopoulos 2017-04-07 10:52:52 -07:00
parent 964f2eed69
commit 4d6fc3c848
2 changed files with 9 additions and 6 deletions

View File

@ -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()
{

View File

@ -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();
}
}
}