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

public abstract Class Netapi32Util

extends Object
Class Inheritance
Imports
java.util.ArrayList, com.sun.jna.Pointer, com.sun.jna.platform.win32.DsGetDC.DS_DOMAIN_TRUSTS, .DsGetDC.PDOMAIN_CONTROLLER_INFO, .Guid.GUID, .LMAccess.GROUP_USERS_INFO_0, .LMAccess.LOCALGROUP_INFO_1, .LMAccess.LOCALGROUP_USERS_INFO_0, .LMAccess.USER_INFO_23, .Secur32.EXTENDED_NAME_FORMAT, .WinNT.PSID, com.sun.jna.ptr.IntByReference, .PointerByReference

Netapi32 Utility API.
Author
dblock[at]dblock.org

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Netapi32Util.DomainController

A domain controller.

public static class
Netapi32Util.DomainTrust

A domain trust relationship.

public static class
public static class
public static class
public static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Netapi32Util.Group[]

Returns:

Local groups.
getCurrentUserLocalGroups
()

Get local groups of the current user.

public static Netapi32Util.DomainController

Returns:

Domain controller information.
getDC
()

Return the domain controller for a current computer.

public static String

Returns:

The name of the primary domain controller.
getDCName
()

Returns the name of the primary domain controller (PDC) on the current computer.

public static String

Returns:

Name of the primary domain controller.
getDCName
(String
Specifies the DNS or NetBIOS name of the remote server on which the function is to execute.
serverName
,
String
Specifies the name of the domain.
domainName
)

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

public static String

Returns:

Domain or workgroup name.
getDomainName
(String
computer name
computerName
)

Get information about a computer.

public static Netapi32Util.DomainTrust[]

Returns:

An array of domain trusts.
getDomainTrusts
()

Retrieve all domain trusts.

public static Netapi32Util.DomainTrust[]

Returns:

An array of domain trusts.
getDomainTrusts
(String
Server name.
serverName
)

Retrieve all domain trusts for a given server.

public static Netapi32Util.Group[]

Returns:

An array of group names.
getGlobalGroups
()

Get the names of global groups on a computer.

public static Netapi32Util.Group[]

Returns:

An array of group names.
getGlobalGroups
(String
Name of the computer.
serverName
)

Get the names of global groups on a computer.

public static int

Returns:

Join status.
getJoinStatus
()

Return the domain/workgroup join status for a computer.

public static int

Returns:

Join status.
getJoinStatus
(String
Computer name.
computerName
)

Return the domain/workgroup join status for a computer.

public static Netapi32Util.LocalGroup[]

Returns:

An array of local group names.
getLocalGroups
()

Get the names of local groups on the current computer.

public static Netapi32Util.LocalGroup[]

Returns:

An array of local group names.
getLocalGroups
(String
Name of the computer.
serverName
)

Get the names of local groups on a computer.

public static Netapi32Util.Group[]

Returns:

Groups.
getUserGroups
(String
User name.
userName
)

Get groups of a given user.

public static Netapi32Util.Group[]

Returns:

Groups.
getUserGroups
(String
User name.
userName
,
String
Server name.
serverName
)

Get groups of a given user on a given system.

public static Netapi32Util.UserInfo
getUserInfo(String accountName)

public static Netapi32Util.UserInfo
getUserInfo(String accountName, String domainName)

public static Netapi32Util.Group[]

Returns:

Local groups.
getUserLocalGroups
(String
User name.
userName
)

Get local groups of a given user.

public static Netapi32Util.Group[]

Returns:

Local groups.
getUserLocalGroups
(String
User name.
userName
,
String
Server name.
serverName
)

Get local groups of a given user on a given system.

public static Netapi32Util.User[]

Returns:

Users.
getUsers
()

Get the names of users on a local computer.

public static Netapi32Util.User[]

Returns:

An array of users.
getUsers
(String
Name of the computer.
serverName
)

Get the names of users on a computer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Netapi32Utilback to summary
public Netapi32Util()

Method Detail

getCurrentUserLocalGroupsback to summary
public static Netapi32Util.Group[] getCurrentUserLocalGroups()

Get local groups of the current user.

Returns:Netapi32Util.Group[]

Local groups.

getDCback to summary
public static Netapi32Util.DomainController getDC()

Return the domain controller for a current computer.

Returns:Netapi32Util.DomainController

Domain controller information.

getDCNameback to summary
public static String getDCName()

Returns the name of the primary domain controller (PDC) on the current computer.

Returns:String

The name of the primary domain controller.

getDCNameback to summary
public static String getDCName(String serverName, String domainName)

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.

domainName:String

Specifies the name of the domain.

Returns:String

Name of the primary domain controller.

getDomainNameback to summary
public static String getDomainName(String computerName)

Get information about a computer.

Parameters
computerName:String

computer name

Returns:String

Domain or workgroup name.

getDomainTrustsback to summary
public static Netapi32Util.DomainTrust[] getDomainTrusts()

Retrieve all domain trusts.

