A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z



NetShareAdd

The NetShareAdd function shares a server resource.

VB4-32,5,6
Public Declare Function NetShareAdd Lib "netapi32.dll" (ByVal servername As Any, ByVal slevel As Long, buf As SHARE_INFO_502, ByVal cbbuf As Long) As Long

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later

Library
Netapi32

Parameter Information
- 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.
Windows NT 4.0 and earlier: This string must begin with \\.

- level
[in] Specifies the information level of the data. This parameter can be one of the following values.
Windows NT/2000/XP: The following levels are valid.
2
Specifies information about the shared resource, including name of the resource, type and permissions, and number of connections. The buf parameter points to a SHARE_INFO_2 structure.
502
Specifies information about the shared resource, including name of the resource, type and permissions, number of connections, and other pertinent information. The buf parameter points to a SHARE_INFO_502 structure.

Windows 95/98/Me: The following level is valid.
50
Specifies information about the shared resource, including the name and type of the resource, a comment associated with the resource, and passwords. The pbBuffer parameter points to a share_info_50 structure. Note that the string you specify in the shi50_path member must contain only uppercase characters. If the path contains lowercase characters, calls to NetShareAdd can fail with NERR_UnknownDevDir or ERROR_BAD_NET_NAME.

- buf
[in] Pointer to the buffer that specifies the data. The format of this data depends on the value of the level parameter.

- parm_err
[out] Pointer to a value that receives the index of the first member of the share information structure that causes the ERROR_INVALID_PARAMETER error. If this parameter is NULL, the index is not returned on error. For more information, see the NetShareSetInfo function.

Return Values
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.

Last update: 07 April 2006