Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function continues a network-resource enumeration started by the WNetOpenEnumfunction.

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 NETRESOURCEstructures. The buffer is valid until the next call using the handle given by the hEnumparameter. The order of NETRESOURCEstructures in the array is not predictable.

lpBufferSize

[in, out] Long pointer to a variable that specifies the size, in bytes, of the lpBufferparameter. If the buffer is too small to receive even one entry, this parameter receives the required size of the buffer.

Return Value

ERROR_SUCCESS indicates that the enumeration succeeded, and the buffer contains the requested data. The calling application can continue to call WNetEnumResourceto 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 GetLastErrorerror 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 hEnumparameter is not valid.

ERROR_INVALID_PARAMETER

One or more parameters contain invalid values.

ERROR_NO_NETWORK

No network is present. This condition is tested before hEnumis tested for validity.

The function returns error values for compatibility with Windows for Workgroups. For compatibility with the Microsoft Win32® API, the function also sets the error value returned by GetLastError.

Remarks

An application cannot set the lpBufferparameter to NULL and retrieve the required buffer size from the lpBufferSizeparameter. Instead, the application should allocate a buffer of a reasonable size — 16 kilobytes (K) is typical — and use the value of lpBufferSizefor error detection.

Requirements

Header winnetwk.h
Library coredll.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

NETRESOURCE