Returns:Netapi32Util.DomainTrust[]

An array of domain trusts.

getDomainTrustsback to summary
public static Netapi32Util.DomainTrust[] getDomainTrusts(String serverName)

Retrieve all domain trusts for a given server.

Parameters
serverName:String

Server name.

Returns:Netapi32Util.DomainTrust[]

An array of domain trusts.

getGlobalGroupsback to summary
public static Netapi32Util.Group[] getGlobalGroups()

Get the names of global groups on a computer.

Returns:Netapi32Util.Group[]

An array of group names.

getGlobalGroupsback to summary
public static Netapi32Util.Group[] getGlobalGroups(String serverName)

Get the names of global groups on a computer.

Parameters
serverName:String

Name of the computer.

Returns:Netapi32Util.Group[]

An array of group names.

getJoinStatusback to summary
public static int getJoinStatus()

Return the domain/workgroup join status for a computer.

Returns:int

Join status.

getJoinStatusback to summary
public static int getJoinStatus(String computerName)

Return the domain/workgroup join status for a computer.

Parameters
computerName:String

Computer name.

Returns:int

Join status.

getLocalGroupsback to summary
public static Netapi32Util.LocalGroup[] getLocalGroups()

Get the names of local groups on the current computer.

Returns:Netapi32Util.LocalGroup[]

An array of local group names.

getLocalGroupsback to summary
public static Netapi32Util.LocalGroup[] getLocalGroups(String serverName)

Get the names of local groups on a computer.

Parameters
serverName:String

Name of the computer.

Returns:Netapi32Util.LocalGroup[]

An array of local group names.

getUserGroupsback to summary
public static Netapi32Util.Group[] getUserGroups(String userName)

Get groups of a given user.

Parameters
userName:String

User name.

Returns:Netapi32Util.Group[]

Groups.

getUserGroupsback to summary
public static Netapi32Util.Group[] getUserGroups(String userName, String serverName)

Get groups of a given user on a given system.

Parameters
userName:String

User name.

serverName:String

Server name.

Returns:Netapi32Util.Group[]

Groups.

getUserInfoback to summary
public static Netapi32Util.UserInfo getUserInfo(String accountName)
getUserInfoback to summary
public static Netapi32Util.UserInfo getUserInfo(String accountName, String domainName)
getUserLocalGroupsback to summary
public static Netapi32Util.Group[] getUserLocalGroups(String userName)

Get local groups of a given user.

Parameters
userName:String

User name.

Returns:Netapi32Util.Group[]

Local groups.

getUserLocalGroupsback to summary
public static Netapi32Util.Group[] getUserLocalGroups(String userName, String serverName)

Get local groups of a given user on a given system.

Parameters
userName:String

User name.

serverName:String

Server name.

Returns:Netapi32Util.Group[]

Local groups.

getUsersback to summary
public static Netapi32Util.User[] getUsers()

Get the names of users on a local computer.

Returns:Netapi32Util.User[]

Users.

getUsersback to summary
public static Netapi32Util.User[] getUsers(String serverName)

Get the names of users on a computer.

Parameters
serverName:String

Name of the computer.

Returns:Netapi32Util.User[]

An array of users.

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

public Class Netapi32Util.DomainController

extends Object
Class Inheritance

A domain controller.

Field Summary

Modifier and TypeField and Description
public String
address

Specifies the address of the discovered domain controller.

public int
addressType

Indicates the type of string that is contained in the DomainControllerAddress member.

public String
clientSiteName

The name of the site that the computer belongs to.

public String
dnsForestName

Pointer to a null-terminated string that specifies the name of the domain at the root of the DS tree.

public Guid.GUID
domainGuid

The GUID of the domain.

public String
domainName

Pointer to a null-terminated string that specifies the name of the domain.

public int
flags

Contains a set of flags that describe the domain controller.

public String
name

Specifies the computer name of the discovered domain controller.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

addressback to summary
public String address

Specifies the address of the discovered domain controller.

addressTypeback to summary
public int addressType

Indicates the type of string that is contained in the DomainControllerAddress member.

clientSiteNameback to summary
public String clientSiteName

The name of the site that the computer belongs to.

dnsForestNameback to summary
public String dnsForestName

Pointer to a null-terminated string that specifies the name of the domain at the root of the DS tree.

domainGuidback to summary
public Guid.GUID domainGuid

The GUID of the domain.

domainNameback to summary
public String domainName

Pointer to a null-terminated string that specifies the name of the domain.

flagsback to summary
public int flags

Contains a set of flags that describe the domain controller.

nameback to summary
public String name

Specifies the computer name of the discovered domain controller.

Constructor Detail

DomainControllerback to summary
public DomainController()
com.sun.jna.platform.win32 back to summary

public Class Netapi32Util.DomainTrust

extends Object
Class Inheritance

A domain trust relationship.

Field Summary

Modifier and TypeField and Description
public String
DnsDomainName

DNS name of the domain.

public Guid.GUID
DomainGuid

