NetFileClose function (lmshare.h)

Forces a resource to close. This function can be used when an error prevents closure by any other means. You should use NetFileClose with caution because it does not write data cached on the client system to the file before closing the file.

Syntax

NET_API_STATUS NET_API_FUNCTION NetFileClose(
  [in] LMSTR servername,
  [in] DWORD fileid
);

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 opened resource instance to close.

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.

Remarks

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

Requirements

Requirement Value
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