Package com.sun.jna.platform.win32

## Interface Mpr

All Superinterfaces:
  `AltCallingConvention`, `Library`, `StdCall`, `StdCallLibrary`

    public interface Mpr
    extends StdCallLibrary

Ported from Winnetwk.h. Microsoft Windows SDK 8.1

Author:
  amarcionek[at]gmail.com

### Nested Class Summary

### Nested classes/interfaces inherited from interface com.sun.jna.Library

`Library.Handler`

### Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary

`StdCallLibrary.StdCallCallback`

### Field Summary

Fields
`static Mpr` `INSTANCE`

### Fields inherited from interface com.sun.jna.Library

`OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER`

### Fields inherited from interface com.sun.jna.win32.StdCallLibrary

`FUNCTION_MAPPER, STDCALL_CONVENTION`

### Method Summary

All Methods Instance Methods Abstract Methods
`int` `WNetAddConnection3​(WinDef.HWND hwndOwner, Winnetwk.NETRESOURCE lpNETRESOURCE, java.lang.String lpPassword, java.lang.String lpUserID, int dwFlags)` The WNetAddConnection3 function makes a connection to a network resource.
`int` `WNetCancelConnection2​(java.lang.String lpName, int dwFlags, boolean fForce)` The WNetCancelConnection2 function cancels an existing network connection.
`int` `WNetCloseEnum​(WinNT.HANDLE hEnum)` The WNetCloseEnum function ends a network resource enumeration started by a call to the WNetOpenEnum function.
`int` `WNetEnumResource​(WinNT.HANDLE hEnum, IntByReference lpcCount, Pointer lpBuffer, IntByReference lpBufferSize)` The WNetEnumResource function continues an enumeration of network resources that was started by a call to the WNetOpenEnum function.
`int` `WNetGetUniversalName​(java.lang.String lpLocalPath, int dwInfoLevel, Pointer lpBuffer, IntByReference lpBufferSize)` The WNetGetUniversalName function takes a drive-based path for a network resource and returns an information structure that contains a more universal form of the name.
`int` `WNetOpenEnum​(int dwScope, int dwType, int dwUsage, Winnetwk.NETRESOURCE.ByReference lpNETRESOURCE, WinNT.HANDLEByReference lphEnum)` The WNetOpenEnum function starts an enumeration of network resources or existing connections.
`int` `WNetUseConnection​(WinDef.HWND hwndOwner, Winnetwk.NETRESOURCE lpNETRESOURCE, java.lang.String lpPassword, java.lang.String lpUserID, int dwFlags, Pointer lpAccessName, IntByReference lpBufferSize, IntByReference lpResult)` The WNetUseConnection function makes a connection to a network resource.

### Field Detail

#### INSTANCE

    static final Mpr INSTANCE

### Method Detail

#### WNetOpenEnum

    int WNetOpenEnum​(int dwScope,
                     int dwType,
                     int dwUsage,
                     Winnetwk.NETRESOURCE.ByReference lpNETRESOURCE,
                     WinNT.HANDLEByReference lphEnum)

The WNetOpenEnum function starts an enumeration of network resources or existing connections. You can continue the enumeration by calling the WNetEnumResource function.

Parameters:
  `dwScope` - Scope of the enumeration. This parameter can be one of the following values from NETRESOURCEScope: RESOURCE_CONNECTED, RESOURCE_CONTEXT, RESOURCE_GLOBALNET, RESOURCE_REMEMBERED
  `dwType` - Resource types to be enumerated. This parameter can be a combination of the following values from NETRESOURCEType: RESOURCETYPE_ANY, RESOURCETYPE_DISK, RESOURCETYPE_PRINT
  `dwUsage` - Resource usage type to be enumerated. This parameter can be a combination of the following values from NETRESOURCEUsage: 0, RESOURCEUSAGE_CONNECTABLE, RESOURCEUSAGE_CONTAINER, RESOURCEUSAGE_ATTACHED, RESOURCEUSAGE_ALL
  `lpNETRESOURCE` - Pointer to a NETRESOURCE structure that specifies the container to enumerate. If the dwScope parameter is not RESOURCE_GLOBALNET, this parameter must be NULL. If this parameter is NULL, the root of the network is assumed. (The system organizes a network as a hierarchy; the root is the topmost container in the network.) If this parameter is not NULL, it must point to a NETRESOURCE structure. This structure can be filled in by the application or it can be returned by a call to the WNetEnumResource function. The NETRESOURCE structure must specify a container resource; that is, the RESOURCEUSAGE_CONTAINER value must be specified in the dwUsage parameter. To enumerate all network resources, an application can begin the enumeration by calling WNetOpenEnum with the lpNETRESOURCE parameter set to NULL, and then use the returned handle to call WNetEnumResource to enumerate resources. If one of the resources in the NETRESOURCE array returned by the WNetEnumResource function is a container resource, you can call WNetOpenEnum to open the resource for further enumeration.
  `lphEnum` - Pointer to an enumeration handle that can be used in a subsequent call to WNetEnumResource.
