This function continues a network-resource enumeration started by the WNetOpenEnum function.
At a Glance
Header file: | Winnetwk.h |
Windows CE versions: | 2.0 and later |
Syntax
DWORD WNetEnumResource( HANDLE hEnum, LPDWORD lpcCount,
LPVOID lpBuffer, LPDWORD lpBufferSize);
Parameters
hEnum
[in] Handle to an enumeration instance. This handle must be returned by WNetOpenEnum.
lpcCount
[in/out] Long pointer to a variable specifying the number of entries requested. If the number requested is 0xFFFFFFFF, the function returns as many entries as possible.
When the function finishes successfully, the variable pointed to by this parameter contains the number of entries actually read.
lpBuffer
[in] Long pointer to the buffer that receives the enumeration results, which are returned as an array of NETRESOURCE structures. The buffer is valid until the next call using the handle given by the hEnum parameter. The order of NETRESOURCE structures in the array is not predictable.
lpBufferSize
[in/out] Long pointer to a variable that specifies the size, in bytes, of the lpBuffer parameter. If the buffer is too small to receive even one entry, this parameter receives the required size of the buffer.
Return Values
ERROR_SUCCESS indicates that the enumeration succeeded, and the buffer contains the requested data. The calling application can continue to call WNetEnumResource to complete the enumeration. ERROR_NO_MORE_ITEMS indicates that there are no more entries. In this case, the buffer contents are undefined. An error value indicates failure. To get extended error information, call GetLastError. Possible GetLastError error values are described in the following table.
Value | Description |
ERROR_MORE_DATA | More entries are available with subsequent calls. |
ERROR_INVALID_HANDLE | The handle specified by the hEnum parameter is not valid. |
ERROR_NO_NETWORK | No network is present. This condition is tested before hEnum is tested for validity. |
The function returns error values for compatibility with Windows for Workgroups. For compatibility with the Win32 API, the function also sets the error value returned by GetLastError.
Remarks
An application cannot set the lpBuffer parameter to NULL and retrieve the required buffer size from the lpBufferSize parameter. Instead, the application should allocate a buffer of a reasonable size—16 kilobytes (K) is typical—and use the value of lpBufferSize for error detection.