Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Aufruf von _NetShareAdd unter Windows 2000


2 replies to this topic

trutmrol

trutmrol
  • Members
  • 94 posts

Posted 02 April 2002 - 15:37

Hallo,
kann mir jemand sagen wie die Parameter zusammmen gesetzt sind
fuer _NetShareAdd damit  das Verzeichnis: 'TEST$'  die Zugriffsrechte

'Authenticated Users' mit 'Read' bekommen?

Danke fuer die Hinweise.



MKaiser

MKaiser
  • Full Members
  • 88 posts

Posted 03 April 2002 - 17:00

Moin,schonmal das MSDN bemüht?

Auszug:

The NetShareAdd function shares a server resource.

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

Windows NT/2000/XP: The parameter order is as follows.

NET_API_STATUS NetShareAdd(
 LPWSTR servername,
 DWORD level,      
 LPBYTE buf,        
 LPDWORD parm_err  
);
Windows 95/98/Me: You must specify the size of the information buffer, in bytes, using the cbBuffer parameter. The Windows NT/Windows 2000/Windows XP parm_err parameter is not available on this platform. Therefore, the parameter list is as follows.

extern API_FUNCTION
NetShareAdd(
 const char FAR * pszServer,      
 short sLevel,                    
 const char FAR * pbBuffer,        
 unsigned short  cbBuffer          
);
Parameters
servername
[in] Pointer to a Unicode (Windows NT/2000/XP) or ANSI (Windows 95/98/Me) string specifying the name of the remote server on which the function is to execute. The string must begin with \\. If this parameter is NULL, the local computer is used.
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. Value Meaning
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. Value Meaning
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 DWORD 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.

Value Meaning
ERROR_ACCESS_DENIED The user does not have access to the requested information.
ERROR_INVALID_LEVEL The value specified for the level parameter is invalid.  
ERROR_INVALID_NAME The character or file system name is invalid.
ERROR_INVALID_PARAMETER The specified parameter is invalid.
NERR_DuplicateShare The share name is already in use on this server.
NERR_RedirectedPath The operation is invalid for a redirected resource. The specified device name is assigned to a shared resource.
NERR_UnknownDevDir The device or directory does not exist.


Remarks
Windows 95/98/Me: See the NetShareAdd Sample (Windows 95/98) topic to view a code sample that demonstrates how to use the NetShareAdd function.

Windows NT/2000/XP: The following code sample demonstrates how to share a network resource using a call to the NetShareAdd function. The code sample fills in the members of the SHARE_INFO_2 structure and calls NetShareAdd, specifying information level 2.

trutmrol

trutmrol
  • Members
  • 94 posts

Posted 05 April 2002 - 15:02

Mit NetShareAdd konnte ich unter Windows 2000 nur den Share einrichenten
und die Security kann man hier nicht  veraendern!!

Frage: Hat jemand schon die Security von Verzeichnise während des Setup's
            veraendert und wie ist die Schnittstelle dazu?


Besten Dank fuer die Hinweise!
Thanks, Roland