Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/todbot/winhiddump into main
Browse files Browse the repository at this point in the history
  • Loading branch information
todbot committed Jan 19, 2021
2 parents 9f73adb + 3526a62 commit d6f0c88
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
27 changes: 16 additions & 11 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@ class Program

static void Main(string[] args)
{
// The code provided will print ‘Hello World’ to the console.
// Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
Console.WriteLine("Hello World Tod!");
Console.WriteLine("WinHIDdump:");

string vidpid = GetArgument(args, "--vidpid");
Console.WriteLine("Got vidpid: " + vidpid);
// Console.WriteLine("Got vidpid: " + vidpid);

var list = DeviceList.Local;
foreach (var hidDevice in list.GetHidDevices())
foreach (var dev in list.GetHidDevices())
{
Console.WriteLine(hidDevice.ToString() + " @ " + hidDevice.DevicePath);
byte[] rawReportDescriptor = hidDevice.GetRawReportDescriptor();
Console.WriteLine("Report Descriptor:");
Console.WriteLine(" {0} ({1} bytes)", string.Join(" ", rawReportDescriptor.Select(d => d.ToString("X2"))), rawReportDescriptor.Length);
Console.Write(string.Format("{0:X4}:{1:X4}: {2} - {3}\nPATH:{4}\n",
dev.VendorID, dev.ProductID, dev.GetManufacturer(), dev.GetProductName(), dev.DevicePath));
// Console.WriteLine(dev.ToString() + " @ " + dev.DevicePath);
byte[] rawReportDescriptor = dev.GetRawReportDescriptor();
Console.Write("DESCRIPTOR:\n ");
for( int i=0; i< rawReportDescriptor.Length; i++)
{
Console.Write(rawReportDescriptor[i].ToString("X2") + " ");
Console.Write((i % 16 == 15) ? "\n " : " ");
}
Console.WriteLine("\n ({0} bytes)", rawReportDescriptor.Length);
// Console.WriteLine(" {0} ({1} bytes)", string.Join(" ", rawReportDescriptor.Select(d => d.ToString("X2"))), rawReportDescriptor.Length);
}
// Console.WriteLine("Press any key to exit");
// Console.ReadKey();

// Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app!
}
}
}
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("hiddump0")]
[assembly: AssemblyTitle("winhiddump")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("hiddump0")]
[assembly: AssemblyProduct("winhiddump")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
1 change: 0 additions & 1 deletion winhiddump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit d6f0c88

Please sign in to comment.