mirror of https://github.com/winsw/winsw
Replace GetLastError
parent
3bb10ab60d
commit
f1036e613b
|
@ -195,7 +195,7 @@ namespace winsw.Native
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
winErrorCode = Kernel32.GetLastError();
|
winErrorCode = Marshal.GetLastWin32Error();
|
||||||
Console.WriteLine("LookupAccountName failed: " + winErrorCode);
|
Console.WriteLine("LookupAccountName failed: " + winErrorCode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,9 +24,6 @@ namespace winsw.Native
|
||||||
string? lpCurrentDirectory,
|
string? lpCurrentDirectory,
|
||||||
[In] ref STARTUPINFO lpStartupInfo,
|
[In] ref STARTUPINFO lpStartupInfo,
|
||||||
out PROCESS_INFORMATION lpProcessInformation);
|
out PROCESS_INFORMATION lpProcessInformation);
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
|
||||||
public static extern int GetLastError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using log4net;
|
using log4net;
|
||||||
using winsw.Native;
|
|
||||||
|
|
||||||
namespace winsw.Util
|
namespace winsw.Util
|
||||||
{
|
{
|
||||||
|
@ -57,7 +56,7 @@ namespace winsw.Util
|
||||||
bool success = FreeConsole();
|
bool success = FreeConsole();
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
long errorCode = Kernel32.GetLastError();
|
long errorCode = Marshal.GetLastWin32Error();
|
||||||
Logger.Warn("Failed to detach from console. Error code: " + errorCode);
|
Logger.Warn("Failed to detach from console. Error code: " + errorCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue