Platform SDK: Network Management |
The NetFileEnum function returns information about some or all open files on a server, depending on the parameters specified.
Only members of the Administrators or Account Operators local group can successfully execute the NetFileEnum function.
Windows NT/2000: The parameter order is as follows.
NET_API_STATUS NetFileEnum( LPWSTR servername, LPWSTR basepath, LPWSTR username, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, PDWORD_PTR resume_handle );
Windows 95/98: The calling application must use the cbBuffer parameter to specify the size, in bytes, of the information buffer pointed to by the pbBuffer parameter. (The cbBuffer parameter replaces the Windows NT/Windows 2000 prefmaxlen parameter.) Neither a user name parameter nor a resume handle parameter is available on this platform. Therefore, the parameter list is as follows.
extern API_FUNCTION NetFileEnum( const char FAR * pszServer, const char FAR * pszBasePath, short sLevel, char FAR * pbBuffer, unsigned short cbBuffer, unsigned short FAR * pcEntriesRead, unsigned short FAR * pcTotalAvail );
Value | Meaning |
---|---|
2 | Windows NT/2000: Return the file identification number. The bufptr parameter points to an array of FILE_INFO_2 structures. |
3 | Windows NT/2000: Return information about the file. The bufptr parameter points to an array of FILE_INFO_3 structures. |
50 | Windows 95/98: Return information about the file. The returned buffer contains an array of file_info_50 structures. |
Windows NT/2000: This buffer is allocated by the system and must be freed using the NetApiBufferFree function. Note that you must free the buffer even if the function fails with ERROR_MORE_DATA.
Windows 95/98: The caller must allocate and deallocate this buffer.
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value can be one of the following error codes.
Value | Meaning |
---|---|
ERROR_ACCESS_DENIED | The user does not have access to the requested information. |
ERROR_INVALID_LEVEL | The value specified for the level parameter is invalid. |
ERROR_MORE_DATA | More entries are available. Specify a large enough buffer to receive all entries. |
ERROR_NOT_ENOUGH_MEMORY | Insufficient memory is available. |
NERR_BufTooSmall | The supplied buffer is too small. |
You can call the NetFileGetInfo function to retrieve information about a particular opening of a server resource.
If you are programming for Active Directory, you may be able to call certain Active Directory Service Interface (ADSI) methods to achieve the same functionality you can achieve by calling NetFileEnum. For more information, see IADsResource and IADsFileServiceOperations.
Windows 95/98: See the NetFileEnum Sample (Windows 95/98) topic to view a code sample that demonstrates how to use the NetFileEnum function.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Lmshare.h (Windows NT/2000) or Svrapi.h (Windows 95/98); include Lm.h (Windows NT/2000).
Library: Use Netapi32.lib (Windows NT/2000) or Svrapi.lib (Windows 95/98).
Network Management Overview, Network Management Functions, NetFile Functions, FILE_INFO_2, FILE_INFO_3, file_info_50, NetFileGetInfo