NPEnumResource function (npapi.h)

Performs an enumeration based on a handle returned by NPOpenEnum.


DWORD NPEnumResource(
  [in]      HANDLE  hEnum,
  [in, out] LPDWORD lpcCount,
  [out]     LPVOID  lpBuffer,
  [in, out] LPDWORD lpBufferSize


[in] hEnum

Handle obtained from an NPOpenEnum call.

[in, out] lpcCount

Pointer to the number of entries requested. It may be 0xFFFFFFFF to request as many entries as possible. If the call succeeds, this location will receive the number of entries actually read.

[out] lpBuffer

Pointer to the buffer to receive the enumeration result, which is returned as an array of NETRESOURCE entries. The buffer is valid until the next call using hEnum.

[in, out] lpBufferSize

Pointer to the size, in bytes, of the buffer passed to the function call on entry. If the buffer is too small for even one entry, this should contain, on exit, the number of bytes needed to read one entry. This value is set only if the return code is WN_MORE_DATA.

Return value

If the function succeeds, it should return WN_SUCCESS. The caller may continue to call NPEnumResource to continue the enumeration. Otherwise, it should return one of the following error codes.

Return code Description
No more entries. The enumeration was completed successfully. When this occurs, the contents of the return buffer, lpBuffer, are undefined.
The buffer is too small to hold even a single entry.
hEnum is not a valid handle.
The network is not present. This condition is checked before hEnum is tested for validity.


When this function is called, the provider should fill the buffer with the requested number of entries (or the maximum that can fit). The returned NETRESOURCE structures should be located contiguously at the head of the buffer, like an array of such structures. The pointers in these structures must point to locations within the buffer. Therefore, data referenced by these pointers should be located at the end of the buffer, after the array of structures. It is the provider's responsibility to package this information correctly.


Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header npapi.h