Skip to content

Commit a3be164

Browse files
committed
Add requirement to run RPCMon as Administrator
1 parent a6c3fcd commit a3be164

File tree

6 files changed

+151
-4
lines changed

6 files changed

+151
-4
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
RPCMon/bin/
3+
4+
RPCMon/obj/
5+
6+
.vs/

RPCMon/Form1.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.Diagnostics.Tracing.Parsers.MicrosoftWindowsRPC;
1717
using RPCMon.Control;
1818
using System.Reflection;
19+
using System.Security.Principal;
1920

2021
namespace RPCMon
2122
{
@@ -38,10 +39,13 @@ public partial class Form1 : Form
3839
private ListView m_LastListViewColumnFilter = new ListView();
3940
private ListView m_LastListViewHighlighFilter = new ListView();
4041
int m_CurrentRowIndexRightClick, m_CurrentColumnIndexRightClick;
42+
bool m_IsElevated = false;
4143

4244
public Form1()
4345
{
4446
InitializeComponent();
47+
configureFormBasedPrivileges();
48+
4549

4650
this.m_RPCDBPath = getDBFromCurrentFolder();
4751
this.toolStripStatusLabelDBPath.Text = "DB File: " + Path.GetFileName(this.m_RPCDBPath);
@@ -84,6 +88,22 @@ public Form1()
8488
new object[] { true });
8589
}
8690

