The Display API functions provide an efficient means of querying lists of user accounts, global group accounts, and computer accounts. These lists are suitable for display in user interfaces.
|
Function |
Description |
|
Returns information about lists of user, global group, or computer accounts. |
|
|
Is used to determine a starting position for subsequent calls to NetQueryDisplayInformation. |
Suppose that a user interface needs to display a list of accounts. The accounts probably will be displayed in alphabetical order. If there are many accounts, they probably will not be displayed all at once. What is needed then is a way to query the accounts database for only the accounts that should be displayed. The functions in the Display category permit this sort of query.
NetGetDisplayInformationIndex is called first. Imagine that somewhere there exists a list, in alphabetical order, of all of the accounts in the accounts database. Given the name of the first account to be displayed, this function returns the position of that name in the in the alphabetical list of all accounts. That position then is passed to NetQueryDisplayInformation, which returns a buffer of information describing the accounts to display, in alphabetical order, starting with the first account to be displayed.
User accounts, global group accounts, and computer accounts all can be queried using the functions in the Display category. The type of account to query is specified when calling the functions.
The following data structures are used by NetQueryDisplayInformation to return information about user, global group, and computer accounts. The type of account being queried determines which data structure is used to return information. NET_DISPLAY_USER is used to return information about user accounts; NET_DISPLAY_MACHINE is used to return information about computer accounts; and NET_DISPLAY_GROUP is used to return information about global group accounts.
The NET_DISPLAY_USER structure has the following format:
typedef struct _NET_DISPLAY_USER {
LPTSTR usri1_name;
LPTSTR usri1_comment;
DWORD usri1_flags;
LPTSTR usri1_full_name;
DWORD usri1_user_id;
DWORD usri1_next_index;
} NET_DISPLAY_USER, *PNET_DISPLAY_USER;
usri1_name points to an ASCIIZ string containing the name of the user account that is described by this structure.
usri1_comment points to an ASCIIZ string containing the comment associated with the user.
usri1_flags describes properties of the user. This member can be the bit-wise or one of the following values from the access.h file. (Exactly one of the values UF_NORMAL_ACCOUNT and UF_TEMP_DUPLICATE_ACCOUNT is present.)
|
Manifest |
Bit Mask |
Meaning |
|
UF_SCRIPT |
0 |
This value is always set. |
|
UF_ACCOUNTDISABLE |
1 |
The user account is disabled. |
|
UF_HOMEDIR_REQUIRED |
3 |
The user must have a home directory. This has an effect only on LAN Manager servers. |
|
UF_LOCKOUT |
4 |
The user account is currently locked out (blocked). |
|
UF_PASSWRD_NOTREQD |
5 |
The user is not required to have a password. |
|
UF_PASSWRD_CANT _CHANGE |
6 |
The user cannot change its password. |
|
UF_TEMP_DUPLICATE _ACCOUNT |
8 |
The user account is a local account. |
|
UF_NORMAL_ACCOUNT |
9 |
The user account is a global account. |
|
UF_DONT_EXPIRE _PASSWORD |
16 |
The users password will never expire |
usri1_full_name points to an ASCIIZ string containing the full name of the user.
usri1_user_id specifies the relative identifier (RID) of the user. The relative identifier is determined by the accounts database when the user is created. It uniquely defines this user account within the domain.
usri1_next_index specifies the index of the next entry to return from the NetQueryDisplayInformation function. Pass this value as the Index parameter of NetQueryDisplayInformation to return the next user account in alphabetical order.
The NET_DISPLAY_MACHINE structure has the following format:
typedef struct _NET_DISPLAY_MACHINE {
LPTSTR usri2_name;
LPTSTR usri2_comment;
DWORD usri2_flags;
DWORD usri2_user_id;
DWORD usri2_next_index;
} NET_DISPLAY_MACHINE, *PNET_DISPLAY_MACHINE;
usri2_name points to an ASCIIZ string containing the name of the computer account that is described by this structure.
usri2_comment points to an ASCIIZ string containing the comment associated with the computer account.
usri2_flags indicates the type of computer account. This member can be the bit-wise or of the following values from the access.h file. (Exactly one of the values UF_WORKSTATION_TRUST_ACCOUNT and UF_SERVER_TRUST_ACCOUNT is present.)
|
Manifest |
Bit Mask |
Meaning |
|
UF_SCRIPT |
0 |
This value is always set. |
|
UF_WORKSTATION_TRUST_ACCOUNT |
12 |
The computer account is for a workstation in this domain. |
|
UF_SERVER_TRUST _ACCOUNT |
13 |
The computer account is for a server in this domain. |
usri2_user_id specifies the relative identifier (RID) of the computer account. The relative identifier is determined by the accounts database when the computer account is created. It uniquely defines this computer account within the domain.
usri2_next_index specifies the index of the next entry to return from the NetQueryDisplayInformation function. Pass this value as the Index parameter of NetQueryDisplayInformation to return the next computer account in alphabetical order.
The NET_DISPLAY_GROUP structure has the following format:
typedef struct _NET_DISPLAY_GROUP {
LPTSTR grpi3_name;
LPTSTR grpi3_comment;
DWORD grpi3_group_id;
DWORD grpi3_attributes;
DWORD grpi3_next_index;
} NET_DISPLAY_GROUP, *PNET_DISPLAY_GROUP;
grpi3_name points to an ASCIIZ string containing the name of the global group account that is described by this structure.
grpi3_comment points to an ASCIIZ string containing the comment associated with the global group account.
grpi3_group_id specifies the relative identifier (RID) of the global group account. The relative identifier is determined by the accounts database when the global group account is created. It uniquely defines this global group account within the domain.
grpi3_attributes describes aspects of the global group account. This member can be the bit-wise or one of the following values from the lmsec.h file:
|
Manifest |
Bit Mask |
|
SE_GROUP_MANDATORY |
0 |
|
SE_GROUP_ENABLED_BY_DEFAULT |
1 |
|
SE_GROUP_ENABLED |
2 |
grpi3_next_index specifies the index of the next entry to return from the NetQueryDisplayInformation function. Pass this value as the Index parameter of NetQueryDisplayInformation to return the next global group account in alphabetical order.