Platform SDK: Network Management

NetAccessCheck

Windows 95/98: The NetAccessCheck function verifies that a user has permission to perform a specified operation on a particular resource.

Windows NT/2000: The NetAccessCheck function is obsolete on Windows NT/Windows 2000. Win32-based applications should use the AccessCheck function.

Security Requirements

Requires Admin privilege to successfully execute on a computer that has local security enabled.

extern API_FUNCTION
 NetAccessCheck(
  char FAR *pszReserved, 
  char FAR *pszUserName, 
  char FAR *pszResource, 
  unsigned short usOperation, 
  unsigned short FAR *pusResult 
);

Parameters

pszReserved
This parameter is reserved. It must be NULL.
pszUserName
Pointer to a string that contains a user name.
pszResource
Pointer to a string that contains the name of the network resource.
usOperation
Describes the type of access operation requested. This member can be a combination of the following values.
Value Meaning
ACCESS_READ Permission to read data from a resource and, by default, to execute the resource.
ACCESS_WRITE Permission to write data to the resource.
ACCESS_CREATE Permission to create an instance of the resource (such as a file); data can be written to the resource when the resource is created.
ACCESS_EXEC Permission to execute the resource.
ACCESS_DELETE Permission to delete the resource.
ACCESS_ATRIB Permission to modify the resource's attributes (such as the date and time when a file was last modified).
ACCESS_PERM Permission to modify the permissions (read, write, create, execute, and delete) assigned to a resource for a user or application.
ACCESS_ALL Permission to read, write, create, execute, and delete resources, and to modify their attributes and permissions.
ACCESS_GROUP Permission for a particular group; this value indicates that the entry is for a group.
ACCESS_NONE The user does not have access to the resource.

pusResult
Pointer to an unsigned short integer that receives a value indicating whether the operation is allowed. This parameter is valid only when the NetAccessCheck function returns NERR_Success. If the user specified by the pszUserName parameter has the required permissions, and the operation is allowed, the value of this parameter is set to zero. In other instances, this parameter is set to ERROR_ACCESS_DENIED.

Return Values

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a Win32 API error code. For a list of error codes, see Error Codes.

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Lmaccess.h (Windows NT/2000) or Svrapi.h (Windows 95/98); include Lm.h (Windows NT/2000).
  Library: Use Netapi32.lib (Windows NT/2000) or Svrapi.lib (Windows 95/98).

See Also

Network Management Overview, Network Management Functions, Access Functions, NetAccessEnum, NetAccessGetInfo