Table of Contents

Class WindowsNetworkFileShare

Namespace
Steeltoe.Common.Net
Assembly
Steeltoe.Common.Net.dll

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 string

Address of the file share

credentials NetworkCredential

Username and password for accessing the file share

mpr IMPR

A 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 bool

Not 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-wnetgetlasterrora
public int GetLastError(out int error, out StringBuilder errorBuf, int errorBufSize, out StringBuilder nameBuf, int nameBufSize)

Parameters

error int

The error code reported by the network provider.

errorBuf StringBuilder

String variable to receive the description of the error

errorBufSize int

Size of error buffer

nameBuf StringBuilder

String variable to receive the network provider raising the error

nameBufSize int

Size 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.