NetFileGetInfo

NetFileGetInfo function

Retrieves information about a particular opening of a server resource.

Syntax


NET_API_STATUS NetFileGetInfo(
  _In_  LMSTR  servername,
  _In_  DWORD  fileid,
  _In_  DWORD  level,
  _Out_ LPBYTE *bufptr
);

Parameters

servername [in]

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.

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.

ValueMeaning
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. 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 codeDescription
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]

Header

Lmshare.h (include Lm.h)

Library

Netapi32.lib

DLL

Netapi32.dll

See also

Network Management Overview
Network Management Functions
NetFile Functions
FILE_INFO_2
FILE_INFO_3
NetFileEnum

 

 

Community Additions

ADD
Show:
© 2016 Microsoft