NetFileGetInfo function (lmshare.h)

Retrieves information about a particular opening of a server resource.


  [in]  LMSTR  servername,
  [in]  DWORD  fileid,
  [in]  DWORD  level,
  [out] LPBYTE *bufptr


[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
Return the file identification number. The bufptr parameter is a pointer to a FILE_INFO_2 structure.
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
The user does not have access to the requested information.
The file was not found.
The value specified for the level parameter is not valid.
Insufficient memory is available.
The supplied buffer is too small.


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.


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



NetFile Functions


Network Management Functions

Network Management Overview