NetFileGetInfo function (lmshare.h)

Retrieves information about a particular opening of a server resource.

Syntax

NET_API_STATUS NET_API_FUNCTION NetFileGetInfo(
  [in]  LMSTR  servername,
  [in]  DWORD  fileid,
  [in]  DWORD  level,
  [out] LPBYTE *bufptr
);

Parameters

[in] servername

Pointer to a string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used.

This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined.

[in] fileid

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.

[in] level

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.

[out] bufptr

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. For more information, see Network Management Function Buffers and Network Management Function Buffer Lengths.

Return value

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.

Return code Description
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 not valid.
ERROR_NOT_ENOUGH_MEMORY
Insufficient memory is available.
NERR_BufTooSmall
The supplied buffer is too small.

Remarks

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

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

   
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header lmshare.h (include Lm.h)
Library Netapi32.lib
DLL Netapi32.dll

See also

FILE_INFO_2

FILE_INFO_3

NetFile Functions

NetFileEnum

Network Management Functions

Network Management Overview