DsGetDcOpen function
The DsGetDcOpen function opens a new domain controller enumeration operation.
Syntax
DWORD WINAPI DsGetDcOpen( _In_ LPCTSTR DnsName, _In_ ULONG OptionFlags, _In_opt_ LPCTSTR SiteName, _In_opt_ GUID *DomainGuid, _In_opt_ LPCTSTR DnsForestName, _In_ ULONG DcFlags, _Out_ PHANDLE RetGetDcContext );
Parameters
- DnsName [in]
-
Pointer to a null-terminated string that contains the domain naming system (DNS) name of the domain to enumerate the domain controllers for. This parameter cannot be NULL.
- OptionFlags [in]
-
Contains a set of flags that modify the behavior of the function. This can be zero or a combination of one or more of the following values.
Value Meaning - DS_ONLY_DO_SITE_NAME
Only site-specific domain controllers are enumerated.
- DS_NOTIFY_AFTER_SITE_RECORDS
The DsGetDcNext function will return the ERROR_FILEMARK_DETECTED value after all of the site-specific domain controllers are retrieved. DsGetDcNext will then enumerate the second group, which contains all domain controllers in the domain, including the site-specific domain controllers contained in the first group.
- SiteName [in, optional]
-
Pointer to a null-terminated string that contains the name of site the client is in. This parameter is optional and may be NULL.
- DomainGuid [in, optional]
-
Pointer to a GUID value that contains the identifier of the domain specified by DnsName. This identifier is used to handle the case of a renamed domain. If this value is specified and the domain specified in DnsName is renamed, this function attempts to enumerate domain controllers in the domain that contains the specified identifier. This parameter is optional and may be NULL.
- DnsForestName [in, optional]
-
Pointer to a null-terminated string that contains the name of the forest that contains the DnsName domain. This value is used in conjunction with DomainGuid to enumerate the domain controllers if the domain has been renamed. This parameter is optional and may be NULL.
- DcFlags [in]
-
Contains a set of flags that identify the type of domain controllers to enumerate. This can be zero or a combination of one or more of the following values.
- RetGetDcContext [out]
-
Pointer to a HANDLE value that receives the domain controller enumeration context handle. This handle is used with the DsGetDcNext function to identify the domain controller enumeration operation. This handle is passed to DsGetDcClose to close the domain controller enumeration operation.
Return value
Returns ERROR_SUCCESS if successful or a Win32 or RPC error otherwise. Possible error values include the following.
| Return code | Description |
|---|---|
|
Either OptionFlags or DcFlags contain invalid flags. |
|
One or more parameters are invalid. |
|
A memory allocation failure occurred. |
Requirements
|
Minimum supported client | Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | DsGetDcOpenW (Unicode) and DsGetDcOpenA (ANSI) |
See also
Send comments about this topic to Microsoft
Build date: 10/26/2012