Returns:
  `NO_ERROR` if the function succeeds, otherwise a system error code. See MSDN documentation for common error values: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385478 (v=vs.85).aspx

#### WNetEnumResource

    int WNetEnumResource​(WinNT.HANDLE hEnum,
                         IntByReference lpcCount,
                         Pointer lpBuffer,
                         IntByReference lpBufferSize)

The WNetEnumResource function continues an enumeration of network resources that was started by a call to the WNetOpenEnum function.

Parameters:
  `hEnum` - [in] Handle that identifies an enumeration instance. This handle must be returned by the WNetOpenEnum function.
  `lpcCount` - [in, out] Pointer to a variable specifying the number of entries requested. If the number requested is -1, the function returns as many entries as possible. If the function succeeds, on return the variable pointed to by this parameter contains the number of entries actually read.
  `lpBuffer` - [out] Pointer to the buffer that receives the enumeration results. The results are returned as an array of NETRESOURCE structures. Note that the buffer you allocate must be large enough to hold the structures, plus the strings to which their members point. For more information, see the Remarks section on MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/ aa385449(v=vs.85).aspx The buffer is valid until the next call using the handle specified by the hEnum parameter. The order of NETRESOURCE structures in the array is not predictable.
  `lpBufferSize` - [in, out] Pointer to a variable that specifies the size of the lpBuffer parameter, in bytes. If the buffer is too small to receive even one entry, this parameter receives the required size of the buffer.
Returns:
  If the function succeeds, the return value is one of the following values: NO_ERROR - The enumeration succeeded, and the buffer contains the requested data. The calling application can continue to call WNetEnumResource to complete the enumeration. ERROR_NO_MORE_ITEMS - There are no more entries. The buffer contents are undefined. If the function fails, see MSDN documentation for common error values: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385478 (v=vs.85).aspx

#### WNetCloseEnum

    int WNetCloseEnum​(WinNT.HANDLE hEnum)

The WNetCloseEnum function ends a network resource enumeration started by a call to the WNetOpenEnum function.

Parameters:
  `hEnum` - [in] Handle that identifies an enumeration instance. This handle must be returned by the WNetOpenEnum function.
Returns:
  `NO_ERROR` if the function succeeds, otherwise a system error code. See MSDN documentation for common error values: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385431 (v=vs.85).aspx

#### WNetGetUniversalName

    int WNetGetUniversalName​(java.lang.String lpLocalPath,
                             int dwInfoLevel,
                             Pointer lpBuffer,
                             IntByReference lpBufferSize)

The WNetGetUniversalName function takes a drive-based path for a network resource and returns an information structure that contains a more universal form of the name.

Parameters:
  `lpLocalPath` - [in] A pointer to a constant null-terminated string that is a drive-based path for a network resource. For example, if drive H has been mapped to a network drive share, and the network resource of interest is a file named Sample.doc in the directory \Win32\Examples on that share, the drive-based path is H:\Win32\Examples\Sample.doc.
  `dwInfoLevel` - [in] The type of structure that the function stores in the buffer pointed to by the lpBuffer parameter. This parameter can be one of the following values defined in the Winnetwk.java. UNIVERSAL_NAME_INFO_LEVEL - The function stores a UNIVERSAL_NAME_INFO structure in the buffer. REMOTE_NAME_INFO_LEVEL - The function stores a REMOTE_NAME_INFO structure in the buffer. The UNIVERSAL_NAME_INFO structure points to a Universal Naming Convention (UNC) name string. The REMOTE_NAME_INFO structure points to a UNC name string and two additional connection information strings. For more information, see the following Remarks section.
  `lpBuffer` - [out] A pointer to a buffer that receives the structure specified by the dwInfoLevel parameter.
  `lpBufferSize` - [in,out] A pointer to a variable that specifies the size, in bytes, of the buffer pointed to by the lpBuffer parameter. If the function succeeds, it sets the variable pointed to by lpBufferSize to the number of bytes stored in the buffer. If the function fails because the buffer is too small, this location receives the required buffer size, and the function returns ERROR_MORE_DATA.
Returns:
  If the function succeeds, the return value is NO_ERROR, otherwise see MSDN for common error codes: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385474 (v=vs.85).aspx

