function WSALookupServiceNext Unit Winsockpas

Syntax

WSALookupServiceNext(hLookup: HANDLE; dwControlFlags: DWORD; var lpdwBufferLength: DWORD; lpqsResults: LPWSAQUERYSETW): Integer; stdcall;

Description

We call this function with the hLookup parameter assigned by a previous call to WSALookupServiceBegin() to retrieve the requested service information. The provider will pass back a pointer to the WSAQUERYSET record in the lpqs-Results buffer. The client should continue to call this function until it returns WSA_E_NO_MORE, indicating that all of the WSAQUERYSET records have been returned.

The dwControlFlags field specified in this function and in WSALookup-ServiceBegin() are treated as "restrictions" for the purpose of combination. The restrictions are combined between those at the invocation of WSALookup-ServiceBegin() and those at the invocation of WSALookupServiceNext(). Therefore, the flags in WSALookupServiceNext() can never increase the amount of data returned beyond what was requested in WSALookup-ServiceBegin(), although it is not an error to specify more or fewer flags. The flags specified at a given WSALookupServiceNext() apply only to that call.

The field dwControlFlags that is set either to LUP_FLUSHPREVIOUS or LUP_RES_SERVICE are exceptions to the "combined restrictions" rule (because they are "behavior" flags instead of "restriction" flags). If either of these flags are used in WSALookupServiceNext(), they have their defined effect regardless of the setting of the same flags in WSALookupServiceBegin().

For example, if LUP_RETURN_VERSION is specified in WSALookup-ServiceBegin(), the service provider retrieves records including the "version." If LUP_RETURN_VERSION is not specified at WSALookupServiceNext(), the returned information does not include the "version," even though it was available. No error is generated.

Also, if LUP_RETURN_BLOB is not specified in WSALookupServiceBegin() but is specified in WSALookupServiceNext(), the returned information does not include the private data. No error is generated.

Table 4-11 describes how the query results are represented in the WSAQUERYSET record.

Table 4-11: Query results in the WSAQUERYSET record

Table 4-11 describes how the query results are represented in the WSAQUERYSET record.

Table 4-11: Query results in the WSAQUERYSET record

WSAQUERYSET Field Name

Result Interpretation

dwSize

Will be set to the size of the WSAQUERYSET. This is used as a versioning mechanism.

lpszServiceInstanceName

Referenced string contains service name

lpServiceClassId

The GUID corresponding to the service class

lpVersion

References version number of the particular service instance

lpszComment

Optional comment string supplied by service instance

dwNameSpace

Name space in which the service instance was found

lpNSProviderId

Identifies the specific name space provider that supplied this query result

WSAQUERYSET Field Name

Result Interpretation

lpszContext

Specifies the context point in a hierarchical name space at which the service is located

dwNumberOfProtocols

Undefined for results

lpafpProtocols

Undefined for results; all needed protocol information is in the CSADDR INFO records.

lpszQueryString

When dwControlFlags includes LUP_RETURN_QUERY_STRING, this field returns the unparsed remainder of the lpszServicelnstanceName specified in the original query. For example, in a name space that identifies services by hierarchical names that specify a host name and a file path within that host, the address returned might be the host address and the unparsed remainder might be the file path. If the lpszServicelnstanceName is fully parsed and LUP_RETURN_QUERY_STRING is used, this field is NULL or points to a zero-length string.

dwNumberOfCsAddrs

Indicates the number of elements in the array of CSADDR INFO records

lpcsaBuffer

A pointer to an array of CSADDR INFO records, with one complete transport address contained within each element

dwOutputFlags

RESULT IS ALIAS flag indicates this is an alias result.

lpBlob

(Optional) A pointer to a provider-specific entity

Parameters hLookup: Handle returned from the previous call to WSALookupServiceBegin() dwControlFlags: Flags to control the next operation. Currently only LUP_

0 0

Post a comment

  • Receive news updates via email from this site