add rdc execution

remotes/origin/master
syneffort 3 years ago
parent fcfd0dfdda
commit 96262b8225
  1. 15
      WoL/Waker/MainForm.Designer.cs
  2. 13
      WoL/Waker/MainForm.cs
  3. 1
      WoL/Waker/Waker.csproj
  4. 79
      WoL/Waker/app.manifest
  5. 37
      WoL/WoL/Utils.cs
  6. 4
      WoL/WoL/WakeOnLan.csproj

@ -42,6 +42,7 @@ namespace Waker
this.label4 = new System.Windows.Forms.Label();
this.PingStatusPanel = new System.Windows.Forms.Panel();
this.pingTimer = new System.Windows.Forms.Timer(this.components);
this.RECButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// AddressTextBox
@ -80,7 +81,7 @@ namespace Waker
//
this.WakeButton.Location = new System.Drawing.Point(271, 12);
this.WakeButton.Name = "WakeButton";
this.WakeButton.Size = new System.Drawing.Size(102, 112);
this.WakeButton.Size = new System.Drawing.Size(102, 83);
this.WakeButton.TabIndex = 4;
this.WakeButton.Text = "WoL";
this.WakeButton.UseVisualStyleBackColor = true;
@ -134,12 +135,23 @@ namespace Waker
this.pingTimer.Interval = 5000;
this.pingTimer.Tick += new System.EventHandler(this.pingTimer_Tick);
//
// RECButton
//
this.RECButton.Location = new System.Drawing.Point(271, 101);
this.RECButton.Name = "RECButton";
this.RECButton.Size = new System.Drawing.Size(102, 23);
this.RECButton.TabIndex = 5;
this.RECButton.Text = "RD Client";
this.RECButton.UseVisualStyleBackColor = true;
this.RECButton.Click += new System.EventHandler(this.RECButton_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(383, 134);
this.Controls.Add(this.RECButton);
this.Controls.Add(this.PingStatusPanel);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
@ -174,6 +186,7 @@ namespace Waker
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Panel PingStatusPanel;
private System.Windows.Forms.Timer pingTimer;
private System.Windows.Forms.Button RECButton;
}
}

@ -10,6 +10,10 @@ using System.Windows.Forms;
using WakeOnLan;
using System.Configuration;
using System.Threading;
using System.Reflection;
using System.Security.Principal;
using System.Diagnostics;
using System.IO;
namespace Waker
{
@ -226,5 +230,14 @@ namespace Waker
else
PingStatusPanel.BackColor = PING_FAIL;
}
private void RECButton_Click(object sender, EventArgs e)
{
string path = @"C:\Windows\System32\mstsc.exe";
if (!File.Exists(path))
return;
Process.Start(path);
}
}
}

@ -11,6 +11,7 @@
<Version>1.0.0.1</Version>
<PackageIcon>Designcontest-Ecommerce-Business-Idea.ico</PackageIcon>
<PackageIconUrl />
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 매니페스트 옵션
Windows 사용자 계정 컨트롤 수준을 변경하려면
requestedExecutionLevel 노드를 다음 중 하나로 바꿉니다.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
requestedExecutionLevel 요소를 지정하면 파일 및 레지스트리 가상화를 사용하지 않습니다.
이전 버전과의 호환성을 위해 애플리케이션에 가상화가 필요한 경우
이 요소를 제거합니다.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 이 애플리케이션이 테스트되고 함께 작동하도록 설계된 Windows 버전
목록입니다. 해당 요소의 주석 처리를 제거하면 Windows에서
호환 가능성이 가장 큰 환경을 자동으로 선택합니다. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 애플리케이션이 DPI를 인식하며 높은 DPI에서 Windows가 자동으로 스케일링하지
않음을 나타냅니다. WPF(Windows Presentation Foundation) 애플리케이션은 자동으로 DPI를 인식하며
옵트인할 필요가 없습니다. 이 설정에 옵트인한 .NET Framework 4.6을 대상으로 하는
Windows Forms 애플리케이션은 app.config에서 'EnableWindowsFormsHighDpiAutoResizing' 설정도 'true'로 설정해야 합니다.
애플리케이션이 긴 경로를 인식하도록 설정합니다. https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation을 참조하세요. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Windows 공용 컨트롤 및 대화 상자의 테마 사용(Windows XP 이상) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

@ -1,13 +1,24 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Security.Principal;
namespace WakeOnLan
{
class Utils
public class Utils
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr);
public static IPAddress GetIpAddress(string ip)
{
Regex regex = new Regex(@"^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$");
@ -20,5 +31,29 @@ namespace WakeOnLan
return hostEntry.AddressList[0];
}
public static void SysTest()
{
IntPtr wow64Value = IntPtr.Zero;
File.Create(@"c:\windows\system32\test");
Debug.WriteLine("Default System Directory : {0}", File.Exists(@"c:\windows\system32\test"));
//Disable Redirection
Wow64DisableWow64FsRedirection(ref wow64Value);
Debug.WriteLine("Wow64Redirection Disable : {0}", File.Exists(@"c:\windows\system32\test"));
//Enable Redirection
Wow64RevertWow64FsRedirection(wow64Value);
Debug.WriteLine("Wow64Redirection Enable : {0}", File.Exists(@"c:\windows\system32\test"));
}
public static bool IsRunningAsAdmin()
{
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(windowsIdentity);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}
}
}

@ -4,4 +4,8 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>
</Project>

Loading…
Cancel
Save