BornToBeRoot / NETworkManager

A powerful tool for managing networks and troubleshoot network problems!
https://borntoberoot.net/NETworkManager/
GNU General Public License v3.0
6.54k stars 681 forks source link

Argument 2 must be passed with the 'ref' keyword #224

Closed PCAssistSoftware closed 4 years ago

PCAssistSoftware commented 4 years ago

Line 308 of RemoteDesktopControl.xaml.cs

Get

Argument 2 must be passed with the 'ref' keyword Argument 3 must be passed with the 'ref' keyword

This is with a fresh download from master branch when trying to build/run the code?

BornToBeRoot commented 4 years ago

Which version of VS/.NET/Windows are you using?

Is the pre-build script executed correctly in vs? There is an issue with the SendKeys in MSTSClib which is fixed with these commands:

https://github.com/BornToBeRoot/NETworkManager/blob/b0c66fd1a3f7befb20667dc4f4f0c6c7dfb4ee29/Scripts/PreBuildEventCommandLine.ps1#L53

Or just copy the MSTSCLib.dll and AxMSTSCLib.dll from my latest release in the Debug folder...

This is the line with the issue: https://github.com/BornToBeRoot/NETworkManager/blob/b0c66fd1a3f7befb20667dc4f4f0c6c7dfb4ee29/Source/NETworkManager/Controls/RemoteDesktopControl.xaml.cs#L308

PCAssistSoftware commented 4 years ago

VS 2019 / Windows 10 / .NET 4.7.2

Actually no the pre-build script didn't allow me to build, so I removed it, not knowing it was related, will add it back tomorrow and let you know exactly why it fails to build with the script enabled

PCAssistSoftware commented 4 years ago

It has nothing to do with the script as that is a build event and I can't get as far as building because of the error in the code as per original report - have attached screenshot this time which hopefully makes it clearer.

image

BornToBeRoot commented 4 years ago

Can you delete the bin and obj folder and rebuild the solution with the working .ps1 pre build script.

image

These commands need to be executed to modify the MSTSCLib.dll to allow the additional arguments (pbArrayKeyUp and plKeyData) in the function SendKeys:

https://github.com/BornToBeRoot/NETworkManager/blob/b0c66fd1a3f7befb20667dc4f4f0c6c7dfb4ee29/Scripts/PreBuildEventCommandLine.ps1#L53-L71

The pre build script does: 1) Build MSTSCLib.dll and AxMSTSCLib.dll with aximp.exe from \system32\mstscax.dll 2) Decompile (ildasm.exe), Modify and Compoile (ilasm.exe) the MSTSCLib.dll to use the SendKeys function (IMsRdpClientNonScriptable::SendKeys)

PCAssistSoftware commented 4 years ago

Deleting bin and obj and then rebuilding seems to have resolved the problem - thank you very much :)

BornToBeRoot commented 4 years ago

Great!