Skip to content

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
fixed #6
+ bumped up nuget packages, VS version and assembly version
- removed Costura.Fody and Fody as they are not used anymore
  • Loading branch information
VoidSec committed Aug 16, 2021
1 parent c24dcf6 commit a1ea49c
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 61 deletions.
4 changes: 2 additions & 2 deletions ioctlpus.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
# Visual Studio Version 16
VisualStudioVersion = 16.0.31605.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ioctlpus", "ioctlpus\ioctlpus.csproj", "{D1B74F9A-055F-4D4F-8649-3991C041838B}"
EndProject
Expand Down
9 changes: 1 addition & 8 deletions ioctlpus/AboutForm.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ioctlpus
Expand Down
2 changes: 0 additions & 2 deletions ioctlpus/FodyWeavers.xml

This file was deleted.

11 changes: 5 additions & 6 deletions ioctlpus/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using static ioctlpus.Utilities.NativeMethods;
using static ioctlpus.Utilities.IOCTL;
using System.Drawing;
using static ioctlpus.Utilities.NativeMethods;

namespace ioctlpus
{
Expand Down Expand Up @@ -168,7 +167,7 @@ private void btnSend_Click(object sender, EventArgs e)
{
uint fa_mask = Convert.ToUInt32(tbAccessMask.Text, 16);
SafeFileHandle sfh = CreateFile(
tbDevicePath.Text,
tbDevicePath.Text.Trim(),
(FileAccess)fa_mask,
FileShare.ReadWrite,
IntPtr.Zero,
Expand All @@ -178,13 +177,13 @@ private void btnSend_Click(object sender, EventArgs e)

int errorCode = 0;

uint ioctl = Convert.ToUInt32(tbIOCTL.Text, 16);
uint ioctl = Convert.ToUInt32(tbIOCTL.Text.Trim(), 16);
uint returnedBytes = 0;
uint inputSize = (uint)nudInputSize.Value;
uint outputSize = (uint)nudOutputSize.Value;
byte[] outputBuffer = new byte[outputSize];
byte[] inputBuffer = new byte[inputSize];


if (sfh.IsInvalid)
{
Expand Down
27 changes: 11 additions & 16 deletions ioctlpus/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using CommandLine;
using static ioctlpus.Utilities.NativeMethods;
using static ioctlpus.Utilities.IOCTL;
using CommandLine;
using Microsoft.Win32.SafeHandles;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.ComponentModel;
using System.Windows.Forms;
using static ioctlpus.Utilities.NativeMethods;

namespace ioctlpus
{
Expand All @@ -32,7 +27,7 @@ public static byte[] StringToByteArray(string hex)

public static string ByteArrayToString(byte[] ba)
{
string hex = "0x"+BitConverter.ToString(ba).Replace("-", " 0x");
string hex = "0x" + BitConverter.ToString(ba).Replace("-", " 0x");
return hex;
}

Expand All @@ -44,7 +39,7 @@ class Options

[Option("guid", HelpText = "Path/GUID of the driver to interact with.", Default = null)]
public string Guid { get; set; }

[Option("ioctl", HelpText = "IOCTL code.", Default = null)]
public string Ioctl { get; set; }

Expand All @@ -53,7 +48,7 @@ class Options

[Option('o', "output-size", HelpText = "Output Size (decimal).", Default = 32)]
public int Output_size { get; set; }

[Option("input", HelpText = "Input buffer.", Default = null)]
public string Input_buffer { get; set; }

Expand Down Expand Up @@ -97,7 +92,7 @@ static void Main(string[] args)
// if we gathered every parameter we can proceed and perform the IOCTL request printing out the result
uint fa_mask = Convert.ToUInt32(opts.Access_mask, 16);
SafeFileHandle sfh = CreateFile(
opts.Guid,
opts.Guid.Trim(),
(FileAccess)fa_mask,
FileShare.ReadWrite,
IntPtr.Zero,
Expand All @@ -107,7 +102,7 @@ static void Main(string[] args)
int errorCode = 0;
uint ioctl = Convert.ToUInt32(opts.Ioctl, 16);
uint ioctl = Convert.ToUInt32(opts.Ioctl.Trim(), 16);
uint returnedBytes = 0;
uint inputSize = (uint)opts.Input_size;
uint outputSize = (uint)opts.Output_size;
Expand Down
5 changes: 2 additions & 3 deletions ioctlpus/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand Down Expand Up @@ -32,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.1.0")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyVersion("0.2.1.1")]
[assembly: AssemblyFileVersion("0.2.1.1")]
3 changes: 0 additions & 3 deletions ioctlpus/Request.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ioctlpus
{
Expand Down
9 changes: 2 additions & 7 deletions ioctlpus/Utilities.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ioctlpus
{
Expand Down Expand Up @@ -67,7 +62,7 @@ public class NativeMethods
public const int EM_SETCUEBANNER = 0x1501;

[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)]string lParam);
public static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);

public const Int32 DIGCF_PRESENT = 2;
public const Int32 DIGCF_DEVICEINTERFACE = 0x10;
Expand Down Expand Up @@ -138,7 +133,7 @@ public static extern bool DeviceIoControl(
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);

[DllImport("kernel32.dll")]
public static extern bool CloseHandle(SafeFileHandle hObject);

Expand Down
22 changes: 10 additions & 12 deletions ioctlpus/ioctlpus.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.5.3.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.5.3.0\build\Costura.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -76,16 +75,23 @@
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'x86|AnyCPU'">
<OutputPath>bin\x86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Be.Windows.Forms.HexBox, Version=1.6.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Be.Windows.Forms.HexBox.1.6.1\lib\net40\Be.Windows.Forms.HexBox.dll</HintPath>
</Reference>
<Reference Include="CommandLine, Version=2.8.0.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.2.8.0\lib\net45\CommandLine.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=5.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.5.3.0\lib\netstandard1.0\Costura.dll</HintPath>
</Reference>
<Reference Include="ListViewPrinter, Version=2.7.1.31255, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ObjectListView.2.7.1.5\lib\ListViewPrinter.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -299,24 +305,16 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.6.5.1\build\Fody.targets" Condition="Exists('..\packages\Fody.6.5.1\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.6.5.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.5.1\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.5.3.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.3.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.5.3.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.3.0\build\Costura.Fody.targets'))" />
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
</Target>
<Import Project="..\packages\Costura.Fody.5.3.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.5.3.0\build\Costura.Fody.targets')" />
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 0 additions & 2 deletions ioctlpus/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<packages>
<package id="Be.Windows.Forms.HexBox" version="1.6.1" targetFramework="net452" />
<package id="CommandLineParser" version="2.8.0" targetFramework="net452" />
<package id="Costura.Fody" version="5.3.0" targetFramework="net461" developmentDependency="true" />
<package id="Fody" version="6.5.1" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.NETCore.Platforms" version="5.0.2" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
Expand Down

0 comments on commit a1ea49c

Please sign in to comment.