34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace FileTransfer
|
|
{
|
|
class WtsApi32
|
|
{
|
|
|
|
[DllImport("Wtsapi32.dll", SetLastError = true)]
|
|
public static extern bool WTSVirtualChannelWrite(IntPtr channelHandle, byte[] data, int length, ref int bytesWritten);
|
|
|
|
[DllImport("Wtsapi32.dll", SetLastError = true)]
|
|
public static extern bool WTSVirtualChannelRead(IntPtr channelHandle, uint TimeOut, byte[] data, int length, ref int bytesReaded);
|
|
|
|
[DllImport("Wtsapi32.dll")]
|
|
public static extern IntPtr WTSVirtualChannelOpen(IntPtr server, int sessionId, [MarshalAs(UnmanagedType.LPStr)] string virtualName);
|
|
|
|
[DllImport("Wtsapi32.dll")]
|
|
public static extern bool WTSVirtualChannelClose(IntPtr channelHandle);
|
|
|
|
public enum VirtualClass
|
|
{
|
|
ClientData,
|
|
FileHandle
|
|
};
|
|
|
|
[DllImport("Wtsapi32.dll", SetLastError = true)]
|
|
public static extern bool WTSVirtualChannelQuery(IntPtr channelHandle, VirtualClass virtualClass, out IntPtr buffer, ref uint bytesReturned);
|
|
|
|
[DllImport("Wtsapi32.dll", SetLastError = true)]
|
|
public static extern void WTSFreeMemory(IntPtr memory);
|
|
}
|
|
}
|