Top Description Inners Fields Methods
com.sun.jna.platform.win32

public Interface Netapi32

extends StdCallLibrary
Imports
com.sun.jna.Native, .Pointer, .Structure, .Structure.FieldOrder, .WString, com.sun.jna.platform.win32.DsGetDC.PDOMAIN_CONTROLLER_INFO, .Guid.GUID, .NTSecApi.PLSA_FOREST_TRUST_INFORMATION, com.sun.jna.ptr.IntByReference, .PointerByReference, com.sun.jna.win32.StdCallLibrary, .W32APIOptions, .W32APITypeMapper

Netapi32.dll Interface.
Author
dblock[at]dblock.org

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Netapi32.SESSION_INFO_10

Contains information about the session, including name of the computer; name of the user; and active and idle times for the session.

Field Summary

Modifier and TypeField and Description
public static final Netapi32
public static final int
Inherited from com.sun.jna.win32.StdCallLibrary:
FUNCTION_MAPPERSTDCALL_CONVENTION

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

Returns ERROR_SUCCESS if successful or a Win32 error code otherwise.
DsEnumerateDomainTrusts
(String
Pointer to a null-terminated string that specifies the name of a computer in the domain to obtain the trust information for. This computer must be running the Windows 2000 or later operating system. If this parameter is NULL, the name of the local computer is used. The caller must be an authenticated user in this domain.
serverName
,
int
Contains a set of flags that determines which domain trusts to enumerate.
Flags
,
PointerByReference
Receives a pointer which points to an array of DS_DOMAIN_TRUSTS structures. Each structure in this array contains trust data about a domain. The caller must free this memory when it is no longer required by calling NetApiBufferFree.
Domains
,
IntByReference
Pointer to a ULONG value that receives the number of elements returned in the Domains array.
DomainCount
)

The DsEnumerateDomainTrusts function obtains domain trust data for a specified domain.

public int

Returns:

If the function returns domain controller data, the return value is ERROR_SUCCESS. If the function fails, the return code is one of ERROR_* values.
DsGetDcName
(String
Pointer to a null-terminated string that specifies the name of the server to process this function. Typically, this parameter is NULL, which indicates that the local computer is used.
ComputerName
,
String
Pointer to a null-terminated string that specifies the name of the domain or application partition to query. This name can either be a DNS style name, for example, fabrikam.com, or a flat-style name, for example, Fabrikam. If a DNS style name is specified, the name may be specified with or without a trailing period.
DomainName
,
Guid.GUID
Pointer to a GUID structure that specifies the GUID of the domain queried. If DomainGuid is not NULL and the domain specified by DomainName or ComputerName cannot be found, DsGetDcName attempts to locate a domain controller in the domain having the GUID specified by DomainGuid.
DomainGuid
,
String
Pointer to a null-terminated string that specifies the name of the site where the returned domain controller should physically exist. If this parameter is NULL, DsGetDcName attempts to return a domain controller in the site closest to the site of the computer specified by ComputerName. This parameter should be NULL, by default.
SiteName
,
int
Contains a set of flags that provide additional data used to process the request.
Flags
,
DsGetDC.PDOMAIN_CONTROLLER_INFO
Pointer to a PDOMAIN_CONTROLLER_INFO value that receives a pointer to a DOMAIN_CONTROLLER_INFO structure that contains data about the domain controller selected. This structure is allocated by DsGetDcName. The caller must free the structure using the NetApiBufferFree function when it is no longer required.
DomainControllerInfo
)

The DsGetDcName function returns the name of a domain controller in a specified domain.

public int

Returns:

