I would like to create/add a virtual network adapter to a client operating system at runtime (via code), preferably in C#. Something similar to that of what VirtualBox/VMware/Himachi creates when you install their software. I am guessing this will require some C/C++ shenanigans for the driver integration, but if it is doable with only C#, all the better.
I am aware of OpenVPN, their stuff is primarily in C, and I am also aware of the TUN/TAP drivers floating around, I just didn't know if these were the only solutions not requiring me creating a fully loaded network driver for Windows.
If you need simple funcionality then you can use Microsoft Loopback Adapter. To install it use devcon tool. Here is some info about it http://support.microsoft.com/kb/311272.
devcon -r install %WINDIR%\Inf\Netloop.inf *MSLOOP After that you can use WMI query with C# to obtain new connection name and then netsh to configure it (ie. netsh int ip set address name="Local Area Connection 2" static 192.168.0.3 255.0.0.0)
Related
I would like to get some network statistics in a C# program (FW 4.8 or .NET 5) of a specific network adapter. I know of System.Net.NetworkInformation.NetworkInterface.GetIPStatistics but this is not helpful because it depends on network interfaces and not adapters. On a Windows 10 machine with Hyper-V enabled, the physical adapters do not have interfaces and are only bridged to a Hyper-V switch.
In the Control Panel GUI the information is available:
I guess the info could be access using the native IP Helper API somewhere but I could not yet find it.
Does anybody now how to get the statistics or have any code ready to use?
I'm setting up a test environment including several instruments connected via LAN(TCP/IP) or USB. A Software shall be written in C# using the Ivi.Visa library. The instruments (which will change over time) get their IP address from a DHCP server so they won't show up in the Resources discovered byIVI.Visa.interop.ResourceManager.FindRsrc() unless they've been previously added by the Keysight Connection manager Software (or equivalent NI tool).
ResourceManager rMgr = new ResourceManager();
string[] enumRcrs = rMgr.FindRsrc("?*INSTR");
How does one achieve to discover new VISA Network devices in C# and add them to the resources list without having to use the external software before?
Modern instruments may support discovery via mDNS (see LXI specification here). I'm not familiar with Ivi.Visa library, but you may want to look over its documentation for instrument discovery feature. If it is not supported then you can probably implement mDNS request in your C# code.
I want to simulate a network drive. It seems that the simplest way would be to use Microsoft Loopback Adapter but all of the instructions I've found on the web how to install it refer to non existing options in Windows 10. Is it not available in Windows 10 or how do I install it?
If it's not available - how can I simulate a network drive? Somehow make a folder recognized as a drive? Make an external HDD behave like that? Something else? (the router doesn't have a USB port so I can't use that.)
If there's some software emulation for testing applications that would be fine. I'm using C#. Perhaps something in Visual Studio?
It's been renamed to "Microsoft KM-TEST Loopback Adapter". (MSDN)
We have a .NET project that uses WMI and are interested in porting it to the Mono framework.
It appears Mono does not support WMI.
Are there any libraries that can add WMI support?
Basically we would want to access a Windows server using WMI from a Linux/OS X box.
Windows Management Instrumentation is a Microsoft implementation of WBEM (Web-Based Enterprise Management).
There are open-source implementations (eg openPegasus) that you might be able to use a client, but there's no telling what MS did with their version. If you can send CIM queries to the server, then you may get good results.
Note that Windows doesn't do WMI over http, only DCOM/DCE-RPC, so some clients will just not work. A quick google.. and OpenPegasus will allow you to access Windows using a WMI Mapper. If not, you could always run the server component on Windows.
Regarding WMI over HTTP, take a look at WinRM, which appears to be an implementation of WS-Management for XP, Win2003, Win2008, and Vista. This defines a way to access Common Information Model (CIM) information over HTTP(S) (SOAP). CIM is defined by the DMTF and WMI is Microsoft's implementation of CIM.
If I read the alphabet soup correctly, you should be able to use SOAP from Linux to access WinRM (WS-Management) on a Windows machine, thus providing access to WMI (as long as WinRM is installed, running, and not firewalled).
Whether running such a thing on a corporate network will be allowed by IT/Security is another matter entierely: any open port can be a security risk and one which allows command, control, and configuration by design can be quite a hole. Certificates, IPSec, and scoped firewall rules are your friend!
Note that I have no direct experience using WS-Management, nor WinRM, so YMMV.
I know you can install wmi-client on Linux (sudo apt-get install wmi-client). You should be able to query any wmi object on a Windows box from the Linux command line using this.
I have a device and the drivers for this device. What I would like to do is build an application that mocks a USB device to communicate with a third party application.
More specifically, I am attempting to build an application that can mock a USB device that mimics a Microsoft Zune. I want to make it so my application can register as a zune device and then communicate with the client. I have added several DLL's to my application in order to attempt to determine the calls that tell the software a connected device is a legitimate zune, but so far I haven't had much luck.
I'm new to this type of development - that is mimicking hardware devices, and I'm not very experienced in importing dll's that were written in C/C++. I am using Visual Studio 2010 (.net 4.0) to develop my app, and I would appreciate any help anyone can offer me towards mimicking the hardware. I do have the device drivers, which Visual studio refuses to reference directly. I also have an actual physical device, so I can see what the drivers are that it uses in Device Manager.
The goal is as follows
Application registers itself as a usb device, mimicking a Microsoft Zune in a similar fashion to how Virtual Clone Drive mimics a DVD player.
Application is recognized by zune client as a valid microsoft zune.
Zune Software works with application as it does the hardware device (syncing, etc)
I just found something called the Device Simulation Framework, which might be exactly what you need. It will still require significant research into how USB works to finish your solution, though. And probably still typically done using C or C++.
The Zune uses a modified version of the MTP protocol called MTPZ, but I found this sample using the Device Simulation Framework to simulate a regular MTP device. It's called The MTP Device Simulator. I can't tell if source code is available.
Are you able to replace the DLLs used by the zune client software with your own DLLs? In that case, you could wrap the original DLLs with your DLLs and intercept the operations.
Update: To find out the signatures of the functions in the DLL, take a look at the Dependency Walker tool, which will list the exported functions (and lots of other information). I'm guessing you will want to write your replacement DLL in C.
Otherwise, you'll have to write drivers that register a USB device with the proper endpoints. I'm not sure how to do this on Windows - I've only done USB coding on the firmware side, not the driver side. You should be able to use any tutorial for creating a Windows USB driver, like Getting Started with USB Driver Development
Zune specifics information might also be useful. Perhaps this blog post and its sequels could help: Inside the Zune/USB Protocol: Part 1