4.1 Example of ResumeHandle

The client calls the NetrFileEnum method to enumerate all open files on a server named "wingtiptoys". There are five open files on the server "wingtiptoys".

The client calls the NetrFileEnum method with the ServerName parameter equal to "wingtiptoys", and the Level field of the FILE_ENUM_STRUCT structure that is passed in the InfoStruct parameter is set to 0x00000003. The client also sets the PreferedMaximumLength parameter to 0x00000100 and passes a non-NULL pointer in the TotalEntries parameter and the ResumeHandle parameter.

If, for example, only the information for the first two open files fits into 0x00000100 bytes, when the server receives this method, it executes the method locally and returns ERROR_MORE_DATA. The server returns the information for the first two open files in the InfoStruct parameter. It also sets the value of TotalEntries to 0x00000005 and the value of ResumeHandle to 0x00000120. The value of ResumeHandle is implementation-specific.

To continue enumerating the open files, the client calls the NetrFileEnum method with ServerName equal to "wingtiptoys", and the Level field of the FILE_ENUM_STRUCT structure that is passed in the InfoStruct parameter is set to 0x00000003. The client also sets the PreferedMaximumLength parameter to MAX_PREFERRED_LENGTH and passes a non-NULL pointer as TotalEntries. The client also passes the unchanged value of ResumeHandle (0x000000120).

On receiving this method, the server executes the method locally to continue enumeration based on a ResumeHandle value of 0x00000120 and returns ERROR_SUCCESS. The server returns the names of the next three open files in the InfoStruct parameter. It also sets the value of TotalEntries to 0x00000003. The value of ResumeHandle is irrelevant.