WNetEnumResource

Perform an enumeration based on handle returned by WNetOpenEnum.

DWORD WNetEnumResource (
    HANDLE hEnum,
    LPDWORD lpcCount,
    LPVOID lpBuffer,
    LPDWORD lpBufferSize
    );
 
hEnum
This must be a handle obtained from WNetOpenEnum call.
lpcCount
Specifies the number of entries requested. It may be 0xFFFFFFFF to request as many as possible. On successful call, this location will receive the number of entries actually read.
lpBuffer
A pointer to the buffer to receive the enumeration result, which are returned as an array of NETRESOURCE entries.
lpBufferSize
This specifies the size of the buffer passed to the function call. If the buffer is too small to receive even one entry, this variable receives the required size of the buffer.
WN_NO_MORE_ENTRIES no more entries found (the contents of the return buffer is undefined).

Other error codes include:

WN_MORE_DATA the buffer is too small even for one entry
WN_BAD_HANDLE hEnum is not a valid handle.
WN_FUNCTION_BUSY The MPR or NP is busy (possibly initializing). The caller should retry.
WN_NO_NETWORK network is not present. This condition is checked for before hEnum is tested for validity.
WN_EXTENDED_ERROR a network specific error occurred. WNetGetLastError should be called to obtain a description of the error.