网站首页  词典首页

请输入您要查询的函数:

 

术语 netsharedel
释义 NetShareDel
语法:
C++
NET_API_STATUS NetShareDel(
__in LMSTR servername,
__in LMSTR netname,
DWORD reserved
);
NetShareDel功能
Deletes a share name from a server's list of shared resources, disconnecting all connections to the shared resource.
扩展的功能NetShareDelEx允许调用指定SHARE_INFO_0,SHARE_INFO_1,SHARE_INFO_2,SHARE_INFO_502,或SHARE_INFO_503结构。
参数
服务器名 [in]
指针指向一个字符串,它指定的DNS或NetBIOS的远程服务器上的功能是执行的名称。如果该参数为NULL,则使用本地计算机。
这个字符串是Unicode或FORCE_UNICODE如果_WIN32_WINNT定义。
网络实名 [in]
一个字符串指针,指定共享的名称删除。
这个字符串是Unicode或FORCE_UNICODE如果_WIN32_WINNT定义。
保留
保留,必须为零。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_ACCESS_DENIEDThe用户没有获得所需的信息。
ERROR_INVALID_PARAMETERThe指定的参数无效。
ERROR_NOT_ENOUGH_MEMORYInsufficient内存可用。
NERR_NetNameNotFoundThe共享名称不存在。
备注
此功能仅适用于服务器消息块(SMB)的股票。对于其他类型的股票,如分布式文件系统(DFS)或WebDAV共享,使用Windows网络(WNet)功能,它支持所有类型的股份。
系统管理员,服务器操作员,或Power Users只有会员本地组,或服务器操作员组成员的,可以成功地删除文件,以函数调用的NetShareDel股。打印操作员可以删除打印机共享。
如果您是Active Directory的程序,您可以调用某些Active Directory服务接口(ADSI)的方法来达到同样的功能,您可以通过调用实现网络管理共享功能。有关更多信息,请参阅IADsFileShare。
实例
下面的代码示例演示如何删除共享使用调用NetShareDel功能。
#define UNICODE
#include
#include
#include
#pragma comment(lib, "Netapi32.lib");
void wmain( int argc, TCHAR *argv[ ])
{
NET_API_STATUS res;
if(argc<3)
printf("Usage: NetShareDel server share\\n");
else
{
//
// Call the NetShareDel function to delete the share.
//
res=NetShareDel(argv[1], argv[2], 0);
//
// Display the result of the call.
//
if(res==0)
printf("Share Removed.\\n");
else
printf("Error: %u\\n", res);
}
return;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmshare.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
网络共享功能
NetShareAdd
NetShareDelEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==NetShareDel Function
Deletes a share name from a server's list of shared resources, disconnecting all connections to the shared resource.
The extended function NetShareDelEx allows the caller to specify a SHARE_INFO_0 , SHARE_INFO_1 , SHARE_INFO_2 , SHARE_INFO_502 , or SHARE_INFO_503 structure.
Syntax
C++
NET_API_STATUS NetShareDel(
__in LMSTR servername,
__in LMSTR netname,
DWORD reserved
);
Parameters
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.
This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined.
netname [in]
Pointer to a string that specifies the name of the share to delete.
This string is Unicode if _WIN32_WINNT or FORCE_UNICODE is defined.
reserved
Reserved, must be zero.
Return Value
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.
Return codeDescription
ERROR_ACCESS_DENIEDThe user does not have access to the requested information.
ERROR_INVALID_PARAMETERThe specified parameter is not valid.
ERROR_NOT_ENOUGH_MEMORYInsufficient memory is available.
NERR_NetNameNotFoundThe share name does not exist.

Remarks
This function applies only to Server Message Block (SMB) shares. For other types of shares, such as Distributed File System (DFS) or WebDAV shares, use Windows Networking (WNet) functions , which support all types of shares.
Only members of the Administrators, Server Operators, or Power Users local group, or those with Server Operator group membership, can successfully delete file shares with a call to the NetShareDel function. The Print Operator can delete printer shares.
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 .
Examples
The following code sample demonstrates how to delete a share using a call to the NetShareDel function.
#define UNICODE
#include
#include
#include
#pragma comment(lib, "Netapi32.lib");
void wmain( int argc, TCHAR *argv[ ])
{
NET_API_STATUS res;
if(argc<3)
printf("Usage: NetShareDel server share\\n");
else
{
//
// Call the NetShareDel function to delete the share.
//
res=NetShareDel(argv[1], argv[2], 0);
//
// Display the result of the call.
//
if(res==0)
printf("Share Removed.\\n");
else
printf("Error: %u\\n", res);
}
return;
}
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderLmshare.h (include Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
See Also
Network Management Overview
Network Management Functions
Network Share Functions
NetShareAdd
NetShareDelEx
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/bb525386(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:21:58