CzFunc.dll丢失avione.dll是什么意思思

调用Win32 API netapi32.dll 实现UNC(网络共享)连接的管理(一) - Flyear_cheng的专栏
- 博客频道 - CSDN.NET
2263人阅读
&本章将使用Win32 API netapi32.dll 实现UNC的 连接授权, 断开连接, 获取UNC连接状态三项功能.
一. 首先导入DLL文件:#region Register Win32 DLL File netapi32.dll
//导入连接授权函数NetUseAdd
[DllImport("netapi32", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]
static extern int NetUseAdd(
string UncServerName, // not used
int Level,
// use info struct level 1 or 2
IntPtr Buf,
ref int ParmError
//导入断开连接函数NetUseDel
[DllImport("netapi32", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]
static extern int NetUseDel(
string UncServerName,
//not used
string UseName,
//Network Resource what do yo
uint ForceCond
//导入Get连接状态函数NetUseGetInfo
[DllImport("netapi32", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]
static extern int NetUseGetInfo(
string UncServerName,
string UseName,
int Level,
ref IntPtr BufPtr);&PRE&&/PRE&
上面是已对参数类型做过转换的针对C#写的代码, 有关函数原型的资料请参阅 MSDN,
接下对上面的各项参数做个简单的介绍,足够应付本章所讲内容(更详细的请参阅MSDN):
(按由上到下的顺序介绍)
string UncServerName:
&&& 这个参数不用, Call的时候置空.
int Level:
&&& 代表采用那种struct将参数传入函数, 1代表或2代表 , 智能在两者之间选择一种.
IntPtr Buf,&
&&& 一个指向上面对应结构的指针(C#没有指针,但这的作用很像指针,有知道更专业教法的朋友通知一声),
ref int ParmError:
这个好像没怎么用到,所以没仔细研究, 请直接看SourceCode中的用法
uint ForceCond:
&&& 断开连接时的模式, 共有三种:
&&& private const uint USE_NOFORCE = 0;&&&& //Do not fail the disconnection if open files exist son the connection.&&& private const uint USE_FORCE = 1;&&&&&& //Fail the disconnection if open files exists on the connection.&&& private const uint USE_LOTS_OF_FORCE = 2;&& //Close any open files and delete the connection.
ref IntPtr BufPtr:
&&& 传入GetNetUseInfo的Struct IntPrt对象, 负责将获取的信息带出来.
一下为实现三项功能的完整Source Code:
&class WinNet
#region Define netapi32.dll need data structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct _USE_INFO_2
internal string ui2_
internal string ui2_
//internal IntPtr ui2_ // don't pass a string or StringBuilder here!!
internal string ui2_
internal uint ui2_
internal uint ui2_asg_
internal uint ui2_
internal uint ui2_
internal string ui2_
internal string ui2_
const uint USE_WILDCARD = 0xFFFFFFFF;
private const uint USE_NOFORCE = 0;
//Do not fail the disconnection if open files exist son the connection.
private const uint USE_FORCE = 1;
//Fail the disconnection if open files exists on the connection.
private const uint USE_LOTS_OF_FORCE = 2;
//Close any open files and delete the connection.
private const uint USE_OK = 0;
//The connection is valid.
private const uint USE_PAUSED = 1;
// Paused by local workstation.
private const uint USE_SESSLOST = 2;// Disconnected.
private const uint USE_DISCONN = 3;// An error occurred.
private const uint USE_NETERR = 4;// A network error occurred.
private const uint USE_CONN = 5;// The connection is being made.
private const uint USE_RECONN = 6;// Reconnecting.
private static WinNet _instance = new WinNet();
public static WinNet Instance
get { return _ }
#endregion
#region Register Win32 DLL File netapi32.dll
[DllImport("netapi32", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]
static extern int NetUseAdd(
string UncServerName, // not used
int Level,
// use info struct level 1 or 2
IntPtr Buf,
ref int ParmError
[DllImport("netapi32", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]
static extern int NetUseDel(
string UncServerName,
//not used
string UseName,
//Network Resource what do yo
uint ForceCond
[DllImport("netapi32", CharSet = CharSet.Auto, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute]
static extern int NetUseGetInfo(
string UncServerName,
string UseName,
int Level,
ref IntPtr BufPtr);
#endregion
/// Establish a use record
public static bool UseRecord(string resource, string user, string password, string domain)
bool RtnValue =
int ret = 1;
int paramError = 0;
_USE_INFO_2 use2 = new _USE_INFO_2();
IntPtr pBuf = IntPtr.Z
//use2.ui2_password = IntPtr.Z
pBuf = Marshal.AllocHGlobal(Marshal.SizeOf(use2));
use2.ui2_local =
use2.ui2_asg_type = USE_WILDCARD;
use2.ui2_remote =
//use2.ui2_password = Marshal.StringToHGlobalAuto(password);
use2.ui2_password =
use2.ui2_username =
use2.ui2_domainname =
Marshal.StructureToPtr(use2, pBuf, true);
ret = NetUseAdd(null, 2, pBuf, ref paramError);
if (ret != 0)
throw new Exception(ErrorCodeHandler(ret));
RtnValue =
catch (Exception e)
Marshal.FreeHGlobal(pBuf);
return RtnV
/// Destroy a use record
public static void DeleteRecord(string resource)
int ret = 1;
ret = NetUseDel(null, resource, USE_LOTS_OF_FORCE);
if (ret != 0)
throw new Exception(ErrorCodeHandler(ret));
catch (Exception e)
public static _USE_INFO_2 GetUseInfo(string resource)
int ret = 1;
_USE_INFO_2 ui2 = new _USE_INFO_2();
IntPtr pBuf = IntPtr.Z
pBuf = Marshal.AllocHGlobal(Marshal.SizeOf(new _USE_INFO_2()));
ret = NetUseGetInfo(null, resource, 2, ref pBuf);
if (ret != 0)
throw new Exception(ErrorCodeHandler(ret));
ui2 = (_USE_INFO_2)Marshal.PtrToStructure(pBuf, typeof(_USE_INFO_2));
Marshal.FreeHGlobal(pBuf);
return ui2;
#region Win32 ErrorCode Handler Code
public static string ErrorCodeHandler(int Win32ErrorCode)
string RtnMessage = string.E
switch (Win32ErrorCode)
RtnMessage = "找不到网络名.";
case 1219:
RtnMessage = "不允许一个用户使用一个以上用户名与一个服务器或共享资源的多重连接。中断与此服务器或共享资源的所有连接,然后再试一次... ";
case 2250:
RtnMessage = "此网络连接不存在.";
RtnMessage = "Unkown Error Code.";
return RtnMessage + "/r/nWin32 Error Code:" + Win32ErrorC
#endregion
关于API调用出项异常的处理, 这也是我在调试代码的时候碰到的一个Bug, 顺便在这个跟大家分享一下:
&&& 通常情况下Api调用出现异常的时候, 会通过GetLastError()方法来取得最后一个错误, 而在我实际执行的时候出现N(N&10)次错误,用GetLastError()得到的错误信息都是"重叠 I/O 操作在进行中", 四处求救没得到答案, 后来我发现在每个API结束之后都会Return一个int类型的返回值: 0代表执行成功, 在本章常用到的已在ErrorCodeHandler()方法中进行了说明.
接下来有空的话计划写一个Windows UNC 共享管理的小程序, 其中将涉及到列出当前所有共享的各种状态,及对所有共享的操作.
上面的获取共享状态目前仅能判断connection or disconnection, 应为我的项目对这个只要求这两种状态,所以在没有进行详细的分类.
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:27936次
排名:千里之外
原创:13篇
转载:10篇
(3)(3)(2)(6)(9)mmvaq0zmylx5uhoombtoqpnuaksbkjgcxuo72a+te2gt73juwy1xmi0cw8amwibw2mcscvhblgrncjywyys/sa==,老奶奶性爱视频 播放,上,同意了。听见黄心
上,同意了。听见黄心玲
&&&&大床开始剧烈的晃动,男女合欢时发出的"嗯嗯啊啊"的淫声从鼓起的"棚子"里传了出来情欲无罪,但因为隔着层被子,显得有些沉闷。&&&&听见杨天傲的话,林欣没有睁开双眼看着他,没有回答他的话,羞红的脸色渐渐的浮现在她那艳丽的脸上。&&&&"我觉得有他们是从四方面考虑的,第一,IIC是世界上唯一一家将亚太地区总部放在中国的大型投资公司,而且还任命了一名中国人担任总代理,我接下来的话,你可能要不爱听了,中国人在一些老外的眼里是最容易收买的,特别是六十多年前,日本人在这方面有过太多的成功经验。"&&&&安木瑾最终还是被放了出来,前提是她签了那份协议,裴逸辰这才放心放她出来。不过她也有个要求,那就是在这幅画他没有亲手交到她手中之前,老奶奶性爱视频他都不可以告诉她宝贝儿子这份协议的存在。还有,这一个月里,她要跟她儿子在一起。而裴逸辰念在这么多年她一个人照顾孩子的份上,同意了。&&&&听见黄心玲的话,会议室里的人顿时你看我,我看你,面面相关,没有回应她的话。他们都知道这个合作项目的难处,如果搞不好霸蕹道男追女电呔,搞砸了,那他以后在公司里可就难混了,所以他们才没有直接答应下来,毕竟各个在商场上混了这么久,各个都混成精播放了,没成的也差不到那去了。&&&&说完三人走进了会议室。&&&&"是。"&&&&虽然高霸蕹道男追女电呔龙的脸上露出了笑容,但是杨天傲依然能在他的眼中看到敌意,见他伸出了手,笑了一下伸出了超大胆厕所偷拍手,跟他的手握在了一起。&&&&侯龙涛在靠窗户的椅子上坐了一会,一个染金发的中国女孩坐在了他身边。 &&&&本来股东们就在比较郑擎风和宫慕寒继承龙腾集团后对他们未来利益的影响mmvaq0zmylx5uhoombtoqpnuaksbkjgcxuo72a+te2gt73juwy1xmi0cw8amwibw2mcscvhblgrnsa==cjywyys,讨论中,很明显他们是倾向于宫慕寒继承龙腾集团。这才会激怒一直坐在那里不吭声的郑擎风。&&&&
友情链接:浙江祥晖数码科技有限公司 商明菊,肛交免费电影
友情链接:,美女成人激情,只为赶紧离开,也就答应了敲诈,但也把"宝
只为赶紧离开,也就答应了敲诈,但也把"宝来"的车牌儿记下了,打算日後再报复。如果不
&&&&无语,彻底的无语,杨天傲没有想到陈雨会来这招,他当然不希望张颖和陈雨之间出现不合问题了,只能不在问了。&&&&啊……啊……感射精的敢叫觉到了……感觉到了……好痒……啊……主人……主人你好会抠啊……呀……抠到子宫了……啊……"任婧瑶的双腿开始不自觉的颤抖。侯龙涛把女人的屁眼儿舔的湿湿的,另一手的手指沾上她流出来的淫水儿,挤入肛门中。阴道中的手指向上挑,直肠中的向下压,隔着两层腔壁互相搓动。&&&&林羽从座位上站了起来,看着杨天傲一脸淫笑道。&&&&"咕噜""咕噜"……&&&&他话是说完了,但是却让轩辕夜苦恼了,安木情的事情,他是没办法帮他做主的,更何况还是波多野结衣女王种子不让她见她妹妹安木瑾了。&&&&苏亦瑶当然知道是凉水,寻单身娇小35岁~45岁女性朋友现在她喷的就是凉水,来灭男人的火,同时也灭她自己心底烧起的一把火。&&&&这样好吗?咱们可以一直抱在一起。"&&&&"刚才是你在说话?"&&&&在侯龙涛不懈的挑逗下,玉倩的表情终于又从痛苦回复到了难奈,阴道中也分泌出了更多的寻单身娇小35岁~45岁女性朋友爱液。侯龙涛开始慢慢的抽插起来,速度不断的加快,随之而来的快感也越来越强烈。玉倩也本能的摇动美臀,配合身后男人的操干,以求获得更大的快感。她嘴中的"啊啊"声也由小变大,由慢变快。&&&&其实"宝来"根本就没受什么"伤",只是掉了一小儿块儿漆,对於这个档次的车来说,绝没有整美女成人激情车重喷的必要,但三个人看出对方好像急於脱身,乾脆就一口价,一千块,要不然就等交警来处理。两人只为赶紧离开,也就答应了敲诈,但也把"宝来"的车牌儿记下了,打算日後再报复。&&&&如果不知道两人关系的人,看见黄心玲的白眼顶会以为他们是对情侣。苦笑的表情再次出现在杨天傲的脸上,他没有想到自己的一句很普通的话,又招到了黄心玲的打击,"我不准备回公司,既然你回公司,那我们就各走各的吧。"&&&&
友情链接:}

我要回帖

更多关于 avione.dll是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信