Issue #85 - Get rid of the deprecated FileHandle API (#167)

pull/172/head
Oleg Nenashev 2016-12-22 23:40:44 +01:00 committed by GitHub
parent 0c8a5e6ee0
commit ab51b50d85
2 changed files with 6 additions and 5 deletions

View File

@ -555,7 +555,7 @@ namespace winsw
Console.SetOut(w);
Console.SetError(w);
var handle = f.Handle;
var handle = f.SafeFileHandle;
Kernel32.SetStdHandle(-11, handle); // set stdout
Kernel32.SetStdHandle(-12, handle); // set stder

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.Win32.SafeHandles;
using System;
using System.Runtime.InteropServices;
namespace winsw.Native
@ -8,8 +9,8 @@ namespace winsw.Native
/// </summary>
public class Kernel32
{
[DllImport("Kernel32.dll", SetLastError = true)]
public static extern int SetStdHandle(int device, IntPtr handle);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool SetStdHandle(int nStdHandle, SafeFileHandle handle);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CreateProcess(string lpApplicationName,