Platform SDK: Network Management

NetFileGetInfo

The NetFileGetInfo function retrieves information about a particular opening of a server resource.

Security Requirements

Only members of the Administrators or Account Operators local group can successfully execute the NetFileGetInfo function.

NET_API_STATUS NetFileGetInfo(
  LPWSTR servername,  
  DWORD fileid,       
  DWORD level,        
  LPBYTE *bufptr      
);

Parameters

servername
[in] Pointer to a Unicode string specifying the name of the remote server on which the function is to execute. The string must begin with \\. If this parameter is NULL, the local computer is used.
fileid
[in] Specifies the file identifier of the open resource for which to return information. The value of this parameter must have been returned in a previous enumeration call. For more information, see the following Remarks section.
level
[in] Specifies the information level of the data. This parameter can be one of the following values.
Value Meaning
2 Return the file identification number. The bufptr parameter is a pointer to a FILE_INFO_2 structure.
3 Return the file identification number and other information about the file. The bufptr parameter is a pointer to a FILE_INFO_3 structure.

bufptr
[out] Pointer to the address of the buffer that receives the information. The format of this data depends on the value of the level parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function.

Return Values

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_FILE_NOT_FOUND The file was not found.
ERROR_INVALID_LEVEL The value specified for the level parameter is invalid.
ERROR_NOT_ENOUGH_MEMORY Insufficient memory is available.
NERR_BufTooSmall The supplied buffer is too small.

Remarks

You can call the NetFileEnum function to retrieve information about multiple files open on a server.

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 NetFileGetInfo. For more information, see IADsResource and IADsFileServiceOperations.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Unsupported.
  Header: Declared in Lmshare.h; include Lm.h.
  Library: Use Netapi32.lib.

See Also

Network Management Overview, Network Management Functions, NetFile Functions, FILE_INFO_2, FILE_INFO_3, NetFileEnum