Contains the GUID of the domain represented by this structure.

public String
DomainGuidString

Contains the string representation of the GUID of the domain represented by this structure.

public WinNT.PSID
DomainSid

Contains the security identifier of the domain represented by this structure.

public String
DomainSidString

Contains the string representation of the security identifier of the domain represented by this structure.

private int
flags

Contains a set of flags that specify more data about the domain trust.

public String
NetbiosDomainName

NetBIOS name of the domain.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True or false.
isInbound
()

The domain represented by this structure directly trusts the domain that the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function is a member of.

public boolean

Returns:

True or false.
isInForest
()

The domain represented by this structure is a member of the same forest as the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function.

public boolean

Returns:

True or false.
isNativeMode
()

The domain represented by this structure is running in the Windows 2000 native mode.

public boolean

Returns:

True or false.
isOutbound
()

The domain represented by this structure is directly trusted by the domain that the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function is a member of.

public boolean

Returns:

True or false.
isPrimary
()

The domain represented by this structure is the primary domain of the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function.

public boolean

Returns:

True or false.
isRoot
()

The domain represented by this structure is the root of a tree and a member of the same forest as the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DnsDomainNameback to summary
public String DnsDomainName

DNS name of the domain.

DomainGuidback to summary
public Guid.GUID DomainGuid

Contains the GUID of the domain represented by this structure.

DomainGuidStringback to summary
public String DomainGuidString

Contains the string representation of the GUID of the domain represented by this structure.

DomainSidback to summary
public WinNT.PSID DomainSid

Contains the security identifier of the domain represented by this structure.

DomainSidStringback to summary
public String DomainSidString

Contains the string representation of the security identifier of the domain represented by this structure.

flagsback to summary
private int flags

Contains a set of flags that specify more data about the domain trust.

NetbiosDomainNameback to summary
public String NetbiosDomainName

NetBIOS name of the domain.

Constructor Detail

DomainTrustback to summary
public DomainTrust()

Method Detail

isInboundback to summary
public boolean isInbound()

The domain represented by this structure directly trusts the domain that the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function is a member of.

Returns:boolean

True or false.

isInForestback to summary
public boolean isInForest()

The domain represented by this structure is a member of the same forest as the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function.

Returns:boolean

True or false.

isNativeModeback to summary
public boolean isNativeMode()

The domain represented by this structure is running in the Windows 2000 native mode.

Returns:boolean

True or false.

isOutboundback to summary
public boolean isOutbound()

The domain represented by this structure is directly trusted by the domain that the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function is a member of.

Returns:boolean

True or false.

isPrimaryback to summary
public boolean isPrimary()

The domain represented by this structure is the primary domain of the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function.

Returns:boolean

True or false.

isRootback to summary
public boolean isRoot()

The domain represented by this structure is the root of a tree and a member of the same forest as the server specified in the ServerName parameter of the DsEnumerateDomainTrusts function.

Returns:boolean

True or false.

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

public Class Netapi32Util.Group

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.jna.platform.win32.Netapi32Util.LocalGroup

A group.

Field Summary

Modifier and TypeField and Description
public String
name

Group name.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
public String name

Group name.

Constructor Detail

Groupback to summary
public Group()
com.sun.jna.platform.win32 back to summary

public Class Netapi32Util.LocalGroup

extends Group
Class Inheritance

A local group.

Field Summary

Modifier and TypeField and Description
public String
comment

Group comment.

Inherited from com.sun.jna.platform.win32.Netapi32Util.Group:
name

Constructor Summary

AccessConstructor and Description
public

Field Detail

commentback to summary
public String comment

Group comment.

Constructor Detail

LocalGroupback to summary
public LocalGroup()
com.sun.jna.platform.win32 back to summary

public Class Netapi32Util.User

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.jna.platform.win32.Netapi32Util.UserInfo

A user.

Field Summary

Modifier and TypeField and Description
public String
comment

Contains a comment associated with the user account.

public String
name

The name of the user account.

Constructor Summary

AccessConstructor and Description
public
User()

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commentback to summary
public String comment

Contains a comment associated with the user account.

nameback to summary
public String name

The name of the user account.

Constructor Detail

Userback to summary
public User()
com.sun.jna.platform.win32 back to summary

public Class Netapi32Util.UserInfo

extends User
Class Inheritance

Field Summary

Modifier and TypeField and Description
public int
flags

The flags of the user account

public String
fullName

The full name belonging to the user account

public WinNT.PSID
sid

The SID of the user account

public String
sidString

The SID of the user account

Inherited from com.sun.jna.platform.win32.Netapi32Util.User:
commentname

Constructor Summary

AccessConstructor and Description
public

Field Detail

flagsback to summary
public int flags

The flags of the user account

fullNameback to summary
public String fullName

The full name belonging to the user account

sidback to summary
public WinNT.PSID sid

The SID of the user account

sidStringback to summary
public String sidString

The SID of the user account

Constructor Detail

UserInfoback to summary
public UserInfo()