网站首页  词典首页

请输入您要查询的函数:

 

术语 netsharecheck
释义 NetShareCheck
语法:
C++
NET_API_STATUS NetShareCheck(
__in LPWSTR servername,
__in LPWSTR device,
__out LPDWORD type
);
NetShareCheck功能
检查是否共用一个服务器设备。
参数
服务器名 [in]
指针指向一个字符串,它指定的DNS或NetBIOS的远程服务器上的功能是执行的名称。如果该参数为NULL,则使用本地计算机。
设备 [in]
一个字符串指针,指定设备的名称来检查共享访问。
输入[出]
指针变量,它接收的标志位掩码指定的共享设备的类型。此参数设置只有在函数返回成功。
下面的标志之一可能指定。
ValueMeaning
STYPE_DISKTREEDisk驱动器。
STYPE_PRINTQPrint队列。
STYPE_DEVICECommunication设备。
STYPE_IPCInterprocess通信(IPC)。
此外,一个或两个下列标志可以指定。
ValueMeaning
STYPE_SPECIALSpecial保留的份额为进程间通信(IPC $)或服务器(管理$)远程管理。也可以参考管理共享如C $,?$,电子$,等等。有关更多信息,请参阅网络共享功能。
STYPE_TEMPORARYA临时份额。
返回值
如果函数成功,返回值是NERR_Success。
如果函数失败,返回值可以是下面的错误代码之一。
返回codeDescription
ERROR_NOT_ENOUGH_MEMORYInsufficient内存可用。
NERR_DeviceNotSharedThe设备没有共享。
备注
此功能仅适用于服务器消息块(SMB)的股票。对于其他类型的股票,如分布式文件系统(DFS)或WebDAV共享,使用Windows网络(WNet)功能,它支持所有类型的股份。
没有特殊组成员必须成功地执行NetShareCheck功能。
如果您是Active Directory的程序,您可以调用某些Active Directory服务接口(ADSI)的方法来达到同样的功能,您可以通过调用实现网络管理共享功能。有关更多信息,请参阅IADsFileShare。
实例
下面的代码示例演示如何检查服务器是否是共享设备,使用调用NetShareCheck功能。该函数返回类型的设备被共享,如对上述文件的类型参数描述。
#define UNICODE
#include
#include
#include
#pragma comment(lib, "Netapi32.lib");
void wmain( int argc, TCHAR *argv[ ])
{
NET_API_STATUS res;
DWORD devType = 0;
if(argc<3)
printf("Usage: NetShareCheck server device\\n");
else
{
//
// Call the NetShareCheck function.
//
res=NetShareCheck(argv[1], _wcsupr(argv[2]), &devType);
//
// If the function succeeds, inform the user.
//
if(res==0)
printf("Device is shared as type %u.\\n",devType);
//
// Otherwise, print the error.
//
else
printf("Error: %u\\n", res);
}
return;
}
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLmshare.h(包括Lm.h)
LibraryNetapi32.lib
DLLNetapi32.dll
参见
网络管理概述
网络管理功能
网络共享功能
NetShareEnum
NetShareGetInfo
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==NetShareCheck Function
Checks whether or not a server is sharing a device.
Syntax
C++
NET_API_STATUS NetShareCheck(
__in LPWSTR servername,
__in LPWSTR device,
__out LPDWORD type
);
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.
device [in]
Pointer to a string that specifies the name of the device to check for shared access.
type [out]
Pointer to a variable that receives a bitmask of flags that specify the type of the shared device. This parameter is set only if the function returns successfully.
One of the following flags may be specified.
ValueMeaning
STYPE_DISKTREEDisk drive.
STYPE_PRINTQPrint queue.
STYPE_DEVICECommunication device.
STYPE_IPCInterprocess communication (IPC).

In addition, one or both of the following flags may be specified.
ValueMeaning
STYPE_SPECIALSpecial share reserved for interprocess communication (IPC$) or remote administration of the server (ADMIN$). Can also refer to administrative shares such as C$, D$, E$, and so forth. For more information, see Network Share Functions .
STYPE_TEMPORARYA temporary share.

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_NOT_ENOUGH_MEMORYInsufficient memory is available.
NERR_DeviceNotSharedThe device is not shared.

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.
No special group membership is required to successfully execute the NetShareCheck function.
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 check whether a server is sharing a device, using a call to the NetShareCheck function. The function returns the type of device being shared, as described in the preceding documentation for the type parameter.
#define UNICODE
#include
#include
#include
#pragma comment(lib, "Netapi32.lib");
void wmain( int argc, TCHAR *argv[ ])
{
NET_API_STATUS res;
DWORD devType = 0;
if(argc<3)
printf("Usage: NetShareCheck server device\\n");
else
{
//
// Call the NetShareCheck function.
//
res=NetShareCheck(argv[1], _wcsupr(argv[2]), &devType);
//
// If the function succeeds, inform the user.
//
if(res==0)
printf("Device is shared as type %u.\\n",devType);
//
// Otherwise, print the error.
//
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
NetShareEnum
NetShareGetInfo
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/bb525385(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:18:32