From 328b987117bbaaa39f575612b361319fff0913f5 Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Thu, 4 Apr 2019 16:40:54 -0700 Subject: [PATCH] Migrated Remotely_Library to .NET Standard. Refactored tuples to typed class. --- Remotely.sln | 2 +- Remotely_Agent/Program.cs | 2 - Remotely_Agent/Services/DeviceSocket.cs | 3 +- Remotely_Desktop/Remotely_Desktop.csproj | 4 + .../ViewModels/MainWindowViewModel.cs | 9 +- Remotely_Library/Models/Device.cs | 1 - .../Models/PSCoreCommandResult.cs | 1 - Remotely_Library/Models/PSError.cs | 1 - Remotely_Library/Models/ScreenCastRequest.cs | 12 + Remotely_Library/Remotely_Library.csproj | 4 +- Remotely_Library/Win32/ADVAPI32.cs | 2 +- .../Win32/GDI32.cs | 2 +- Remotely_Library/Win32/Kernel32.cs | 2 +- Remotely_Library/Win32/SECUR32.cs | 2 +- Remotely_Library/Win32/User32.cs | 13 +- Remotely_Library/Win32/WTSAPI32.cs | 2 +- Remotely_Library/Win32/Win32Interop.cs | 114 +- Remotely_ScreenCast.Core/Conductor.cs | 19 +- Remotely_ScreenCast.Core/Models/CursorInfo.cs | 24 - .../Models/CursorInfo.d.ts | 5 - .../Remotely_ScreenCast.Core.csproj | 6 +- .../Sockets/MessageHandlers.cs | 5 +- .../Sockets/OutgoingMessages.cs | 1 + Remotely_ScreenCast.Linux/Program.cs | 9 +- .../Remotely_ScreenCast.Linux.csproj | 1 + .../Capture/BitBltCapture.cs | 1 - .../Capture/CursorIconWatcher.cs | 3 +- Remotely_ScreenCast.Win/Capture/DXCapture.cs | 1 - Remotely_ScreenCast.Win/Input/WinInput.cs | 4 +- Remotely_ScreenCast.Win/Program.cs | 9 +- .../Remotely_ScreenCast.Win.csproj | 11 +- Remotely_ScreenCast.Win/Win32/ADVAPI32.cs | 372 ----- Remotely_ScreenCast.Win/Win32/Kernel32.cs | 24 - Remotely_ScreenCast.Win/Win32/SECUR32.cs | 373 ----- Remotely_ScreenCast.Win/Win32/User32.cs | 1252 ----------------- Remotely_ScreenCast.Win/Win32/WTSAPI32.cs | 43 - Remotely_ScreenCast.Win/Win32/Win32Interop.cs | 144 -- Remotely_Server/API/CommandsController.cs | 1 - Remotely_Server/CurrentVersion.txt | 2 +- Remotely_Server/Services/ApplicationConfig.cs | 2 +- Remotely_Server/Services/DeviceSocketHub.cs | 1 - Remotely_Server/appsettings.json | 2 +- .../Pages/OrganizationManagement.js.map | 2 +- .../scripts/Pages/OrganizationManagement.ts | 4 +- 44 files changed, 95 insertions(+), 2402 deletions(-) create mode 100644 Remotely_Library/Models/ScreenCastRequest.cs rename {Remotely_ScreenCast.Win => Remotely_Library}/Win32/GDI32.cs (99%) delete mode 100644 Remotely_ScreenCast.Core/Models/CursorInfo.cs delete mode 100644 Remotely_ScreenCast.Core/Models/CursorInfo.d.ts delete mode 100644 Remotely_ScreenCast.Win/Win32/ADVAPI32.cs delete mode 100644 Remotely_ScreenCast.Win/Win32/Kernel32.cs delete mode 100644 Remotely_ScreenCast.Win/Win32/SECUR32.cs delete mode 100644 Remotely_ScreenCast.Win/Win32/User32.cs delete mode 100644 Remotely_ScreenCast.Win/Win32/WTSAPI32.cs delete mode 100644 Remotely_ScreenCast.Win/Win32/Win32Interop.cs diff --git a/Remotely.sln b/Remotely.sln index 75a6ee6f..07bf3cfc 100644 --- a/Remotely.sln +++ b/Remotely.sln @@ -35,7 +35,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remotely_Desktop", "Remotel EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Remotely_ScreenCast.Linux", "Remotely_ScreenCast.Linux\Remotely_ScreenCast.Linux.csproj", "{E46F11D0-3C88-4D43-8CCC-EE7182CAD5C1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Remotely_ScreenCast.Core", "Remotely_ScreenCast.Core\Remotely_ScreenCast.Core.csproj", "{B04A1728-2E87-491E-BC7F-F575A1754DEF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Remotely_ScreenCast.Core", "Remotely_ScreenCast.Core\Remotely_ScreenCast.Core.csproj", "{B04A1728-2E87-491E-BC7F-F575A1754DEF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Remotely_Agent/Program.cs b/Remotely_Agent/Program.cs index 84429bfd..67b9f6b3 100644 --- a/Remotely_Agent/Program.cs +++ b/Remotely_Agent/Program.cs @@ -1,7 +1,5 @@ using Remotely_Agent.Services; using Remotely_Library.Services; -using Remotely_Library.Win32; -using Remotely_Library.Win32_Classes; using Newtonsoft.Json; using System; using System.Collections.Generic; diff --git a/Remotely_Agent/Services/DeviceSocket.cs b/Remotely_Agent/Services/DeviceSocket.cs index f88f5bc9..3b05290b 100644 --- a/Remotely_Agent/Services/DeviceSocket.cs +++ b/Remotely_Agent/Services/DeviceSocket.cs @@ -1,7 +1,5 @@ using Remotely_Library.Models; using Remotely_Library.Services; -using Remotely_Library.Win32; -using Remotely_Library.Win32_Classes; using Microsoft.AspNetCore.SignalR.Client; using Newtonsoft.Json; using System; @@ -14,6 +12,7 @@ using System.Text; using System.Threading.Tasks; using System.Timers; using System.Reflection; +using Remotely_Library.Win32; namespace Remotely_Agent.Services { diff --git a/Remotely_Desktop/Remotely_Desktop.csproj b/Remotely_Desktop/Remotely_Desktop.csproj index c86c4bd0..7963087f 100644 --- a/Remotely_Desktop/Remotely_Desktop.csproj +++ b/Remotely_Desktop/Remotely_Desktop.csproj @@ -134,6 +134,10 @@ + + {a9e1ba7a-6080-4dac-9b29-6dc8437150ea} + Remotely_Library + {b04a1728-2e87-491e-bc7f-f575a1754def} Remotely_ScreenCast.Core diff --git a/Remotely_Desktop/ViewModels/MainWindowViewModel.cs b/Remotely_Desktop/ViewModels/MainWindowViewModel.cs index aea50e41..ca1d0299 100644 --- a/Remotely_Desktop/ViewModels/MainWindowViewModel.cs +++ b/Remotely_Desktop/ViewModels/MainWindowViewModel.cs @@ -1,5 +1,6 @@ using Remotely_Desktop.Controls; using Remotely_Desktop.Services; +using Remotely_Library.Models; using Remotely_ScreenCast.Core; using Remotely_ScreenCast.Core.Capture; using Remotely_ScreenCast.Core.Models; @@ -150,11 +151,11 @@ namespace Remotely_Desktop.ViewModels await Conductor?.OutgoingMessages?.SendCursorChange(cursor, Conductor.Viewers.Keys.ToList()); } } - private void ScreenCastRequested(object sender, Tuple viewerAndRequester) + private void ScreenCastRequested(object sender, ScreenCastRequest screenCastRequest) { App.Current.Dispatcher.Invoke(() => { - var result = MessageBox.Show($"You've received a connection request from {viewerAndRequester.Item2}. Accept?", "Connection Request", MessageBoxButton.YesNo, MessageBoxImage.Question); + var result = MessageBox.Show($"You've received a connection request from {screenCastRequest.RequesterName}. Accept?", "Connection Request", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { Task.Run(async() => @@ -177,8 +178,8 @@ namespace Remotely_Desktop.ViewModels Logger.Write(ex); capturer = new BitBltCapture(); } - await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List() { viewerAndRequester.Item1 }); - ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, capturer, Conductor); + await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List() { screenCastRequest.ViewerID }); + ScreenCaster.BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, capturer, Conductor); }); } }); diff --git a/Remotely_Library/Models/Device.cs b/Remotely_Library/Models/Device.cs index ea04ce6b..63b20f84 100644 --- a/Remotely_Library/Models/Device.cs +++ b/Remotely_Library/Models/Device.cs @@ -6,7 +6,6 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.IO; using System.Linq; -using System.Management; using System.Runtime.InteropServices; namespace Remotely_Library.Models diff --git a/Remotely_Library/Models/PSCoreCommandResult.cs b/Remotely_Library/Models/PSCoreCommandResult.cs index a6dffea1..976ecb52 100644 --- a/Remotely_Library/Models/PSCoreCommandResult.cs +++ b/Remotely_Library/Models/PSCoreCommandResult.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Management.Automation; using System.Text; namespace Remotely_Library.Models diff --git a/Remotely_Library/Models/PSError.cs b/Remotely_Library/Models/PSError.cs index 2a5d9394..9e8aed5d 100644 --- a/Remotely_Library/Models/PSError.cs +++ b/Remotely_Library/Models/PSError.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Management.Automation; using System.Text; namespace Remotely_Library.Models diff --git a/Remotely_Library/Models/ScreenCastRequest.cs b/Remotely_Library/Models/ScreenCastRequest.cs new file mode 100644 index 00000000..4c13b270 --- /dev/null +++ b/Remotely_Library/Models/ScreenCastRequest.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Remotely_Library.Models +{ + public class ScreenCastRequest + { + public string ViewerID { get; set; } + public string RequesterName { get; set; } + } +} diff --git a/Remotely_Library/Remotely_Library.csproj b/Remotely_Library/Remotely_Library.csproj index b1e16357..9df655e6 100644 --- a/Remotely_Library/Remotely_Library.csproj +++ b/Remotely_Library/Remotely_Library.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netstandard2.0 AnyCPU;x86;x64 @@ -19,11 +19,9 @@ - - diff --git a/Remotely_Library/Win32/ADVAPI32.cs b/Remotely_Library/Win32/ADVAPI32.cs index 58bb18e2..c7da5679 100644 --- a/Remotely_Library/Win32/ADVAPI32.cs +++ b/Remotely_Library/Win32/ADVAPI32.cs @@ -4,7 +4,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Security; -namespace Remotely_Library.Win32_Classes +namespace Remotely_Library.Win32 { public static class ADVAPI32 { diff --git a/Remotely_ScreenCast.Win/Win32/GDI32.cs b/Remotely_Library/Win32/GDI32.cs similarity index 99% rename from Remotely_ScreenCast.Win/Win32/GDI32.cs rename to Remotely_Library/Win32/GDI32.cs index 86a35847..2dea3bd8 100644 --- a/Remotely_ScreenCast.Win/Win32/GDI32.cs +++ b/Remotely_Library/Win32/GDI32.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -namespace Win32 +namespace Remotely_Library.Win32 { public static class GDI32 { diff --git a/Remotely_Library/Win32/Kernel32.cs b/Remotely_Library/Win32/Kernel32.cs index e4215494..1e3114a7 100644 --- a/Remotely_Library/Win32/Kernel32.cs +++ b/Remotely_Library/Win32/Kernel32.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace Remotely_Library.Win32_Classes +namespace Remotely_Library.Win32 { public static class Kernel32 { diff --git a/Remotely_Library/Win32/SECUR32.cs b/Remotely_Library/Win32/SECUR32.cs index 5a2c9853..24dd82bd 100644 --- a/Remotely_Library/Win32/SECUR32.cs +++ b/Remotely_Library/Win32/SECUR32.cs @@ -3,7 +3,7 @@ using System.Runtime.InteropServices; using System.Runtime.Versioning; using Microsoft.Win32.SafeHandles; using System.Runtime.ConstrainedExecution; -using Remotely_Library.Win32_Classes; +using Remotely_Library.Win32; public static class SECUR32 { diff --git a/Remotely_Library/Win32/User32.cs b/Remotely_Library/Win32/User32.cs index cf6037a7..b0a6baf1 100644 --- a/Remotely_Library/Win32/User32.cs +++ b/Remotely_Library/Win32/User32.cs @@ -5,7 +5,7 @@ using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Text; -namespace Remotely_Library.Win32_Classes +namespace Remotely_Library.Win32 { public static class User32 { @@ -63,6 +63,12 @@ namespace Remotely_Library.Win32_Classes XDOWN = 0x0080, XUP = 0x0100 } + public enum MonitorState + { + MonitorStateOn = -1, + MonitorStateOff = 2, + MonitorStateStandBy = 1 + } [Flags] public enum KEYEVENTF : uint { @@ -1126,7 +1132,7 @@ namespace Remotely_Library.Win32_Classes [DllImport("user32.dll")] public static extern bool EnumDesktopsA(IntPtr hwinsta, EnumDesktopsDelegate lpEnumFunc, IntPtr lParam); - + [DllImport("user32.dll", SetLastError = true)] public static extern IntPtr OpenInputDesktop(uint dwFlags, bool fInherit, ACCESS_MASK dwDesiredAccess); @@ -1238,6 +1244,9 @@ namespace Remotely_Library.Win32_Classes [DllImport("user32.dll")] public static extern short VkKeyScan(char ch); + [DllImport("user32.dll")] + public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam); + #endregion } } diff --git a/Remotely_Library/Win32/WTSAPI32.cs b/Remotely_Library/Win32/WTSAPI32.cs index 4c3ae3b1..e10bbe7c 100644 --- a/Remotely_Library/Win32/WTSAPI32.cs +++ b/Remotely_Library/Win32/WTSAPI32.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace Remotely_Library.Win32_Classes +namespace Remotely_Library.Win32 { public static class WTSAPI32 { diff --git a/Remotely_Library/Win32/Win32Interop.cs b/Remotely_Library/Win32/Win32Interop.cs index ebc08ecc..f44ce40e 100644 --- a/Remotely_Library/Win32/Win32Interop.cs +++ b/Remotely_Library/Win32/Win32Interop.cs @@ -1,12 +1,12 @@ -using Remotely_Library.Win32_Classes; +using Remotely_Library.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Text; -using static Remotely_Library.Win32_Classes.ADVAPI32; -using static Remotely_Library.Win32_Classes.User32; +using static Remotely_Library.Win32.ADVAPI32; +using static Remotely_Library.Win32.User32; namespace Remotely_Library.Win32 { @@ -65,14 +65,14 @@ namespace Remotely_Library.Win32 // user input. To remedy this we set the lpDesktop parameter to indicate we want to enable user // interaction with the new process. STARTUPINFO si = new STARTUPINFO(); - si.cb = (int)Marshal.SizeOf(si); + si.cb = Marshal.SizeOf(si); si.lpDesktop = @"winsta0\" + desktopName; // Flags that specify the priority and creation method of the process. uint dwCreationFlags; if (hiddenWindow) { - dwCreationFlags = NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW; + dwCreationFlags = NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW | DETACHED_PROCESS; } else { @@ -120,81 +120,6 @@ namespace Remotely_Library.Win32 { return User32.OpenInputDesktop(0, false, ACCESS_MASK.GENERIC_ALL); } - public static void SendLeftMouseDown(int x, int y) - { - mouse_event(MOUSEEVENTF_LEFTDOWN, (uint)x, (uint)y, 0, GetMessageExtraInfo()); - } - public static void SendLeftMouseUp(int x, int y) - { - mouse_event(MOUSEEVENTF_LEFTUP, (uint)x, (uint)y, 0, GetMessageExtraInfo()); - } - public static void SendRightMouseDown(int x, int y) - { - mouse_event(MOUSEEVENTF_RIGHTDOWN, (uint)x, (uint)y, 0, GetMessageExtraInfo()); - } - public static void SendRightMouseUp(int x, int y) - { - mouse_event(MOUSEEVENTF_RIGHTUP, (uint)x, (uint)y, 0, GetMessageExtraInfo()); - } - - // Offsets are used in case there's a multi-monitor setup where the left-most or top-most edge of the virtual screen - // is not 0. The coordinates sent from the web viewer are always zero-based, so the offset must be applied. - public static uint SendMouseMove(double x, double y) - { - // Coordinates must be normalized. The bottom-right coordinate is mapped to 65535. - var normalizedX = x * (double)65535; - var normalizedY = y * (double)65535; - var union = new InputUnion() { mi = new MOUSEINPUT() { dwFlags = MOUSEEVENTF.ABSOLUTE | MOUSEEVENTF.MOVE | MOUSEEVENTF.VIRTUALDESK, dx = (int)normalizedX, dy = (int)normalizedY, time = 0, mouseData = 0, dwExtraInfo = (UIntPtr)GetMessageExtraInfo() } }; - var input = new INPUT() { type = InputType.MOUSE, U = union }; - return SendInput(1, new INPUT[] { input }, INPUT.Size); - } - - public static uint SendMouseWheel(int deltaY) - { - if (deltaY < 0) - { - deltaY = -120; - } - else if (deltaY > 0) - { - deltaY = 120; - } - var union = new User32.InputUnion() { mi = new User32.MOUSEINPUT() { dwFlags = MOUSEEVENTF.WHEEL, dx = 0, dy = 0, time = 0, mouseData = deltaY, dwExtraInfo = GetMessageExtraInfo() } }; - var input = new User32.INPUT() { type = InputType.MOUSE, U = union }; - return SendInput(1, new User32.INPUT[] { input }, INPUT.Size); - } - - public static void SendKeyDown(VirtualKey key) - { - var union = new InputUnion() - { - ki = new KEYBDINPUT() - { - wVk = key, - wScan = 0, - time = 0, - dwExtraInfo = GetMessageExtraInfo() - } - }; - var input = new INPUT() { type = InputType.KEYBOARD, U = union }; - SendInput(1, new INPUT[] { input }, INPUT.Size); - } - public static void SendKeyUp(VirtualKey key) - { - var union = new InputUnion() - { - ki = new KEYBDINPUT() - { - wVk = key, - wScan = 0, - time = 0, - dwFlags = KEYEVENTF.KEYUP, - dwExtraInfo = GetMessageExtraInfo() - } - }; - var input = new INPUT() { type = InputType.KEYBOARD, U = union }; - SendInput(1, new INPUT[] { input }, INPUT.Size); - } public static string GetCurrentDesktop() { var inputDesktop = OpenInputDesktop(); @@ -203,33 +128,16 @@ namespace Remotely_Library.Win32 var success = GetUserObjectInformationW(inputDesktop, UOI_NAME, deskBytes, 256, out lenNeeded); if (!success) { - return "default"; + CloseDesktop(inputDesktop); + return "Default"; } - string deskName; - deskName = Encoding.Unicode.GetString(deskBytes.Take((int)lenNeeded).ToArray()).Replace("\0", ""); + var desktopName = Encoding.Unicode.GetString(deskBytes.Take((int)lenNeeded).ToArray()).Replace("\0", ""); CloseDesktop(inputDesktop); - return deskName; + return desktopName; } - - // Remove trailing empty bytes in the buffer. - private static byte[] TrimBytes(byte[] bytes) + public static void SetMonitorState(MonitorState state) { - // Loop backwards through array until the first non-zero byte is found. - var firstZero = 0; - for (int i = bytes.Length - 1; i >= 0; i--) - { - if (bytes[i] != 0) - { - firstZero = i + 1; - break; - } - } - if (firstZero == 0) - { - throw new Exception("Byte array is empty."); - } - // Return non-empty bytes. - return bytes.Take(firstZero).ToArray(); + User32.SendMessage(0xFFFF, 0x112, 0xF170, (int)state); } } } diff --git a/Remotely_ScreenCast.Core/Conductor.cs b/Remotely_ScreenCast.Core/Conductor.cs index ffac6e9c..04089762 100644 --- a/Remotely_ScreenCast.Core/Conductor.cs +++ b/Remotely_ScreenCast.Core/Conductor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Extensions.DependencyInjection; +using Remotely_Library.Models; using Remotely_ScreenCast.Core.Enums; using Remotely_ScreenCast.Core.Input; using Remotely_ScreenCast.Core.Models; @@ -16,9 +17,9 @@ namespace Remotely_ScreenCast.Core { public class Conductor { - public event EventHandler> ScreenCastInitiated; + public event EventHandler ScreenCastInitiated; - public event EventHandler> ScreenCastRequested; + public event EventHandler ScreenCastRequested; public event EventHandler SessionIDChanged; @@ -98,14 +99,19 @@ namespace Remotely_ScreenCast.Core timer.Start(); } - internal void InvokeScreenCastInitiated(Tuple viewerIdAndRequesterName) + internal void InvokeScreenCastInitiated(ScreenCastRequest viewerIdAndRequesterName) { ScreenCastInitiated?.Invoke(null, viewerIdAndRequesterName); } - internal void InvokeScreenCastRequested(Tuple viewerIdAndRequesterName) + internal void InvokeScreenCastRequested(ScreenCastRequest viewerIdAndRequesterName) { ScreenCastRequested?.Invoke(null, viewerIdAndRequesterName); } + internal void InvokeSessionIDChanged(string sessionID) + { + SessionIDChanged?.Invoke(null, sessionID); + } + internal void InvokeViewerAdded(Viewer viewer) { ViewerAdded?.Invoke(null, viewer); @@ -114,10 +120,5 @@ namespace Remotely_ScreenCast.Core { ViewerRemoved?.Invoke(null, viewerID); } - - internal void InvokeSessionIDChanged(string sessionID) - { - SessionIDChanged?.Invoke(null, sessionID); - } } } diff --git a/Remotely_ScreenCast.Core/Models/CursorInfo.cs b/Remotely_ScreenCast.Core/Models/CursorInfo.cs deleted file mode 100644 index 59b5335d..00000000 --- a/Remotely_ScreenCast.Core/Models/CursorInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Remotely_ScreenCast.Core.Models -{ - public class CursorInfo - { - public CursorInfo(byte[] imageBytes, Point hotspot, string cssOverride = null) - { - ImageBytes = imageBytes; - HotSpot = hotspot; - CssOverride = cssOverride; - } - - public byte[] ImageBytes { get; set; } - public Point HotSpot { get; set; } - - public string CssOverride { get; set; } - } -} diff --git a/Remotely_ScreenCast.Core/Models/CursorInfo.d.ts b/Remotely_ScreenCast.Core/Models/CursorInfo.d.ts deleted file mode 100644 index e7037d9b..00000000 --- a/Remotely_ScreenCast.Core/Models/CursorInfo.d.ts +++ /dev/null @@ -1,5 +0,0 @@ - interface CursorInfo { - ImageBytes: any[]; - HotSpot: any; - CssOverride: string; - } diff --git a/Remotely_ScreenCast.Core/Remotely_ScreenCast.Core.csproj b/Remotely_ScreenCast.Core/Remotely_ScreenCast.Core.csproj index 9a371c88..54d454d4 100644 --- a/Remotely_ScreenCast.Core/Remotely_ScreenCast.Core.csproj +++ b/Remotely_ScreenCast.Core/Remotely_ScreenCast.Core.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -23,4 +23,8 @@ + + + + diff --git a/Remotely_ScreenCast.Core/Sockets/MessageHandlers.cs b/Remotely_ScreenCast.Core/Sockets/MessageHandlers.cs index f1c2f366..5e959c3b 100644 --- a/Remotely_ScreenCast.Core/Sockets/MessageHandlers.cs +++ b/Remotely_ScreenCast.Core/Sockets/MessageHandlers.cs @@ -12,6 +12,7 @@ using System.IO; using System.Diagnostics; using Remotely_ScreenCast.Core.Models; using Remotely_ScreenCast.Core.Input; +using Remotely_Library.Models; namespace Remotely_ScreenCast.Core.Sockets { @@ -30,7 +31,7 @@ namespace Remotely_ScreenCast.Core.Sockets { try { - conductor.InvokeScreenCastInitiated(new Tuple(viewerID, requesterName)); + conductor.InvokeScreenCastInitiated(new ScreenCastRequest() { ViewerID = viewerID, RequesterName = requesterName }); } catch (Exception ex) { @@ -40,7 +41,7 @@ namespace Remotely_ScreenCast.Core.Sockets hubConnection.On("RequestScreenCast", (string viewerID, string requesterName) => { - conductor.InvokeScreenCastRequested(new Tuple(viewerID, requesterName)); + conductor.InvokeScreenCastRequested(new ScreenCastRequest() { ViewerID = viewerID, RequesterName = requesterName }); }); hubConnection.On("KeyDown", (string key, string viewerID) => diff --git a/Remotely_ScreenCast.Core/Sockets/OutgoingMessages.cs b/Remotely_ScreenCast.Core/Sockets/OutgoingMessages.cs index 76eb2fdb..4d52d2da 100644 --- a/Remotely_ScreenCast.Core/Sockets/OutgoingMessages.cs +++ b/Remotely_ScreenCast.Core/Sockets/OutgoingMessages.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.SignalR.Client; +using Remotely_Library.Models; using Remotely_ScreenCast.Core.Models; using System; using System.Collections.Concurrent; diff --git a/Remotely_ScreenCast.Linux/Program.cs b/Remotely_ScreenCast.Linux/Program.cs index 78b73cfd..c5060119 100644 --- a/Remotely_ScreenCast.Linux/Program.cs +++ b/Remotely_ScreenCast.Linux/Program.cs @@ -1,4 +1,5 @@ -using Remotely_ScreenCast.Core; +using Remotely_Library.Models; +using Remotely_ScreenCast.Core; using Remotely_ScreenCast.Core.Capture; using Remotely_ScreenCast.Core.Utilities; using Remotely_ScreenCast.Linux.Capture; @@ -41,13 +42,13 @@ namespace Remotely_ScreenCast.Linux } } - private static async void ScreenCastInitiated(object sender, Tuple viewerAndRequester) + private static async void ScreenCastInitiated(object sender, ScreenCastRequest screenCastRequest) { try { var capturer = new X11Capture(Display); - await Conductor.OutgoingMessages.SendCursorChange(new Core.Models.CursorInfo(null, Point.Empty, "default"), new List() { viewerAndRequester.Item1 }); - ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, capturer, Conductor); + await Conductor.OutgoingMessages.SendCursorChange(new CursorInfo(null, Point.Empty, "default"), new List() { screenCastRequest.ViewerID }); + ScreenCaster.BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, capturer, Conductor); } catch (Exception ex) { diff --git a/Remotely_ScreenCast.Linux/Remotely_ScreenCast.Linux.csproj b/Remotely_ScreenCast.Linux/Remotely_ScreenCast.Linux.csproj index 70ca8bd4..feb58a91 100644 --- a/Remotely_ScreenCast.Linux/Remotely_ScreenCast.Linux.csproj +++ b/Remotely_ScreenCast.Linux/Remotely_ScreenCast.Linux.csproj @@ -19,6 +19,7 @@ + diff --git a/Remotely_ScreenCast.Win/Capture/BitBltCapture.cs b/Remotely_ScreenCast.Win/Capture/BitBltCapture.cs index fd5dc063..abde830e 100644 --- a/Remotely_ScreenCast.Win/Capture/BitBltCapture.cs +++ b/Remotely_ScreenCast.Win/Capture/BitBltCapture.cs @@ -5,7 +5,6 @@ using System.IO; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Forms; -using Win32; using System.Linq; using System.Threading.Tasks; using System.Collections.Generic; diff --git a/Remotely_ScreenCast.Win/Capture/CursorIconWatcher.cs b/Remotely_ScreenCast.Win/Capture/CursorIconWatcher.cs index 013d4a7c..89698da4 100644 --- a/Remotely_ScreenCast.Win/Capture/CursorIconWatcher.cs +++ b/Remotely_ScreenCast.Win/Capture/CursorIconWatcher.cs @@ -11,7 +11,8 @@ using System.Text; using System.Threading.Tasks; using System.Timers; using System.Windows.Forms; -using Win32; +using Remotely_Library.Win32; +using Remotely_Library.Models; namespace Remotely_ScreenCast.Win.Capture { diff --git a/Remotely_ScreenCast.Win/Capture/DXCapture.cs b/Remotely_ScreenCast.Win/Capture/DXCapture.cs index eec8835e..18600414 100644 --- a/Remotely_ScreenCast.Win/Capture/DXCapture.cs +++ b/Remotely_ScreenCast.Win/Capture/DXCapture.cs @@ -10,7 +10,6 @@ using System.Drawing.Imaging; using System.Linq; using System.Threading; using System.Windows.Forms; -using Win32; namespace Remotely_ScreenCast.Win.Capture { diff --git a/Remotely_ScreenCast.Win/Input/WinInput.cs b/Remotely_ScreenCast.Win/Input/WinInput.cs index ab039f12..2f3c9205 100644 --- a/Remotely_ScreenCast.Win/Input/WinInput.cs +++ b/Remotely_ScreenCast.Win/Input/WinInput.cs @@ -1,8 +1,8 @@ using Remotely_ScreenCast.Core.Input; using Remotely_ScreenCast.Core.Models; using System; -using Win32; -using static Win32.User32; +using Remotely_Library.Win32; +using static Remotely_Library.Win32.User32; namespace Remotely_ScreenCast.Win.Input { diff --git a/Remotely_ScreenCast.Win/Program.cs b/Remotely_ScreenCast.Win/Program.cs index 00fda10a..b95224f8 100644 --- a/Remotely_ScreenCast.Win/Program.cs +++ b/Remotely_ScreenCast.Win/Program.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Extensions.DependencyInjection; +using Remotely_Library.Models; using Remotely_ScreenCast.Core; using Remotely_ScreenCast.Core.Capture; using Remotely_ScreenCast.Core.Enums; @@ -19,7 +20,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using Win32; +using Remotely_Library.Win32; namespace Remotely_ScreenCast.Win { @@ -69,7 +70,7 @@ namespace Remotely_ScreenCast.Win } } - private static async void ScreenCastInitiated(object sender, Tuple viewerAndRequester) + private static async void ScreenCastInitiated(object sender, ScreenCastRequest screenCastRequest) { ICapturer capturer; try @@ -89,8 +90,8 @@ namespace Remotely_ScreenCast.Win Logger.Write(ex); capturer = new BitBltCapture(); } - await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List() { viewerAndRequester.Item1 }); - ScreenCaster.BeginScreenCasting(viewerAndRequester.Item1, viewerAndRequester.Item2, capturer, Conductor); + await Conductor.OutgoingMessages.SendCursorChange(CursorIconWatcher.GetCurrentCursor(), new List() { screenCastRequest.ViewerID }); + ScreenCaster.BeginScreenCasting(screenCastRequest.ViewerID, screenCastRequest.RequesterName, capturer, Conductor); } public static async void CursorIconWatcher_OnChange(object sender, CursorInfo cursor) diff --git a/Remotely_ScreenCast.Win/Remotely_ScreenCast.Win.csproj b/Remotely_ScreenCast.Win/Remotely_ScreenCast.Win.csproj index 56c69c13..0d147de0 100644 --- a/Remotely_ScreenCast.Win/Remotely_ScreenCast.Win.csproj +++ b/Remotely_ScreenCast.Win/Remotely_ScreenCast.Win.csproj @@ -157,13 +157,6 @@ - - - - - - - @@ -173,6 +166,10 @@ + + {a9e1ba7a-6080-4dac-9b29-6dc8437150ea} + Remotely_Library + {b04a1728-2e87-491e-bc7f-f575a1754def} Remotely_ScreenCast.Core diff --git a/Remotely_ScreenCast.Win/Win32/ADVAPI32.cs b/Remotely_ScreenCast.Win/Win32/ADVAPI32.cs deleted file mode 100644 index 46c2920a..00000000 --- a/Remotely_ScreenCast.Win/Win32/ADVAPI32.cs +++ /dev/null @@ -1,372 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Security; - -namespace Win32 -{ - public static class ADVAPI32 - { - #region Structs - public struct TOKEN_PRIVILEGES - { - public struct LUID - { - public UInt32 LowPart; - public Int32 HighPart; - } - [StructLayout(LayoutKind.Sequential, Pack = 4)] - public struct LUID_AND_ATTRIBUTES - { - public LUID Luid; - public UInt32 Attributes; - } - public int PrivilegeCount; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = ANYSIZE_ARRAY)] - public LUID_AND_ATTRIBUTES[] Privileges; - } - public class USEROBJECTFLAGS - { - public int fInherit = 0; - public int fReserved = 0; - public int dwFlags = 0; - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public int Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public int dwProcessId; - public int dwThreadId; - } - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwYSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - #endregion - - #region Enums - public enum TOKEN_INFORMATION_CLASS - { - /// -     /// The buffer receives a TOKEN_USER structure that contains the user account of the token. -     /// - TokenUser = 1, - - /// -     /// The buffer receives a TOKEN_GROUPS structure that contains the group accounts associated with the token. -     /// - TokenGroups, - - /// -     /// The buffer receives a TOKEN_PRIVILEGES structure that contains the privileges of the token. -     /// - TokenPrivileges, - - /// -     /// The buffer receives a TOKEN_OWNER structure that contains the default owner security identifier (SID) for newly created objects. -     /// - TokenOwner, - - /// -     /// The buffer receives a TOKEN_PRIMARY_GROUP structure that contains the default primary group SID for newly created objects. -     /// - TokenPrimaryGroup, - - /// -     /// The buffer receives a TOKEN_DEFAULT_DACL structure that contains the default DACL for newly created objects. -     /// - TokenDefaultDacl, - - /// -     /// The buffer receives a TOKEN_SOURCE structure that contains the source of the token. TOKEN_QUERY_SOURCE access is needed to retrieve this information. -     /// - TokenSource, - - /// -     /// The buffer receives a TOKEN_TYPE value that indicates whether the token is a primary or impersonation token. -     /// - TokenType, - - /// -     /// The buffer receives a SECURITY_IMPERSONATION_LEVEL value that indicates the impersonation level of the token. If the access token is not an impersonation token, the function fails. -     /// - TokenImpersonationLevel, - - /// -     /// The buffer receives a TOKEN_STATISTICS structure that contains various token statistics. -     /// - TokenStatistics, - - /// -     /// The buffer receives a TOKEN_GROUPS structure that contains the list of restricting SIDs in a restricted token. -     /// - TokenRestrictedSids, - - /// -     /// The buffer receives a DWORD value that indicates the Terminal Services session identifier that is associated with the token. -     /// - TokenSessionId, - - /// -     /// The buffer receives a TOKEN_GROUPS_AND_PRIVILEGES structure that contains the user SID, the group accounts, the restricted SIDs, and the authentication ID associated with the token. -     /// - TokenGroupsAndPrivileges, - - /// -     /// Reserved. -     /// - TokenSessionReference, - - /// -     /// The buffer receives a DWORD value that is nonzero if the token includes the SANDBOX_INERT flag. -     /// - TokenSandBoxInert, - - /// -     /// Reserved. -     /// - TokenAuditPolicy, - - /// -     /// The buffer receives a TOKEN_ORIGIN value. -     /// - TokenOrigin, - - /// -     /// The buffer receives a TOKEN_ELEVATION_TYPE value that specifies the elevation level of the token. -     /// - TokenElevationType, - - /// -     /// The buffer receives a TOKEN_LINKED_TOKEN structure that contains a handle to another token that is linked to this token. -     /// - TokenLinkedToken, - - /// -     /// The buffer receives a TOKEN_ELEVATION structure that specifies whether the token is elevated. -     /// - TokenElevation, - - /// -     /// The buffer receives a DWORD value that is nonzero if the token has ever been filtered. -     /// - TokenHasRestrictions, - - /// -     /// The buffer receives a TOKEN_ACCESS_INFORMATION structure that specifies security information contained in the token. -     /// - TokenAccessInformation, - - /// -     /// The buffer receives a DWORD value that is nonzero if virtualization is allowed for the token. -     /// - TokenVirtualizationAllowed, - - /// -     /// The buffer receives a DWORD value that is nonzero if virtualization is enabled for the token. -     /// - TokenVirtualizationEnabled, - - /// -     /// The buffer receives a TOKEN_MANDATORY_LABEL structure that specifies the token's integrity level. -     /// - TokenIntegrityLevel, - - /// -     /// The buffer receives a DWORD value that is nonzero if the token has the UIAccess flag set. -     /// - TokenUIAccess, - - /// -     /// The buffer receives a TOKEN_MANDATORY_POLICY structure that specifies the token's mandatory integrity policy. -     /// - TokenMandatoryPolicy, - - /// -     /// The buffer receives the token's logon security identifier (SID). -     /// - TokenLogonSid, - - /// -     /// The maximum value for this enumeration -     /// - MaxTokenInfoClass - } - public enum LOGON_TYPE - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK, - LOGON32_LOGON_BATCH, - LOGON32_LOGON_SERVICE, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT, - LOGON32_LOGON_NEW_CREDENTIALS - } - public enum LOGON_PROVIDER - { - LOGON32_PROVIDER_DEFAULT, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [Flags] - public enum CreateProcessFlags - { - CREATE_BREAKAWAY_FROM_JOB = 0x01000000, - CREATE_DEFAULT_ERROR_MODE = 0x04000000, - CREATE_NEW_CONSOLE = 0x00000010, - CREATE_NEW_PROCESS_GROUP = 0x00000200, - CREATE_NO_WINDOW = 0x08000000, - CREATE_PROTECTED_PROCESS = 0x00040000, - CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000, - CREATE_SEPARATE_WOW_VDM = 0x00000800, - CREATE_SHARED_WOW_VDM = 0x00001000, - CREATE_SUSPENDED = 0x00000004, - CREATE_UNICODE_ENVIRONMENT = 0x00000400, - DEBUG_ONLY_THIS_PROCESS = 0x00000002, - DEBUG_PROCESS = 0x00000001, - DETACHED_PROCESS = 0x00000008, - EXTENDED_STARTUPINFO_PRESENT = 0x00080000, - INHERIT_PARENT_AFFINITY = 0x00010000 - } - public enum TOKEN_TYPE : int - { - TokenPrimary = 1, - TokenImpersonation = 2 - } - - public enum SECURITY_IMPERSONATION_LEVEL : int - { - SecurityAnonymous = 0, - SecurityIdentification = 1, - SecurityImpersonation = 2, - SecurityDelegation = 3, - } - - #endregion - - #region Constants - public const int TOKEN_DUPLICATE = 0x0002; - public const uint MAXIMUM_ALLOWED = 0x2000000; - public const int CREATE_NEW_CONSOLE = 0x00000010; - public const int CREATE_NO_WINDOW = 0x08000000; - public const int DETACHED_PROCESS = 0x00000008; - public const int TOKEN_ALL_ACCESS = 0x000f01ff; - public const int PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF; - public const int STANDARD_RIGHTS_REQUIRED = 0x000F0000; - public const int SYNCHRONIZE = 0x00100000; - - public const int IDLE_PRIORITY_CLASS = 0x40; - public const int NORMAL_PRIORITY_CLASS = 0x20; - public const int HIGH_PRIORITY_CLASS = 0x80; - public const int REALTIME_PRIORITY_CLASS = 0x100; - public const UInt32 SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001; - public const UInt32 SE_PRIVILEGE_ENABLED = 0x00000002; - public const UInt32 SE_PRIVILEGE_REMOVED = 0x00000004; - public const UInt32 SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000; - public const Int32 ANYSIZE_ARRAY = 1; - - public const int UOI_FLAGS = 1; - public const int UOI_NAME = 2; - public const int UOI_TYPE = 3; - public const int UOI_USER_SID = 4; - public const int UOI_HEAPSIZE = 5; - public const int UOI_IO = 6; - #endregion - - #region DLL Imports - [DllImport("advapi32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool AdjustTokenPrivileges(IntPtr tokenHandle, - [MarshalAs(UnmanagedType.Bool)]bool disableAllPrivileges, - ref TOKEN_PRIVILEGES newState, - UInt32 bufferLengthInBytes, - ref TOKEN_PRIVILEGES previousState, - out UInt32 returnLengthInBytes); - [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandles, - uint dwCreationFlags, - IntPtr lpEnvironment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - out PROCESS_INFORMATION lpProcessInformation); - - [DllImport("advapi32.dll", SetLastError = true)] - public static extern bool AllocateLocallyUniqueId(out IntPtr pLuid); - - [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = false)] - public static extern SECUR32.WinErrors LsaNtStatusToWinError(SECUR32.WinStatusCodes status); - - [DllImport("advapi32.dll", SetLastError = true)] - public static extern bool GetTokenInformation( - IntPtr TokenHandle, - SECUR32.TOKEN_INFORMATION_CLASS TokenInformationClass, - IntPtr TokenInformation, - uint TokenInformationLength, - out uint ReturnLength); - - [DllImport("advapi32.dll", SetLastError = true, BestFitMapping = false, ThrowOnUnmappableChar = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool LogonUser( - [MarshalAs(UnmanagedType.LPStr)] string pszUserName, - [MarshalAs(UnmanagedType.LPStr)] string pszDomain, - [MarshalAs(UnmanagedType.LPStr)] string pszPassword, - int dwLogonType, - int dwLogonProvider, - out IntPtr phToken); - - [DllImport("advapi32", SetLastError = true), SuppressUnmanagedCodeSecurityAttribute] - public static extern bool OpenProcessToken(IntPtr ProcessHandle, int DesiredAccess, ref IntPtr TokenHandle); - [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public extern static bool DuplicateTokenEx( - IntPtr hExistingToken, - uint dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpTokenAttributes, - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, - TOKEN_TYPE TokenType, - out IntPtr phNewToken); - - [DllImport("advapi32.dll", SetLastError = false)] - public static extern uint LsaNtStatusToWinError(uint status); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool GetUserObjectInformationW(IntPtr hObj, int nIndex, - [Out] byte[] pvInfo, uint nLength, out uint lpnLengthNeeded); - #endregion - - - } -} diff --git a/Remotely_ScreenCast.Win/Win32/Kernel32.cs b/Remotely_ScreenCast.Win/Win32/Kernel32.cs deleted file mode 100644 index 82d924ae..00000000 --- a/Remotely_ScreenCast.Win/Win32/Kernel32.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Win32 -{ - public static class Kernel32 - { - #region DLL Imports - - [DllImport("kernel32.dll", SetLastError = true)] - public static extern bool CloseHandle(IntPtr hSnapshot); - - [DllImport("kernel32.dll")] - public static extern uint WTSGetActiveConsoleSessionId(); - - [DllImport("kernel32.dll")] - public static extern bool ProcessIdToSessionId(uint dwProcessId, ref uint pSessionId); - - [DllImport("kernel32.dll")] - public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId); - - #endregion - } -} diff --git a/Remotely_ScreenCast.Win/Win32/SECUR32.cs b/Remotely_ScreenCast.Win/Win32/SECUR32.cs deleted file mode 100644 index 9fb7c439..00000000 --- a/Remotely_ScreenCast.Win/Win32/SECUR32.cs +++ /dev/null @@ -1,373 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Runtime.Versioning; -using Microsoft.Win32.SafeHandles; -using System.Runtime.ConstrainedExecution; -using Win32; - -public static class SECUR32 -{ - public enum WinStatusCodes : uint - { - STATUS_SUCCESS = 0 - } - - public enum WinErrors : uint - { - NO_ERROR = 0, - } - public enum WinLogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - // SECURITY_LOGON_TYPE - public enum SecurityLogonType - { - Interactive = 2, // Interactively logged on (locally or remotely) - Network, // Accessing system via network - Batch, // Started via a batch queue - Service, // Service started by service controller - Proxy, // Proxy logon - Unlock, // Unlock workstation - NetworkCleartext, // Network logon with cleartext credentials - NewCredentials, // Clone caller, new default credentials - RemoteInteractive, // Remote, yet interactive. Terminal server - CachedInteractive, // Try cached credentials without hitting the net. - CachedRemoteInteractive, // Same as RemoteInteractive, this is used internally for auditing purpose - CachedUnlock // Cached Unlock workstation - } - - [StructLayout(LayoutKind.Sequential)] - public struct LSA_UNICODE_STRING - { - public UInt16 Length; - public UInt16 MaximumLength; - public IntPtr Buffer; - } - - [StructLayout(LayoutKind.Sequential)] - public struct TOKEN_SOURCE - { - public TOKEN_SOURCE(string name) - { - SourceName = new byte[8]; - System.Text.Encoding.GetEncoding(1252).GetBytes(name, 0, name.Length, SourceName, 0); - if (!ADVAPI32.AllocateLocallyUniqueId(out SourceIdentifier)) - throw new System.ComponentModel.Win32Exception(); - } - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] SourceName; - public IntPtr SourceIdentifier; - } - [StructLayout(LayoutKind.Sequential)] - public struct KERB_INTERACTIVE_LOGON - { - public KERB_LOGON_SUBMIT_TYPE MessageType; - public string LogonDomainName; - public string UserName; - public string Password; - } - public enum KERB_LOGON_SUBMIT_TYPE - { - KerbInteractiveLogon = 2, - KerbSmartCardLogon = 6, - KerbWorkstationUnlockLogon = 7, - KerbSmartCardUnlockLogon = 8, - KerbProxyLogon = 9, - KerbTicketLogon = 10, - KerbTicketUnlockLogon = 11, - KerbS4ULogon = 12, - KerbCertificateLogon = 13, - KerbCertificateS4ULogon = 14, - KerbCertificateUnlockLogon = 15 - } - public enum TOKEN_INFORMATION_CLASS - { - /// -     /// The buffer receives a TOKEN_USER structure that contains the user account of the token. -     /// - TokenUser = 1, - - /// -     /// The buffer receives a TOKEN_GROUPS structure that contains the group accounts associated with the token. -     /// - TokenGroups, - - /// -     /// The buffer receives a TOKEN_PRIVILEGES structure that contains the privileges of the token. -     /// - TokenPrivileges, - - /// -     /// The buffer receives a TOKEN_OWNER structure that contains the default owner security identifier (SID) for newly created objects. -     /// - TokenOwner, - - /// -     /// The buffer receives a TOKEN_PRIMARY_GROUP structure that contains the default primary group SID for newly created objects. -     /// - TokenPrimaryGroup, - - /// -     /// The buffer receives a TOKEN_DEFAULT_DACL structure that contains the default DACL for newly created objects. -     /// - TokenDefaultDacl, - - /// -     /// The buffer receives a TOKEN_SOURCE structure that contains the source of the token. TOKEN_QUERY_SOURCE access is needed to retrieve this information. -     /// - TokenSource, - - /// -     /// The buffer receives a TOKEN_TYPE value that indicates whether the token is a primary or impersonation token. -     /// - TokenType, - - /// -     /// The buffer receives a SECURITY_IMPERSONATION_LEVEL value that indicates the impersonation level of the token. If the access token is not an impersonation token, the function fails. -     /// - TokenImpersonationLevel, - - /// -     /// The buffer receives a TOKEN_STATISTICS structure that contains various token statistics. -     /// - TokenStatistics, - - /// -     /// The buffer receives a TOKEN_GROUPS structure that contains the list of restricting SIDs in a restricted token. -     /// - TokenRestrictedSids, - - /// -     /// The buffer receives a DWORD value that indicates the Terminal Services session identifier that is associated with the token. -     /// - TokenSessionId, - - /// -     /// The buffer receives a TOKEN_GROUPS_AND_PRIVILEGES structure that contains the user SID, the group accounts, the restricted SIDs, and the authentication ID associated with the token. -     /// - TokenGroupsAndPrivileges, - - /// -     /// Reserved. -     /// - TokenSessionReference, - - /// -     /// The buffer receives a DWORD value that is nonzero if the token includes the SANDBOX_INERT flag. -     /// - TokenSandBoxInert, - - /// -     /// Reserved. -     /// - TokenAuditPolicy, - - /// -     /// The buffer receives a TOKEN_ORIGIN value. -     /// - TokenOrigin, - - /// -     /// The buffer receives a TOKEN_ELEVATION_TYPE value that specifies the elevation level of the token. -     /// - TokenElevationType, - - /// -     /// The buffer receives a TOKEN_LINKED_TOKEN structure that contains a handle to another token that is linked to this token. -     /// - TokenLinkedToken, - - /// -     /// The buffer receives a TOKEN_ELEVATION structure that specifies whether the token is elevated. -     /// - TokenElevation, - - /// -     /// The buffer receives a DWORD value that is nonzero if the token has ever been filtered. -     /// - TokenHasRestrictions, - - /// -     /// The buffer receives a TOKEN_ACCESS_INFORMATION structure that specifies security information contained in the token. -     /// - TokenAccessInformation, - - /// -     /// The buffer receives a DWORD value that is nonzero if virtualization is allowed for the token. -     /// - TokenVirtualizationAllowed, - - /// -     /// The buffer receives a DWORD value that is nonzero if virtualization is enabled for the token. -     /// - TokenVirtualizationEnabled, - - /// -     /// The buffer receives a TOKEN_MANDATORY_LABEL structure that specifies the token's integrity level. -     /// - TokenIntegrityLevel, - - /// -     /// The buffer receives a DWORD value that is nonzero if the token has the UIAccess flag set. -     /// - TokenUIAccess, - - /// -     /// The buffer receives a TOKEN_MANDATORY_POLICY structure that specifies the token's mandatory integrity policy. -     /// - TokenMandatoryPolicy, - - /// -     /// The buffer receives the token's logon security identifier (SID). -     /// - TokenLogonSid, - - /// -     /// The maximum value for this enumeration -     /// - MaxTokenInfoClass - } - [StructLayout(LayoutKind.Sequential)] - public struct QUOTA_LIMITS - { - UInt32 PagedPoolLimit; - UInt32 NonPagedPoolLimit; - UInt32 MinimumWorkingSetSize; - UInt32 MaximumWorkingSetSize; - UInt32 PagefileLimit; - Int64 TimeLimit; - } - - [StructLayout(LayoutKind.Sequential)] - public struct LSA_STRING - { - public UInt16 Length; - public UInt16 MaximumLength; - public /*PCHAR*/ IntPtr Buffer; - } - - - [DllImport("secur32.dll", SetLastError = true)] - public static extern WinStatusCodes LsaLogonUser( - [In] IntPtr LsaHandle, - [In] ref LSA_STRING OriginName, - [In] SecurityLogonType LogonType, - [In] UInt32 AuthenticationPackage, - [In] IntPtr AuthenticationInformation, - [In] UInt32 AuthenticationInformationLength, - [In] /*PTOKEN_GROUPS*/ IntPtr LocalGroups, - [In] ref TOKEN_SOURCE SourceContext, - [Out] /*PVOID*/ out IntPtr ProfileBuffer, - [Out] out UInt32 ProfileBufferLength, - [Out] out Int64 LogonId, - [Out] out IntPtr Token, - [Out] out QUOTA_LIMITS Quotas, - [Out] out WinStatusCodes SubStatus - ); - - [DllImport("secur32.dll", SetLastError = true)] - public static extern WinStatusCodes LsaRegisterLogonProcess( - IntPtr LogonProcessName, - out IntPtr LsaHandle, - out ulong SecurityMode - ); - - [DllImport("secur32.dll", SetLastError = false)] - public static extern WinStatusCodes LsaLookupAuthenticationPackage([In] IntPtr LsaHandle, [In] ref LSA_STRING PackageName, [Out] out UInt32 AuthenticationPackage); - - [DllImport("secur32.dll", CharSet = CharSet.Auto, SetLastError = true)] - [ResourceExposure(ResourceScope.None)] - internal static extern int LsaConnectUntrusted( - [In, Out] ref SafeLsaLogonProcessHandle LsaHandle); - - [DllImport("secur32.dll", SetLastError = false)] - public static extern WinStatusCodes LsaConnectUntrusted([Out] out IntPtr LsaHandle); - - [System.Security.SecurityCritical] // auto-generated - internal sealed class SafeLsaLogonProcessHandle : SafeHandleZeroOrMinusOneIsInvalid - { - private SafeLsaLogonProcessHandle() : base(true) { } - - // 0 is an Invalid Handle - internal SafeLsaLogonProcessHandle(IntPtr handle) : base(true) - { - SetHandle(handle); - } - - internal static SafeLsaLogonProcessHandle InvalidHandle - { - get { return new SafeLsaLogonProcessHandle(IntPtr.Zero); } - } - - [System.Security.SecurityCritical] - override protected bool ReleaseHandle() - { - // LsaDeregisterLogonProcess returns an NTSTATUS - return LsaDeregisterLogonProcess(handle) >= 0; - } - } - - [DllImport("secur32.dll", SetLastError = true)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [ResourceExposure(ResourceScope.None)] - internal static extern int LsaDeregisterLogonProcess(IntPtr handle); - - - public static void CreateNewSession() - { - var kli = new SECUR32.KERB_INTERACTIVE_LOGON() - { - MessageType = SECUR32.KERB_LOGON_SUBMIT_TYPE.KerbInteractiveLogon, - UserName = "", - Password = "" - }; - IntPtr pluid; - IntPtr lsaHan; - uint authPackID; - IntPtr kerbLogInfo; - SECUR32.LSA_STRING logonProc = new SECUR32.LSA_STRING() - { - Buffer = Marshal.StringToHGlobalAuto("InstaLogon"), - Length = (ushort)Marshal.SizeOf(Marshal.StringToHGlobalAuto("InstaLogon")), - MaximumLength = (ushort)Marshal.SizeOf(Marshal.StringToHGlobalAuto("InstaLogon")) - }; - SECUR32.LSA_STRING originName = new SECUR32.LSA_STRING() - { - Buffer = Marshal.StringToHGlobalAuto("InstaLogon"), - Length = (ushort)Marshal.SizeOf(Marshal.StringToHGlobalAuto("InstaLogon")), - MaximumLength = (ushort)Marshal.SizeOf(Marshal.StringToHGlobalAuto("InstaLogon")) - }; - SECUR32.LSA_STRING authPackage = new SECUR32.LSA_STRING() - { - Buffer = Marshal.StringToHGlobalAuto("MICROSOFT_KERBEROS_NAME_A"), - Length = (ushort)Marshal.SizeOf(Marshal.StringToHGlobalAuto("MICROSOFT_KERBEROS_NAME_A")), - MaximumLength = (ushort)Marshal.SizeOf(Marshal.StringToHGlobalAuto("MICROSOFT_KERBEROS_NAME_A")) - }; - IntPtr hLogonProc = Marshal.AllocHGlobal(Marshal.SizeOf(logonProc)); - Marshal.StructureToPtr(logonProc, hLogonProc, false); - ADVAPI32.AllocateLocallyUniqueId(out pluid); - LsaConnectUntrusted(out lsaHan); - //SECUR32.LsaRegisterLogonProcess(hLogonProc, out lsaHan, out secMode); - SECUR32.LsaLookupAuthenticationPackage(lsaHan, ref authPackage, out authPackID); - - kerbLogInfo = Marshal.AllocHGlobal(Marshal.SizeOf(kli)); - Marshal.StructureToPtr(kli, kerbLogInfo, false); - - var ts = new SECUR32.TOKEN_SOURCE("Insta"); - IntPtr profBuf; - uint profBufLen; - long logonID; - IntPtr logonToken; - SECUR32.QUOTA_LIMITS quotas; - SECUR32.WinStatusCodes subStatus; - SECUR32.LsaLogonUser(lsaHan, ref originName, SECUR32.SecurityLogonType.Interactive, authPackID, kerbLogInfo, (uint)Marshal.SizeOf(kerbLogInfo), IntPtr.Zero, ref ts, out profBuf, out profBufLen, out logonID, out logonToken, out quotas, out subStatus); - } -} \ No newline at end of file diff --git a/Remotely_ScreenCast.Win/Win32/User32.cs b/Remotely_ScreenCast.Win/Win32/User32.cs deleted file mode 100644 index 356d8cba..00000000 --- a/Remotely_ScreenCast.Win/Win32/User32.cs +++ /dev/null @@ -1,1252 +0,0 @@ -using Microsoft.Win32.SafeHandles; -using System; -using System.Linq; -using System.Runtime.ConstrainedExecution; -using System.Runtime.InteropServices; -using System.Text; - -namespace Win32 -{ - public static class User32 - { - #region Constants - public const Int32 CURSOR_SHOWING = 0x00000001; - public const uint MOUSEEVENTF_ABSOLUTE = 0x8000; - public const int MOUSEEVENTF_LEFTDOWN = 0x02; - public const int MOUSEEVENTF_LEFTUP = 0x04; - public const int MOUSEEVENTF_RIGHTDOWN = 0x08; - public const int MOUSEEVENTF_RIGHTUP = 0x10; - public const int MOUSEEVENTF_MOVE = 0x0001; - public const uint KEYEVENTF_EXTENDEDKEY = 0x0001; - public const uint KEYEVENTF_KEYUP = 0x0002; - - public const int SPIF_SENDWININICHANGE = 0x02; - public const int SPI_SETDESKWALLPAPER = 20; - public const int SPIF_UPDATEINIFILE = 1; - public const int SPIF_SENDCHANGE = 2; - - public static readonly int SPI_GETDESKWALLPAPER = 0x73; - public static readonly int MAX_PATH = 260; - #endregion - - #region Enums - [Flags] - public enum MouseEventFlags : uint - { - LEFTDOWN = 0x00000002, - LEFTUP = 0x00000004, - MIDDLEDOWN = 0x00000020, - MIDDLEUP = 0x00000040, - MOVE = 0x00000001, - ABSOLUTE = 0x00008000, - RIGHTDOWN = 0x00000008, - RIGHTUP = 0x00000010, - WHEEL = 0x00000800, - XDOWN = 0x00000080, - XUP = 0x00000100 - } - [Flags] - public enum MOUSEEVENTF : uint - { - ABSOLUTE = 0x8000, - HWHEEL = 0x01000, - MOVE = 0x0001, - MOVE_NOCOALESCE = 0x2000, - LEFTDOWN = 0x0002, - LEFTUP = 0x0004, - RIGHTDOWN = 0x0008, - RIGHTUP = 0x0010, - MIDDLEDOWN = 0x0020, - MIDDLEUP = 0x0040, - VIRTUALDESK = 0x4000, - WHEEL = 0x0800, - XDOWN = 0x0080, - XUP = 0x0100 - } - public enum MonitorState - { - MonitorStateOn = -1, - MonitorStateOff = 2, - MonitorStateStandBy = 1 - } - [Flags] - public enum KEYEVENTF : uint - { - EXTENDEDKEY = 0x0001, - KEYUP = 0x0002, - SCANCODE = 0x0008, - UNICODE = 0x0004 - } - - public enum VirtualKey : short - { - /// -         ///Left mouse button -         /// - LBUTTON = 0x01, - /// -         ///Right mouse button -         /// - RBUTTON = 0x02, - /// -         ///Control-break processing -         /// - CANCEL = 0x03, - /// -         ///Middle mouse button (three-button mouse) -         /// - MBUTTON = 0x04, - /// -         ///Windows 2000/XP: X1 mouse button -         /// - XBUTTON1 = 0x05, - /// -         ///Windows 2000/XP: X2 mouse button -         /// - XBUTTON2 = 0x06, - /// -         ///BACKSPACE key -         /// - BACK = 0x08, - /// -         ///TAB key -         /// - TAB = 0x09, - /// -         ///CLEAR key -         /// - CLEAR = 0x0C, - /// -         ///ENTER key -         /// - RETURN = 0x0D, - /// -         ///SHIFT key -         /// - SHIFT = 0x10, - /// -         ///CTRL key -         /// - CONTROL = 0x11, - /// -         ///ALT key -         /// - MENU = 0x12, - /// -         ///PAUSE key -         /// - PAUSE = 0x13, - /// -         ///CAPS LOCK key -         /// - CAPITAL = 0x14, - /// -         ///Input Method Editor (IME) Kana mode -         /// - KANA = 0x15, - /// -         ///IME Hangul mode -         /// - HANGUL = 0x15, - /// -         ///IME Junja mode -         /// - JUNJA = 0x17, - /// -         ///IME final mode -         /// - FINAL = 0x18, - /// -         ///IME Hanja mode -         /// - HANJA = 0x19, - /// -         ///IME Kanji mode -         /// - KANJI = 0x19, - /// -         ///ESC key -         /// - ESCAPE = 0x1B, - /// -         ///IME convert -         /// - CONVERT = 0x1C, - /// -         ///IME nonconvert -         /// - NONCONVERT = 0x1D, - /// -         ///IME accept -         /// - ACCEPT = 0x1E, - /// -         ///IME mode change request -         /// - MODECHANGE = 0x1F, - /// -         ///SPACEBAR -         /// - SPACE = 0x20, - /// -         ///PAGE UP key -         /// - PRIOR = 0x21, - /// -         ///PAGE DOWN key -         /// - NEXT = 0x22, - /// -         ///END key -         /// - END = 0x23, - /// -         ///HOME key -         /// - HOME = 0x24, - /// -         ///LEFT ARROW key -         /// - LEFT = 0x25, - /// -         ///UP ARROW key -         /// - UP = 0x26, - /// -         ///RIGHT ARROW key -         /// - RIGHT = 0x27, - /// -         ///DOWN ARROW key -         /// - DOWN = 0x28, - /// -         ///SELECT key -         /// - SELECT = 0x29, - /// -         ///PRINT key -         /// - PRINT = 0x2A, - /// -         ///EXECUTE key -         /// - EXECUTE = 0x2B, - /// -         ///PRINT SCREEN key -         /// - SNAPSHOT = 0x2C, - /// -         ///INS key -         /// - INSERT = 0x2D, - /// -         ///DEL key -         /// - DELETE = 0x2E, - /// -         ///HELP key -         /// - HELP = 0x2F, - /// -         ///0 key -         /// - KEY_0 = 0x30, - /// -         ///1 key -         /// - KEY_1 = 0x31, - /// -         ///2 key -         /// - KEY_2 = 0x32, - /// -         ///3 key -         /// - KEY_3 = 0x33, - /// -         ///4 key -         /// - KEY_4 = 0x34, - /// -         ///5 key -         /// - KEY_5 = 0x35, - /// -         ///6 key -         /// - KEY_6 = 0x36, - /// -         ///7 key -         /// - KEY_7 = 0x37, - /// -         ///8 key -         /// - KEY_8 = 0x38, - /// -         ///9 key -         /// - KEY_9 = 0x39, - /// -         ///A key -         /// - KEY_A = 0x41, - /// -         ///B key -         /// - KEY_B = 0x42, - /// -         ///C key -         /// - KEY_C = 0x43, - /// -         ///D key -         /// - KEY_D = 0x44, - /// -         ///E key -         /// - KEY_E = 0x45, - /// -         ///F key -         /// - KEY_F = 0x46, - /// -         ///G key -         /// - KEY_G = 0x47, - /// -         ///H key -         /// - KEY_H = 0x48, - /// -         ///I key -         /// - KEY_I = 0x49, - /// -         ///J key -         /// - KEY_J = 0x4A, - /// -         ///K key -         /// - KEY_K = 0x4B, - /// -         ///L key -         /// - KEY_L = 0x4C, - /// -         ///M key -         /// - KEY_M = 0x4D, - /// -         ///N key -         /// - KEY_N = 0x4E, - /// -         ///O key -         /// - KEY_O = 0x4F, - /// -         ///P key -         /// - KEY_P = 0x50, - /// -         ///Q key -         /// - KEY_Q = 0x51, - /// -         ///R key -         /// - KEY_R = 0x52, - /// -         ///S key -         /// - KEY_S = 0x53, - /// -         ///T key -         /// - KEY_T = 0x54, - /// -         ///U key -         /// - KEY_U = 0x55, - /// -         ///V key -         /// - KEY_V = 0x56, - /// -         ///W key -         /// - KEY_W = 0x57, - /// -         ///X key -         /// - KEY_X = 0x58, - /// -         ///Y key -         /// - KEY_Y = 0x59, - /// -         ///Z key -         /// - KEY_Z = 0x5A, - /// -         ///Left Windows key (Microsoft Natural keyboard) -         /// - LWIN = 0x5B, - /// -         ///Right Windows key (Natural keyboard) -         /// - RWIN = 0x5C, - /// -         ///Applications key (Natural keyboard) -         /// - APPS = 0x5D, - /// -         ///Computer Sleep key -         /// - SLEEP = 0x5F, - /// -         ///Numeric keypad 0 key -         /// - NUMPAD0 = 0x60, - /// -         ///Numeric keypad 1 key -         /// - NUMPAD1 = 0x61, - /// -         ///Numeric keypad 2 key -         /// - NUMPAD2 = 0x62, - /// -         ///Numeric keypad 3 key -         /// - NUMPAD3 = 0x63, - /// -         ///Numeric keypad 4 key -         /// - NUMPAD4 = 0x64, - /// -         ///Numeric keypad 5 key -         /// - NUMPAD5 = 0x65, - /// -         ///Numeric keypad 6 key -         /// - NUMPAD6 = 0x66, - /// -         ///Numeric keypad 7 key -         /// - NUMPAD7 = 0x67, - /// -         ///Numeric keypad 8 key -         /// - NUMPAD8 = 0x68, - /// -         ///Numeric keypad 9 key -         /// - NUMPAD9 = 0x69, - /// -         ///Multiply key -         /// - MULTIPLY = 0x6A, - /// -         ///Add key -         /// - ADD = 0x6B, - /// -         ///Separator key -         /// - SEPARATOR = 0x6C, - /// -         ///Subtract key -         /// - SUBTRACT = 0x6D, - /// -         ///Decimal key -         /// - DECIMAL = 0x6E, - /// -         ///Divide key -         /// - DIVIDE = 0x6F, - /// -         ///F1 key -         /// - F1 = 0x70, - /// -         ///F2 key -         /// - F2 = 0x71, - /// -         ///F3 key -         /// - F3 = 0x72, - /// -         ///F4 key -         /// - F4 = 0x73, - /// -         ///F5 key -         /// - F5 = 0x74, - /// -         ///F6 key -         /// - F6 = 0x75, - /// -         ///F7 key -         /// - F7 = 0x76, - /// -         ///F8 key -         /// - F8 = 0x77, - /// -         ///F9 key -         /// - F9 = 0x78, - /// -         ///F10 key -         /// - F10 = 0x79, - /// -         ///F11 key -         /// - F11 = 0x7A, - /// -         ///F12 key -         /// - F12 = 0x7B, - /// -         ///F13 key -         /// - F13 = 0x7C, - /// -         ///F14 key -         /// - F14 = 0x7D, - /// -         ///F15 key -         /// - F15 = 0x7E, - /// -         ///F16 key -         /// - F16 = 0x7F, - /// -         ///F17 key   -         /// - F17 = 0x80, - /// -         ///F18 key   -         /// - F18 = 0x81, - /// -         ///F19 key   -         /// - F19 = 0x82, - /// -         ///F20 key   -         /// - F20 = 0x83, - /// -         ///F21 key   -         /// - F21 = 0x84, - /// -         ///F22 key, (PPC only) Key used to lock device. -         /// - F22 = 0x85, - /// -         ///F23 key   -         /// - F23 = 0x86, - /// -         ///F24 key   -         /// - F24 = 0x87, - /// -         ///NUM LOCK key -         /// - NUMLOCK = 0x90, - /// -         ///SCROLL LOCK key -         /// - SCROLL = 0x91, - /// -         ///Left SHIFT key -         /// - LSHIFT = 0xA0, - /// -         ///Right SHIFT key -         /// - RSHIFT = 0xA1, - /// -         ///Left CONTROL key -         /// - LCONTROL = 0xA2, - /// -         ///Right CONTROL key -         /// - RCONTROL = 0xA3, - /// -         ///Left MENU key -         /// - LMENU = 0xA4, - /// -         ///Right MENU key -         /// - RMENU = 0xA5, - /// -         ///Windows 2000/XP: Browser Back key -         /// - BROWSER_BACK = 0xA6, - /// -         ///Windows 2000/XP: Browser Forward key -         /// - BROWSER_FORWARD = 0xA7, - /// -         ///Windows 2000/XP: Browser Refresh key -         /// - BROWSER_REFRESH = 0xA8, - /// -         ///Windows 2000/XP: Browser Stop key -         /// - BROWSER_STOP = 0xA9, - /// -         ///Windows 2000/XP: Browser Search key -         /// - BROWSER_SEARCH = 0xAA, - /// -         ///Windows 2000/XP: Browser Favorites key -         /// - BROWSER_FAVORITES = 0xAB, - /// -         ///Windows 2000/XP: Browser Start and Home key -         /// - BROWSER_HOME = 0xAC, - /// -         ///Windows 2000/XP: Volume Mute key -         /// - VOLUME_MUTE = 0xAD, - /// -         ///Windows 2000/XP: Volume Down key -         /// - VOLUME_DOWN = 0xAE, - /// -         ///Windows 2000/XP: Volume Up key -         /// - VOLUME_UP = 0xAF, - /// -         ///Windows 2000/XP: Next Track key -         /// - MEDIA_NEXT_TRACK = 0xB0, - /// -         ///Windows 2000/XP: Previous Track key -         /// - MEDIA_PREV_TRACK = 0xB1, - /// -         ///Windows 2000/XP: Stop Media key -         /// - MEDIA_STOP = 0xB2, - /// -         ///Windows 2000/XP: Play/Pause Media key -         /// - MEDIA_PLAY_PAUSE = 0xB3, - /// -         ///Windows 2000/XP: Start Mail key -         /// - LAUNCH_MAIL = 0xB4, - /// -         ///Windows 2000/XP: Select Media key -         /// - LAUNCH_MEDIA_SELECT = 0xB5, - /// -         ///Windows 2000/XP: Start Application 1 key -         /// - LAUNCH_APP1 = 0xB6, - /// -         ///Windows 2000/XP: Start Application 2 key -         /// - LAUNCH_APP2 = 0xB7, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_1 = 0xBA, - /// -         ///Windows 2000/XP: For any country/region, the '+' key -         /// - OEM_PLUS = 0xBB, - /// -         ///Windows 2000/XP: For any country/region, the ',' key -         /// - OEM_COMMA = 0xBC, - /// -         ///Windows 2000/XP: For any country/region, the '-' key -         /// - OEM_MINUS = 0xBD, - /// -         ///Windows 2000/XP: For any country/region, the '.' key -         /// - OEM_PERIOD = 0xBE, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_2 = 0xBF, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_3 = 0xC0, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_4 = 0xDB, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_5 = 0xDC, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_6 = 0xDD, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_7 = 0xDE, - /// -         ///Used for miscellaneous characters; it can vary by keyboard. -         /// - OEM_8 = 0xDF, - /// -         ///Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard -         /// - OEM_102 = 0xE2, - /// -         ///Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key -         /// - PROCESSKEY = 0xE5, - /// -         ///Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. -         ///The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, -         ///see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP -         /// - PACKET = 0xE7, - /// -         ///Attn key -         /// - ATTN = 0xF6, - /// -         ///CrSel key -         /// - CRSEL = 0xF7, - /// -         ///ExSel key -         /// - EXSEL = 0xF8, - /// -         ///Erase EOF key -         /// - EREOF = 0xF9, - /// -         ///Play key -         /// - PLAY = 0xFA, - /// -         ///Zoom key -         /// - ZOOM = 0xFB, - /// -         ///Reserved -         /// - NONAME = 0xFC, - /// -         ///PA1 key -         /// - PA1 = 0xFD, - /// -         ///Clear key -         /// - OEM_CLEAR = 0xFE - } - public enum ScanCodeShort : short - { - LBUTTON = 0, - RBUTTON = 0, - CANCEL = 70, - MBUTTON = 0, - XBUTTON1 = 0, - XBUTTON2 = 0, - BACK = 14, - TAB = 15, - CLEAR = 76, - RETURN = 28, - SHIFT = 42, - CONTROL = 29, - MENU = 56, - PAUSE = 0, - CAPITAL = 58, - KANA = 0, - HANGUL = 0, - JUNJA = 0, - FINAL = 0, - HANJA = 0, - KANJI = 0, - ESCAPE = 1, - CONVERT = 0, - NONCONVERT = 0, - ACCEPT = 0, - MODECHANGE = 0, - SPACE = 57, - PRIOR = 73, - NEXT = 81, - END = 79, - HOME = 71, - LEFT = 75, - UP = 72, - RIGHT = 77, - DOWN = 80, - SELECT = 0, - PRINT = 0, - EXECUTE = 0, - SNAPSHOT = 84, - INSERT = 82, - DELETE = 83, - HELP = 99, - KEY_0 = 11, - KEY_1 = 2, - KEY_2 = 3, - KEY_3 = 4, - KEY_4 = 5, - KEY_5 = 6, - KEY_6 = 7, - KEY_7 = 8, - KEY_8 = 9, - KEY_9 = 10, - KEY_A = 30, - KEY_B = 48, - KEY_C = 46, - KEY_D = 32, - KEY_E = 18, - KEY_F = 33, - KEY_G = 34, - KEY_H = 35, - KEY_I = 23, - KEY_J = 36, - KEY_K = 37, - KEY_L = 38, - KEY_M = 50, - KEY_N = 49, - KEY_O = 24, - KEY_P = 25, - KEY_Q = 16, - KEY_R = 19, - KEY_S = 31, - KEY_T = 20, - KEY_U = 22, - KEY_V = 47, - KEY_W = 17, - KEY_X = 45, - KEY_Y = 21, - KEY_Z = 44, - LWIN = 91, - RWIN = 92, - APPS = 93, - SLEEP = 95, - NUMPAD0 = 82, - NUMPAD1 = 79, - NUMPAD2 = 80, - NUMPAD3 = 81, - NUMPAD4 = 75, - NUMPAD5 = 76, - NUMPAD6 = 77, - NUMPAD7 = 71, - NUMPAD8 = 72, - NUMPAD9 = 73, - MULTIPLY = 55, - ADD = 78, - SEPARATOR = 0, - SUBTRACT = 74, - DECIMAL = 83, - DIVIDE = 53, - F1 = 59, - F2 = 60, - F3 = 61, - F4 = 62, - F5 = 63, - F6 = 64, - F7 = 65, - F8 = 66, - F9 = 67, - F10 = 68, - F11 = 87, - F12 = 88, - F13 = 100, - F14 = 101, - F15 = 102, - F16 = 103, - F17 = 104, - F18 = 105, - F19 = 106, - F20 = 107, - F21 = 108, - F22 = 109, - F23 = 110, - F24 = 118, - NUMLOCK = 69, - SCROLL = 70, - LSHIFT = 42, - RSHIFT = 54, - LCONTROL = 29, - RCONTROL = 29, - LMENU = 56, - RMENU = 56, - BROWSER_BACK = 106, - BROWSER_FORWARD = 105, - BROWSER_REFRESH = 103, - BROWSER_STOP = 104, - BROWSER_SEARCH = 101, - BROWSER_FAVORITES = 102, - BROWSER_HOME = 50, - VOLUME_MUTE = 32, - VOLUME_DOWN = 46, - VOLUME_UP = 48, - MEDIA_NEXT_TRACK = 25, - MEDIA_PREV_TRACK = 16, - MEDIA_STOP = 36, - MEDIA_PLAY_PAUSE = 34, - LAUNCH_MAIL = 108, - LAUNCH_MEDIA_SELECT = 109, - LAUNCH_APP1 = 107, - LAUNCH_APP2 = 33, - OEM_1 = 39, - OEM_PLUS = 13, - OEM_COMMA = 51, - OEM_MINUS = 12, - OEM_PERIOD = 52, - OEM_2 = 53, - OEM_3 = 41, - OEM_4 = 26, - OEM_5 = 43, - OEM_6 = 27, - OEM_7 = 40, - OEM_8 = 0, - OEM_102 = 86, - PROCESSKEY = 0, - PACKET = 0, - ATTN = 0, - CRSEL = 0, - EXSEL = 0, - EREOF = 93, - PLAY = 0, - ZOOM = 98, - NONAME = 0, - PA1 = 0, - OEM_CLEAR = 0, - } - [Flags] - public enum ACCESS_MASK : uint - { - DELETE = 0x00010000, - READ_CONTROL = 0x00020000, - WRITE_DAC = 0x00040000, - WRITE_OWNER = 0x00080000, - SYNCHRONIZE = 0x00100000, - - STANDARD_RIGHTS_REQUIRED = 0x000F0000, - - STANDARD_RIGHTS_READ = 0x00020000, - STANDARD_RIGHTS_WRITE = 0x00020000, - STANDARD_RIGHTS_EXECUTE = 0x00020000, - - STANDARD_RIGHTS_ALL = 0x001F0000, - - SPECIFIC_RIGHTS_ALL = 0x0000FFFF, - - ACCESS_SYSTEM_SECURITY = 0x01000000, - - MAXIMUM_ALLOWED = 0x02000000, - - GENERIC_READ = 0x80000000, - GENERIC_WRITE = 0x40000000, - GENERIC_EXECUTE = 0x20000000, - GENERIC_ALL = 0x10000000, - - DESKTOP_READOBJECTS = 0x00000001, - DESKTOP_CREATEWINDOW = 0x00000002, - DESKTOP_CREATEMENU = 0x00000004, - DESKTOP_HOOKCONTROL = 0x00000008, - DESKTOP_JOURNALRECORD = 0x00000010, - DESKTOP_JOURNALPLAYBACK = 0x00000020, - DESKTOP_ENUMERATE = 0x00000040, - DESKTOP_WRITEOBJECTS = 0x00000080, - DESKTOP_SWITCHDESKTOP = 0x00000100, - - WINSTA_ENUMDESKTOPS = 0x00000001, - WINSTA_READATTRIBUTES = 0x00000002, - WINSTA_ACCESSCLIPBOARD = 0x00000004, - WINSTA_CREATEDESKTOP = 0x00000008, - WINSTA_WRITEATTRIBUTES = 0x00000010, - WINSTA_ACCESSGLOBALATOMS = 0x00000020, - WINSTA_EXITWINDOWS = 0x00000040, - WINSTA_ENUMERATE = 0x00000100, - WINSTA_READSCREEN = 0x00000200, - - WINSTA_ALL_ACCESS = 0x0000037F - } - public enum InputType : uint - { - MOUSE = 0, - KEYBOARD = 1, - HARDWARE = 2 - } - #endregion - - #region Structs - [StructLayout(LayoutKind.Sequential)] - public struct ICONINFO - { - public bool fIcon; - public Int32 xHotspot; - public Int32 yHotspot; - public IntPtr hbmMask; - public IntPtr hbmColor; - } - - [StructLayout(LayoutKind.Sequential)] - public struct POINT - { - public Int32 x; - public Int32 y; - } - - [StructLayout(LayoutKind.Sequential)] - public struct CursorInfo - { - public Int32 cbSize; - public Int32 flags; - public IntPtr hCursor; - public POINT ptScreenPos; - } - [StructLayout(LayoutKind.Sequential)] - public struct INPUT - { - public InputType type; - public InputUnion U; - public static int Size - { - get { return Marshal.SizeOf(typeof(INPUT)); } - } - } - - [StructLayout(LayoutKind.Explicit)] - public struct InputUnion - { - [FieldOffset(0)] - public MOUSEINPUT mi; - [FieldOffset(0)] - public KEYBDINPUT ki; - [FieldOffset(0)] - public HARDWAREINPUT hi; - } - [StructLayout(LayoutKind.Sequential)] - public struct MOUSEINPUT - { - public int dx; - public int dy; - public int mouseData; - public MOUSEEVENTF dwFlags; - public uint time; - public UIntPtr dwExtraInfo; - } - [StructLayout(LayoutKind.Sequential)] - public struct KEYBDINPUT - { - public VirtualKey wVk; - public ScanCodeShort wScan; - public KEYEVENTF dwFlags; - public int time; - public UIntPtr dwExtraInfo; - } - [StructLayout(LayoutKind.Sequential)] - public struct HARDWAREINPUT - { - public int uMsg; - public short wParamL; - public short wParamH; - } - #endregion - - #region DLL Imports - [DllImport("user32.dll")] - public static extern bool GetCursorInfo(out CursorInfo pci); - [DllImport("user32.dll", SetLastError = false)] - public static extern IntPtr GetDesktopWindow(); - - [DllImport("user32.dll")] - public static extern IntPtr GetCursor(); - - [DllImport("user32.dll")] - public static extern IntPtr CopyIcon(IntPtr hIcon); - - [DllImport("user32.dll")] - public static extern bool DrawIcon(IntPtr hdc, int x, int y, IntPtr hIcon); - - [DllImport("user32.dll")] - public static extern bool GetIconInfo(IntPtr hIcon, out ICONINFO piconinfo); - - [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, UIntPtr dwExtraInfo); - - [DllImport("user32.dll")] - public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo); - - [DllImport("user32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool GetCursorPos(out System.Drawing.Point lpPoint); - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetCursorPos(int x, int y); - - [DllImport("user32.dll")] - public static extern IntPtr SetCursor(IntPtr hcursor); - - [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType, - int cxDesired, int cyDesired, uint fuLoad); - - [DllImport("user32.dll")] - public static extern IntPtr CreateCursor(IntPtr hInst, int xHotSpot, int yHotSpot, - int nWidth, int nHeight, byte[] pvANDPlane, byte[] pvXORPlane); - - [DllImport("user32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool PrintWindow(IntPtr hwnd, IntPtr hDC, uint nFlags); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool SwitchDesktop(IntPtr hDesktop); - - public delegate bool EnumDesktopsDelegate(string desktop, IntPtr lParam); - - [DllImport("user32.dll")] - public static extern bool EnumDesktopsA(IntPtr hwinsta, EnumDesktopsDelegate lpEnumFunc, IntPtr lParam); - - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr OpenInputDesktop(uint dwFlags, bool fInherit, ACCESS_MASK dwDesiredAccess); - - public delegate bool EnumWindowStationsDelegate(string windowsStation, IntPtr lParam); - - [DllImport("user32.dll")] - public static extern bool EnumWindowStations(EnumWindowStationsDelegate lpEnumFunc, IntPtr lParam); - - [DllImport("user32.dll")] - public static extern IntPtr GetShellWindow(); - - public sealed class SafeWindowStationHandle : SafeHandleZeroOrMinusOneIsInvalid - { - public SafeWindowStationHandle() - : base(true) - { - } - - protected override bool ReleaseHandle() - { - return CloseWindowStation(handle); - - } - } - - [return: MarshalAs(UnmanagedType.Bool)] - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - [DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern bool CloseWindowStation(IntPtr hWinsta); - - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - [DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern SafeWindowStationHandle OpenWindowStation([MarshalAs(UnmanagedType.LPTStr)] string lpszWinSta, [MarshalAs(UnmanagedType.Bool)] bool fInherit, ACCESS_MASK dwDesiredAccess); - - [DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern IntPtr OpenWindowStationW([MarshalAs(UnmanagedType.LPTStr)] string lpszWinSta, [MarshalAs(UnmanagedType.Bool)] bool fInherit, ACCESS_MASK dwDesiredAccess); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool SetProcessWindowStation(IntPtr hWinSta); - - [DllImport("user32.dll")] - public static extern IntPtr GetWindowDC(IntPtr hWnd); - - public delegate bool EnumWindowsProc(IntPtr hwnd, IntPtr lParam); - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool EnumChildWindows(IntPtr hwndParent, EnumWindowsProc lpEnumFunc, IntPtr lParam); - - [DllImport("User32.dll")] - public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); - - [DllImport("User32.dll")] - public static extern IntPtr GetProcessWindowStation(); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool SetThreadDesktop(IntPtr hDesktop); - - [DllImport("user32.dll")] - public static extern IntPtr OpenDesktop(string lpszDesktop, uint dwFlags, bool fInherit, ACCESS_MASK dwDesiredAccess); - [DllImport("user32.dll", SetLastError = true)] - public static extern bool CloseDesktop(IntPtr hDesktop); - - public delegate bool EnumDesktopWindowsDelegate(IntPtr hWnd, int lParam); - - [DllImport("user32.dll")] - public static extern bool EnumDesktopWindows(IntPtr hDesktop, EnumDesktopWindowsDelegate lpfn, IntPtr lParam); - - [DllImport("user32.dll")] - public static extern IntPtr GetDC(IntPtr hWnd); - - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr SetActiveWindow(IntPtr hWnd); - - [DllImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool SetForegroundWindow(IntPtr hWnd); - - [DllImport("user32.dll")] - public static extern uint SendInput(uint nInputs, [MarshalAs(UnmanagedType.LPArray), In] INPUT[] pInputs, int cbSize); - [DllImport("user32.dll", SetLastError = false)] - public static extern UIntPtr GetMessageExtraInfo(); - [DllImport("sas.dll")] - public static extern void SendSAS(bool AsUser); - [DllImport("user32.dll")] - public static extern bool OpenClipboard(IntPtr hWnd); - [DllImport("user32.dll")] - public static extern bool EmptyClipboard(); - [DllImport("user32.dll")] - public static extern bool CloseClipboard(); - [DllImport("user32.dll")] - public static extern IntPtr SetClipboardData(int Format, IntPtr hMem); - - [DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)] - public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); - /* - * SystemParametersInfo( - * SPI_SETDESKWALLPAPER, 0, "filename.bmp", - * SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); - */ - - [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] - public static extern int SystemParametersInfo( - int uAction, int uParam, string lpvParam, int fuWinIni); - - [DllImport("user32.dll", SetLastError = true)] - public static extern bool LockWorkStation(); - - [DllImport("user32.dll")] - public static extern short VkKeyScan(char ch); - - [DllImport("user32.dll")] - public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam); - - #endregion - } -} diff --git a/Remotely_ScreenCast.Win/Win32/WTSAPI32.cs b/Remotely_ScreenCast.Win/Win32/WTSAPI32.cs deleted file mode 100644 index b43b0214..00000000 --- a/Remotely_ScreenCast.Win/Win32/WTSAPI32.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Runtime.InteropServices; - -namespace Win32 -{ - public static class WTSAPI32 - { - [StructLayout(LayoutKind.Sequential)] - public struct WTS_SESSION_INFO - { - public Int32 SessionID; - [MarshalAs(UnmanagedType.LPStr)] - public String pWinStationName; - public WTS_CONNECTSTATE_CLASS State; - } - public enum WTS_CONNECTSTATE_CLASS - { - WTSActive, - WTSConnected, - WTSConnectQuery, - WTSShadow, - WTSDisconnected, - WTSIdle, - WTSListen, - WTSReset, - WTSDown, - WTSInit - } - public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; - - [DllImport("wtsapi32.dll", SetLastError = true)] - static extern IntPtr WTSOpenServer(string pServerName); - - [DllImport("wtsapi32.dll", SetLastError = true)] - public static extern int WTSEnumerateSessions( - System.IntPtr hServer, - int Reserved, - int Version, - ref System.IntPtr ppSessionInfo, - ref int pCount); - - } -} diff --git a/Remotely_ScreenCast.Win/Win32/Win32Interop.cs b/Remotely_ScreenCast.Win/Win32/Win32Interop.cs deleted file mode 100644 index 2ac337de..00000000 --- a/Remotely_ScreenCast.Win/Win32/Win32Interop.cs +++ /dev/null @@ -1,144 +0,0 @@ -using Win32; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using static Win32.ADVAPI32; -using static Win32.User32; -using System.Windows.Forms; - -namespace Win32 -{ - public class Win32Interop - { - public static bool OpenInteractiveProcess(string applicationName, string desktopName, bool hiddenWindow, out PROCESS_INFORMATION procInfo) - { - uint winlogonPid = 0; - IntPtr hUserTokenDup = IntPtr.Zero, hPToken = IntPtr.Zero, hProcess = IntPtr.Zero; - procInfo = new PROCESS_INFORMATION(); - - // Obtain session ID for active session. - uint dwSessionId = Kernel32.WTSGetActiveConsoleSessionId(); - - // Check for RDP session. If active, use that session ID instead. - var rdpSessionID = GetRDPSession(); - if (rdpSessionID > 0) - { - dwSessionId = rdpSessionID; - } - - // Obtain the process ID of the winlogon process that is running within the currently active session. - Process[] processes = Process.GetProcessesByName("winlogon"); - foreach (Process p in processes) - { - if ((uint)p.SessionId == dwSessionId) - { - winlogonPid = (uint)p.Id; - } - } - - // Obtain a handle to the winlogon process. - hProcess = Kernel32.OpenProcess(MAXIMUM_ALLOWED, false, winlogonPid); - - // Obtain a handle to the access token of the winlogon process. - if (!OpenProcessToken(hProcess, TOKEN_DUPLICATE, ref hPToken)) - { - Kernel32.CloseHandle(hProcess); - return false; - } - - // Security attibute structure used in DuplicateTokenEx and CreateProcessAsUser. - SECURITY_ATTRIBUTES sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - - // Copy the access token of the winlogon process; the newly created token will be a primary token. - if (!DuplicateTokenEx(hPToken, MAXIMUM_ALLOWED, ref sa, SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, TOKEN_TYPE.TokenPrimary, out hUserTokenDup)) - { - Kernel32.CloseHandle(hProcess); - Kernel32.CloseHandle(hPToken); - return false; - } - - // By default, CreateProcessAsUser creates a process on a non-interactive window station, meaning - // the window station has a desktop that is invisible and the process is incapable of receiving - // user input. To remedy this we set the lpDesktop parameter to indicate we want to enable user - // interaction with the new process. - STARTUPINFO si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = @"winsta0\" + desktopName; - - // Flags that specify the priority and creation method of the process. - uint dwCreationFlags; - if (hiddenWindow) - { - dwCreationFlags = NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW | DETACHED_PROCESS; - } - else - { - dwCreationFlags = NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE; - } - - // Create a new process in the current user's logon session. - bool result = CreateProcessAsUser(hUserTokenDup, null, applicationName, ref sa, ref sa, false, dwCreationFlags, IntPtr.Zero, null, ref si, out procInfo); - - // Invalidate the handles. - Kernel32.CloseHandle(hProcess); - Kernel32.CloseHandle(hPToken); - Kernel32.CloseHandle(hUserTokenDup); - - return result; - } - - public static uint GetRDPSession() - { - IntPtr ppSessionInfo = IntPtr.Zero; - Int32 count = 0; - Int32 retval = WTSAPI32.WTSEnumerateSessions(WTSAPI32.WTS_CURRENT_SERVER_HANDLE, 0, 1, ref ppSessionInfo, ref count); - Int32 dataSize = Marshal.SizeOf(typeof(WTSAPI32.WTS_SESSION_INFO)); - var sessList = new List(); - Int64 current = (Int64)ppSessionInfo; - - if (retval != 0) - { - for (int i = 0; i < count; i++) - { - WTSAPI32.WTS_SESSION_INFO sessInf = (WTSAPI32.WTS_SESSION_INFO)Marshal.PtrToStructure((System.IntPtr)current, typeof(WTSAPI32.WTS_SESSION_INFO)); - current += dataSize; - sessList.Add(sessInf); - } - } - uint retVal = 0; - var rdpSession = sessList.Find(ses => ses.pWinStationName.ToLower().Contains("rdp") && ses.State == 0); - if (sessList.Exists(ses => ses.pWinStationName.ToLower().Contains("rdp") && ses.State == 0)) - { - retVal = (uint)rdpSession.SessionID; - } - return retVal; - } - public static IntPtr OpenInputDesktop() - { - return User32.OpenInputDesktop(0, false, ACCESS_MASK.GENERIC_ALL); - } - public static string GetCurrentDesktop() - { - var inputDesktop = OpenInputDesktop(); - byte[] deskBytes = new byte[256]; - uint lenNeeded; - var success = GetUserObjectInformationW(inputDesktop, UOI_NAME, deskBytes, 256, out lenNeeded); - if (!success) - { - CloseDesktop(inputDesktop); - return "Default"; - } - var desktopName = Encoding.Unicode.GetString(deskBytes.Take((int)lenNeeded).ToArray()).Replace("\0", ""); - CloseDesktop(inputDesktop); - return desktopName; - } - public static void SetMonitorState(MonitorState state) - { - User32.SendMessage(0xFFFF, 0x112, 0xF170, (int)state); - } - } -} diff --git a/Remotely_Server/API/CommandsController.cs b/Remotely_Server/API/CommandsController.cs index f59d6ddc..0b921d0f 100644 --- a/Remotely_Server/API/CommandsController.cs +++ b/Remotely_Server/API/CommandsController.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Management.Automation; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; diff --git a/Remotely_Server/CurrentVersion.txt b/Remotely_Server/CurrentVersion.txt index 38daac5a..49254084 100644 --- a/Remotely_Server/CurrentVersion.txt +++ b/Remotely_Server/CurrentVersion.txt @@ -1 +1 @@ -2019.04.03.2058 +2019.04.04.0721 diff --git a/Remotely_Server/Services/ApplicationConfig.cs b/Remotely_Server/Services/ApplicationConfig.cs index a6b2111f..89a9d0df 100644 --- a/Remotely_Server/Services/ApplicationConfig.cs +++ b/Remotely_Server/Services/ApplicationConfig.cs @@ -23,7 +23,7 @@ namespace Remotely_Server.Services public bool RedirectToHTTPS => bool.Parse(Config["ApplicationOptions:RedirectToHTTPS"]); public bool AllowApiLogin => bool.Parse(Config["ApplicationOptions:AllowApiLogin"]); public bool UseHSTS => bool.Parse(Config["ApplicationOptions:RedirectToHTTPS"]); - + public string[] TrustedCorsOrigins => Config.GetSection("ApplicationOptions:TrustedCorsOrigins").Get(); public string SmtpHost => Config["ApplicationOptions:SmtpHost"]; public int SmtpPort => int.Parse(Config["ApplicationOptions:SmtpPort"]); public string SmtpUserName => Config["ApplicationOptions:SmtpUserName"]; diff --git a/Remotely_Server/Services/DeviceSocketHub.cs b/Remotely_Server/Services/DeviceSocketHub.cs index d0299ec0..b8e57b6a 100644 --- a/Remotely_Server/Services/DeviceSocketHub.cs +++ b/Remotely_Server/Services/DeviceSocketHub.cs @@ -8,7 +8,6 @@ using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Management.Automation; using System.Threading.Tasks; namespace Remotely_Server.Services diff --git a/Remotely_Server/appsettings.json b/Remotely_Server/appsettings.json index c626a8ce..a2f5e82f 100644 --- a/Remotely_Server/appsettings.json +++ b/Remotely_Server/appsettings.json @@ -19,7 +19,7 @@ "DataRetentionInDays": 90, "RemoteControlSessionLimit": 1, "AllowApiLogin": false, - "TrustedCorsOrigins": [ ], + "TrustedCorsOrigins": [], "SmtpHost": "", "SmtpPort": 25, "SmtpUserName": "", diff --git a/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.js.map b/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.js.map index 7ff086e3..4cc8fa31 100644 --- a/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.js.map +++ b/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.js.map @@ -1 +1 @@ -{"version":3,"file":"OrganizationManagement.js","sourceRoot":"","sources":["OrganizationManagement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElE,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,EAA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IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,4CAA4C,QAAQ,EAAE,CAAC,CAAC;IAC7F,GAAG,CAAC,gBAAgB,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;IACzD,GAAG,CAAC,IAAI,EAAE,CAAC;AACf,CAAC;AACD,SAAS,SAAS,CAAC,GAAmB;IAClC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,SAAS,CAAC,OAAO,EAAE,qCAAqC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAChG,CAAC"} \ No newline at end of file diff --git a/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.ts b/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.ts index cb3df644..efefc3c5 100644 --- a/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.ts +++ b/Remotely_Server/wwwroot/scripts/Pages/OrganizationManagement.ts @@ -293,9 +293,9 @@ function deleteInvite(ev: MouseEvent) { xhr.onerror = () => { showError(xhr); } - xhr.open("delete", location.origin + `/api/OrganizationManagement/DeleteInvite/`); + xhr.open("delete", location.origin + `/api/OrganizationManagement/DeleteInvite/${inviteID}`); xhr.setRequestHeader("Content-Type", "application/json"); - xhr.send(JSON.stringify(inviteID)); + xhr.send(); } function showError(xhr: XMLHttpRequest) { console.error(xhr);