I'm reverse engineering a control plugin for a laptop and trying to figure out how to call the methods that emulate what the "app" is doing. It's written in C#, so I thought I could just use PowerShell to call methods on it. I've used DotPeek to figure out that everything is handled into a single DLL which implements the methods that I want to access.
The class looks like:
namespace Vendor.package1.package2.SomePlugin
{
internal class SomeClass : IInterfaceThatIWant, ...
{
~SomeClass()
{
}
public RequestObject SetSomething()
{
... method that I want to use
}
public ResponseObject GetSomething()
{
...
}
private SomeClass()
{
...
}
public static SomeClass GetInstance()
{
...
}
}
Inside PowerShell, I've tried:
Add-Type -Path "c:\pathtodll\x64\vendor.dll"
and
[System.Reflection.Assembly]::LoadFrom("c:\pathtodll\x64\vendor.dll")
...which did not show any error, so I assume both worked.
Next I'm trying:
[Vendor.package1.package2.SomePlugin.SomeClass]::GetInstance()
Unable to find type [Vendor.package1.package2.SomePlugin.SomeClass].
New-Object Vendor.package1.package2.SomePlugin.SomeClass
New-Object : Cannot find type [Vendor.package1.package2.SomePlugin.SomeClass]: verify that the assembly containing this type is loaded.
[Vendor.package1.package2.SomePlugin.SomeClass]::GetInstance
Unable to find type [Vendor.package1.package2.SomePlugin.SomeClass].
and various other permutations but I cannot get a class handle.