using System; using System.Runtime.InteropServices; namespace Vanara.PInvoke { public static partial class NetApi32 { /// The information level to use to retrieve platform-specific information. [PInvokeData("lmwksta.h", MSDNShortId = "c705dadd-cf55-44d9-bf36-09e078112479")] public enum PLATFORM_ID { /// The MS-DOS platform. PLATFORM_ID_DOS = 300, /// The OS/2 platform. PLATFORM_ID_OS2 = 400, /// The Windows NT platform. PLATFORM_ID_NT = 500, /// The OSF platform. PLATFORM_ID_OSF = 600, /// The VMS platform. PLATFORM_ID_VMS = 700, } /// The NetWkstaGetInfo function returns information about the configuration of a workstation. /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 100 /// /// Return information about the workstation environment, including platform-specific information, the name of the domain and the /// local computer, and information concerning the operating system. The bufptr parameter points to a WKSTA_INFO_100 structure. /// /// /// /// 101 /// /// In addition to level 100 information, return the path to the LANMAN directory. The bufptr parameter points to a WKSTA_INFO_101 structure. /// /// /// /// 102 /// /// In addition to level 101 information, return the number of users who are logged on to the local computer. The bufptr parameter /// points to a WKSTA_INFO_102 structure. /// /// /// /// /// /// 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 can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_LEVEL /// The level parameter is invalid. /// /// /// /// /// /// Windows Server 2003 and Windows XP: If you call this function on a domain controller that is running Active Directory, /// access is allowed or denied based on the ACL for the securable object. To enable anonymous access, the user Anonymous must be a /// member of the "Pre-Windows 2000 compatible access" group. This is because anonymous tokens do not include the Everyone group SID /// by default. If you call this function on a member server or workstation, all authenticated users can view the information. /// Anonymous access is also permitted if the EveryoneIncludesAnonymous policy setting allows anonymous access. Anonymous access is /// always permitted for level 100. If you call this function at level 101, authenticated users can view the information. Members of /// the Administrators, and the Server, System and Print Operator local groups can view information at levels 102 and 502. For more /// information about restricting anonymous access, see Security Requirements for the Network Management Functions. For more /// information on ACLs, ACEs, and access tokens, see Access Control Model. /// /// /// Windows 2000: If you call this function on a domain controller that is running Active Directory, access is allowed or /// denied based on the access control list (ACL) for the securable object. The default ACL permits all authenticated users and /// members of the " Pre-Windows 2000 compatible access" group to view the information. By default, the "Pre-Windows 2000 compatible /// access" group includes Everyone as a member. This enables anonymous access to the information if the system allows anonymous /// access. If you call this function on a member server or workstation, all authenticated users can view the information. Anonymous /// access is also permitted if the RestrictAnonymous policy setting allows anonymous access. /// /// /// To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information,see /// Using the Windows Headers. /// /// Examples /// /// The following code sample demonstrates how to retrieve information about the configuration elements for a workstation using a /// call to the NetWkstaGetInfo function. The sample calls NetWkstaGetInfo, specifying information level 102 ( /// WKSTA_INFO_102). If the call succeeds, the sample prints information about the workstation. Finally, the code sample frees the /// memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstagetinfo NET_API_STATUS NET_API_FUNCTION // NetWkstaGetInfo( LMSTR servername, DWORD level, OUT LPBYTE *bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "08777069-1afd-4482-8090-c65ef0bec1ea")] public static extern Win32Error NetWkstaGetInfo([Optional] string servername, uint level, out SafeNetApiBuffer bufptr); /// /// The NetWkstaSetInfo function configures a workstation with information that remains in effect after the system has been reinitialized. /// /// /// A pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// The information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 100 /// /// Windows NT: Specifies information about a workstation environment, including platform-specific information, the names of the /// domain and the local computer, and information concerning the operating system. The buffer parameter points to a WKSTA_INFO_100 /// structure. The wk100_computername and wk100_langroup fields of this structure cannot be set by calling this function. To set /// these values, call SetComputerName/SetComputerNameEx or NetJoinDomain, respectively. /// /// /// /// 101 /// /// Windows NT: In addition to level 100 information, specifies the path to the LANMAN directory. The buffer parameter points to a /// WKSTA_INFO_101 structure. The wk101_computername and wk101_langroup fields of this structure cannot be set by calling this /// function. To set these values, call SetComputerName/SetComputerNameEx or NetJoinDomain, respectively. /// /// /// /// 102 /// /// Windows NT: In addition to level 101 information, specifies the number of users who are logged on to the local computer. The /// buffer parameter points to a WKSTA_INFO_102 structure. The wk102_computername and wk102_langroup fields of this structure cannot /// be set by calling this function. To set these values, call SetComputerName/SetComputerNameEx or NetJoinDomain, respectively. /// /// /// /// 502 /// /// Windows NT: The buffer parameter points to a WKSTA_INFO_502 structure that contains information about the workstation environment. /// /// /// /// Do not set levels 1010-1013, 1018, 1023, 1027, 1028, 1032, 1033, 1035, or 1041-1062. /// /// /// 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 workstation information structure that causes the /// ERROR_INVALID_PARAMETER error. If this parameter is NULL, the index is not returned on error. For more information, see /// the Remarks section. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_PARAMETER /// One of the function parameters is invalid. For more information, see the following Remarks section. /// /// /// /// /// Only members of the Administrators group can successfully execute the NetWkstaSetInfo function on a remote server. /// /// The NetWkstaSetInfo function calls the workstation service on the local system or a remote system. Only a limited number /// of members of the WKSTA_INFO_502 structure can actually be changed using the NetWkstaSetInfo function. No errors are /// returned if a member is set that is ignored by the workstation service. The workstation service is primarily configured using /// settings in the registry. /// /// /// The NetWkstaUserSetInfo function can be used instead of the NetWkstaSetInfo function to set configuration information on /// the local system. The NetWkstaUserSetInfo function calls the Local Security Authority (LSA). /// /// /// If the NetWkstaSetInfo function returns ERROR_INVALID_PARAMETER, you can use the parm_err parameter to indicate the first /// member of the workstation information structure that is invalid. (A workstation information structure begins with WKSTA_INFO_ and /// its format is specified by the level parameter.) The following table lists the values that can be returned in the parm_err /// parameter and the corresponding structure member that is in error. (The prefix wki*_ indicates that the member can begin with /// multiple prefixes, for example, wki100_ or wki402_.) /// /// /// /// Value /// Member /// /// /// WKSTA_PLATFORM_ID_PARMNUM /// wki*_platform_id /// /// /// WKSTA_COMPUTERNAME_PARMNUM /// wki*_computername /// /// /// WKSTA_LANGROUP_PARMNUM /// wki*_langroup /// /// /// WKSTA_VER_MAJOR_PARMNUM /// wki*_ver_major /// /// /// WKSTA_VER_MINOR_PARMNUM /// wki*_ver_minor /// /// /// WKSTA_LOGGED_ON_USERS_PARMNUM /// wki*_logged_on_users /// /// /// WKSTA_LANROOT_PARMNUM /// wki*_lanroot /// /// /// WKSTA_LOGON_DOMAIN_PARMNUM /// wki*_logon_domain /// /// /// WKSTA_LOGON_SERVER_PARMNUM /// wki*_logon_server /// /// /// WKSTA_CHARWAIT_PARMNUM /// wki*_char_wait /// /// /// WKSTA_CHARTIME_PARMNUM /// wki*_collection_time /// /// /// WKSTA_CHARCOUNT_PARMNUM /// wki*_maximum_collection_count /// /// /// WKSTA_KEEPCONN_PARMNUM /// wki*_keep_conn /// /// /// WKSTA_KEEPSEARCH_PARMNUM /// wki*_keep_search /// /// /// WKSTA_MAXCMDS_PARMNUM /// wki*_max_cmds /// /// /// WKSTA_NUMWORKBUF_PARMNUM /// wki*_num_work_buf /// /// /// WKSTA_MAXWRKCACHE_PARMNUM /// wki*_max_wrk_cache /// /// /// WKSTA_SESSTIMEOUT_PARMNUM /// wki*_sess_timeout /// /// /// WKSTA_SIZERROR_PARMNUM /// wki*_siz_error /// /// /// WKSTA_NUMALERTS_PARMNUM /// wki*_num_alerts /// /// /// WKSTA_NUMSERVICES_PARMNUM /// wki*_num_services /// /// /// WKSTA_ERRLOGSZ_PARMNUM /// wki*_errlog_sz /// /// /// WKSTA_PRINTBUFTIME_PARMNUM /// wki*_print_buf_time /// /// /// WKSTA_NUMCHARBUF_PARMNU /// wki*_num_char_buf /// /// /// WKSTA_SIZCHARBUF_PARMNUM /// wki*_siz_char_buf /// /// /// WKSTA_WRKHEURISTICS_PARMNUM /// wki*_wrk_heuristics /// /// /// WKSTA_MAILSLOTS_PARMNUM /// wki*_mailslots /// /// /// WKSTA_MAXTHREADS_PARMNUM /// wki*_max_threads /// /// /// WKSTA_SIZWORKBUF_PARMNUM /// wki*_siz_work_buf /// /// /// WKSTA_NUMDGRAMBUF_PARMNUM /// wki*_num_dgram_buf /// /// /// /// The workstation service parameter settings are stored in the registry, not in the LanMan.ini file used prveiously by LAN Manager. /// The NetWkstaSetInfo function does not change the values in the LanMan.ini file. When the workstation service is stopped /// and restarted, workstation parameters are reset to the default values specified in the registry (unless they are overwritten by /// command-line parameters). Values set by previous calls to NetWkstaSetInfo can be overwritten when workstation parameters /// are reset. /// /// Examples /// /// The following code sample demonstrates how to set the session time-out value associated with a workstation using a call to the /// NetServerSetInfo function. (The session time-out is the number of seconds the server waits before disconnecting an /// inactive session.) The code specifies information level 502 (WKSTA_INFO_502). /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstasetinfo NET_API_STATUS NET_API_FUNCTION // NetWkstaSetInfo( LMSTR servername, DWORD level, LPBYTE buffer, OUT LPDWORD parm_err ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "d746b6c9-5ef1-4174-a84f-44e4e50200cd")] public static extern Win32Error NetWkstaSetInfo([Optional] string servername, uint level, IntPtr buffer, out uint parm_err); /// /// /// [This function is obsolete. To change the default settings for transport protocols manually, use the Local Area Connection /// Properties dialog box in the Network and Dial-Up Connections folder.] /// /// Not supported. /// /// The NetWkstaTransportAdd function binds (or connects) the redirector to the transport. The redirector is the software on /// the client computer which generates file requests to the server computer. /// /// /// /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// This string must begin with \. /// /// /// Specifies the information level of the data. This parameter can be the following value. /// /// /// Value /// Meaning /// /// /// 0 /// Specifies workstation transport protocol information. The buf parameter points to a WKSTA_TRANSPORT_INFO_0 structure. /// /// /// /// /// 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. /// /// /// Pointer to a value that receives the index of the first parameter that causes the ERROR_INVALID_PARAMETER error. If this /// parameter is NULL, the index is not returned on error. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_LEVEL /// The level parameter, which indicates what level of data structure information is available, is invalid. /// /// /// ERROR_INVALID_PARAMETER /// One of the function parameters is invalid. /// /// /// /// /// Only members of the Administrators local group can successfully execute the NetWkstaTransportAdd function. /// /// If the NetWkstaTransportAdd function returns ERROR_INVALID_PARAMETER, you can use the parm_err parameter to indicate the /// member of the WKSTA_TRANSPORT_INFO_0 structure that is invalid. The following table lists the values that can be returned /// in the parm_err parameter and the corresponding structure member that is in error. /// /// /// /// Value /// Member /// /// /// TRANSPORT_QUALITYOFSERVICE_PARMNUM /// wkti0_quality_of_service /// /// /// TRANSPORT_NAME_PARMNUM /// wkti0_transport_name /// /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstatransportadd NET_API_STATUS NET_API_FUNCTION // NetWkstaTransportAdd( LPTSTR servername, DWORD level, LPBYTE buf, LPDWORD parm_err ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "016060ea-eae1-421f-b708-5c2ddd2000c1")] public static extern Win32Error NetWkstaTransportAdd([Optional] string servername, uint level, IntPtr buf, out uint parm_err); /// /// /// [This function is obsolete. To change the default settings for transport protocols manually, use the Local Area Connection /// Properties dialog box in the Network and Dial-Up Connections folder.] /// /// Not supported. /// /// The NetWkstaTransportDel function unbinds the transport protocol from the redirector. (The redirector is the software on /// the client computer that generates file requests to the server computer.) /// /// /// /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// This string must begin with \. /// /// Pointer to a string that specifies the name of the transport protocol to disconnect from the redirector. /// /// /// Specifies the level of force to use when disconnecting the transport protocol from the redirector. This parameter can be one of /// the following values. /// /// /// /// Value /// Meaning /// /// /// USE_NOFORCE /// Fail the disconnection if open files exist on the connection. /// /// /// USE_FORCE /// 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 can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_INVALID_PARAMETER /// One of the function parameters is invalid. /// /// /// NERR_UseNotFound /// The network connection does not exist. /// /// /// /// Only members of the Administrators local group can successfully execute the NetWkstaTransportDel function. // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstatransportdel NET_API_STATUS NET_API_FUNCTION // NetWkstaTransportDel( IN LMSTR servername, IN LMSTR transportname, IN DWORD ucond ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "6d0ec459-8d7b-41fe-96dd-203e6a42164f")] public static extern Win32Error NetWkstaTransportDel([Optional] string servername, string transportname, uint ucond); /// /// The NetWkstaTransportEnum function supplies information about transport protocols that are managed by the redirector, /// which is the software on the client computer that generates file requests to the server computer. /// /// /// A pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// The level of information requested for the data. This parameter can be the following value. /// /// /// Value /// Meaning /// /// /// 0 /// Return workstation transport protocol information. The bufptr parameter points to an array of WKSTA_TRANSPORT_INFO_0 structures. /// /// /// /// /// 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. Note that you must free the buffer even if the /// function fails with ERROR_MORE_DATA or NERR_BufTooSmall. /// /// /// The preferred maximum length of returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates the /// amount of memory required for the data. If you specify another value 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 or /// NERR_BufTooSmall. 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. /// /// The resume handle. /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_MORE_DATA /// More entries are available. Specify a large enough buffer to receive all entries. /// /// /// ERROR_INVALID_LEVEL /// /// The level parameter, which indicates what level of data structure information is available, is invalid. This error is returned if /// the level parameter is specified as a value other than zero. /// /// /// /// ERROR_INVALID_PARAMETER /// One or more parameters was invalid. This error is returned if the bufptr or the entriesread parameters are NULL pointers. /// /// /// ERROR_NOT_ENOUGH_MEMORY /// Insufficient memory was available to process the request. /// /// /// ERROR_NOT_SUPPORTED /// /// The request is not supported. This error is returned if a remote server was specified in servername parameter, and this request /// is not supported on the remote server. /// /// /// /// NERR_BufTooSmall /// /// More entries are available. Specify a large enough buffer to receive all entries. This error code is defined in the Lmerr.h /// header file. /// /// /// /// /// No special group membership is required to successfully execute the NetWkstaTransportEnum function. // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstatransportenum NET_API_STATUS NET_API_FUNCTION // NetWkstaTransportEnum( LPTSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD // totalentries, LPDWORD resume_handle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "08bd22a9-00a7-4563-9353-c070ca9b2500")] public static extern Win32Error NetWkstaTransportEnum([Optional] string servername, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resume_handle); /// /// The NetWkstaUserEnum function lists information about all users currently logged on to the workstation. This list includes /// interactive, service and batch logons. /// /// /// Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this /// parameter is NULL, the local computer is used. /// /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// /// Return the names of users currently logged on to the workstation. The bufptr parameter points to an array of WKSTA_USER_INFO_0 structures. /// /// /// /// 1 /// /// Return the names of the current users and the domains accessed by the workstation. The bufptr parameter points to an array of /// WKSTA_USER_INFO_1 structures. /// /// /// /// /// /// 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. Note that you must free the buffer even if the /// function fails with ERROR_MORE_DATA. /// /// /// Specifies the preferred maximum length of returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates /// the amount of memory required for the data. If you specify another value 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. /// /// Pointer to a value that receives the count of elements actually enumerated. /// /// 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. /// /// /// Pointer to a value that contains a resume handle which is used to continue an existing search. The handle should be zero on the /// first call and left unchanged for subsequent calls. If this parameter is NULL, no resume handle is stored. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_ACCESS_DENIED /// The user does not have access to the requested information. /// /// /// ERROR_MORE_DATA /// More entries are available. Specify a large enough buffer to receive all entries. /// /// /// ERROR_INVALID_LEVEL /// The level parameter is invalid. /// /// /// /// /// /// Note that since the NetWkstaUserEnum function lists entries for service and batch logons, as well as for interactive /// logons, the function can return entries for users who have logged off a workstation. This can occur, for example, when a user /// calls a service that impersonates the user. In this instance, NetWkstaUserEnum returns an entry for the user until the /// service stops impersonating the user. /// /// /// Windows Server 2003 and Windows XP: If you call this function on a domain controller that is running Active Directory, /// access is allowed or denied based on the ACL for the securable object. To enable anonymous access, the user Anonymous must be a /// member of the "Pre-Windows 2000 compatible access" group. This is because anonymous tokens do not include the Everyone group SID /// by default. If you call this function on a member server or workstation, all authenticated users can view the information. /// Anonymous access is also permitted if the RestrictAnonymous policy setting permits anonymous access. If the RestrictAnonymous /// policy setting does not permit anonymous access, only an administrator can successfully execute the function. Members of the /// Administrators, and the Server, System and Print Operator local groups can also view information. For more information about /// restricting anonymous access, see Security Requirements for the Network Management Functions. For more information on ACLs, ACEs, /// and access tokens, see Access Control Model. /// /// /// Windows 2000: If you call this function on a domain controller that is running Active Directory, access is allowed or /// denied based on the access control list (ACL) for the securable object. The default ACL permits all authenticated users and /// members of the " Pre-Windows 2000 compatible access" group to view the information. By default, the "Pre-Windows 2000 compatible /// access" group includes Everyone as a member. This enables anonymous access to the information if the system allows anonymous /// access. If you call this function on a member server or workstation, all authenticated users can view the information. Anonymous /// access is also permitted if the RestrictAnonymous policy setting allows anonymous access. /// /// /// To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information,see /// Using the Windows Headers. /// /// Examples /// /// The following code sample demonstrates how to list information about all users currently logged on to a workstation using a call /// to the NetWkstaUserEnum function. The sample calls NetWkstaUserEnum, specifying information level 0 ( /// WKSTA_USER_INFO_0). The sample loops through the entries and prints the names of the users logged on to a workstation. Finally, /// the code sample frees the memory allocated for the information buffer, and prints the total number of users enumerated. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstauserenum NET_API_STATUS NET_API_FUNCTION // NetWkstaUserEnum( LMSTR servername, IN DWORD level, LPBYTE *bufptr, IN DWORD prefmaxlen, LPDWORD entriesread, LPDWORD // totalentries, LPDWORD resumehandle ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "42eaeb70-3ce8-4eae-b20b-4729db90a7ef")] public static extern Win32Error NetWkstaUserEnum([Optional] string servername, uint level, out SafeNetApiBuffer bufptr, uint prefmaxlen, out uint entriesread, out uint totalentries, ref uint resumehandle); /// /// The NetWkstaUserGetInfo function returns information about the currently logged-on user. This function must be called in /// the context of the logged-on user. /// /// This parameter must be set to NULL. /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 0 /// /// Return the name of the user currently logged on to the workstation. The bufptr parameter points to a WKSTA_USER_INFO_0 structure. /// /// /// /// 1 /// /// Return information about the workstation, including the name of the current user and the domains accessed by the workstation. The /// bufptr parameter points to a WKSTA_USER_INFO_1 structure. /// /// /// /// 1101 /// Return domains browsed by the workstation. The bufptr parameter points to a WKSTA_USER_INFO_1101 structure. /// /// /// /// /// Pointer to the buffer that receives the data. The format of this data depends on the value of the bufptr 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 can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_NOT_ENOUGH_MEMORY /// /// The system ran out of memory resources. Either the network manager configuration is incorrect, or the program is running on a /// system with insufficient memory. /// /// /// /// ERROR_INVALID_LEVEL /// The level parameter is invalid. /// /// /// ERROR_INVALID_PARAMETER /// One of the function parameters is invalid. /// /// /// /// /// The NetWkstaUserGetInfo function only works locally. /// Examples /// /// The following code sample demonstrates how to retrieve information about the currently logged-on user using a call to the /// NetWkstaUserGetInfo function. The sample calls NetWkstaUserGetInfo, specifying information level 1 ( /// WKSTA_USER_INFO_1). If the call succeeds, the sample prints information about the logged-on user. Finally, the sample frees the /// memory allocated for the information buffer. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstausergetinfo NET_API_STATUS NET_API_FUNCTION // NetWkstaUserGetInfo( LMSTR reserved, DWORD level, OUT LPBYTE *bufptr ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "25ec7a49-fd26-4105-823b-a257a57f724e")] public static extern Win32Error NetWkstaUserGetInfo([Optional] string reserved, uint level, out SafeNetApiBuffer bufptr); /// /// The NetWkstaUserSetInfo function sets the user-specific information about the configuration elements for a workstation. /// /// This parameter must be set to zero. /// /// Specifies the information level of the data. This parameter can be one of the following values. /// /// /// Value /// Meaning /// /// /// 1 /// /// Specifies information about the workstation, including the name of the current user and the domains accessed by the workstation. /// The buf parameter points to a WKSTA_USER_INFO_1 structure. /// /// /// /// 1101 /// Specifies domains browsed by the workstation. The buf parameter points to a WKSTA_USER_INFO_1101 structure. /// /// /// /// /// 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. /// /// /// Pointer to a value that receives the index of the first parameter that causes the ERROR_INVALID_PARAMETER error. If this /// parameter is NULL, the index is not returned on error. /// /// /// If the function succeeds, the return value is NERR_Success. /// If the function fails, the return value can be one of the following error codes. /// /// /// Return code /// Description /// /// /// ERROR_INVALID_LEVEL /// The level parameter is invalid. /// /// /// ERROR_INVALID_PARAMETER /// One of the function parameters is invalid. /// /// /// /// /// The NetWkstaUserSetInfo function only works locally. Administrator group membership is required. /// /// Domain names in the wkui1101_oth_domains member of the WKSTA_USER_INFO_1101 structure are separated by spaces. An empty /// list is valid. A NULL pointer means to leave the member unmodified. The wkui1101_oth_domains member cannot be set /// with MS-DOS. When setting this element, NetWkstaUserSetInfo rejects the request if the name list was invalid or if a name /// could not be added to one or more of the network adapters managed by the system. /// /// /// If the NetWkstaUserSetInfo function returns ERROR_INVALID_PARAMETER, you can use the parm_err parameter to indicate the /// member of the workstation user information structure that is invalid. (A workstation user information structure begins with /// WKSTA_USER_INFO_ and its format is specified by the level parameter.) The following table lists the value that can be returned in /// the parm_err parameter and the corresponding structure member that is in error. (The prefix wkui*_ indicates that the member can /// begin with multiple prefixes, for example, wkui0_ or wkui1_.) /// /// /// /// Value /// Member /// /// /// WKSTA_OTH_DOMAINS_PARMNUM /// wkui*_oth_domains /// /// /// Examples /// /// The following code sample demonstrates how to set user-specific information for a workstation using a call to the /// NetWkstaUserSetInfo function, specifying information level 1101 ( WKSTA_USER_INFO_1101). /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/nf-lmwksta-netwkstausersetinfo NET_API_STATUS NET_API_FUNCTION // NetWkstaUserSetInfo( LMSTR reserved, DWORD level, LPBYTE buf, LPDWORD parm_err ); [DllImport(Lib.NetApi32, SetLastError = false, ExactSpelling = true)] [PInvokeData("lmwksta.h", MSDNShortId = "d48667a3-5ae9-4a7d-9af6-14f08835940d")] public static extern Win32Error NetWkstaUserSetInfo([Optional] string reserved, uint level, IntPtr buf, out uint parm_err); /// /// The WKSTA_INFO_100 structure contains information about a workstation environment, including platform-specific /// information, the names of the domain and the local computer, and information concerning the operating system. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_info_100 typedef struct _WKSTA_INFO_100 { DWORD // wki100_platform_id; LMSTR wki100_computername; LMSTR wki100_langroup; DWORD wki100_ver_major; DWORD wki100_ver_minor; } // WKSTA_INFO_100, *PWKSTA_INFO_100, *LPWKSTA_INFO_100; [PInvokeData("lmwksta.h", MSDNShortId = "c705dadd-cf55-44d9-bf36-09e078112479")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_100 { /// /// Type: DWORD /// The information level to use to retrieve platform-specific information. /// Possible values for this member are listed in the Lmcons.h header file. /// /// /// Value /// Meaning /// /// /// PLATFORM_ID_DOS 300 /// The MS-DOS platform. /// /// /// PLATFORM_ID_OS2 400 /// The OS/2 platform. /// /// /// PLATFORM_ID_NT 500 /// The Windows NT platform. /// /// /// PLATFORM_ID_OSF 600 /// The OSF platform. /// /// /// PLATFORM_ID_VMS 700 /// The VMS platform. /// /// /// public PLATFORM_ID wki100_platform_id; /// /// Type: LMSTR /// A pointer to a string specifying the name of the local computer. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki100_computername; /// /// Type: LMSTR /// A pointer to a string specifying the name of the domain to which the computer belongs. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki100_langroup; /// /// Type: DWORD /// The major version number of the operating system running on the computer. /// public uint wki100_ver_major; /// /// Type: DWORD /// The minor version number of the operating system running on the computer. /// public uint wki100_ver_minor; } /// /// The WKSTA_INFO_101 structure contains information about a workstation environment, including platform-specific /// information, the name of the domain and the local computer, and information concerning the operating system. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_info_101 typedef struct _WKSTA_INFO_101 { DWORD // wki101_platform_id; LMSTR wki101_computername; LMSTR wki101_langroup; DWORD wki101_ver_major; DWORD wki101_ver_minor; LMSTR // wki101_lanroot; } WKSTA_INFO_101, *PWKSTA_INFO_101, *LPWKSTA_INFO_101; [PInvokeData("lmwksta.h", MSDNShortId = "2b692d40-6229-45ef-9ec6-ee464bba0696")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_101 { /// /// Type: DWORD /// The information level to use to retrieve platform-specific information. /// Possible values for this member are listed in the Lmcons.h header file. /// /// /// Value /// Meaning /// /// /// PLATFORM_ID_DOS 300 /// The MS-DOS platform. /// /// /// PLATFORM_ID_OS2 400 /// The OS/2 platform. /// /// /// PLATFORM_ID_NT 500 /// The Windows NT platform. /// /// /// PLATFORM_ID_OSF 600 /// The OSF platform. /// /// /// PLATFORM_ID_VMS 700 /// The VMS platform. /// /// /// public PLATFORM_ID wki101_platform_id; /// /// Type: LMSTR /// A pointer to a string specifying the name of the local computer. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki101_computername; /// /// Type: LMSTR /// A pointer to a string specifying the name of the domain to which the computer belongs. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki101_langroup; /// /// Type: DWORD /// The major version number of the operating system running on the computer. /// public uint wki101_ver_major; /// /// Type: DWORD /// The minor version number of the operating system running on the computer. /// public uint wki101_ver_minor; /// /// Type: LMSTR /// A pointer to a string that contains the path to the LANMAN directory. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki101_lanroot; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1010 { public uint wki1010_char_wait; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1011 { public uint wki1011_collection_time; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1012 { public uint wki1012_maximum_collection_count; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1013 { public uint wki1013_keep_conn; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1018 { public uint wki1018_sess_timeout; } /// /// The WKSTA_INFO_102 structure contains information about a workstation environment, including platform-specific /// information, the name of the domain and the local computer, and information concerning the operating system. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_info_102 typedef struct _WKSTA_INFO_102 { DWORD // wki102_platform_id; LMSTR wki102_computername; LMSTR wki102_langroup; DWORD wki102_ver_major; DWORD wki102_ver_minor; LMSTR // wki102_lanroot; DWORD wki102_logged_on_users; } WKSTA_INFO_102, *PWKSTA_INFO_102, *LPWKSTA_INFO_102; [PInvokeData("lmwksta.h", MSDNShortId = "01607fb5-c433-439c-aaaa-3736697f7c07")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_102 { /// /// Type: DWORD /// The information level to use to retrieve platform-specific information. /// Possible values for this member are listed in the Lmcons.h header file. /// /// /// Value /// Meaning /// /// /// PLATFORM_ID_DOS 300 /// The MS-DOS platform. /// /// /// PLATFORM_ID_OS2 400 /// The OS/2 platform. /// /// /// PLATFORM_ID_NT 500 /// The Windows NT platform. /// /// /// PLATFORM_ID_OSF 600 /// The OSF platform. /// /// /// PLATFORM_ID_VMS 700 /// The VMS platform. /// /// /// public PLATFORM_ID wki102_platform_id; /// /// Type: LMSTR /// A pointer to a string specifying the name of the local computer. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki102_computername; /// /// Type: LMSTR /// A pointer to a string specifying the name of the domain to which the computer belongs. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki102_langroup; /// /// Type: DWORD /// The major version number of the operating system running on the computer. /// public uint wki102_ver_major; /// /// Type: DWORD /// The minor version number of the operating system running on the computer. /// public uint wki102_ver_minor; /// /// Type: LMSTR /// A pointer to a string that contains the path to the LANMAN directory. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wki102_lanroot; /// /// Type: DWORD /// The number of users who are logged on to the local computer. /// public uint wki102_logged_on_users; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1023 { public uint wki1023_siz_char_buf; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1027 { public uint wki1027_errlog_sz; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1028 { public uint wki1028_print_buf_time; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1032 { public uint wki1032_wrk_heuristics; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1033 { public uint wki1033_max_threads; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1041 { public uint wki1041_lock_quota; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1042 { public uint wki1042_lock_increment; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1043 { public uint wki1043_lock_maximum; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1044 { public uint wki1044_pipe_increment; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1045 { public uint wki1045_pipe_maximum; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1046 { public uint wki1046_dormant_file_limit; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1047 { public uint wki1047_cache_file_timeout; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1048 { [MarshalAs(UnmanagedType.Bool)] public bool wki1048_use_opportunistic_locking; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1049 { [MarshalAs(UnmanagedType.Bool)] public bool wki1049_use_unlock_behind; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1050 { [MarshalAs(UnmanagedType.Bool)] public bool wki1050_use_close_behind; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1051 { [MarshalAs(UnmanagedType.Bool)] public bool wki1051_buf_named_pipes; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1052 { [MarshalAs(UnmanagedType.Bool)] public bool wki1052_use_lock_read_unlock; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1053 { [MarshalAs(UnmanagedType.Bool)] public bool wki1053_utilize_nt_caching; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1054 { [MarshalAs(UnmanagedType.Bool)] public bool wki1054_use_raw_read; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1055 { [MarshalAs(UnmanagedType.Bool)] public bool wki1055_use_raw_write; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1056 { [MarshalAs(UnmanagedType.Bool)] public bool wki1056_use_write_raw_data; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1057 { [MarshalAs(UnmanagedType.Bool)] public bool wki1057_use_encryption; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1058 { [MarshalAs(UnmanagedType.Bool)] public bool wki1058_buf_files_deny_write; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1059 { [MarshalAs(UnmanagedType.Bool)] public bool wki1059_buf_read_only_files; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1060 { [MarshalAs(UnmanagedType.Bool)] public bool wki1060_force_core_create_mode; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1061 { [MarshalAs(UnmanagedType.Bool)] public bool wki1061_use_512_byte_max_transfer; } [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_1062 { public uint wki1062_read_ahead_throughput; } /// /// Down-level NetWkstaGetInfo and NetWkstaSetInfo. DOS specific workstation information - admin or domain operator access /// [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_302 { public uint wki302_char_wait; public uint wki302_collection_time; public uint wki302_maximum_collection_count; public uint wki302_keep_conn; public uint wki302_keep_search; public uint wki302_max_cmds; public uint wki302_num_work_buf; public uint wki302_siz_work_buf; public uint wki302_max_wrk_cache; public uint wki302_sess_timeout; public uint wki302_siz_error; public uint wki302_num_alerts; public uint wki302_num_services; public uint wki302_errlog_sz; public uint wki302_print_buf_time; public uint wki302_num_char_buf; public uint wki302_siz_char_buf; public string wki302_wrk_heuristics; public uint wki302_mailslots; public uint wki302_num_dgram_buf; } /// /// Down-level NetWkstaGetInfo and NetWkstaSetInfo. OS/2 specific workstation information - admin or domain operator access /// [PInvokeData("lmwksta.h")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_402 { public uint wki402_char_wait; public uint wki402_collection_time; public uint wki402_maximum_collection_count; public uint wki402_keep_conn; public uint wki402_keep_search; public uint wki402_max_cmds; public uint wki402_num_work_buf; public uint wki402_siz_work_buf; public uint wki402_max_wrk_cache; public uint wki402_sess_timeout; public uint wki402_siz_error; public uint wki402_num_alerts; public uint wki402_num_services; public uint wki402_errlog_sz; public uint wki402_print_buf_time; public uint wki402_num_char_buf; public uint wki402_siz_char_buf; public string wki402_wrk_heuristics; public uint wki402_mailslots; public uint wki402_num_dgram_buf; public uint wki402_max_threads; } /// The WKSTA_INFO_502 structure is obsolete. The structure contains information about a workstation environment. // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_info_502 typedef struct _WKSTA_INFO_502 { DWORD // wki502_char_wait; DWORD wki502_collection_time; DWORD wki502_maximum_collection_count; DWORD wki502_keep_conn; DWORD // wki502_max_cmds; DWORD wki502_sess_timeout; DWORD wki502_siz_char_buf; DWORD wki502_max_threads; DWORD wki502_lock_quota; DWORD // wki502_lock_increment; DWORD wki502_lock_maximum; DWORD wki502_pipe_increment; DWORD wki502_pipe_maximum; DWORD // wki502_cache_file_timeout; DWORD wki502_dormant_file_limit; DWORD wki502_read_ahead_throughput; DWORD wki502_num_mailslot_buffers; // DWORD wki502_num_srv_announce_buffers; DWORD wki502_max_illegal_datagram_events; DWORD // wki502_illegal_datagram_event_reset_frequency; BOOL wki502_log_election_packets; BOOL wki502_use_opportunistic_locking; BOOL // wki502_use_unlock_behind; BOOL wki502_use_close_behind; BOOL wki502_buf_named_pipes; BOOL wki502_use_lock_read_unlock; BOOL // wki502_utilize_nt_caching; BOOL wki502_use_raw_read; BOOL wki502_use_raw_write; BOOL wki502_use_write_raw_data; BOOL // wki502_use_encryption; BOOL wki502_buf_files_deny_write; BOOL wki502_buf_read_only_files; BOOL wki502_force_core_create_mode; BOOL // wki502_use_512_byte_max_transfer; } WKSTA_INFO_502, *PWKSTA_INFO_502, *LPWKSTA_INFO_502; [PInvokeData("lmwksta.h", MSDNShortId = "716e700a-e464-47ec-a2df-74c03597ac6d")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_INFO_502 { /// /// Type: DWORD /// The number of seconds the computer waits for a remote resource to become available. /// public uint wki502_char_wait; /// /// Type: DWORD /// /// The number of milliseconds the computer collects data before sending the data to a character device resource. The workstation /// waits the specified time or collects the number of characters specified by the wki502_maximum_collection_count member, /// whichever comes first. /// /// public uint wki502_collection_time; /// /// Type: DWORD /// /// The number of bytes of information the computer collects before sending the data to a character device resource. The /// workstation collects the specified number of bytes or waits the period of time specified by the wki502_collection_time /// member, whichever comes first. /// /// public uint wki502_maximum_collection_count; /// /// Type: DWORD /// The number of seconds the server maintains an inactive connection to a server's resource. /// public uint wki502_keep_conn; /// /// Type: DWORD /// The number of simultaneous network device driver commands that can be sent to the network. /// public uint wki502_max_cmds; /// /// Type: DWORD /// The number of seconds the server waits before disconnecting an inactive session. /// public uint wki502_sess_timeout; /// /// Type: DWORD /// The maximum size, in bytes, of a character pipe buffer and device buffer. /// public uint wki502_siz_char_buf; /// /// Type: DWORD /// The number of threads the computer can dedicate to the network. /// public uint wki502_max_threads; /// /// Type: DWORD /// Reserved. /// public uint wki502_lock_quota; /// /// Type: DWORD /// Reserved. /// public uint wki502_lock_increment; /// /// Type: DWORD /// Reserved. /// public uint wki502_lock_maximum; /// /// Type: DWORD /// Reserved. /// public uint wki502_pipe_increment; /// /// Type: DWORD /// Reserved. /// public uint wki502_pipe_maximum; /// /// Type: DWORD /// Reserved. /// public uint wki502_cache_file_timeout; /// /// Type: DWORD /// Reserved. /// public uint wki502_dormant_file_limit; /// /// Type: DWORD /// Reserved. /// public uint wki502_read_ahead_throughput; /// /// Type: DWORD /// Reserved. /// public uint wki502_num_mailslot_buffers; /// /// Type: DWORD /// Reserved. /// public uint wki502_num_srv_announce_buffers; /// /// Type: DWORD /// Reserved. /// public uint wki502_max_illegal_datagram_events; /// /// Type: DWORD /// Reserved. /// public uint wki502_illegal_datagram_event_reset_frequency; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_log_election_packets; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_opportunistic_locking; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_unlock_behind; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_close_behind; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_buf_named_pipes; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_lock_read_unlock; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_utilize_nt_caching; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_raw_read; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_raw_write; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_write_raw_data; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_encryption; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_buf_files_deny_write; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_buf_read_only_files; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_force_core_create_mode; /// /// Type: BOOL /// Reserved. /// [MarshalAs(UnmanagedType.Bool)] public bool wki502_use_512_byte_max_transfer; } /// /// The WKSTA_TRANSPORT_INFO_0 structure contains information about the workstation transport protocol, such as Wide Area /// Network (WAN) or NetBIOS. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_transport_info_0 typedef struct // _WKSTA_TRANSPORT_INFO_0 { DWORD wkti0_quality_of_service; DWORD wkti0_number_of_vcs; LMSTR wkti0_transport_name; LMSTR // wkti0_transport_address; BOOL wkti0_wan_ish; } WKSTA_TRANSPORT_INFO_0, *PWKSTA_TRANSPORT_INFO_0, *LPWKSTA_TRANSPORT_INFO_0; [PInvokeData("lmwksta.h", MSDNShortId = "e7afe2a3-f729-4fd5-afc3-d3ffbd09e884")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_TRANSPORT_INFO_0 { /// /// Specifies a value that determines the search order of the transport protocol with respect to other transport protocols. The /// highest value is searched first. /// public uint wkti0_quality_of_service; /// Specifies the number of clients communicating with the server using this transport protocol. public uint wkti0_number_of_vcs; /// Specifies the device name of the transport protocol. public string wkti0_transport_name; /// /// Specifies the address of the server on this transport protocol. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkti0_transport_address; /// /// /// This member is ignored by the NetWkstaTransportAdd function. For the NetWkstaTransportEnum function, this member indicates /// whether the transport protocol is a WAN transport protocol. This member is set to TRUE for NetBIOS/TCIP; it is set to /// FALSE for NetBEUI and NetBIOS/IPX. /// /// /// Certain legacy networking protocols, including NetBEUI, will no longer be supported. For more information, see Network /// Protocol Support in Windows. /// /// [MarshalAs(UnmanagedType.Bool)] public bool wkti0_wan_ish; } /// The WKSTA_USER_INFO_0 structure contains the name of the user on a specified workstation. // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_user_info_0 typedef struct _WKSTA_USER_INFO_0 { // LMSTR wkui0_username; } WKSTA_USER_INFO_0, *PWKSTA_USER_INFO_0, *LPWKSTA_USER_INFO_0; [PInvokeData("lmwksta.h", MSDNShortId = "8bd8d8c7-4558-46cb-ab46-a2197d53e9f7")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_USER_INFO_0 { /// /// Specifies the name of the user currently logged on to the workstation. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkui0_username; } /// /// The WKSTA_USER_INFO_1 structure contains user information as it pertains to a specific workstation. The information /// includes the name of the current user and the domains accessed by the workstation. /// // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_user_info_1 typedef struct _WKSTA_USER_INFO_1 { // LMSTR wkui1_username; LMSTR wkui1_logon_domain; LMSTR wkui1_oth_domains; LMSTR wkui1_logon_server; } WKSTA_USER_INFO_1, // *PWKSTA_USER_INFO_1, *LPWKSTA_USER_INFO_1; [PInvokeData("lmwksta.h", MSDNShortId = "a30747de-6cb0-41dc-95a7-be3d471056d5")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_USER_INFO_1 { /// /// Specifies the name of the user currently logged on to the workstation. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkui1_username; /// /// Specifies the name of the domain in which the user is currently logged on. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkui1_logon_domain; /// /// Specifies the list of operating system domains browsed by the workstation. The domain names are separated by blanks. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkui1_oth_domains; /// /// Specifies the name of the server that authenticated the user. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkui1_logon_server; } /// The WKSTA_USER_INFO_1101 structure contains information about the domains accessed by a workstation. // https://docs.microsoft.com/en-us/windows/desktop/api/lmwksta/ns-lmwksta-_wksta_user_info_1101 typedef struct _WKSTA_USER_INFO_1101 // { LMSTR wkui1101_oth_domains; } WKSTA_USER_INFO_1101, *PWKSTA_USER_INFO_1101, *LPWKSTA_USER_INFO_1101; [PInvokeData("lmwksta.h", MSDNShortId = "88772ba2-046b-4b03-ae02-d851075e4363")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WKSTA_USER_INFO_1101 { /// /// Specifies the list of operating system domains browsed by the workstation. The domain names are separated by blanks. /// This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined. /// public string wkui1101_oth_domains; } } }