Class WindowsNetworkFileShare
For interacting with SMB network file shares on Windows
public class WindowsNetworkFileShare : IDisposable
- Inheritance
-
WindowsNetworkFileShare
- Implements
- Inherited Members
Constructors
WindowsNetworkFileShare(string, NetworkCredential, IMPR)
Initializes a new instance of the WindowsNetworkFileShare class.
public WindowsNetworkFileShare(string networkName, NetworkCredential credentials, IMPR mpr = null)
Parameters
networkName
stringAddress of the file share
credentials
NetworkCredentialUsername and password for accessing the file share
mpr
IMPRA class that handles calls to mpr.dll or performs same operations
Methods
Dispose()
public void Dispose()
Dispose(bool)
Disposes the object, cancels connection with file share
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolNot used
~WindowsNetworkFileShare()
Finalizes an instance of the WindowsNetworkFileShare class.
protected ~WindowsNetworkFileShare()
GetLastError(out int, out StringBuilder, int, out StringBuilder, int)
Retrieves the most recent extended error code set by a WNet function
Wraps an underlying P/Invoke call to mpr.dll - https://docs.microsoft.com/en-us/windows/desktop/api/winnetwk/nf-winnetwk-wnetgetlasterrorapublic int GetLastError(out int error, out StringBuilder errorBuf, int errorBufSize, out StringBuilder nameBuf, int nameBufSize)
Parameters
error
intThe error code reported by the network provider.
errorBuf
StringBuilderString variable to receive the description of the error
errorBufSize
intSize of error buffer
nameBuf
StringBuilderString variable to receive the network provider raising the error
nameBufSize
intSize of name buffer
Returns
- int
If the function succeeds, and it obtains the last error that the network provider reported, the return value is NO_ERROR.
If the caller supplies an invalid buffer, the return value is ERROR_INVALID_ADDRESS.