wntShareAdd

Shares a resource.

 
Syntax:

wntShareAdd(server-name, resource, share-name,share-type, max-users)

Parameters:

(s) server-name: name of a network file server or empty string ("") to indicate the current machine.

(s) resource: identifies the object to be shared. Resource can be a directory name (e.g., "c:\util"), a printer object (e.g., "HP LaserJet III"), or the name  of a sharable device.

(s) share-name: name by which other users will access the resource.

(i) share-type: identifies the type of the 'resource' object. 0 = directory, 1 = printer, 2 = device, 3 = IPC shares and 2147483648 = special shares

(i) max-users: the maximum number of users allowed, or -1 for the highest possible number.

Returns:

(s) 1.

 

If the 'share-type' is 1 for printer both the 'server-name' and 'max-users' are ignored. Set 'server-name' to a blank string ("") and 'max-users' to -1.

 

If the 'share-type' is 3 when adding Special shares like "ADMIN$" it is necessary to specify an empty string as the resource name; WinNT/2K/XP will take care of associating the proper resource name with the special share name.

 

Note: Only members of the Administrators or Account Operators local group or those with Communication, Print, or Server operator group membership can successfully execute this function. The Print operator can add only Printer queues. The Communication operator can add only communication-device queues.

 

Example:
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

; This example adds a share called "Public" to the C:\TEMP ; directory. It sets max-users to -1 to provide unlimited ; concurrent access to the directory. wntShareAdd("","C:\TEMP","Public",0,-1) Exit
See Also:

wntShareDel, wntShareSet