91+
private void configureFormBasedPrivileges()
92+
{
93+
bool isElevated;
94+
using (WindowsIdentity identity = WindowsIdentity.GetCurrent())
95+
{
96+
WindowsPrincipal principal = new WindowsPrincipal(identity);
97+
isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator);
98+
m_IsElevated = isElevated;
99+
if (isElevated)
100+
{
101+
this.Text = "RPCMon - RPC Monitor Based Windows Events (Administrator)";
102+
}
103+
}
104+
}
105+
106+
87107
private void checkIdDBGHelpExist()
88108
{
89109
if (!File.Exists(Engine.DbgHelpFilePath))
@@ -307,6 +327,7 @@ private void setProcessName(Microsoft.Diagnostics.Tracing.Parsers.MicrosoftWindo
307327

308328
private void toolStripButtonStart_Click(object sender, EventArgs e)
309329
{
330+
310331
if (!m_IsCaptureButtonPressed)
311332
{
312333
toolStripButtonStart.Image = global::RPCMon.Properties.Resources.pause_button;
@@ -324,7 +345,6 @@ private void toolStripButtonStart_Click(object sender, EventArgs e)
324345
m_TraceSession.Dispose();
325346
m_CaptureThread.Abort();
326347
}
327-
328348
}
329349

330350
/*private void toolStripButtonStop_Click(object sender, EventArgs e)
@@ -845,7 +865,7 @@ private void toolStripButtonClear_Click(object sender, EventArgs e)
845865

846866
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
847867
{
848-
MessageBox.Show("Authors: Eviatar Gerzi (@g3rzi) and Yaniv Yakobovich\nVersion: 1.0\n\nCopyright (c) 2022 CyberArk Software Ltd. All rights reserved", "About");
868+
MessageBox.Show("Authors: Eviatar Gerzi (@g3rzi) and Yaniv Yakobovich\nVersion: 1.1\n\nCopyright (c) 2022 CyberArk Software Ltd. All rights reserved", "About");
849869
}
850870

851871
private void toolStripButtonFind_Click(object sender, EventArgs e)

RPCMon/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("1.1.0.0")]
36+
[assembly: AssemblyFileVersion("1.1.0.0")]

RPCMon/RPCMon.csproj

+32
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1414
<Deterministic>true</Deterministic>
15+
<PublishUrl>publish\</PublishUrl>
16+
<Install>true</Install>
17+
<InstallFrom>Disk</InstallFrom>
18+
<UpdateEnabled>false</UpdateEnabled>
19+
<UpdateMode>Foreground</UpdateMode>
20+
<UpdateInterval>7</UpdateInterval>
21+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
22+
<UpdatePeriodically>false</UpdatePeriodically>
23+
<UpdateRequired>false</UpdateRequired>
24+
<MapFileExtensions>true</MapFileExtensions>
25+
<ApplicationRevision>0</ApplicationRevision>
26+
<ApplicationVersion>1.1.0.%2a</ApplicationVersion>
27+
<IsWebBootstrapper>false</IsWebBootstrapper>
28+
<UseApplicationTrust>false</UseApplicationTrust>
29+
<BootstrapperEnabled>true</BootstrapperEnabled>
1530
</PropertyGroup>
1631
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1732
<PlatformTarget>x64</PlatformTarget>
@@ -33,6 +48,10 @@
3348
<ErrorReport>prompt</ErrorReport>
3449
<WarningLevel>4</WarningLevel>
3550
</PropertyGroup>
51+
<PropertyGroup />
52+
<PropertyGroup>
53+
<ApplicationManifest>app.manifest</ApplicationManifest>
54+
</PropertyGroup>
3655
<ItemGroup>
3756
<Reference Include="Microsoft.Diagnostics.Tracing.TraceEvent">
3857
<HintPath>..\Packages\Microsoft.Diagnostics.Tracing.TraceEvent.2.0.42\lib\net45\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>
@@ -130,6 +149,7 @@
130149
<DependentUpon>Resources.resx</DependentUpon>
131150
<DesignTime>True</DesignTime>
132151
</Compile>
152+
<None Include="app.manifest" />
133153
<None Include="packages.config" />
134154
<None Include="Properties\Settings.settings">
135155
<Generator>SettingsSingleFileGenerator</Generator>
@@ -181,5 +201,17 @@
181201
<ItemGroup>
182202
<None Include="Resources\duplicate-disable.png" />
183203
</ItemGroup>
204+
<ItemGroup>
205+
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
206+
<Visible>False</Visible>
207+
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
208+
<Install>true</Install>
209+
</BootstrapperPackage>
210+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
211+
<Visible>False</Visible>
212+
<ProductName>.NET Framework 3.5 SP1</ProductName>
213+
<Install>false</Install>
214+
</BootstrapperPackage>
215+
</ItemGroup>
184216
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
185217
</Project>

RPCMon/RPCMon.csproj.user

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<PublishUrlHistory>publish\</PublishUrlHistory>
5+
<InstallUrlHistory />
6+
<SupportUrlHistory />
7+
<UpdateUrlHistory />
8+
<BootstrapperUrlHistory />
9+
<ErrorReportUrlHistory />
10+
<FallbackCulture>en-US</FallbackCulture>
11+
<VerifyUploadedFiles>false</VerifyUploadedFiles>
12+
</PropertyGroup>
13+
</Project>

RPCMon/app.manifest

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
-->
19+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
20+
</requestedPrivileges>
21+
</security>
22+
</trustInfo>
23+
24+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25+
<application>
26+
<!-- A list of the Windows versions that this application has been tested on
27+
and is designed to work with. Uncomment the appropriate elements
28+
and Windows will automatically select the most compatible environment. -->
29+
30+
<!-- Windows Vista -->
31+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
32+
33+
<!-- Windows 7 -->
34+
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
35+
36+
<!-- Windows 8 -->
37+
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
38+
39+
<!-- Windows 8.1 -->
40+
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
41+
42+
<!-- Windows 10 -->
43+
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
44+
45+
</application>
46+
</compatibility>
47+
48+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
49+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
50+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
51+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
52+
<!--
53+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
54+
<windowsSettings>
55+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
56+
</windowsSettings>
57+
</application>
58+
-->
59+
60+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
61+
<!--
62+
<dependency>
63+
<dependentAssembly>
64+
<assemblyIdentity
65+
type="win32"
66+
name="Microsoft.Windows.Common-Controls"
67+
version="6.0.0.0"
68+
processorArchitecture="*"
69+
publicKeyToken="6595b64144ccf1df"
70+
language="*"
71+
/>
72+
</dependentAssembly>
73+
</dependency>
74+
-->
75+
76+
</assembly>

0 commit comments

Comments
 (0)