Share Category

The functions in the Share category control shared resources.

Function

Description

NetShareAdd

Shares a resource on a server.

NetShareAdd32

This function is the same as NetShareAdd except that it uses 32-bit data structures, is RPC-based, and supports additional information levels.

NetShareCheck

Queries whether a server is sharing a device.

NetShareCheck32

This function is the same as NetShareCheck except that it is RPC-based.

NetShareDel

Deletes a share name from a server’s list of shared resources.

NetShareDel32

This function is the same as NetShareDel except that it is RPC-based.

NetShareEnum

Retrieves share information about each shared resource on a server.

NetShareEnum32

This function is the same as NetShareEnum except that it uses 32-bit data structures, is RPC-based, supports additional information levels, and is resumable.

NetShareGetInfo

Retrieves information about a specified shared resource on a server.

NetShareGetInfo32

This function is the same as NetShareGetInfo except that it uses 32-bit data structures, is RPC-based, and supports additional information levels.

NetShareSetInfo

Sets a shared resource’s parameters.

NetShareSetInfo32

This function is the same as NetShareSetInfo except that it uses 32-bit data structures, is RPC-based, and supports additional information levels.

A shared resource refers to a server’s local resource (for example, a disk drive, print device, or named pipe) that other applications on the network can access. A unique share name is assigned to each shared resource to enable remote users and applications to refer to the shared resource, rather than the share’s local device name.

When allowing remote users and applications to access a server resource, you must first share the resource by assigning it a share name. NetShareAdd and NetShareAdd32 add a share to a server.

NetShareAdd and NetShareAdd32 require only a share name and a local device name to share a resource. A user or application must have an account on the server to access the resource.

For information on setting up user accounts on servers, see User Category. For information on assigning permissions in, see Access Permissions Category.

In addition to providing for the sharing of normal resources, Advanced Server defines special shares necessary for interprocess communications (IPC) and remote administration of the server. The types of special shares are defined as follows:

Share Category Data Structures

Share information can be returned by the NetShareEnum and NetShareGetInfo functions at one of three levels of detail (0, 1, and 2) specified by the sLevel parameter. NetShareAdd requires level 2 detail. NetShareSetInfo can be called with level 1 or 2.

Share information can be retrieved by NetShareEnum32 and NetShareGetInfo32 at levels 0, 1, 2, and 502.

NetShareAdd32 requires levels 2 or 502.

NetShareSetInfo32 can be called with levels 1, 2, 502, 1004, 1006, and 1501.

Share Information (level 0)

The share_info_0 data structure that can be returned by NetShareEnum or NetShareGetInfo has the following format:

Within this structure, shi0_netname is an ASCIIZ string containing the share name of a resource.

The SHARE_INFO_0 data structure that can be used by NetShareEnum32 or NetShareGetInfo32 has the following format:

Within this structure, all parameters are defined in the same way as in the share_info_0 data structure.

Share Information (level 1)

The share_info_1 data structure that can be used by NetShareEnum, NetShareGetInfo, or NetShareSetInfo has the following format:

Within this structure, the following parameters are defined:

shi1_netname is an ASCIIZ string containing the share name of a resource. NNLEN is defined in the netcons.h header file.

shi1_pad1 word-aligns the data structure components.

shi1_type is one of four values specifying the type of share, as defined in the shares.h file as follows:

Manifest

Value

Meaning

STYPE_DISKTREE

0

Disk drive

STYPE_PRINTQ

1

Print queue

STYPE_DEVICE

2

Character device

STYPE_IPC

3

Interprocess communications (IPC)

shi1_remark points to an ASCIIZ string containing an optional comment about the shared resource.

The SHARE_INFO_1 data structure that can be used by NetShareEnum32, NetShareGetInfo32, or NetShareSetInfo32 has the following format:

Within this structure, all parameters are defined in the same way as in share_info_1 data structure.

Share Information (level 2)

The share_info_2 data structure that can be used by NetShareEnum, NetShareGetInfo, NetShareSetInfo, or NetShareAdd has the following format:

Within this structure, the following parameters are defined:

shi2_netname through shi2_remark are the same as the corresponding elements of the share_info_1 data structure. For a complete description, see Share Information (level 1).

shi2_max_uses gives the maximum number of concurrent connections that the shared resource can accommodate (unlimited if the shi2_max_uses value is -1).

shi2_current_uses specifies how many connections are currently made to the resource.

shi2_path points to an ASCIIZ string containing the shared resource’s local path name. For disks, shi2_path is the path being shared. For print queues, shi2_path is the name of the print queue being shared.

shi2_pad2 word-aligns the data structure components.

The SHARE_INFO_2 data structure that can be used by NetShareEnum32, NetShareGetInfo32, NetShareAdd32, or NetShareSetInfo32 has the following format:

Within this structure, all parameters are defined in the same way as in share_info_2 data structure.

Share Information (level 502)

The SHARE_INFO_502 data structure that can be used by NetShareEnum32, NetShareGetInfo32, NetShareAdd32, or NetShareSetInfo32 has the following format:

Within this structure, the following parameters are defined:

shi502_netname through shi502_password are the same as the corresponding elements in the SHARE_INFO_2 data structure.

shi502_security_descriptor specifies the security descriptor for this shared resource.

The following info levels are only valid for NetShareSetInfo32 and replace the older way of passing in a Parmnum to set a specific field.

The following information structures also are supported on down-level systems such as LAN Manager 2.x .

Share Information (level 1004)

The SHARE_INFO_1004 data structure has the following format:

Within this structure, shi1004_remark points to an ASCIIZ string containing an optional comment about the shared resource.

Share Information (level 1006)

The SHARE_INFO_1006 data structure has the following format:

Within this structure, shi1006_max_uses specifies the maximum number of concurrent connections that the shared resource can accommodate.

The following information structure is supported only on Windows NT.

Share Information (level 1501)

The SHARE_INFO_1501 data structure has the following format:

Within this structure, shi1501_security_descriptor specifies the security descriptor for this shared resource.

For NetShareSetInfo32, parmnum values refer to the fields in the SHARE_INFO structure as follows. These values are used when indicating an error in a specific parameter using parm_err.

parmnum value

Field in share_info struct

SHARE_NETNAME_PARMNUM

shi_netname

SHARE_TYPE_PARMNUM

shi_type

SHARE_REMARK_PARMNUM

shi_remark

SHARE_PERMISSIONS_PARMNUM

shi_permissions

SHARE_MAX_USES_PARMNUM

shi_max_uses

SHARE_CURRENT_USES_PARMNUM

shi_current_uses

SHARE_PATH_PARMNUM

shi_path

SHARE_PASSWD_PARMNUM

shi_passwd

SHARE_FILE_SD_PARMNUM

shi_security_descriptor

Previous Page Page Top Index Next Page See Page