Network Share Functions
The network share functions control shared resources. A shared resource is a local resource on a server (for example, a disk directory, print device, or named pipe) that can be accessed by users and applications on the network.
The share functions are listed following.
Function | Description |
---|---|
NetShareAdd | Shares a resource on a server. |
NetShareCheck | Queries whether a server is sharing a device. |
NetShareDel | Deletes a share name from a server's list of shared resources. |
NetShareEnum | Retrieves share information about each shared resource on a server. |
NetShareGetInfo | Retrieves information about a specified shared resource on a server. |
NetShareSetInfo | Sets a shared resource's parameters. |
The NetShareAdd function allows a user or application to share a resource of a specific type using the specified share name. The NetShareAdd function requires the share name and local device name to share the resource. A user or application must have an account on the server to access the resource.
You can also specify a security descriptor to be associated with a share. Security descriptors specify which users are allowed to access files through the share, and with what type of access. Specify a SECURITY_DESCRIPTOR with the SHARE_INFO_502 information level when calling NetShareAdd or NetShareSetInfo. NetShareSetInfo supports the SHARE_INFO_1501 information level. For more information about security descriptors, see Access Control.
The network management functions use the following special share names for interprocess communication (IPC) and remote administration of the server:
- IPC$, reserved for interprocess communication
- ADMIN$, reserved for remote administration
- A$, B$, C$ (and other local disk names followed by a dollar sign), assigned to local disk devices
To list all connections made to a shared resource on a server, or to list all connections established from a particular computer, call the NetConnectionEnum function. You can call NetConnectionEnum at the CONNECTION_INFO_0 and CONNECTION_INFO_1 information levels.
Share functions are available at the following information levels:
The following information levels are valid only for NetShareSetInfo:
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 the network management share functions. For more information, see IADsFileShare.