#### WNetUseConnection

    int WNetUseConnection​(WinDef.HWND hwndOwner,
                          Winnetwk.NETRESOURCE lpNETRESOURCE,
                          java.lang.String lpPassword,
                          java.lang.String lpUserID,
                          int dwFlags,
                          Pointer lpAccessName,
                          IntByReference lpBufferSize,
                          IntByReference lpResult)

The WNetUseConnection function makes a connection to a network resource. The function can redirect a local device to a network resource. The WNetUseConnection function is similar to the WNetAddConnection3 function. The main difference is that WNetUseConnection can automatically select an unused local device to redirect to the network resource.

Parameters:
  `hwndOwner` - [in] Handle to a window that the provider of network resources can use as an owner window for dialog boxes. Use this parameter if you set the CONNECT_INTERACTIVE value in the dwFlags parameter.
  `lpNETRESOURCE` - [in] Pointer to a NETRESOURCE structure that specifies details of the proposed connection. The structure contains information about the network resource, the local device, and the network resource provider. You must specify the following members of the NETRESOURCE structure. The WNetUseConnection function ignores the other members of the NETRESOURCE structure. For more information, see the descriptions following for the dwFlags parameter. dwType Specifies the type of resource to connect to. It is most efficient to specify a resource type in this member, such as RESOURCETYPE_DISK or RESOURCETYPE_PRINT. However, if the lpLocalName member is NULL, or if it points to an empty string and CONNECT_REDIRECT is not set, dwType can be RESOURCETYPE_ANY. This method works only if the function does not automatically choose a device to redirect to the network resource. Although this member is required, its information may be ignored by the network service provider lpLocalName Pointer to a null-terminated string that specifies the name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a case-insensitive manner. If the string is empty, or if lpLocalName is NULL, a connection to the network occurs without redirection. If the CONNECT_REDIRECT value is set in the dwFlags parameter, or if the network requires a redirected local device, the function chooses a local device to redirect and returns the name of the device in the lpAccessName parameter. lpRemoveName Pointer to a null-terminated string that specifies the network resource to connect to. The string can be up to MAX_PATH characters in length, and it must follow the network provider's naming conventions. lpProvider Pointer to a null-terminated string that specifies the network provider to connect to. If lpProvider is NULL, or if it points to an empty string, the operating system attempts to determine the correct provider by parsing the string pointed to by the lpRemoteName member. If this member is not NULL, the operating system attempts to make a connection only to the named network provider. You should set this member only if you know the network provider you want to use. Otherwise, let the operating system determine which provider the network name maps to.
  `lpPassword` - [in] Pointer to a constant null-terminated string that specifies a password to be used in making the network connection. If lpPassword is NULL, the function uses the current default password associated with the user specified by lpUserID. If lpPassword points to an empty string, the function does not use a password. If the connection fails because of an invalid password and the CONNECT_INTERACTIVE value is set in the dwFlags parameter, the function displays a dialog box asking the user to type the password.
  `lpUserID` - [in] Pointer to a constant null-terminated string that specifies a user name for making the connection. If lpUserID is NULL, the function uses the default user name. (The user context for the process provides the default user name.) The lpUserID parameter is specified when users want to connect to a network resource for which they have been assigned a user name or account other than the default user name or account. The user-name string represents a security context. It may be specific to a network provider. For security context, see https://msdn.microsoft.com/en-us/library/windows/desktop/ ms721625(v=vs.85).aspx
  `dwFlags` - [in] Set of bit flags describing the connection. This parameter can be any combination of the values in ConnectFlag.
  `lpAccessName` - [out] Pointer to a buffer that receives system requests on the connection. This parameter can be NULL. If this parameter is specified, and the lpLocalName member of the NETRESOURCE structure specifies a local device, this buffer receives the local device name. If lpLocalName does not specify a device and the network requires a local device redirection, or if the CONNECT_REDIRECT value is set, this buffer receives the name of the redirected local device. Otherwise, the name copied into the buffer is that of a remote resource. If specified, this buffer must be at least as large as the string pointed to by the lpRemoteName member.
  `lpBufferSize` - [in, out] Pointer to a variable that specifies the size of the lpAccessName buffer, in characters. If the call fails because the buffer is not large enough, the function returns the required buffer size in this location. For more information, see the descriptions of the lpAccessName parameter and the ERROR_MORE_DATA error code in the Return Values section.
  `lpResult` - [out] Pointer to a variable that receives additional information about the connection. This parameter can be the following value: ConnectFlag.CONNECT_LOCALDRIVE - If this flag is set, the connection was made using a local device redirection. If the lpAccessName parameter points to a buffer, the local device name is copied to the buffer.
Returns:
  `NO_ERROR` if the function succeeds, otherwise a system error code. See MSDN documentation for common error values: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385482 (v=vs.85).aspx

