using System;
using System.Runtime.InteropServices;
namespace Vanara.PInvoke
{
public static partial class NetApi32
{
/// A set of bit flags that describe connection behavior and credential handling.
[PInvokeData("lmuse.h", MSDNShortId = "3fb3ad35-f9e5-46ba-b930-fc2ccafd8ee9")]
[Flags]
public enum NetUseFlags
{
/// Do not connect to the server.
CREATE_NO_CONNECT = 0x1,
/// Force a connection to the server, bypassing the CSC.
CREATE_BYPASS_CSC = 0x2,
///
/// Create a connection with credentials passed in this netuse if none exist. If connection already exists then update
/// credentials after issuing remote tree connection. This is needed as CSC cannot verify credentials while offline.
///
CREATE_CRED_RESET = 0x4,
/// No explicit credentials are supplied in the call to NetUseAdd.
USE_DEFAULT_CREDENTIALS = 0x4,
/// Enforce connection level integrity.
CREATE_REQUIRE_CONNECTION_INTEGRITY = 0x8,
/// Enforce connection level privacy.
CREATE_REQUIRE_CONNECTION_PRIVACY = 0x10,
/// Persist the mapping in the registry. (Only valid for global mappings.)
CREATE_PERSIST_MAPPING = 0x20,
/// Enables write-through semantics on all files opened via this mapping.
CREATE_WRITE_THROUGH_SEMANTICS = 0x40,
}
/// The level of force to use in deleting the connection.
[PInvokeData("lmuse.h", MSDNShortId = "200b0640-71e9-4f60-bf4c-c8df10bfe095")]
public enum NetUseForce
{
/// Fail the disconnection if open files exist on the connection.
USE_NOFORCE = 0,
/// Do not fail the disconnection if open files exist on the connection.
USE_FORCE = 1,
/// Close any open files and delete the connection.
USE_LOTS_OF_FORCE = 2
}
/// The status of the connection.
[PInvokeData("lmuse.h", MSDNShortId = "b9f680b8-b56a-42be-9af1-d7b18328ded4")]
public enum NetUseStatus
{
/// The connection is valid.
USE_OK = 0,
/// Paused by local workstation.
USE_PAUSED = 1,
/// Disconnected.
USE_SESSLOST = 2,
/// An error occurred.
USE_DISCONN = 2,
/// A network error occurred.
USE_NETERR = 3,
/// The connection is being made.
USE_CONN = 4,
/// Reconnecting.
USE_RECONN = 5,
}
/// The type of remote resource being accessed.
[PInvokeData("lmuse.h", MSDNShortId = "b9f680b8-b56a-42be-9af1-d7b18328ded4")]
public enum NetUseType
{
///
/// Matches the type of the server's shared resources. Wildcards can be used only with the NetUseAdd function, and only when the
/// ui1_local member is NULL. For more information, see the following Remarks section.
///
USE_WILDCARD = -1,
/// Disk device.
USE_DISKDEV = 0,
/// Spooled printer.
USE_SPOOLDEV = 1,
/// Undocumented
USE_CHARDEV = 2,
/// Interprocess communication (IPC).
USE_IPC = 3,
}
///
/// The NetUseAdd function establishes a connection between the local computer and a remote server. You can specify a local
/// drive letter or a printer device to connect. If you do not specify a local drive letter or printer device, the function
/// authenticates the client with the server for future connections.
///
///
///
/// The UNC name of the computer on which to execute this function. If this parameter is NULL, then the local computer is
/// used. If the UncServerName parameter specified is a remote computer, then the remote computer must support remote RPC calls using
/// the legacy Remote Access Protocol mechanism.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
///
/// A value that specifies the information level of the data. This parameter can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// 1
///
/// Specifies information about the connection between a local device and a shared resource. Information includes the connection
/// status and type. The Buf parameter is a pointer to a USE_INFO_1 structure.
///
///
/// -
/// 2
///
/// Specifies information about the connection between a local device and a shared resource. Information includes the connection
/// status and type, and a user name and domain name. The Buf parameter is a pointer to a USE_INFO_2 structure.
///
///
///
///
///
/// A pointer to the buffer that specifies the data. The format of this data depends on the value of the Level parameter. For more
/// information, see Network Management Function Buffers.
///
///
/// A pointer to a value that receives the index of the first member of the information structure in error when the
/// ERROR_INVALID_PARAMETER error is returned. If this parameter is NULL, the index is not returned on error. For more
/// information, see the following Remarks section.
///
///
/// If the function succeeds, the return value is NERR_Success.
/// If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.
///
///
/// You can also use the WNetAddConnection2 and WNetAddConnection3 functions to redirect a local device to a network resource.
///
/// No special group membership is required to call the NetUseAdd function. This function cannot be executed on a remote
/// server except in cases of downlevel compatibility.
///
///
/// This function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseAdd function does not
/// support Distributed File System (DFS) shares. To add a share using a different network provider (WebDAV or a DFS share, for
/// example), use the WNetAddConnection2 or WNetAddConnection3 function.
///
///
/// If the NetUseAdd function returns ERROR_INVALID_PARAMETER, you can use the ParmError parameter to indicate the first
/// member of the information structure that is invalid. (The information structure begins with USE_INFO_ and its format is specified
/// by the Level parameter.) The following table lists the values that can be returned in the ParmError parameter and the
/// corresponding structure member that is in error. (The prefix ui*_ indicates that the member can begin with multiple prefixes, for
/// example, ui1_ or ui2_.)
///
///
///
/// Constant
/// Value
/// Member
///
/// -
/// USE_LOCAL_PARMNUM
/// 1
/// ui*_local
///
/// -
/// USE_REMOTE_PARMNUM
/// 2
/// ui*_remote
///
/// -
/// USE_PASSWORD_PARMNUM
/// 3
/// ui*_password
///
/// -
/// USE_ASGTYPE_PARMNUM
/// 4
/// ui*_asg_type
///
/// -
/// USE_USERNAME_PARMNUM
/// 5
/// ui*_username
///
/// -
/// USE_DOMAINNAME_PARMNUM
/// 6
/// ui*_domainname
///
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/nf-lmuse-netuseadd NET_API_STATUS NET_API_FUNCTION NetUseAdd( LPTSTR
// servername, DWORD LevelFlags, LPBYTE buf, LPDWORD parm_err );
[DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Auto)]
[PInvokeData("lmuse.h", MSDNShortId = "22550c17-003a-4f59-80f0-58fa3e286844")]
public static extern Win32Error NetUseAdd(string servername, uint LevelFlags, IntPtr buf, out uint parm_err);
///
/// The NetUseDel function ends a connection to a shared resource.
/// You can also use the WNetCancelConnection2 function to terminate a network connection.
///
///
///
/// The UNC name of the computer on which to execute this function. If this is parameter is NULL, then the local computer is used.
///
///
/// If the UncServerName parameter specified is a remote computer, then the remote computer must support remote RPC calls using the
/// legacy Remote Access Protocol mechanism.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
///
/// A pointer to a string that specifies the path of the connection to delete.
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
///
/// The level of force to use in deleting the connection.
/// This parameter can be one of the following values defined in the lmuseflg.h header file.
///
///
/// Value
/// Meaning
///
/// -
/// USE_NOFORCE
/// Fail the disconnection if open files exist on the connection.
///
/// -
/// USE_FORCE
/// Do not fail the disconnection if open files exist on the connection.
///
/// -
/// USE_LOTS_OF_FORCE
/// Close any open files and delete the connection.
///
///
///
///
/// If the function succeeds, the return value is NERR_Success.
/// If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.
///
///
///
/// The NetUseDel function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseDel
/// function does not support Distributed File System (DFS) shares or other network file systems. To terminate a connection to a
/// share using a different network provider (WebDAV or a DFS share, for example), use the WNetCancelConnection2 function.
///
///
/// No special group membership is required to call the NetUseDel function. This function cannot be executed on a remote
/// server except in cases of downlevel compatibility.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/nf-lmuse-netusedel NET_API_STATUS NET_API_FUNCTION NetUseDel( LMSTR
// UncServerName, LMSTR UseName, DWORD ForceLevelFlags );
[DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Auto)]
[PInvokeData("lmuse.h", MSDNShortId = "200b0640-71e9-4f60-bf4c-c8df10bfe095")]
public static extern Win32Error NetUseDel([Optional] string UncServerName, string UseName, NetUseForce ForceLevelFlags);
///
/// The NetUseEnum function lists all current connections between the local computer and resources on remote servers.
/// You can also use the WNetOpenEnum and the WNetEnumResource functions to enumerate network resources or connections.
///
///
///
/// The UNC name of the computer on which to execute this function. If this is parameter is NULL, then the local computer is
/// used. If the UncServerName parameter specified is a remote computer, then the remote computer must support remote RPC calls using
/// the legacy Remote Access Protocol mechanism.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
///
/// The information level of the data requested. This parameter can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// 0
///
/// Specifies a local device name and the share name of a remote resource. The BufPtr parameter points to an array of USE_INFO_0 structures.
///
///
/// -
/// 1
///
/// Specifies information about the connection between a local device and a shared resource, including connection status and type.
/// The BufPtr parameter points to an array of USE_INFO_1 structures.
///
///
/// -
/// 2
///
/// Specifies information about the connection between a local device and a shared resource. Information includes the connection
/// status, connection type, user name, and domain name. The BufPtr parameter points to an array of USE_INFO_2 structures.
///
///
///
///
///
/// A pointer to the buffer that receives the information structures. The format of this data depends on the value of the Level
/// parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function when the information is
/// no longer needed. Note that you must free the buffer even if the function fails with ERROR_MORE_DATA.
///
///
/// The preferred maximum length, in bytes, of the data to return. If MAX_PREFERRED_LENGTH is specified, the function
/// allocates the amount of memory required for the data. If another value is specified in this parameter, it can restrict the number
/// of bytes that the function returns. If the buffer size is insufficient to hold all entries, the function returns
/// ERROR_MORE_DATA. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.
///
/// A pointer to a value that receives the count of elements actually enumerated.
///
/// A pointer to a value that receives the total number of entries that could have been enumerated from the current resume position.
/// Note that applications should consider this value only as a hint.
///
///
/// A pointer to a value that contains a resume handle which is used to continue the search. The handle should be zero on the first
/// call and left unchanged for subsequent calls. If ResumeHandle is NULL, then no resume handle is stored.
///
///
/// If the function succeeds, the return value is NERR_Success.
/// If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.
///
///
/// Return code
/// Description
///
/// -
/// ERROR_INVALID_PARAMETER
///
/// An invalid parameter was passed to the function. This error is returned if a NULL pointer is passed in the BufPtr or entriesread parameters.
///
///
/// -
/// ERROR_MORE_DATA
/// There is more data to return. This error is returned if the buffer size is insufficient to hold all entries.
///
/// -
/// ERROR_NOT_SUPPORTED
///
/// The request is not supported. This error is returned if the UncServerName parameter was not NULL and the remote server does not
/// support remote RPC calls using the legacy Remote Access Protocol mechanism.
///
///
/// -
/// Other
/// Use FormatMessage to obtain the message string for the returned error.
///
///
///
///
///
/// No special group membership is required to call the NetUseEnum function. This function cannot be executed on a remote
/// server except in cases of downlevel compatibility using the legacy Remote Access Protocol.
///
/// To retrieve information about one network connection, you can call the NetUseGetInfo function.
///
/// This function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseEnum function does not
/// support Distributed File System (DFS) shares. To enumerate shares using a different network provider (WebDAV or a DFS share, for
/// example), use the WNetOpenEnum, WNetEnumResource, and WNetCloseEnum functions.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/nf-lmuse-netuseenum NET_API_STATUS NET_API_FUNCTION NetUseEnum( LMSTR
// UncServerName, DWORD LevelFlags, LPBYTE *BufPtr, DWORD PreferedMaximumSize, LPDWORD EntriesRead, LPDWORD TotalEntries, LPDWORD
// ResumeHandle );
[DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Auto)]
[PInvokeData("lmuse.h", MSDNShortId = "fb527f85-baea-48e8-b837-967870834ec5")]
public static extern Win32Error NetUseEnum([Optional] string UncServerName, uint LevelFlags, out SafeNetApiBuffer BufPtr, uint PreferedMaximumSize, out uint EntriesRead, out uint TotalEntries, ref uint ResumeHandle);
///
/// The NetUseGetInfo function retrieves information about a connection to a shared resource.
/// You can also use the WNetGetConnection function to retrieve the name of a network resource associated with a local device.
///
///
///
/// The UNC name of computer on which to execute this function. If this is parameter is NULL, then the local computer is used.
/// If the UncServerName parameter specified is a remote computer, then the remote computer must support remote RPC calls using the
/// legacy Remote Access Protocol mechanism.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
///
/// A pointer to a string that specifies the name of the connection for which to return information.
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
///
/// The information level of the data requested. This parameter can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// 0
///
/// Specifies a local device name and the share name of a remote resource. The BufPtr parameter is a pointer to a USE_INFO_0 structure.
///
///
/// -
/// 1
///
/// Specifies information about the connection between a local device and a shared resource, including connection status and type.
/// The BufPtr parameter is a pointer to a USE_INFO_1 structure.
///
///
/// -
/// 2
///
/// Specifies information about the connection between a local device and a shared resource. Information includes the connection
/// status, connection type, user name, and domain name. The BufPtr parameter is a pointer to a USE_INFO_2 structure.
///
///
///
///
///
/// A pointer to the buffer that receives the data. The format of this data depends on the value of the Level parameter. This buffer
/// is allocated by the system and must be freed using the NetApiBufferFree function. For more information, see Network Management
/// Function Buffers and Network Management Function Buffer Lengths.
///
///
/// If the function succeeds, the return value is NERR_Success.
/// If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.
///
///
///
/// No special group membership is required to call the NetUseGetInfo function. This function cannot be executed on a remote
/// server except in cases of downlevel compatibility.
///
///
/// To list all current connections between the local computer and resources on remote servers, you can call the NetUseEnum function.
///
///
/// This function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseGetInfo function does
/// not support Distributed File System (DFS) shares. To retrieve information for a share using a different network provider (WebDAV
/// or a DFS share, for example), use the WNetGetConnection function.
///
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/nf-lmuse-netusegetinfo NET_API_STATUS NET_API_FUNCTION NetUseGetInfo(
// LMSTR UncServerName, LMSTR UseName, DWORD LevelFlags, LPBYTE *bufptr );
[DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Auto)]
[PInvokeData("lmuse.h", MSDNShortId = "257875db-5ed9-4569-8dbb-5dcc7a6af95c")]
public static extern Win32Error NetUseGetInfo([Optional] string UncServerName, string UseName, uint LevelFlags, out SafeNetApiBuffer bufptr);
/// The USE_INFO_0 structure contains the name of a shared resource and the local device redirected to it.
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/ns-lmuse-_use_info_0 typedef struct _USE_INFO_0 { LMSTR ui0_local;
// LMSTR ui0_remote; } USE_INFO_0, *PUSE_INFO_0, *LPUSE_INFO_0;
[PInvokeData("lmuse.h", MSDNShortId = "86db3f19-84c5-4e89-82cb-f01d17dcf4ec")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct USE_INFO_0
{
///
/// Pointer to a Unicode string that specifies the local device name (for example, drive E or LPT1) being redirected to the
/// shared resource. The constant DEVLEN specifies the maximum number of characters in the string.
///
public string ui0_local;
///
/// Pointer to a Unicode string that specifies the share name of the remote resource being accessed. The string is in the form:
///
public string ui0_remote;
}
///
/// The USE_INFO_1 structure contains information about the connection between a local device and a shared resource. The
/// information includes connection status and connection type.
///
///
/// Specifying a ui1_local member that is NULL requests authentication with the server without redirecting a drive
/// letter or a device. Future redirections involving the server while the same connection is in effect use the password specified by
/// the ui1_password member in the initial call to the NetUseAdd function.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/ns-lmuse-use_info_1 typedef struct _USE_INFO_1 { LMSTR ui1_local; LMSTR
// ui1_remote; LMSTR ui1_password; DWORD ui1_status; DWORD ui1_asg_type; DWORD ui1_refcount; DWORD ui1_usecount; } USE_INFO_1,
// *PUSE_INFO_1, *LPUSE_INFO_1;
[PInvokeData("lmuse.h", MSDNShortId = "b9f680b8-b56a-42be-9af1-d7b18328ded4")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct USE_INFO_1
{
///
/// Type: LMSTR
///
/// A pointer to a string that contains the local device name (for example, drive E or LPT1) being redirected to the shared
/// resource. The constant DEVLEN specifies the maximum number of characters in the string. This member can be NULL. For
/// more information, see the following Remarks section.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui1_local;
///
/// Type: LMSTR
/// A pointer to a string that contains the share name of the remote resource being accessed. The string is in the form:
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui1_remote;
///
/// Type: LMSTR
///
/// A pointer to a string that contains the password needed to establish a session between a specific workstation and a server.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui1_password;
///
/// Type: DWORD
/// The status of the connection. This element is not used by the NetUseAdd function. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// USE_OK
/// The connection is valid.
///
/// -
/// USE_PAUSED
/// Paused by local workstation.
///
/// -
/// USE_SESSLOST
/// Disconnected.
///
/// -
/// USE_DISCONN
/// An error occurred.
///
/// -
/// USE_NETERR
/// A network error occurred.
///
/// -
/// USE_CONN
/// The connection is being made.
///
/// -
/// USE_RECONN
/// Reconnecting.
///
///
///
public NetUseStatus ui1_status;
///
/// Type: DWORD
/// The type of remote resource being accessed. This member can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// USE_WILDCARD
///
/// Matches the type of the server's shared resources. Wildcards can be used only with the NetUseAdd function, and only when the
/// ui1_local member is NULL. For more information, see the following Remarks section.
///
///
/// -
/// USE_DISKDEV
/// Disk device.
///
/// -
/// USE_SPOOLDEV
/// Spooled printer.
///
/// -
/// USE_IPC
/// Interprocess communication (IPC).
///
///
///
public NetUseType ui1_asg_type;
///
/// Type: DWORD
///
/// The number of files, directories, and other processes that are open on the remote resource. This element is not used by the
/// NetUseAdd function.
///
///
public uint ui1_refcount;
///
/// Type: DWORD
///
/// The number of explicit connections (redirection with a local device name) or implicit UNC connections (redirection without a
/// local device name) that are established with the resource.
///
///
public uint ui1_usecount;
}
///
/// The USE_INFO_2 structure contains information about a connection between a local computer and a shared resource, including
/// connection type, connection status, user name, and domain name.
///
///
/// Specifying a ui2_local member that is NULL requests authentication with the server without redirecting a drive
/// letter or a device. Future redirections involving the server while the same connection is in effect use the authentication
/// information specified in the initial call to the NetUseAdd function. This information includes the combination of the
/// ui2_password, ui2_username, and ui2_domainname members.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/ns-lmuse-_use_info_2 typedef struct _USE_INFO_2 { LMSTR ui2_local;
// LMSTR ui2_remote; LMSTR ui2_password; DWORD ui2_status; DWORD ui2_asg_type; DWORD ui2_refcount; DWORD ui2_usecount; LMSTR
// ui2_username; LMSTR ui2_domainname; } USE_INFO_2, *PUSE_INFO_2, *LPUSE_INFO_2;
[PInvokeData("lmuse.h", MSDNShortId = "4cc36108-085a-47c4-9dfa-b46f7e208c8b")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct USE_INFO_2
{
///
/// Type: LMSTR
///
/// A pointer to a string that contains the local device name (for example, drive E or LPT1) being redirected to the shared
/// resource. The constant DEVLEN specifies the maximum number of characters in the string. This member can be NULL. For
/// more information, see the following Remarks section.
///
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui2_local;
///
/// Type: LMSTR
/// A pointer to a string that contains the share name of the remote resource. The string is in the form
///
public string ui2_remote;
///
/// Type: LMSTR
/// A pointer to a string that contains the password needed to establish a session with a specific workstation.
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui2_password;
///
/// Type: DWORD
/// The status of the connection. This element is not used by the NetUseAdd function. The following values are defined.
///
///
/// Value
/// Meaning
///
/// -
/// USE_OK
/// The connection is successful.
///
/// -
/// USE_PAUSED
/// Paused by a local workstation.
///
/// -
/// USE_SESSLOST
/// Disconnected.
///
/// -
/// USE_DISCONN
/// An error occurred.
///
/// -
/// USE_NETERR
/// A network error occurred.
///
/// -
/// USE_CONN
/// The connection is being made.
///
/// -
/// USE_RECONN
/// Reconnecting.
///
///
///
public NetUseStatus ui2_status;
///
/// Type: DWORD
/// The type of remote resource being accessed. This member can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// USE_WILDCARD
///
/// Matches the type of the server's shared resources. Wildcards can be used only with the NetUseAdd function, and only when the
/// ui2_local member is a NULL string. For more information, see the following Remarks section.
///
///
/// -
/// USE_DISKDEV
/// Disk device.
///
/// -
/// USE_SPOOLDEV
/// Spooled printer.
///
/// -
/// USE_IPC
/// Interprocess communication (IPC).
///
///
///
public NetUseType ui2_asg_type;
///
/// Type: DWORD
///
/// The number of files, directories, and other processes that are open on the remote resource. This element is not used by the
/// NetUseAdd function.
///
///
public uint ui2_refcount;
///
/// Type: DWORD
///
/// The number of explicit connections (redirection with a local device name) or implicit UNC connections (redirection without a
/// local device name) that are established with the resource.
///
///
public uint ui2_usecount;
///
/// Type: LPWSTR
/// A pointer to a string that contains the name of the user who initiated the connection.
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui2_username;
///
/// Type: LMSTR
/// A pointer to a string that contains the domain name of the remote resource.
/// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.
///
public string ui2_domainname;
}
///
/// The USE_INFO_3 structure contains information about a connection between a local computer and a shared resource, including
/// connection type, connection status, user name, domain name, and specific flags that describe connection behavior.
///
// https://docs.microsoft.com/en-us/windows/desktop/api/lmuse/ns-lmuse-_use_info_3 typedef struct _USE_INFO_3 { USE_INFO_2 ui3_ui2;
// ULONG ui3_flags; } USE_INFO_3, *PUSE_INFO_3, *LPUSE_INFO_3;
[PInvokeData("lmuse.h", MSDNShortId = "3fb3ad35-f9e5-46ba-b930-fc2ccafd8ee9")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct USE_INFO_3
{
/// USE_INFO_2 structure that contains
public USE_INFO_2 ui3_ui2;
/// A set of bit flags that describe connection behavior and credential handling.
public NetUseFlags ui3_flags;
}
/// Undocumented.
[PInvokeData("lmuse.h")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct USE_INFO_4
{
/// Undocumented.
public USE_INFO_3 ui4_ui3;
/// Undocumented.
public uint ui4_auth_identity_length;
/// Undocumented.
public IntPtr ui4_auth_identity;
}
/// Undocumented.
[PInvokeData("lmuse.h")]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct USE_INFO_5
{
/// Undocumented.
public USE_INFO_3 ui4_ui3;
/// Undocumented.
public uint ui4_auth_identity_length;
/// Undocumented.
public IntPtr ui4_auth_identity;
/// Undocumented.
public uint ui5_security_descriptor_length;
/// Undocumented.
public IntPtr ui5_security_descriptor;
/// Undocumented.
public uint ui5_use_options_length;
/// Undocumented.
public IntPtr ui5_use_options;
}
}
}