Returns NO_ERROR if successful or a Win32 error code otherwise.
DsGetForestTrustInformation
(String
Contains the name of the domain controller that DsGetForestTrustInformationW is connected to remotely. The caller must be an authenticated user on this server. If this parameter is NULL, the local server is used.
serverName
,
String
Contains the NETBIOS or DNS name of the trusted domain that the forest trust data is to be retrieved for. This domain must have the TRUST_ATTRIBUTE_FOREST_TRANSITIVE trust attribute. If this parameter is NULL, the forest trust data for the domain hosted by ServerName is retrieved.
trustedDomainName
,
int
Contains a set of flags that modify the behavior of this function. DS_GFTI_UPDATE_TDO: If this flag is set, DsGetForestTrustInformationW will update the forest trust data of the trusted domain identified by the TrustedDomainName parameter.
Flags
,
NTSecApi.PLSA_FOREST_TRUST_INFORMATION
Pointer to an LSA_FOREST_TRUST_INFORMATION structure pointer that receives the forest trust data that describes the namespaces claimed by the domain specified by TrustedDomainName. The Time member of all returned records will be zero.
ForestTrustInfo
)

The DsGetForestTrustInformationW function obtains forest trust data for a specified domain.

public int

Returns:

If the function succeeds, the return value is NERR_Success. If the function fails, the return value is a system error code.
NetApiBufferFree
(Pointer
buffer
buffer
)

Frees the memory that the NetApiBufferAllocate function allocates.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetGetDCName
(String
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.
serverName
,
String
Specifies the name of the domain.
domainName
,
PointerByReference
Receives a string that specifies the server name of the PDC of the domain.
bufptr
)

Returns the name of the primary domain controller (PDC).

public int

Returns:

If the function succeeds, the return value is NERR_Success. If the function fails, the return value is a system error code.
NetGetJoinInformation
(String
Specifies the DNS or NetBIOS name of the computer on which to call the function.
lpServer
,
PointerByReference
Receives the NetBIOS name of the domain or workgroup to which the computer is joined.
lpNameBuffer
,
IntByReference
Join status of the specified computer.
BufferType
)

Retrieves join status information for the specified computer.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetGroupEnum
(String
Pointer to a constant 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.
servername
,
int
Specifies the information level of the data.
level
,
PointerByReference
Pointer to the buffer to receive the global group information structure. The format of this data depends on the value of the level parameter.
bufptr
,
int
Specifies the preferred maximum length of the returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates the amount of memory required to hold 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.
prefmaxlen
,
IntByReference
Pointer to a value that receives the count of elements actually enumerated.
entriesread
,
IntByReference
Pointer to a value that receives the total number of entries that could have been enumerated from the current resume position. The total number of entries is only a hint.
totalentries
,
IntByReference
Pointer to a variable that contains a resume handle that is used to continue the global group enumeration. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, no resume handle is stored.
resume_handle
)

The NetGroupEnum function retrieves information about each global group in the security database, which is the security accounts manager (SAM) database or, in the case of domain controllers, the Active Directory.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetLocalGroupEnum
(String
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.
serverName
,
int
Specifies the information level of the data.
level
,
PointerByReference
Pointer to the address of the buffer that receives the information structure.
bufptr
,
int
Specifies the preferred maximum length of returned data, in bytes.
prefmaxlen
,
IntByReference
Pointer to a value that receives the count of elements actually enumerated.
entriesread
,
IntByReference
Pointer to a value that receives the approximate total number of entries that could have been enumerated from the current resume position.
totalentries
,
IntByReference
Pointer to a value that contains a resume handle that is used to continue an existing local group search.
resume_handle
)

Returns information about each local group account on the specified server.

public int

Returns:

If the function succeeds, the return value is NERR_Success (0). If the function fails, the return value is an error code.
NetSessionEnum
(WString
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.
servername
,
WString
Pointer to a string that specifies the name of the computer session for which information is to be returned. If this parameter is NULL, NetSessionEnum returns information for all computer sessions on the server.
UncClientName
,
WString
Pointer to a string that specifies the name of the user for which information is to be returned. If this parameter is NULL, NetSessionEnum returns information for all users.
username
,
int
Specifies the information level of the data. This parameter can be one of 0, 1, 2, 10, 502.
level
,
PointerByReference
Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter, for example SESSION_INFO_0 for level 0.

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.

bufptr
,
int
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.
prefmaxlen
,
IntByReference
Pointer to a value that receives the count of elements actually enumerated.
entriesread
,
IntByReference
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.
totalentries
,
IntByReference
Pointer to a value that contains a resume handle which is used to continue an existing session search. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, no resume handle is stored.
resume_handle
)

