资源简介
检测出所有局域网PC,然后通过配置,生成.rdp文件,直接通过算法将密码写入这个文件,运行这个文件就无需输入密码,vs2008下开发,vs2008及以上版本可正常编译

代码片段和文件信息
// DlgSetRdp.cpp : 实现文件
//
#include “stdafx.h“
#include “TCPSERVER.h“
#include “DlgSetRdp.h“
#include
#include
using namespace std;
// CDlgSetRdp 对话框
IMPLEMENT_DYNAMIC(CDlgSetRdp CDialog)
CDlgSetRdp::CDlgSetRdp(CWnd* pParent /*=NULL*/)
: CDialog(CDlgSetRdp::IDD pParent)
{
}
CDlgSetRdp::~CDlgSetRdp()
{
}
void CDlgSetRdp::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX IDC_STATIC_IP m_txtIp);
DDX_Control(pDX IDC_EDIT_USERNAME m_editUsername);
DDX_Control(pDX IDC_EDIT_PASSWORD m_editPass);
}
BEGIN_MESSAGE_MAP(CDlgSetRdp CDialog)
ON_BN_CLICKED(IDOK &CDlgSetRdp::OnBnClickedOk)
END_MESSAGE_MAP()
// CDlgSetRdp 消息处理程序
BOOL CDlgSetRdp::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
m_txtIp.SetWindowText(m_strIp);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
std::wstring MbsToWcs( const std::string& mbs ) {
int lengthOfWcs = MultiByteToWideChar( CP_ACP 0 mbs.c_str() -1 NULL 0 );
wchar_t* wcs = new wchar_t[ lengthOfWcs ];
MultiByteToWideChar( CP_ACP 0 mbs.c_str() -1 wcs lengthOfWcs );
std::wstring result = wcs;
delete wcs;
wcs = NULL;
return result;
}
void CDlgSetRdp::OnBnClickedOk()
{
CString strPass;
m_editPass.GetWindowText(strPass);
CString strUser;
m_editUsername.GetWindowText(strUser);
string strPassword = strPass.GetBuffer();
wstring strWpassword = MbsToWcs(strPassword);
DATA_BLOB DataIn;
DATA_BLOB DataOut;
// mstsc.exe中使用的是unicode所以必须做宽字符转换
BYTE *pbDataInput =(BYTE *)strWpassword.c_str();
DWORD cbDataInput = wcslen(strWpassword.c_str())*sizeof(wchar_t);
DataIn.pbData = pbDataInput;
DataIn.cbData = cbDataInput;
CString passwordres;
if(CryptProtectData(
&DataIn
L“psw“ // A description string
// to be included with the
// encrypted data.
NULL // Optional entropy not used.
NULL // Reserved.
NULL // Pass NULL for the
// prompt structure.
0
&DataOut))
{
int count=0;
while ( count <= (int)DataOut.cbData ){
// 因为一个unsigned int 占32位
// 转换成成16进制要占两位
// 所以这里需要用%02
char tmp[100] = {0};
sprintf(tmp“%02X“DataOut.pbData[count]);
passwordres += tmp;
count++;
}
}
CString strFile;
strFile.Format(“screen mode id:i:1\n“
“desktopwidth:i:1024\n“
“desktopheight:i:768\n“
“session bpp:i:16\n“
“winposstr:s:01161236969863\n“
“full address:s:%s\n“
“compression:i:1\n“
“keyboardhook:i:2\n“
“audiomode:i:0\n“
“redirectdrives:i:0\n“
“redirectprinters:i:1\n“
“redirectcomports:i:0\n“
“redirectsmartcards:i:1\n“
“drivestoredirect:s:C:;D:;\n“
“displayconnectionbar:i:1\n“
“autoreconnection enabled:i:0\n“
“username:s:%s\n“
“domain:s:\n“
“alternate shell:s:\n“
“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1776 2012-12-25 18:39 TCPSERVER\dat\1 Default.rdp
文件 888 2012-12-25 19:32 TCPSERVER\dat\192.168.1.28.rdp
文件 3647 2012-12-26 11:01 TCPSERVER\DlgSetRdp.cpp
文件 542 2012-12-25 19:06 TCPSERVER\DlgSetRdp.h
文件 19 2012-12-25 11:43 TCPSERVER\MemPool.cpp
文件 0 2012-12-25 11:32 TCPSERVER\MemPool.h
文件 2799 2012-12-24 16:37 TCPSERVER\ReadMe.txt
文件 21630 2003-07-24 09:52 TCPSERVER\res\TCPSERVER.ico
文件 365 2012-12-24 16:37 TCPSERVER\res\TCPSERVER.rc2
文件 1143 2012-12-25 19:01 TCPSERVER\resource.h
文件 140 2012-12-24 16:37 TCPSERVER\stdafx.cpp
文件 1842 2012-12-25 13:20 TCPSERVER\stdafx.h
文件 1030 2012-12-24 16:37 TCPSERVER\targetver.h
文件 43804 2013-06-04 09:20 TCPSERVER\TCPSERVER.APS
文件 2504 2012-12-25 19:59 TCPSERVER\TCPSERVER.cpp
文件 764 2012-12-25 19:59 TCPSERVER\TCPSERVER.h
文件 6427 2012-12-26 10:00 TCPSERVER\TCPSERVER.rc
文件 883 2012-12-24 16:37 TCPSERVER\TCPSERVER.sln
文件 5840 2012-12-25 20:03 TCPSERVER\TCPSERVER.vcproj
文件 13576 2012-12-25 19:58 TCPSERVER\TCPSERVERDlg.cpp
文件 1132 2012-12-25 18:53 TCPSERVER\TCPSERVERDlg.h
目录 0 2013-01-05 16:21 TCPSERVER\dat
目录 0 2013-01-05 16:21 TCPSERVER\res
目录 0 2013-06-27 09:13 TCPSERVER
----------- --------- ---------- ----- ----
110751 24
- 上一篇:GDAL无缝图片拼接
- 下一篇:冒险岛NPC编写工具源码
相关资源
- 远程桌面(带C 源码)
- 远程桌面协议 (RDP)控件库
- 让RDPWrap-v1.5/1.6支持18362.657的ini文件
- 3389批量生成器 用于批量生成远程桌面
- mRemoteNG Installer
- Rdpscan.rar
- 3389bpzd 端口字典工具
- wordpress 完全手册,全部函数,开发参
- RIzhuti-3.4修复版日主题
- FreeRdp源码分析.7z
- wordpress插件awebooking
-
wordpress的幻灯片插件 la
yerSlider 中文 - 本人亲自编译的最全的64位osg3.4第三方
- WIN10家庭版远程桌面完美解决方案18
- 基于浏览器控制的windows远桌面控制程
- 主题猫仿虎嗅WordPress
- 带复制代码功能的Codecolorer插件wordp
- 解决windows远程桌面连接问题工具
- win10下的mstsc.exe
- ROST WordParser206472
- win10多用户远程连接文件.rar
- WindowsXP-KB952155-RDP6.1
- Winconnect server xp SP3
- 研发项目管理方法(RDPM)(第一版第
- wordpress采集插件wp-autopost-pro专业版
- Grace8最新破解版
- 华为项目管理RDPM PDF清晰版
- WordPress自适应图片主题 CX-UDY主题模板
- WordPress 苏醒: Grace8.2最新版主题,最新
- WordPress v4.0 中文版.zip
评论
共有 条评论