DWORD WNetEnumResource(hEnum, lpcEntries, lpvBuffer, lpcbBuffer) | |||||
HANDLE hEnum; | /* enumeration handle returned by WNetOpenEnum | */ | |||
LPDWORD lpcEntries; | /* number of entries to list | */ | |||
LPVOID lpvBuffer; | /* pointer to buffer for results | */ | |||
LPDWORD lpcbBuffer; | /* size of the buffer | */ |
The WNetEnumResource function continues a network-resource enumeration started by the WNetOpenEnum function.
hEnum
Identifies an enumeration instance. This handle must have been returned by the WNetOpenEnum function.
lpcEntries
Points 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 completes successfully, the variable at lpcEntries contains the number of entries actually read.
lpvBuffer
Points 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.
lpcbBuffer
Points to a variable that specifies the size (in bytes) of lpvBuffer. If the buffer is too small, this variable receives the required size of the buffer.
If the function is successful, the return value is one of the following values:
Value | Meaning |
NO_ERROR | The enumeration was successful, and the buffer contains the requested data. The caller can continue to call the WNetEnumResource function to complete the enumeration. |
ERROR_NO_MORE_ITEMS | There are no more entries. The buffer contents are undefined. |
If the return value is not NO_ERROR or ERROR_NO_MORE_ITEMS, it is an error code, which may be one of the following:
Value | Meaning |
ERROR_MORE_DATA | The buffer is too small for even one entry. |
ERROR_INVALID_HANDLE | The handle given by the hEnum parameter is not valid. |
ERROR_NO_NETWORK | No network is present. This condition is tested before hEnum is tested for validity. |
ERROR_EXTENDED_ERROR | A network-specific error occurred. Use the WNetGetLastError function to obtain a description of the error. |
This function returns error codes for compatibility with Windows 3.1. For compatibility with Win32, the function also sets the error-code value returned by the GetLastError function.
An application cannot set the lpvBuffer to NULL and retrieve the required buffer size from the lpcbBuffer parameter. Instead, the application should allocate a buffer of a reasonable size (16K is typical) and use the value of lpcbBuffer for error-detection.
NETRESOURCE, WNetCloseEnum, WNetOpenEnum