100分问:我如何实现象网上邻居中的右键的影射网络驱动器的功能,假设我网络路径已知.分不够可以加 [email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 WNETAddConnection()映射网络驱动器 NetUseAdd BOOL EstablishNullSession( LPCWSTR Server, BOOL bEstablish ) { LPCWSTR szIpc = L"\\IPC$"; WCHAR RemoteResource[UNCLEN + 5 + 1]; // UNC len + \IPC$ + NULL DWORD cchServer; NET_API_STATUS nas; // // do not allow NULL or empty server name // if(Server == NULL || *Server == L'\0') { SetLastError(ERROR_INVALID_COMPUTERNAME); return FALSE; } cchServer = lstrlenW( Server ); if(Server[0] != L'\\' && Server[1] != L'\\') { // // prepend slashes and NULL terminate // RemoteResource[0] = L'\\'; RemoteResource[1] = L'\\'; RemoteResource[2] = L'\0'; } else { cchServer -= 2; // drop slashes from count RemoteResource[0] = L'\0'; } if(cchServer > CNLEN) { SetLastError(ERROR_INVALID_COMPUTERNAME); return FALSE; } if(lstrcatW(RemoteResource, Server) == NULL) return FALSE; if(lstrcatW(RemoteResource, szIpc) == NULL) return FALSE; // // disconnect or connect to the resource, based on bEstablish // if(bEstablish) { USE_INFO_2 ui2; ZeroMemory(&ui2, sizeof(ui2)); ui2.ui2_local = NULL; ui2.ui2_remote = RemoteResource; ui2.ui2_asg_type = USE_IPC; ui2.ui2_password = ui2.ui2_username = ui2.ui2_domainname = L""; nas = NetUseAdd(NULL, 2, (LPBYTE)&ui2, NULL); } else { nas = NetUseDel(NULL, RemoteResource, 0); } if( nas == NERR_Success ) return TRUE; // indicate success return FALSE; } 关于win7任务管理器中物理内存部分显示的已缓存大小获取问题 SQL SERVER (VC) 散分! 请问我现在,c++学了一遍现在想学VC++6.0请问用哪本书好些!:) 请问SNMP 中口令是什么有什么用呀 一个小问题,熟悉COM的兄弟帮忙看看(分数不够可以加) 请教 这段代码为什么会出错?帮看看 代号为 chinaos 的国产操作系统... 小的有分相送,只求带我入DDK之门,宁愿倾家荡产 问题,谁能详细讲解一下,学完MCSD能达到什么程度?不够可以再给分 想买一个笔记本,有没有好推荐?(价格在15000以下)
EstablishNullSession(
LPCWSTR Server,
BOOL bEstablish
)
{
LPCWSTR szIpc = L"\\IPC$";
WCHAR RemoteResource[UNCLEN + 5 + 1]; // UNC len + \IPC$ + NULL
DWORD cchServer; NET_API_STATUS nas; //
// do not allow NULL or empty server name
//
if(Server == NULL || *Server == L'\0') {
SetLastError(ERROR_INVALID_COMPUTERNAME);
return FALSE;
} cchServer = lstrlenW( Server ); if(Server[0] != L'\\' && Server[1] != L'\\') { //
// prepend slashes and NULL terminate
//
RemoteResource[0] = L'\\';
RemoteResource[1] = L'\\';
RemoteResource[2] = L'\0';
}
else {
cchServer -= 2; // drop slashes from count RemoteResource[0] = L'\0';
} if(cchServer > CNLEN) {
SetLastError(ERROR_INVALID_COMPUTERNAME);
return FALSE;
} if(lstrcatW(RemoteResource, Server) == NULL) return FALSE;
if(lstrcatW(RemoteResource, szIpc) == NULL) return FALSE; //
// disconnect or connect to the resource, based on bEstablish
//
if(bEstablish) {
USE_INFO_2 ui2; ZeroMemory(&ui2, sizeof(ui2)); ui2.ui2_local = NULL;
ui2.ui2_remote = RemoteResource;
ui2.ui2_asg_type = USE_IPC;
ui2.ui2_password = ui2.ui2_username = ui2.ui2_domainname = L""; nas = NetUseAdd(NULL, 2, (LPBYTE)&ui2, NULL);
}
else {
nas = NetUseDel(NULL, RemoteResource, 0);
} if( nas == NERR_Success ) return TRUE; // indicate success return FALSE;
}