Provides information about sessions established on a server.

public int

Returns:

If the function succeeds, the return value is NERR_Success. If the function fails, the return value can be an error code as seen on MSDN.
NetShareAdd
(String
[in] 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.
servername
,
int
[in] Specifies the information level of the data. This parameter can be one of the following values: 2 - Specifies information about the shared resource, including the name of the resource, type and permissions, and number of connections. The buf parameter points to a SHARE_INFO_2 structure. 502 - Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, and other pertinent information. The buf parameter points to a SHARE_INFO_502 structure. 503 - Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, and other pertinent information. The buf parameter points to a SHARE_INFO_503 structure.
level
,
Pointer
[in] 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 (https://msdn.microsoft.com/en-us/library/windows/desktop/aa370676(v=vs.85).aspx)
buf
,
IntByReference
[out] Pointer to a value that receives the index of the first member of the share 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 NetShareSetInfo function.
parm_err
)

Shares a server resource.

public int

Returns:

If the function succeeds, the return value is LMErr.NERR_Success. If the function fails, the return value can be an error code as seen on MSDN.
NetShareDel
(String
[in] 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.
servername
,
String
[in] Pointer to a string that specifies the name of the share to delete.
netname
,
int
Reserved, must be zero.
reserved
)

Deletes a share name from a server's list of shared resources, disconnecting all connections to the shared resource.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserAdd
(String
Pointer to a constant string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute.
servername
,
int
Specifies the information level of the data.
level
,
Structure
Pointer to the buffer that specifies the data. The format of this data depends on the value of the level parameter.
buf
,
IntByReference
Pointer to a value that receives the index of the first member of the user information structure that causes ERROR_INVALID_PARAMETER. If this parameter is NULL, the index is not returned on error.
parm_err
)

The NetUserAdd function adds a user account and assigns a password and privilege level.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserChangePassword
(String
Pointer to a constant string that specifies the DNS or NetBIOS name of a remote server or domain on which the function is to execute. If this parameter is NULL, the logon domain of the caller is used.
domainname
,
String
Pointer to a constant string that specifies a user name. The NetUserChangePassword function changes the password for the specified user. If this parameter is NULL, the logon name of the caller is used.
username
,
String
Pointer to a constant string that specifies the user's old password.
oldpassword
,
String
Pointer to a constant string that specifies the user's new password.
newpassword
)

The NetUserChangePassword function changes a user's password for a specified network server or domain.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserDel
(String
Pointer to a constant 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.
servername
,
String
Pointer to a constant string that specifies the name of the user account to delete.
username
)

The NetUserDel function deletes a user account from a server.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserEnum
(String
Pointer to a constant 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.
servername
,
int
Specifies the information level of the data.
level
,
int
Specifies a value that filters the account types for enumeration.
filter
,
PointerByReference
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.
bufptr
,
int
Specifies the preferred maximum length, in 8-bit bytes of returned data. 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.
prefmaxlen
,
IntByReference
Pointer to a value that receives the count of elements actually enumerated.
entriesread
,
IntByReference
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.
totalentries
,
IntByReference
Pointer to a value that contains a resume handle which is used to continue an existing user search. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, then no resume handle is stored.
resume_handle
)

The NetUserEnum function provides information about all user accounts on a server.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserGetGroups
(String
Pointer to a constant 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.
servername
,
String
Pointer to a constant string that specifies the name of the user to search for in each group account. For more information, see the following Remarks section.
username
,
int
Specifies the information level of the data.
level
,
PointerByReference
Pointer to the buffer that receives the data. 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.
bufptr
,
int
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.
prefmaxlen
,
IntByReference
Pointer to a value that receives the count of elements actually retrieved.
entriesread
,
IntByReference
Pointer to a value that receives the total number of entries that could have been retrieved.
totalentries
)

The NetUserGetGroups function retrieves a list of global groups to which a specified user belongs.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserGetInfo
(String
A pointer to a constant 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.
servername
,
String
A pointer to a constant string that specifies the name of the user account for which to return information. For more information, see the following Remarks section.
username
,
int
The information level of the data. This parameter can be one of the following values. Value Meaning 0 Return the user account name. The bufptr parameter points to a USER_INFO_0 structure. 1 Return detailed information about the user account. The bufptr parameter points to a USER_INFO_1 structure. 2 Return detailed information and additional attributes about the user account. The bufptr parameter points to a USER_INFO_2 structure. 3 Return detailed information and additional attributes about the user account. This level is valid only on servers. The bufptr parameter points to a USER_INFO_3 structure. Note that it is recommended that you use USER_INFO_4 instead. 4 Return detailed information and additional attributes about the user account. This level is valid only on servers. The bufptr parameter points to a USER_INFO_4 structure. Windows 2000: This level is not supported. 10 Return user and account names and comments. The bufptr parameter points to a USER_INFO_10 structure. 11 Return detailed information about the user account. The bufptr parameter points to a USER_INFO_11 structure. 20 Return the user's name and identifier and various account attributes. The bufptr parameter points to a USER_INFO_20 structure. Note that on Windows XP and later, it is recommended that you use USER_INFO_23 instead. 23 Return the user's name and identifier and various account attributes. The bufptr parameter points to a USER_INFO_23 structure. Windows 2000: This level is not supported.
level
,
PointerByReference
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.
bufptr
)

The NetUserGetInfo function retrieves information about a particular user account on a server.

public int

Returns:

If the function succeeds, the return value is NERR_Success.
NetUserGetLocalGroups
(String
Pointer to a constant 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.
servername
,
String
Pointer to a constant string that specifies the name of the user for which to return local group membership information. If the string is of the form DomainName\UserName the user name is expected to be found on that domain. If the string is of the form UserName, the user name is expected to be found on the server specified by the servername parameter.
username
,
int
Specifies the information level of the data.
level
,
int
Specifies a bitmask of flags. Currently, only the value LG_INCLUDE_INDIRECT is defined. If this bit is set, the function also returns the names of the local groups in which the user is indirectly a member (that is, the user has membership in a global group that is itself a member of one or more local groups).
flags
,
PointerByReference
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.
bufptr
,
int
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.
prefmaxlen
,
IntByReference
Pointer to a value that receives the count of elements actually enumerated.
entriesread
,
IntByReference
Pointer to a value that receives the total number of entries that could have been enumerated.
totalentries
)

The NetUserGetLocalGroups function retrieves a list of local groups to which a specified user belongs.

Field Detail

INSTANCEback to summary
public static final Netapi32 INSTANCE
MAX_PREFERRED_LENGTHback to summary
public static final int MAX_PREFERRED_LENGTH

Method Detail

DsEnumerateDomainTrustsback to summary
public int DsEnumerateDomainTrusts(String serverName, int Flags, PointerByReference Domains, IntByReference DomainCount)

The DsEnumerateDomainTrusts function obtains domain trust data for a specified domain.

Parameters
serverName:String

Pointer to a null-terminated string that specifies the name of a computer in the domain to obtain the trust information for. This computer must be running the Windows 2000 or later operating system. If this parameter is NULL, the name of the local computer is used. The caller must be an authenticated user in this domain.

Flags:int

Contains a set of flags that determines which domain trusts to enumerate.

Domains:PointerByReference

Receives a pointer which points to an array of DS_DOMAIN_TRUSTS structures. Each structure in this array contains trust data about a domain. The caller must free this memory when it is no longer required by calling NetApiBufferFree.

DomainCount:IntByReference

Pointer to a ULONG value that receives the number of elements returned in the Domains array.

Returns:int

Returns ERROR_SUCCESS if successful or a Win32 error code otherwise.

DsGetDcNameback to summary
public int DsGetDcName(String ComputerName, String DomainName, Guid.GUID DomainGuid, String SiteName, int Flags, DsGetDC.PDOMAIN_CONTROLLER_INFO DomainControllerInfo)

The DsGetDcName function returns the name of a domain controller in a specified domain. This function accepts additional domain controller selection criteria to indicate preference for a domain controller with particular characteristics.

Parameters
ComputerName:String

Pointer to a null-terminated string that specifies the name of the server to process this function. Typically, this parameter is NULL, which indicates that the local computer is used.

DomainName:String

Pointer to a null-terminated string that specifies the name of the domain or application partition to query. This name can either be a DNS style name, for example, fabrikam.com, or a flat-style name, for example, Fabrikam. If a DNS style name is specified, the name may be specified with or without a trailing period.

DomainGuid:Guid.GUID

Pointer to a GUID structure that specifies the GUID of the domain queried. If DomainGuid is not NULL and the domain specified by DomainName or ComputerName cannot be found, DsGetDcName attempts to locate a domain controller in the domain having the GUID specified by DomainGuid.

SiteName:String

Pointer to a null-terminated string that specifies the name of the site where the returned domain controller should physically exist. If this parameter is NULL, DsGetDcName attempts to return a domain controller in the site closest to the site of the computer specified by ComputerName. This parameter should be NULL, by default.

Flags:int

Contains a set of flags that provide additional data used to process the request.

DomainControllerInfo:DsGetDC.PDOMAIN_CONTROLLER_INFO

Pointer to a PDOMAIN_CONTROLLER_INFO value that receives a pointer to a DOMAIN_CONTROLLER_INFO structure that contains data about the domain controller selected. This structure is allocated by DsGetDcName. The caller must free the structure using the NetApiBufferFree function when it is no longer required.

Returns:int

If the function returns domain controller data, the return value is ERROR_SUCCESS. If the function fails, the return code is one of ERROR_* values.

DsGetForestTrustInformationback to summary
public int DsGetForestTrustInformation(String serverName, String trustedDomainName, int Flags, NTSecApi.PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo)

The DsGetForestTrustInformationW function obtains forest trust data for a specified domain.

Parameters
serverName:String

Contains the name of the domain controller that DsGetForestTrustInformationW is connected to remotely. The caller must be an authenticated user on this server. If this parameter is NULL, the local server is used.

trustedDomainName:String

Contains the NETBIOS or DNS name of the trusted domain that the forest trust data is to be retrieved for. This domain must have the TRUST_ATTRIBUTE_FOREST_TRANSITIVE trust attribute. If this parameter is NULL, the forest trust data for the domain hosted by ServerName is retrieved.

Flags:int

Contains a set of flags that modify the behavior of this function. DS_GFTI_UPDATE_TDO: If this flag is set, DsGetForestTrustInformationW will update the forest trust data of the trusted domain identified by the TrustedDomainName parameter.

ForestTrustInfo:NTSecApi.PLSA_FOREST_TRUST_INFORMATION

Pointer to an LSA_FOREST_TRUST_INFORMATION structure pointer that receives the forest trust data that describes the namespaces claimed by the domain specified by TrustedDomainName. The Time member of all returned records will be zero.

Returns:int

Returns NO_ERROR if successful or a Win32 error code otherwise.

NetApiBufferFreeback to summary
public int NetApiBufferFree(Pointer buffer)

Frees the memory that the NetApiBufferAllocate function allocates.

Parameters
buffer:Pointer

buffer

Returns:int

If the function succeeds, the return value is NERR_Success. If the function fails, the return value is a system error code.

NetGetDCNameback to summary
public int NetGetDCName(String serverName, String domainName, PointerByReference bufptr)

Returns the name of the primary domain controller (PDC).

Parameters
serverName:String

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.

domainName:String

Specifies the name of the domain.

bufptr:PointerByReference

Receives a string that specifies the server name of the PDC of the domain.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetGetJoinInformationback to summary
public int NetGetJoinInformation(String lpServer, PointerByReference lpNameBuffer, IntByReference BufferType)

Retrieves join status information for the specified computer.

Parameters
lpServer:String

Specifies the DNS or NetBIOS name of the computer on which to call the function.

lpNameBuffer:PointerByReference

Receives the NetBIOS name of the domain or workgroup to which the computer is joined.

BufferType:IntByReference

Join status of the specified computer.

Returns:int

If the function succeeds, the return value is NERR_Success. If the function fails, the return value is a system error code.

NetGroupEnumback to summary
public int NetGroupEnum(String servername, int level, PointerByReference bufptr, int prefmaxlen, IntByReference entriesread, IntByReference totalentries, IntByReference resume_handle)

The NetGroupEnum function retrieves information about each global group in the security database, which is the security accounts manager (SAM) database or, in the case of domain controllers, the Active Directory.

Parameters
servername:String

Pointer to a constant 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.

level:int

Specifies the information level of the data.

bufptr:PointerByReference

Pointer to the buffer to receive the global group information structure. The format of this data depends on the value of the level parameter.

prefmaxlen:int

Specifies the preferred maximum length of the returned data, in bytes. If you specify MAX_PREFERRED_LENGTH, the function allocates the amount of memory required to hold 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.

entriesread:IntByReference

Pointer to a value that receives the count of elements actually enumerated.

totalentries:IntByReference

Pointer to a value that receives the total number of entries that could have been enumerated from the current resume position. The total number of entries is only a hint.

resume_handle:IntByReference

Pointer to a variable that contains a resume handle that is used to continue the global group enumeration. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, no resume handle is stored.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetLocalGroupEnumback to summary
public int NetLocalGroupEnum(String serverName, int level, PointerByReference bufptr, int prefmaxlen, IntByReference entriesread, IntByReference totalentries, IntByReference resume_handle)

Returns information about each local group account on the specified server.

Parameters
serverName:String

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.

level:int

Specifies the information level of the data.

bufptr:PointerByReference

Pointer to the address of the buffer that receives the information structure.

prefmaxlen:int

Specifies the preferred maximum length of returned data, in bytes.

entriesread:IntByReference

Pointer to a value that receives the count of elements actually enumerated.

totalentries:IntByReference

Pointer to a value that receives the approximate total number of entries that could have been enumerated from the current resume position.

resume_handle:IntByReference

Pointer to a value that contains a resume handle that is used to continue an existing local group search.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetSessionEnumback to summary
public int NetSessionEnum(WString servername, WString UncClientName, WString username, int level, PointerByReference bufptr, int prefmaxlen, IntByReference entriesread, IntByReference totalentries, IntByReference resume_handle)

Provides information about sessions established on a server.

Parameters
servername:WString

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.

UncClientName:WString

Pointer to a string that specifies the name of the computer session for which information is to be returned. If this parameter is NULL, NetSessionEnum returns information for all computer sessions on the server.

username:WString

Pointer to a string that specifies the name of the user for which information is to be returned. If this parameter is NULL, NetSessionEnum returns information for all users.

level:int

Specifies the information level of the data. This parameter can be one of 0, 1, 2, 10, 502.

bufptr:PointerByReference

Pointer to the buffer that receives the data. The format of this data depends on the value of the level parameter, for example SESSION_INFO_0 for level 0.

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.

prefmaxlen:int

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.

entriesread:IntByReference

Pointer to a value that receives the count of elements actually enumerated.

totalentries:IntByReference

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.

resume_handle:IntByReference

Pointer to a value that contains a resume handle which is used to continue an existing session search. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, no resume handle is stored.

Returns:int

If the function succeeds, the return value is NERR_Success (0). If the function fails, the return value is an error code.

NetShareAddback to summary
public int NetShareAdd(String servername, int level, Pointer buf, IntByReference parm_err)

Shares a server resource.

Parameters
servername:String

[in] 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.

level:int

[in] Specifies the information level of the data. This parameter can be one of the following values: 2 - Specifies information about the shared resource, including the name of the resource, type and permissions, and number of connections. The buf parameter points to a SHARE_INFO_2 structure. 502 - Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, and other pertinent information. The buf parameter points to a SHARE_INFO_502 structure. 503 - Specifies information about the shared resource, including the name of the resource, type and permissions, number of connections, and other pertinent information. The buf parameter points to a SHARE_INFO_503 structure.

buf:Pointer

[in] 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 (https://msdn.microsoft.com/en-us/library/windows/desktop/aa370676(v=vs.85).aspx)

parm_err:IntByReference

[out] Pointer to a value that receives the index of the first member of the share 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 NetShareSetInfo function.

Returns:int

If the function succeeds, the return value is NERR_Success. If the function fails, the return value can be an error code as seen on MSDN.

NetShareDelback to summary
public int NetShareDel(String servername, String netname, int reserved)

Deletes a share name from a server's list of shared resources, disconnecting all connections to the shared resource.

Parameters
servername:String

[in] 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.

netname:String

[in] Pointer to a string that specifies the name of the share to delete.

reserved:int

Reserved, must be zero.

Returns:int

If the function succeeds, the return value is LMErr.NERR_Success. If the function fails, the return value can be an error code as seen on MSDN.

NetUserAddback to summary
public int NetUserAdd(String servername, int level, Structure buf, IntByReference parm_err)

The NetUserAdd function adds a user account and assigns a password and privilege level.

Parameters
servername:String

Pointer to a constant string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute.

level:int

Specifies the information level of the data.

buf:Structure

Pointer to the buffer that specifies the data. The format of this data depends on the value of the level parameter.

parm_err:IntByReference

Pointer to a value that receives the index of the first member of the user information structure that causes ERROR_INVALID_PARAMETER. If this parameter is NULL, the index is not returned on error.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetUserChangePasswordback to summary
public int NetUserChangePassword(String domainname, String username, String oldpassword, String newpassword)

The NetUserChangePassword function changes a user's password for a specified network server or domain.

Parameters
domainname:String

Pointer to a constant string that specifies the DNS or NetBIOS name of a remote server or domain on which the function is to execute. If this parameter is NULL, the logon domain of the caller is used.

username:String

Pointer to a constant string that specifies a user name. The NetUserChangePassword function changes the password for the specified user. If this parameter is NULL, the logon name of the caller is used.

oldpassword:String

Pointer to a constant string that specifies the user's old password.

newpassword:String

Pointer to a constant string that specifies the user's new password.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetUserDelback to summary
public int NetUserDel(String servername, String username)

The NetUserDel function deletes a user account from a server.

Parameters
servername:String

Pointer to a constant 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.

username:String

Pointer to a constant string that specifies the name of the user account to delete.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetUserEnumback to summary
public int NetUserEnum(String servername, int level, int filter, PointerByReference bufptr, int prefmaxlen, IntByReference entriesread, IntByReference totalentries, IntByReference resume_handle)

The NetUserEnum function provides information about all user accounts on a server.

Parameters
servername:String

Pointer to a constant 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.

level:int

Specifies the information level of the data.

filter:int

Specifies a value that filters the account types for enumeration.

bufptr:PointerByReference

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.

prefmaxlen:int

Specifies the preferred maximum length, in 8-bit bytes of returned data. 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.

entriesread:IntByReference

Pointer to a value that receives the count of elements actually enumerated.

totalentries:IntByReference

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.

resume_handle:IntByReference

Pointer to a value that contains a resume handle which is used to continue an existing user search. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, then no resume handle is stored.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetUserGetGroupsback to summary
public int NetUserGetGroups(String servername, String username, int level, PointerByReference bufptr, int prefmaxlen, IntByReference entriesread, IntByReference totalentries)

The NetUserGetGroups function retrieves a list of global groups to which a specified user belongs.

Parameters
servername:String

Pointer to a constant 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.

username:String

Pointer to a constant string that specifies the name of the user to search for in each group account. For more information, see the following Remarks section.

level:int

Specifies the information level of the data.

bufptr:PointerByReference

Pointer to the buffer that receives the data. 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.

prefmaxlen:int

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.

entriesread:IntByReference

Pointer to a value that receives the count of elements actually retrieved.

totalentries:IntByReference

Pointer to a value that receives the total number of entries that could have been retrieved.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetUserGetInfoback to summary
public int NetUserGetInfo(String servername, String username, int level, PointerByReference bufptr)

The NetUserGetInfo function retrieves information about a particular user account on a server.

Parameters
servername:String

A pointer to a constant 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.

username:String

A pointer to a constant string that specifies the name of the user account for which to return information. For more information, see the following Remarks section.

level:int

The information level of the data. This parameter can be one of the following values. Value Meaning 0 Return the user account name. The bufptr parameter points to a USER_INFO_0 structure. 1 Return detailed information about the user account. The bufptr parameter points to a USER_INFO_1 structure. 2 Return detailed information and additional attributes about the user account. The bufptr parameter points to a USER_INFO_2 structure. 3 Return detailed information and additional attributes about the user account. This level is valid only on servers. The bufptr parameter points to a USER_INFO_3 structure. Note that it is recommended that you use USER_INFO_4 instead. 4 Return detailed information and additional attributes about the user account. This level is valid only on servers. The bufptr parameter points to a USER_INFO_4 structure. Windows 2000: This level is not supported. 10 Return user and account names and comments. The bufptr parameter points to a USER_INFO_10 structure. 11 Return detailed information about the user account. The bufptr parameter points to a USER_INFO_11 structure. 20 Return the user's name and identifier and various account attributes. The bufptr parameter points to a USER_INFO_20 structure. Note that on Windows XP and later, it is recommended that you use USER_INFO_23 instead. 23 Return the user's name and identifier and various account attributes. The bufptr parameter points to a USER_INFO_23 structure. Windows 2000: This level is not supported.

bufptr:PointerByReference

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.

Returns:int

If the function succeeds, the return value is NERR_Success.

NetUserGetLocalGroupsback to summary
public int NetUserGetLocalGroups(String servername, String username, int level, int flags, PointerByReference bufptr, int prefmaxlen, IntByReference entriesread, IntByReference totalentries)

The NetUserGetLocalGroups function retrieves a list of local groups to which a specified user belongs.

Parameters
servername:String

Pointer to a constant 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.

username:String

Pointer to a constant string that specifies the name of the user for which to return local group membership information. If the string is of the form DomainName\UserName the user name is expected to be found on that domain. If the string is of the form UserName, the user name is expected to be found on the server specified by the servername parameter.

level:int

Specifies the information level of the data.

flags:int

Specifies a bitmask of flags. Currently, only the value LG_INCLUDE_INDIRECT is defined. If this bit is set, the function also returns the names of the local groups in which the user is indirectly a member (that is, the user has membership in a global group that is itself a member of one or more local groups).

bufptr:PointerByReference

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.

prefmaxlen:int

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.

entriesread:IntByReference

Pointer to a value that receives the count of elements actually enumerated.

totalentries:IntByReference

Pointer to a value that receives the total number of entries that could have been enumerated.

Returns:int

If the function succeeds, the return value is NERR_Success.

com.sun.jna.platform.win32 back to summary

public Class Netapi32.SESSION_INFO_10

extends Structure
Class Inheritance
Annotations
@FieldOrder:sesi10_cname, sesi10_username, sesi10_time, sesi10_idle_time

Contains information about the session, including name of the computer; name of the user; and active and idle times for the session.

Field Summary

Modifier and TypeField and Description
public String
public int
public int
public String
Inherited from com.sun.jna.Structure:
ALIGN_DEFAULTALIGN_GNUCALIGN_MSVCALIGN_NONECALCULATE_SIZE

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Inherited from com.sun.jna.Structure:
allocateMemoryallocateMemoryautoAllocateautoReadautoReadautoWriteautoWritecacheTypeInfocalculateSizeclearcreateFieldsOrdercreateFieldsOrdercreateFieldsOrdercreateFieldsOrderdataEqualsdataEqualsensureAllocatedequalsfieldOffsetgetAutoReadgetAutoWritegetFieldListgetFieldOrdergetFieldsgetNativeAlignmentgetNativeSizegetNativeSizegetPointergetStringEncodinggetStructAlignmenthashCodenewInstancenewInstancereadreadFieldreadFieldsetAlignTypesetAutoReadsetAutoSynchsetAutoWritesetStringEncodingsizesortFieldstoArraytoArraytoStringtoStringuseMemoryuseMemorywritewriteFieldwriteFieldwriteField

Field Detail

sesi10_cnameback to summary
public String sesi10_cname
sesi10_idle_timeback to summary
public int sesi10_idle_time
sesi10_timeback to summary
public int sesi10_time
sesi10_usernameback to summary
public String sesi10_username

Constructor Detail

SESSION_INFO_10back to summary
public SESSION_INFO_10()
SESSION_INFO_10back to summary
public SESSION_INFO_10(Pointer p)