This project's intent is to encapsulate WNet functionnalities, or at list part of them.
You can either connect using username and password, or ask for an authentication prompt. This operation will create a trust connection between the host and the targeted machine.
Native method documentation
// With prompt
string targetUNC = "\\RemoteComputerUNC";
PinvokeWindowsNetworking.ConnectToRemote(targetUNC, null, null, prompUser: true)
// With credentials
string targetUNC = "\\RemoteComputerUNC";
string userName = "DOMAIN\Username"
string password = "123456"
PinvokeWindowsNetworking.ConnectToRemote(targetUNC, userName, password, prompUser: true)
Closes a connection created with WNetUseConnection.
Native method documentation
string targetUNC = "\\RemoteComputerUNC";
PinvokeWindowsNetworking.DisconnectRemote(targetUNC)