For both 16-bit and 32-bit applications, each buffer length (specified by usBuflen or ulBuflen) is limited to 64KB. The exceptions are Net32AliasEnum and Net32UserEnum (OS/2 only), which can return greater than 64KB. For DSS only, all Net32User and Net32Group APIs support buffers larger than 64KB.
When a data structure contains one or more pointers to variable-length data (such as an ASCIIZ string) and is passed between an application and an API, that application must provide a buffer large enough to store both the fixed-length and variable-length data. (Buffer size is specified by the 16-bit usBuflen or 32-bit ulBuflen parameters.) Otherwise, not all of the data can be passed or returned. If the buffer is too small for the fixed-length data, the API returns NERR_BufTooSmall.
If a buffer is too small to hold all variable-length data associated with a structure, your application should notify the API that no variable-length data is being passed. This is done by specifying NULL pointers to the variable-length data.
If an application calls an API that could return more variable-length data than the buffer can store, that API returns as much data as possible, setting any pointers to data not returned to NULL. In this case, the API also returns the code ERROR_MORE_DATA (value 234) and the number of bytes required to store all available data (in the pusBytesAvail or pulBytesAvail value). For some APIs, you can get all the data you want by repeatedly calling the API, such as NetFileEnum2 (or Net32FileEnum2). LAN Server provides a sample program (FILEEN32.C) demonstrating this feature of Net32FileEnum2. See Sample Programs for an overview of the sample programs provided with LAN Server.
For XXXGetInfo APIs, you can determine the necessary buffer size by calling the GetInfo API with the level parameter set to the level of data structure you want and usBuflen (or ulBuflen) set to 0. In this case, the GetInfo API returns the number of bytes available from that API in the pusBytesAvail (or pulBytesAvail) value. Then you can call the same API again and allocate a buffer size (usBuflen or ulBuflen) at least as large as the returned bytes available.
Note: This technique should not be used on DSS for NetUser, NetGroup, NetApp, or NetAlias APIs because it may affect the performance of your application.
Exception