diff --git a/CcRemote/.vs/CcRemote/v15/.suo b/CcRemote/.vs/CcRemote/v15/.suo index 7b3221e..545a6ea 100644 Binary files a/CcRemote/.vs/CcRemote/v15/.suo and b/CcRemote/.vs/CcRemote/v15/.suo differ diff --git a/CcRemote/CcRemote/CcRemote.rc b/CcRemote/CcRemote/CcRemote.rc index 8e62e57..c88672e 100644 Binary files a/CcRemote/CcRemote/CcRemote.rc and b/CcRemote/CcRemote/CcRemote.rc differ diff --git a/CcRemote/CcRemote/CcRemote.vcxproj b/CcRemote/CcRemote/CcRemote.vcxproj index 6a53757..cdec20b 100644 --- a/CcRemote/CcRemote/CcRemote.vcxproj +++ b/CcRemote/CcRemote/CcRemote.vcxproj @@ -227,6 +227,7 @@ <ClInclude Include="InputDlg.h" /> <ClInclude Include="pch.h" /> <ClInclude Include="PublicStruct.h" /> + <ClInclude Include="RegDlg.h" /> <ClInclude Include="Resource.h" /> <ClInclude Include="SEU_QQwry.h" /> <ClInclude Include="targetver.h" /> @@ -269,6 +270,7 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> </ClCompile> + <ClCompile Include="RegDlg.cpp" /> <ClCompile Include="SEU_QQwry.cpp" /> <ClCompile Include="TrueColorToolBar.cpp" /> </ItemGroup> diff --git a/CcRemote/CcRemote/CcRemote.vcxproj.filters b/CcRemote/CcRemote/CcRemote.vcxproj.filters index 7e4928a..1959017 100644 --- a/CcRemote/CcRemote/CcRemote.vcxproj.filters +++ b/CcRemote/CcRemote/CcRemote.vcxproj.filters @@ -96,6 +96,9 @@ <ClInclude Include="CServerDlg.h"> <Filter>头文件</Filter> </ClInclude> + <ClInclude Include="RegDlg.h"> + <Filter>头文件</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="CcRemote.cpp"> @@ -155,6 +158,9 @@ <ClCompile Include="CServerDlg.cpp"> <Filter>源文件</Filter> </ClCompile> + <ClCompile Include="RegDlg.cpp"> + <Filter>源文件</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ResourceCompile Include="CcRemote.rc"> diff --git a/CcRemote/CcRemote/RegDlg.cpp b/CcRemote/CcRemote/RegDlg.cpp new file mode 100644 index 0000000..a8893a4 --- /dev/null +++ b/CcRemote/CcRemote/RegDlg.cpp @@ -0,0 +1,290 @@ +// RegDlg.cpp : ʵ���ļ� +// + +#include "pch.h" +#include "CcRemote.h" +#include "RegDlg.h" +#include "afxdialogex.h" +#include "..\..\common\macros.h" + + +// CRegDlg �Ի��� + +IMPLEMENT_DYNAMIC(CRegDlg, CDialog) + + enum MYKEY{ + MHKEY_CLASSES_ROOT, + MHKEY_CURRENT_USER, + MHKEY_LOCAL_MACHINE, + MHKEY_USERS, + MHKEY_CURRENT_CONFIG +}; + +enum KEYVALUE{ + MREG_SZ, + MREG_DWORD, + MREG_BINARY, + MREG_EXPAND_SZ +}; +struct REGMSG{ + int count; //���ָ��� + DWORD size; //���ִ�С + DWORD valsize; //ֵ��С + +}; +CRegDlg::CRegDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext) + : CDialog(IDD_DIALOG_REGEDIT, pParent) +{ + m_iocpServer = pIOCPServer; + m_pContext = pContext; +} + +CRegDlg::~CRegDlg() +{ +} + +void CRegDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_TREE, m_tree); + DDX_Control(pDX, IDC_LIST, m_list); +} + + +BEGIN_MESSAGE_MAP(CRegDlg, CDialog) + ON_NOTIFY(TVN_SELCHANGED, IDC_TREE, &CRegDlg::OnTvnSelchangedTree) +END_MESSAGE_MAP() + + +// CRegDlg ��Ϣ�������� + + +BOOL CRegDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // TODO: �ڴ����Ӷ���ij�ʼ�� + + HICON hIcon = NULL; + m_ImageList_tree.Create(18, 18, ILC_COLOR16,10, 0); + + //hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_FATHER_ICON), IMAGE_ICON, 18, 18, 0); + //m_ImageList_tree.Add(hIcon); + //hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_DIR_ICON), IMAGE_ICON, 32, 32, 0); + //m_ImageList_tree.Add(hIcon); + + + + m_tree.SetImageList ( &m_ImageList_tree,TVSIL_NORMAL ); + + DWORD dwStyle = GetWindowLong(m_tree.m_hWnd,GWL_STYLE); + + dwStyle |=TVS_HASBUTTONS | TVS_HASLINES;// | TVS_LINESATROOT;���ﲻ��һ���������ʽ��Ȼicoͼ������ʾ + + SetWindowLong(m_tree.m_hWnd,GWL_STYLE,dwStyle); + m_hRoot = m_tree.InsertItem("ע�������",0,0,0,0); + HKCU=m_tree.InsertItem("HKEY_CURRENT_USER",1,1,m_hRoot,0); + HKLM=m_tree.InsertItem("HKEY_LOCAL_MACHINE",1,1,m_hRoot,0); + HKUS=m_tree.InsertItem("HKEY_USERS",1,1,m_hRoot,0); + HKCC=m_tree.InsertItem("HKEY_CURRENT_CONFIG",1,1,m_hRoot,0); + HKCR=m_tree.InsertItem("HKEY_CLASSES_ROOT",1,1,m_hRoot,0); + + m_tree.Expand(m_hRoot,TVE_EXPAND); + + m_list.InsertColumn(0,"����",LVCFMT_LEFT,150,-1); + m_list.InsertColumn(1,"����",LVCFMT_LEFT,60,-1); + m_list.InsertColumn(2,"����",LVCFMT_LEFT,300,-1); + m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT); + //////����ͼ��////// + //m_HeadIcon.Create(16,16,TRUE,2,2); + //m_HeadIcon.Add(AfxGetApp()->LoadIcon(IDI_STR_ICON)); + //m_HeadIcon.Add(AfxGetApp()->LoadIcon(IDI_DWORD_ICON)); + //m_list.SetImageList(&m_HeadIcon,LVSIL_SMALL); + return TRUE; // return TRUE unless you set the focus to a control + // �쳣: OCX ����ҳӦ���� FALSE +} + + +void CRegDlg::OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult) +{ + LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); + // TODO: �ڴ����ӿؼ�֪ͨ����������� + if(!isEnable) return; + isEnable=false;; + TVITEM item = pNMTreeView->itemNew; + + if(item.hItem == m_hRoot) + { + isEnable=true;; + return; + } + SelectNode=item.hItem; //�����û��������ڵ��� + m_list.DeleteAllItems(); + + CString FullPath=GetFullPath(SelectNode); + HTREEITEM CurrentNode = item.hItem; //ȡ�ô˽ڵ��ȫ·�� + + while(m_tree.GetChildItem(CurrentNode)!=NULL) + { + m_tree.DeleteItem(m_tree.GetChildItem(CurrentNode)); //ɾ�� ����� OnSelchangingTree�¼� *** + } + + char bToken=getFatherPath(FullPath); + //����һ���� + int nitem=m_list.InsertItem(0,"(Data)",0); + m_list.SetItemText(nitem,1,"REG_SZ"); + m_list.SetItemText(nitem,2,"(NULL)"); + //BeginWaitCursor(); + //char *buf=new char[FullPath.GetLength] + FullPath.Insert(0,bToken);//���� �Ǹ����� + bToken=COMMAND_REG_FIND; + FullPath.Insert(0,bToken); //�����ѯ���� + + m_iocpServer->Send(m_pContext, (LPBYTE)(FullPath.GetBuffer(0)), FullPath.GetLength()+1); + isEnable=true;; + *pResult = 0; +} + + +CString CRegDlg::GetFullPath(HTREEITEM hCurrent) +{ + CString strTemp; + CString strReturn = ""; + while(1){ + if(hCurrent==m_hRoot) return strReturn; + strTemp = m_tree.GetItemText(hCurrent); //�õ���ǰ�� + if(strTemp.Right(1) != "\\") + strTemp += "\\"; + strReturn = strTemp + strReturn; + hCurrent = m_tree.GetParentItem(hCurrent); //�õ����� + + } + return strReturn; +} + + +char CRegDlg::getFatherPath(CString& FullPath) +{ + char bToken; + if(!FullPath.Find("HKEY_CLASSES_ROOT")) //�ж����� + { + //MKEY=HKEY_CLASSES_ROOT; + bToken=MHKEY_CLASSES_ROOT; + FullPath.Delete(0,sizeof("HKEY_CLASSES_ROOT")); + }else if(!FullPath.Find("HKEY_CURRENT_USER")) + { + bToken=MHKEY_CURRENT_USER; + FullPath.Delete(0,sizeof("HKEY_CURRENT_USER")); + + }else if(!FullPath.Find("HKEY_LOCAL_MACHINE")) + { + bToken=MHKEY_LOCAL_MACHINE; + FullPath.Delete(0,sizeof("HKEY_LOCAL_MACHINE")); + + }else if(!FullPath.Find("HKEY_USERS")) + { + bToken=MHKEY_USERS; + FullPath.Delete(0,sizeof("HKEY_USERS")); + + }else if(!FullPath.Find("HKEY_CURRENT_CONFIG")) + { + bToken=MHKEY_CURRENT_CONFIG; + FullPath.Delete(0,sizeof("HKEY_CURRENT_CONFIG")); + + } + return bToken; +} + + +void CRegDlg::OnReceiveComplete(void) +{ + switch (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[0]) + { + case TOKEN_REG_PATH: //������ + AddPath((char*)(m_pContext->m_DeCompressionBuffer.GetBuffer(1))); + break; + case TOKEN_REG_KEY: //���ռ� ��ֵ + AddKey((char*)(m_pContext->m_DeCompressionBuffer.GetBuffer(1))); + break; + default: + break; + } +} + + +void CRegDlg::AddKey(char* lpBuffer) +{ + m_list.DeleteAllItems(); + int nitem=m_list.InsertItem(0,"(Data)",0); + m_list.SetItemText(nitem,1,"REG_SZ"); + m_list.SetItemText(nitem,2,"(NULL)"); + + if(lpBuffer==NULL) return; + REGMSG msg; + memcpy((void*)&msg,lpBuffer,sizeof(msg)); + char* tmp=lpBuffer+sizeof(msg); + for(int i=0;i<msg.count;i++) + { + BYTE Type=tmp[0]; //ȡ����־ͷ + tmp+=sizeof(BYTE); + char* szValueName=tmp; //ȡ������ + tmp+=msg.size; + BYTE* szValueDate=(BYTE*)tmp; //ȡ��ֵ + tmp+=msg.valsize; + if(Type==MREG_SZ) + { + int nitem=m_list.InsertItem(0,szValueName,0); + m_list.SetItemText(nitem,1,"REG_SZ"); + m_list.SetItemText(nitem,2,(char*)szValueDate); + } + if(Type==MREG_DWORD) + { + char ValueDate[256]; + DWORD d=(DWORD)szValueDate; + memcpy((void*)&d,szValueDate,sizeof(DWORD)); + CString value; + value.Format("0x%x",d); + sprintf(ValueDate," (%wd)",d); + value+=" "; + value+=ValueDate; + int nitem=m_list.InsertItem(0,szValueName,1); + m_list.SetItemText(nitem,1,"REG_DWORD"); + m_list.SetItemText(nitem,2,value); + + } + if(Type==MREG_BINARY) + { + char ValueDate[256]; + sprintf(ValueDate,"%wd",szValueDate); + + int nitem=m_list.InsertItem(0,szValueName,1); + m_list.SetItemText(nitem,1,"REG_BINARY"); + m_list.SetItemText(nitem,2,ValueDate); + } + if(Type==MREG_EXPAND_SZ) + { + int nitem=m_list.InsertItem(0,szValueName,0); + m_list.SetItemText(nitem,1,"REG_EXPAND_SZ"); + m_list.SetItemText(nitem,2,(char*)szValueDate); + } + } +} + + +void CRegDlg::AddPath(char* lpBuffer) +{ + if(lpBuffer==NULL) return; + int msgsize=sizeof(REGMSG); + REGMSG msg; + memcpy((void*)&msg,lpBuffer,msgsize); + DWORD size =msg.size; + int count=msg.count; + + if(size>0&&count>0){ //һ�㱣����ʩ + for(int i=0;i<count;i++){ + char* szKeyName=lpBuffer+size*i+msgsize; + m_tree.InsertItem(szKeyName,1,1,SelectNode,0);//�����Ӽ����� + m_tree.Expand(SelectNode,TVE_EXPAND); + } + } +} diff --git a/CcRemote/CcRemote/RegDlg.h b/CcRemote/CcRemote/RegDlg.h new file mode 100644 index 0000000..074dd88 --- /dev/null +++ b/CcRemote/CcRemote/RegDlg.h @@ -0,0 +1,46 @@ +#pragma once + +#include "include/IOCPServer.h" +// CRegDlg �Ի��� + +class CRegDlg : public CDialog +{ + DECLARE_DYNAMIC(CRegDlg) + +public: + CRegDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // �����캯�� + virtual ~CRegDlg(); + +// �Ի������� + enum { IDD = IDD_DIALOG_REGEDIT}; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧�� + + DECLARE_MESSAGE_MAP() + + ClientContext* m_pContext; + CIOCPServer* m_iocpServer; + bool isEnable; //�ؼ��Ƿ���� + HTREEITEM SelectNode; +public: + CTreeCtrl m_tree; + CListCtrl m_list; + CImageList m_HeadIcon; +protected: + HTREEITEM m_hRoot; + HTREEITEM HKLM; + HTREEITEM HKCR; + HTREEITEM HKCU; + HTREEITEM HKUS; + HTREEITEM HKCC; + CImageList m_ImageList_tree; +public: + virtual BOOL OnInitDialog(); + afx_msg void OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult); + CString GetFullPath(HTREEITEM hCurrent); + char getFatherPath(CString& FullPath); + void OnReceiveComplete(void); + void AddKey(char* lpBuffer); + void AddPath(char* lpBuffer); +}; diff --git a/CcRemote/CcRemote/Release/CcRemote.Build.CppClean.log b/CcRemote/CcRemote/Release/CcRemote.Build.CppClean.log index 22a8d69..12d5285 100644 --- a/CcRemote/CcRemote/Release/CcRemote.Build.CppClean.log +++ b/CcRemote/CcRemote/Release/CcRemote.Build.CppClean.log @@ -1,5 +1,3 @@ -f:\myapp\ccremote\bin\ccremote.ipdb -f:\myapp\ccremote\bin\ccremote.iobj f:\myapp\ccremote\ccremote\ccremote\release\ccremote.pch f:\myapp\ccremote\ccremote\ccremote\release\vc141.pdb f:\myapp\ccremote\ccremote\ccremote\release\pch.obj @@ -21,17 +19,6 @@ f:\myapp\ccremote\ccremote\ccremote\release\cfilemanagerdlg.obj f:\myapp\ccremote\ccremote\ccremote\release\ccremotedlg.obj f:\myapp\ccremote\ccremote\ccremote\release\ccremote.obj f:\myapp\ccremote\ccremote\ccremote\release\caudiodlg.obj -f:\myapp\ccremote\bin\ccremote.exe -f:\myapp\ccremote\bin\ccremote.pdb -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.res -f:\myapp\ccremote\ccremote\ccremote\..\..\bin\ccremote.exe -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\ccremote.write.1u.tlog f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\cl.command.1.tlog f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\cl.read.1.tlog f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\cl.write.1.tlog -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\link.command.1.tlog -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\link.read.1.tlog -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\link.write.1.tlog -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\rc.command.1.tlog -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\rc.read.1.tlog -f:\myapp\ccremote\ccremote\ccremote\release\ccremote.tlog\rc.write.1.tlog diff --git a/CcRemote/CcRemote/Release/CcRemote.log b/CcRemote/CcRemote/Release/CcRemote.log index 3c08bad..9a1cf63 100644 --- a/CcRemote/CcRemote/Release/CcRemote.log +++ b/CcRemote/CcRemote/Release/CcRemote.log @@ -70,10 +70,17 @@ f:\myapp\ccremote\ccremote\ccremote\inputdlg.h(69): warning C4302: “类型强 f:\myapp\ccremote\ccremote\ccremote\inputdlg.cpp(124): warning C4996: 'wcscpy': This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. d:\windows kits\10\include\10.0.17763.0\ucrt\corecrt_wstring.h(123): note: 参见“wcscpy”的声明 f:\myapp\ccremote\ccremote\ccremote\inputdlg.cpp(159): warning C4302: “类型强制转换”: 从“LPSTR”到“WORD”截断 + RegDlg.cpp +f:\myapp\ccremote\ccremote\ccremote\regdlg.cpp(247): warning C4475: “sprintf”: 不可在格式说明符中将长度修饰符“w”与类型字段字符“d”一起使用 +f:\myapp\ccremote\ccremote\ccremote\regdlg.cpp(258): warning C4475: “sprintf”: 不可在格式说明符中将长度修饰符“w”与类型字段字符“d”一起使用 +f:\myapp\ccremote\ccremote\ccremote\regdlg.cpp(247): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. + d:\windows kits\10\include\10.0.17763.0\ucrt\stdio.h(1774): note: 参见“sprintf”的声明 +f:\myapp\ccremote\ccremote\ccremote\regdlg.cpp(258): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. + d:\windows kits\10\include\10.0.17763.0\ucrt\stdio.h(1774): note: 参见“sprintf”的声明 SEU_QQwry.cpp TrueColorToolBar.cpp 正在生成代码 - All 717 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. + All 731 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 已完成代码的生成 nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) 已在 LIBCMTD.lib(new_scalar.obj) 中定义;已忽略第二个定义 nafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) 已在 LIBCMTD.lib(delete_scalar.obj) 中定义;已忽略第二个定义 diff --git a/CcRemote/CcRemote/Release/CcRemote.res b/CcRemote/CcRemote/Release/CcRemote.res index 27457d9..15983ac 100644 Binary files a/CcRemote/CcRemote/Release/CcRemote.res and b/CcRemote/CcRemote/Release/CcRemote.res differ diff --git a/CcRemote/CcRemote/resource.h b/CcRemote/CcRemote/resource.h index 6437a8f..3c1ab4d 100644 Binary files a/CcRemote/CcRemote/resource.h and b/CcRemote/CcRemote/resource.h differ diff --git a/bin/CcRemote.exe b/bin/CcRemote.exe index 0eb334f..f32c990 100644 Binary files a/bin/CcRemote.exe and b/bin/CcRemote.exe differ diff --git a/common/macros.h b/common/macros.h index 2c68301..7c47c84 100644 --- a/common/macros.h +++ b/common/macros.h @@ -84,6 +84,8 @@ enum COMMAND_SERVICES_AUTO, // ������ʽ - �Զ����� COMMAND_SERVICES_MANUAL, // ������ʽ - �ֶ����� + COMMAND_REGEDIT, //ע������� + COMMAND_REG_FIND, //ע��� ������ʶ // ����˷����ı�ʶ TOKEN_AUTH = 100, // Ҫ����֤ @@ -121,7 +123,10 @@ enum TOKEN_WSLIST, // �����б� TOKEN_DIALUPASS, // �������� TOKEN_SHELL_START, // Զ���ն˿�ʼ - TOKEN_SERVERLIST // �����б� + TOKEN_SERVERLIST, // �����б� + TOKEN_REGEDIT, // ע�����ʼ����� + TOKEN_REG_PATH, // ע�������� + TOKEN_REG_KEY // ע��������� };