#### WNetAddConnection3

    int WNetAddConnection3​(WinDef.HWND hwndOwner,
                           Winnetwk.NETRESOURCE lpNETRESOURCE,
                           java.lang.String lpPassword,
                           java.lang.String lpUserID,
                           int dwFlags)

The WNetAddConnection3 function makes a connection to a network resource. The function can redirect a local device to the network resource.

Parameters:
  `hwndOwner` - [in] Handle to a window that the provider of network resources can use as an owner window for dialog boxes. Use this parameter if you set the CONNECT_INTERACTIVE value in the dwFlags parameter.
  `lpNETRESOURCE` - [in] Pointer to a NETRESOURCE structure that specifies details of the proposed connection. The structure contains information about the network resource, the local device, and the network resource provider. You must specify the following members of the NETRESOURCE structure. The WNetUseConnection function ignores the other members of the NETRESOURCE structure. For more information, see the descriptions following for the dwFlags parameter. dwType Specifies the type of resource to connect to. It is most efficient to specify a resource type in this member, such as RESOURCETYPE_DISK or RESOURCETYPE_PRINT. However, if the lpLocalName member is NULL, or if it points to an empty string and CONNECT_REDIRECT is not set, dwType can be RESOURCETYPE_ANY. This method works only if the function does not automatically choose a device to redirect to the network resource. Although this member is required, its information may be ignored by the network service provider lpLocalName Pointer to a null-terminated string that specifies the name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a case-insensitive manner. If the string is empty, or if lpLocalName is NULL, a connection to the network occurs without redirection. If the CONNECT_REDIRECT value is set in the dwFlags parameter, or if the network requires a redirected local device, the function chooses a local device to redirect and returns the name of the device in the lpAccessName parameter. lpRemoveName Pointer to a null-terminated string that specifies the network resource to connect to. The string can be up to MAX_PATH characters in length, and it must follow the network provider's naming conventions. lpProvider Pointer to a null-terminated string that specifies the network provider to connect to. If lpProvider is NULL, or if it points to an empty string, the operating system attempts to determine the correct provider by parsing the string pointed to by the lpRemoteName member. If this member is not NULL, the operating system attempts to make a connection only to the named network provider. You should set this member only if you know the network provider you want to use. Otherwise, let the operating system determine which provider the network name maps to.
  `lpPassword` - [in] Pointer to a constant null-terminated string that specifies a password to be used in making the network connection. If lpPassword is NULL, the function uses the current default password associated with the user specified by lpUserID. If lpPassword points to an empty string, the function does not use a password. If the connection fails because of an invalid password and the CONNECT_INTERACTIVE value is set in the dwFlags parameter, the function displays a dialog box asking the user to type the password.
  `lpUserID` - [in] Pointer to a constant null-terminated string that specifies a user name for making the connection. If lpUserID is NULL, the function uses the default user name. (The user context for the process provides the default user name.) The lpUserID parameter is specified when users want to connect to a network resource for which they have been assigned a user name or account other than the default user name or account. The user-name string represents a security context. It may be specific to a network provider. For security context, see https://msdn.microsoft.com/en-us/library/windows/desktop/ ms721625(v=vs.85).aspx
  `dwFlags` - [in] Set of bit flags describing the connection. This parameter can be any combination of the values in ConnectFlag.

#### WNetCancelConnection2

    int WNetCancelConnection2​(java.lang.String lpName,
                              int dwFlags,
                              boolean fForce)

The WNetCancelConnection2 function cancels an existing network connection. You can also call the function to remove remembered network connections that are not currently connected.

Parameters:
  `lpName` - [in] Pointer to a constant null-terminated string that specifies the name of either the redirected local device or the remote network resource to disconnect from. If this parameter specifies a redirected local device, the function cancels only the specified device redirection. If the parameter specifies a remote network resource, all connections without devices are canceled.
  `dwFlags` - [in] Connection type. The following values are defined. 0 - The system does not update information about the connection. If the connection was marked as persistent in the registry, the system continues to restore the connection at the next logon. If the connection was not marked as persistent, the function ignores the setting of the CONNECT_UPDATE_PROFILE flag. CONNECT_UPDATE_PROFILE - The system updates the user profile with the information that the connection is no longer a persistent one. The system will not restore this connection during subsequent logon operations. (Disconnecting resources using remote names has no effect on persistent connections.)
  `fForce` - [in] Specifies whether the disconnection should occur if there are open files or jobs on the connection. If this parameter is FALSE, the function fails if there are open files or jobs.
Returns:
  `NO_ERROR` if the function succeeds, otherwise a system error code. See MSDN documentation for common error values: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385482 (v=vs.85).aspx