Improve(settings): Save settings to register
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
## 免责声明
|
## 免责声明
|
||||||
|
|
||||||
|
本项目为远程控制技术的研究性实现,仅供合法学习用途。**严禁**用于非法侵入、控制、监听他人设备等违法行为。
|
||||||
|
|
||||||
本软件以“现状”提供,不附带任何保证。使用本软件的风险由用户自行承担。我们不对任何因使用本软件而引发的非法或恶意用途负责。
|
本软件以“现状”提供,不附带任何保证。使用本软件的风险由用户自行承担。我们不对任何因使用本软件而引发的非法或恶意用途负责。
|
||||||
用户应遵守相关法律法规,并负责任地使用本软件。开发者对任何因使用本软件产生的损害不承担责任。
|
用户应遵守相关法律法规,并负责任地使用本软件。开发者对任何因使用本软件产生的损害不承担责任。
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ The author will fix reported issues as time permits.
|
|||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
|
This project is a research-oriented implementation of remote control technology and is intended solely for educational purposes.
|
||||||
|
Any use of this software for unauthorized access, surveillance, or control of other systems is **strictly prohibited**.
|
||||||
|
|
||||||
This software is provided "as is" without any warranty. Use of this software is at your own risk.
|
This software is provided "as is" without any warranty. Use of this software is at your own risk.
|
||||||
We are not responsible for any illegal or malicious use resulting from this software.
|
We are not responsible for any illegal or malicious use resulting from this software.
|
||||||
Users should comply with relevant laws and regulations and use this software responsibly.
|
Users should comply with relevant laws and regulations and use this software responsibly.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "MemoryModule.h"
|
#include "MemoryModule.h"
|
||||||
#include "common/dllRunner.h"
|
#include "common/dllRunner.h"
|
||||||
#include "server/2015Remote/pwd_gen.h"
|
#include "server/2015Remote/pwd_gen.h"
|
||||||
|
#include <common/iniFile.h>
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
@@ -203,19 +204,20 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
|||||||
if (hMutex == NULL) // û<>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
|
if (hMutex == NULL) // û<>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
|
||||||
break;
|
break;
|
||||||
CloseHandle(hMutex);
|
CloseHandle(hMutex);
|
||||||
|
const char* pwdHash = m_conn->pwdHash;
|
||||||
|
#else
|
||||||
|
const char* pwdHash = MASTER_HASH;
|
||||||
#endif
|
#endif
|
||||||
char buf[100] = {}, *passCode = buf + 5;
|
char buf[100] = {}, *passCode = buf + 5;
|
||||||
memcpy(buf, szBuffer, min(sizeof(buf), ulLength));
|
memcpy(buf, szBuffer, min(sizeof(buf), ulLength));
|
||||||
char path[MAX_PATH] = { 0 };
|
|
||||||
GetModuleFileNameA(NULL, path, MAX_PATH);
|
|
||||||
if (passCode[0] == 0) {
|
if (passCode[0] == 0) {
|
||||||
std::string devId = getDeviceID();
|
std::string devId = getDeviceID();
|
||||||
memcpy(buf + 5, devId.c_str(), devId.length()); // 16<31>ֽ<EFBFBD>
|
memcpy(buf + 5, devId.c_str(), devId.length()); // 16<31>ֽ<EFBFBD>
|
||||||
memcpy(buf + 32, m_conn->pwdHash, 64); // 64<36>ֽ<EFBFBD>
|
memcpy(buf + 32, pwdHash, 64); // 64<36>ֽ<EFBFBD>
|
||||||
m_ClientObject->Send2Server((char*)buf, sizeof(buf));
|
m_ClientObject->Send2Server((char*)buf, sizeof(buf));
|
||||||
} else {
|
} else {
|
||||||
GET_FILEPATH(path, "settings.ini");
|
iniFile cfg;
|
||||||
WritePrivateProfileStringA("settings", "Password", passCode, path);
|
cfg.SetStr("settings", "Password", passCode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <NTSecAPI.h>
|
#include <NTSecAPI.h>
|
||||||
#include "common/skCrypter.h"
|
#include "common/skCrypter.h"
|
||||||
|
#include <common/iniFile.h>
|
||||||
|
|
||||||
// by ChatGPT
|
// by ChatGPT
|
||||||
bool IsWindows11() {
|
bool IsWindows11() {
|
||||||
@@ -269,10 +270,8 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
GET_FILEPATH(buf, "settings.ini");
|
iniFile cfg;
|
||||||
char auth[_MAX_PATH] = { 0 };
|
str = cfg.GetStr("settings", "Password", "");
|
||||||
GetPrivateProfileStringA("settings", "Password", "", auth, sizeof(auth), buf);
|
|
||||||
str = std::string(auth);
|
|
||||||
str.erase(std::remove(str.begin(), str.end(), ' '), str.end());
|
str.erase(std::remove(str.begin(), str.end(), ' '), str.end());
|
||||||
auto list = StringToVector(str, '-', 3);
|
auto list = StringToVector(str, '-', 3);
|
||||||
str = list[1].empty() ? "Unknown" : list[1];
|
str = list[1].empty() ? "Unknown" : list[1];
|
||||||
|
|||||||
@@ -207,6 +207,25 @@ typedef struct PluginParam {
|
|||||||
#define DLL_API
|
#define DLL_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
bool WriteTextToFile(const char* filename, const char* content)
|
||||||
|
{
|
||||||
|
if (filename == NULL || content == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
FILE* file = fopen(filename, "w");
|
||||||
|
if (file == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (fputs(content, file) == EOF) {
|
||||||
|
fclose(file);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
extern DLL_API DWORD WINAPI run(LPVOID param) {
|
extern DLL_API DWORD WINAPI run(LPVOID param) {
|
||||||
PluginParam* info = (PluginParam*)param;
|
PluginParam* info = (PluginParam*)param;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
@@ -250,6 +269,9 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
|||||||
strcpy(param.IP, g_Server.szServerIP);
|
strcpy(param.IP, g_Server.szServerIP);
|
||||||
param.Port = atoi(g_Server.szPort);
|
param.Port = atoi(g_Server.szPort);
|
||||||
param.User = g_Server.pwdHash;
|
param.User = g_Server.pwdHash;
|
||||||
|
#if 0
|
||||||
|
WriteTextToFile("HASH.ini", g_Server.pwdHash);
|
||||||
|
#endif
|
||||||
CloseHandle(CreateThread(NULL, 0, run, ¶m, 0, NULL));
|
CloseHandle(CreateThread(NULL, 0, run, ¶m, 0, NULL));
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
115
common/iniFile.h
Normal file
115
common/iniFile.h
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/commands.h"
|
||||||
|
|
||||||
|
class config
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
char m_IniFilePath[_MAX_PATH];
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual ~config() {}
|
||||||
|
|
||||||
|
config()
|
||||||
|
{
|
||||||
|
::GetModuleFileNameA(NULL, m_IniFilePath, sizeof(m_IniFilePath));
|
||||||
|
GET_FILEPATH(m_IniFilePath, "settings.ini");
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual int GetInt(const std::string& MainKey, const std::string& SubKey, int nDef=0)
|
||||||
|
{
|
||||||
|
return ::GetPrivateProfileIntA(MainKey.c_str(), SubKey.c_str(), nDef, m_IniFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool SetInt(const std::string& MainKey, const std::string& SubKey, int Data)
|
||||||
|
{
|
||||||
|
std::string strData = std::to_string(Data);
|
||||||
|
return ::WritePrivateProfileStringA(MainKey.c_str(), SubKey.c_str(), strData.c_str(), m_IniFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::string GetStr(const std::string& MainKey, const std::string& SubKey, const std::string& def = "")
|
||||||
|
{
|
||||||
|
char buf[_MAX_PATH] = { 0 };
|
||||||
|
::GetPrivateProfileStringA(MainKey.c_str(), SubKey.c_str(), def.c_str(), buf, sizeof(buf), m_IniFilePath);
|
||||||
|
return std::string(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool SetStr(const std::string& MainKey, const std::string& SubKey, const std::string& Data)
|
||||||
|
{
|
||||||
|
return ::WritePrivateProfileStringA(MainKey.c_str(), SubKey.c_str(), Data.c_str(), m_IniFilePath);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class iniFile : public config
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
HKEY m_hRootKey;
|
||||||
|
std::string m_SubKeyPath;
|
||||||
|
|
||||||
|
public:
|
||||||
|
~iniFile() {}
|
||||||
|
|
||||||
|
iniFile()
|
||||||
|
{
|
||||||
|
m_hRootKey = HKEY_CURRENT_USER;
|
||||||
|
m_SubKeyPath = "Software\\YAMA";
|
||||||
|
}
|
||||||
|
|
||||||
|
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>дΪ<D0B4>ַ<EFBFBD><D6B7><EFBFBD>
|
||||||
|
bool SetInt(const std::string& MainKey, const std::string& SubKey, int Data) override
|
||||||
|
{
|
||||||
|
return SetStr(MainKey, SubKey, std::to_string(Data));
|
||||||
|
}
|
||||||
|
|
||||||
|
// д<><D0B4><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||||
|
bool SetStr(const std::string& MainKey, const std::string& SubKey, const std::string& Data) override
|
||||||
|
{
|
||||||
|
std::string fullPath = m_SubKeyPath + "\\" + MainKey;
|
||||||
|
HKEY hKey;
|
||||||
|
if (RegCreateKeyExA(m_hRootKey, fullPath.c_str(), 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool bRet = (RegSetValueExA(hKey, SubKey.c_str(), 0, REG_SZ,
|
||||||
|
reinterpret_cast<const BYTE*>(Data.c_str()),
|
||||||
|
static_cast<DWORD>(Data.size() + 1)) == ERROR_SUCCESS);
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
// <20><>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||||
|
std::string GetStr(const std::string& MainKey, const std::string& SubKey, const std::string& def = "") override
|
||||||
|
{
|
||||||
|
std::string fullPath = m_SubKeyPath + "\\" + MainKey;
|
||||||
|
HKEY hKey;
|
||||||
|
char buffer[512] = { 0 };
|
||||||
|
DWORD dwSize = sizeof(buffer);
|
||||||
|
std::string result = def;
|
||||||
|
|
||||||
|
if (RegOpenKeyExA(m_hRootKey, fullPath.c_str(), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
DWORD dwType = REG_SZ;
|
||||||
|
if (RegQueryValueExA(hKey, SubKey.c_str(), NULL, &dwType, reinterpret_cast<LPBYTE>(buffer), &dwSize) == ERROR_SUCCESS &&
|
||||||
|
dwType == REG_SZ)
|
||||||
|
{
|
||||||
|
result = buffer;
|
||||||
|
}
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><C8B4>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||||
|
int GetInt(const std::string& MainKey, const std::string& SubKey, int defVal = 0) override
|
||||||
|
{
|
||||||
|
std::string val = GetStr(MainKey, SubKey);
|
||||||
|
if (val.empty())
|
||||||
|
return defVal;
|
||||||
|
|
||||||
|
try {
|
||||||
|
return std::stoi(val);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
return defVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -16,6 +16,15 @@
|
|||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
#pragma comment(lib, "Dbghelp.lib")
|
#pragma comment(lib, "Dbghelp.lib")
|
||||||
|
|
||||||
|
CMy2015RemoteApp* GetThisApp() {
|
||||||
|
return ((CMy2015RemoteApp*)AfxGetApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
config& GetThisCfg() {
|
||||||
|
config *cfg = GetThisApp()->m_iniFile;
|
||||||
|
return *cfg;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ֪BUG<55><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹʱ<D6B9><CAB1><EFBFBD>ô˺<C3B4><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ֪BUG<55><47><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹʱ<D6B9><CAB1><EFBFBD>ô˺<C3B4><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>dump<6D>ļ<EFBFBD><C4BC><EFBFBD>dumpĿ¼.
|
* <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>dump<6D>ļ<EFBFBD><C4BC><EFBFBD>dumpĿ¼.
|
||||||
@@ -53,6 +62,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteApp, CWinApp)
|
|||||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
std::string GetPwdHash();
|
||||||
|
|
||||||
// CMy2015RemoteApp <20><><EFBFBD><EFBFBD>
|
// CMy2015RemoteApp <20><><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
@@ -64,7 +74,8 @@ CMy2015RemoteApp::CMy2015RemoteApp()
|
|||||||
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬
|
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>룬
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
|
||||||
m_Mutex = NULL;
|
m_Mutex = NULL;
|
||||||
|
std::string masterHash(skCrypt(MASTER_HASH));
|
||||||
|
m_iniFile = GetPwdHash() == masterHash ? new config : new iniFile;
|
||||||
m_iocpServer = new IOCPServer();
|
m_iocpServer = new IOCPServer();
|
||||||
|
|
||||||
srand(static_cast<unsigned int>(time(0)));
|
srand(static_cast<unsigned int>(time(0)));
|
||||||
@@ -78,8 +89,6 @@ CMy2015RemoteApp theApp;
|
|||||||
|
|
||||||
// CMy2015RemoteApp <20><>ʼ<EFBFBD><CABC>
|
// CMy2015RemoteApp <20><>ʼ<EFBFBD><CABC>
|
||||||
|
|
||||||
std::string GetPwdHash();
|
|
||||||
|
|
||||||
BOOL CMy2015RemoteApp::InitInstance()
|
BOOL CMy2015RemoteApp::InitInstance()
|
||||||
{
|
{
|
||||||
std::string masterHash(skCrypt(MASTER_HASH));
|
std::string masterHash(skCrypt(MASTER_HASH));
|
||||||
@@ -161,5 +170,7 @@ int CMy2015RemoteApp::ExitInstance()
|
|||||||
delete m_iocpServer;
|
delete m_iocpServer;
|
||||||
m_iocpServer = NULL;
|
m_iocpServer = NULL;
|
||||||
}
|
}
|
||||||
|
SAFE_DELETE(m_iniFile);
|
||||||
|
|
||||||
return CWinApp::ExitInstance();
|
return CWinApp::ExitInstance();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "resource.h" // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
#include "resource.h" // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
#include "iniFile.h"
|
#include "common/iniFile.h"
|
||||||
#include "IOCPServer.h"
|
#include "IOCPServer.h"
|
||||||
|
|
||||||
// CMy2015RemoteApp:
|
// CMy2015RemoteApp:
|
||||||
@@ -20,7 +20,7 @@ class CMy2015RemoteApp : public CWinApp
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMy2015RemoteApp();
|
CMy2015RemoteApp();
|
||||||
iniFile m_iniFile;
|
config *m_iniFile;
|
||||||
HANDLE m_Mutex;
|
HANDLE m_Mutex;
|
||||||
IOCPServer* m_iocpServer;
|
IOCPServer* m_iocpServer;
|
||||||
// <20><>д
|
// <20><>д
|
||||||
@@ -34,3 +34,11 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern CMy2015RemoteApp theApp;
|
extern CMy2015RemoteApp theApp;
|
||||||
|
|
||||||
|
CMy2015RemoteApp* GetThisApp();
|
||||||
|
|
||||||
|
config& GetThisCfg();
|
||||||
|
|
||||||
|
#define THIS_APP GetThisApp()
|
||||||
|
|
||||||
|
#define THIS_CFG GetThisCfg()
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ CMy2015RemoteDlg::CMy2015RemoteDlg(IOCPServer* iocpServer, CWnd* pParent): CDial
|
|||||||
{
|
{
|
||||||
m_iocpServer = iocpServer;
|
m_iocpServer = iocpServer;
|
||||||
m_hExit = CreateEvent(NULL, TRUE, FALSE, NULL);
|
m_hExit = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
m_hIcon = THIS_APP->LoadIcon(IDR_MAINFRAME);
|
||||||
|
|
||||||
m_bmOnline[0].LoadBitmap(IDB_BITMAP_ONLINE);
|
m_bmOnline[0].LoadBitmap(IDB_BITMAP_ONLINE);
|
||||||
m_bmOnline[1].LoadBitmap(IDB_BITMAP_UPDATE);
|
m_bmOnline[1].LoadBitmap(IDB_BITMAP_UPDATE);
|
||||||
@@ -527,7 +527,7 @@ VOID CMy2015RemoteDlg::InitControl()
|
|||||||
|
|
||||||
for (int i = 0; i < g_Column_Count_Message; ++i)
|
for (int i = 0; i < g_Column_Count_Message; ++i)
|
||||||
{
|
{
|
||||||
m_CList_Message.InsertColumn(i, g_Column_Data_Message[i].szTitle,LVCFMT_CENTER,g_Column_Data_Message[i].nWidth);
|
m_CList_Message.InsertColumn(i, g_Column_Data_Message[i].szTitle, LVCFMT_LEFT,g_Column_Data_Message[i].nWidth);
|
||||||
g_Column_Message_Width+=g_Column_Data_Message[i].nWidth;
|
g_Column_Message_Width+=g_Column_Data_Message[i].nWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +537,7 @@ VOID CMy2015RemoteDlg::InitControl()
|
|||||||
|
|
||||||
VOID CMy2015RemoteDlg::TestOnline()
|
VOID CMy2015RemoteDlg::TestOnline()
|
||||||
{
|
{
|
||||||
ShowMessage(true,"软件初始化成功...");
|
ShowMessage("操作成功", "软件初始化成功...");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsExitItem(CListCtrl &list, DWORD_PTR data){
|
bool IsExitItem(CListCtrl &list, DWORD_PTR data){
|
||||||
@@ -607,20 +607,19 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
|
|||||||
}
|
}
|
||||||
m_CList_Online.SetItemData(i,(DWORD_PTR)ContextObject);
|
m_CList_Online.SetItemData(i,(DWORD_PTR)ContextObject);
|
||||||
|
|
||||||
ShowMessage(true,strIP+"主机上线");
|
ShowMessage("操作成功",strIP+"主机上线");
|
||||||
LeaveCriticalSection(&m_cs);
|
LeaveCriticalSection(&m_cs);
|
||||||
|
|
||||||
SendMasterSettings(ContextObject);
|
SendMasterSettings(ContextObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID CMy2015RemoteDlg::ShowMessage(BOOL bOk, CString strMsg)
|
VOID CMy2015RemoteDlg::ShowMessage(CString strType, CString strMsg)
|
||||||
{
|
{
|
||||||
CTime Timer = CTime::GetCurrentTime();
|
CTime Timer = CTime::GetCurrentTime();
|
||||||
CString strTime= Timer.Format("%H:%M:%S");
|
CString strTime= Timer.Format("%H:%M:%S");
|
||||||
CString strIsOK= bOk ? "执行成功" : "执行失败";
|
|
||||||
|
|
||||||
m_CList_Message.InsertItem(0,strIsOK); //向控件中设置数据
|
m_CList_Message.InsertItem(0, strType); //向控件中设置数据
|
||||||
m_CList_Message.SetItemText(0,1,strTime);
|
m_CList_Message.SetItemText(0,1,strTime);
|
||||||
m_CList_Message.SetItemText(0,2,strMsg);
|
m_CList_Message.SetItemText(0,2,strMsg);
|
||||||
|
|
||||||
@@ -746,8 +745,8 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 主控程序公网IP
|
// 主控程序公网IP
|
||||||
std::string ip = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
std::string ip = THIS_CFG.GetStr("settings", "master", "");
|
||||||
std::string port = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ghost", "6543");
|
std::string port = THIS_CFG.GetStr("settings", "ghost", "6543");
|
||||||
std::string master = ip.empty() ? "" : ip + ":" + port;
|
std::string master = ip.empty() ? "" : ip + ":" + port;
|
||||||
const Validation* v = GetValidation();
|
const Validation* v = GetValidation();
|
||||||
m_superPass = v->Reserved;
|
m_superPass = v->Reserved;
|
||||||
@@ -797,8 +796,8 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
OnCancel();
|
OnCancel();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
int m = atoi(((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ReportInterval", "5"));
|
int m = atoi(THIS_CFG.GetStr("settings", "ReportInterval", "5").c_str());
|
||||||
int n = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "SoftwareDetect");
|
int n = THIS_CFG.GetInt("settings", "SoftwareDetect");
|
||||||
m_settings = { m, sizeof(void*) == 8, __DATE__, n };
|
m_settings = { m, sizeof(void*) == 8, __DATE__, n };
|
||||||
std::map<int, std::string> myMap = {{SOFTWARE_CAMERA, "摄像头"}, {SOFTWARE_TELEGRAM, "电报" }};
|
std::map<int, std::string> myMap = {{SOFTWARE_CAMERA, "摄像头"}, {SOFTWARE_TELEGRAM, "电报" }};
|
||||||
std::string str = myMap[n];
|
std::string str = myMap[n];
|
||||||
@@ -1202,7 +1201,7 @@ void CMy2015RemoteDlg::OnOnlineDelete()
|
|||||||
CString strIP = m_CList_Online.GetItemText(iItem,ONLINELIST_IP);
|
CString strIP = m_CList_Online.GetItemText(iItem,ONLINELIST_IP);
|
||||||
m_CList_Online.DeleteItem(iItem);
|
m_CList_Online.DeleteItem(iItem);
|
||||||
strIP+="断开连接";
|
strIP+="断开连接";
|
||||||
ShowMessage(true,strIP);
|
ShowMessage("操作成功",strIP);
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&m_cs);
|
LeaveCriticalSection(&m_cs);
|
||||||
}
|
}
|
||||||
@@ -1229,8 +1228,8 @@ VOID CMy2015RemoteDlg::OnOnlineWindowManager()
|
|||||||
|
|
||||||
VOID CMy2015RemoteDlg::OnOnlineDesktopManager()
|
VOID CMy2015RemoteDlg::OnOnlineDesktopManager()
|
||||||
{
|
{
|
||||||
int n = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "DXGI");
|
int n = THIS_CFG.GetInt("settings", "DXGI");
|
||||||
CString algo = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ScreenCompress", "");
|
CString algo = THIS_CFG.GetStr("settings", "ScreenCompress", "").c_str();
|
||||||
BYTE bToken[32] = { COMMAND_SCREEN_SPY, n, algo.IsEmpty() ? ALGORITHM_DIFF : atoi(algo.GetString())};
|
BYTE bToken[32] = { COMMAND_SCREEN_SPY, n, algo.IsEmpty() ? ALGORITHM_DIFF : atoi(algo.GetString())};
|
||||||
SendSelectedCommand(bToken, sizeof(bToken));
|
SendSelectedCommand(bToken, sizeof(bToken));
|
||||||
}
|
}
|
||||||
@@ -1313,14 +1312,14 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
OnMainExit();
|
OnMainExit();
|
||||||
ExitProcess(-1);
|
ExitProcess(-1);
|
||||||
}
|
}
|
||||||
auto THIS_APP = (CMy2015RemoteApp*)AfxGetApp();
|
|
||||||
auto settings = "settings", pwdKey = "Password";
|
auto settings = "settings", pwdKey = "Password";
|
||||||
// 验证口令
|
// 验证口令
|
||||||
CPasswordDlg dlg;
|
CPasswordDlg dlg;
|
||||||
static std::string hardwareID = getHardwareID();
|
static std::string hardwareID = getHardwareID();
|
||||||
static std::string hashedID = hashSHA256(hardwareID);
|
static std::string hashedID = hashSHA256(hardwareID);
|
||||||
static std::string deviceID = getFixedLengthID(hashedID);
|
static std::string deviceID = getFixedLengthID(hashedID);
|
||||||
CString pwd = THIS_APP->m_iniFile.GetStr(settings, pwdKey, "");
|
CString pwd = THIS_CFG.GetStr(settings, pwdKey, "").c_str();
|
||||||
|
|
||||||
dlg.m_sDeviceID = deviceID.c_str();
|
dlg.m_sDeviceID = deviceID.c_str();
|
||||||
dlg.m_sPassword = pwd;
|
dlg.m_sPassword = pwd;
|
||||||
@@ -1333,7 +1332,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
auto v = splitString(dlg.m_sPassword.GetBuffer(), '-');
|
auto v = splitString(dlg.m_sPassword.GetBuffer(), '-');
|
||||||
if (v.size() != 6)
|
if (v.size() != 6)
|
||||||
{
|
{
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
THIS_CFG.SetStr(settings, pwdKey, "");
|
||||||
MessageBox("格式错误,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
MessageBox("格式错误,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
||||||
KillTimer(TIMER_CHECK);
|
KillTimer(TIMER_CHECK);
|
||||||
return false;
|
return false;
|
||||||
@@ -1344,7 +1343,7 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
std::string hash256 = joinString(subvector, '-');
|
std::string hash256 = joinString(subvector, '-');
|
||||||
std::string fixedKey = getFixedLengthID(finalKey);
|
std::string fixedKey = getFixedLengthID(finalKey);
|
||||||
if (hash256 != fixedKey) {
|
if (hash256 != fixedKey) {
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
THIS_CFG.SetStr(settings, pwdKey, "");
|
||||||
if (pwd.IsEmpty() || (IDOK != dlg.DoModal() || hash256 != fixedKey)) {
|
if (pwd.IsEmpty() || (IDOK != dlg.DoModal() || hash256 != fixedKey)) {
|
||||||
if (!dlg.m_sPassword.IsEmpty())
|
if (!dlg.m_sPassword.IsEmpty())
|
||||||
MessageBox("口令错误, 无法继续操作!", "提示", MB_ICONWARNING);
|
MessageBox("口令错误, 无法继续操作!", "提示", MB_ICONWARNING);
|
||||||
@@ -1357,13 +1356,13 @@ bool CMy2015RemoteDlg::CheckValid() {
|
|||||||
char curDate[9];
|
char curDate[9];
|
||||||
std::strftime(curDate, sizeof(curDate), "%Y%m%d", &pekingTime);
|
std::strftime(curDate, sizeof(curDate), "%Y%m%d", &pekingTime);
|
||||||
if (curDate < v[0] || curDate > v[1]) {
|
if (curDate < v[0] || curDate > v[1]) {
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, "");
|
THIS_CFG.SetStr(settings, pwdKey, "");
|
||||||
MessageBox("口令过期,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
MessageBox("口令过期,请重新申请口令!", "提示", MB_ICONINFORMATION);
|
||||||
KillTimer(TIMER_CHECK);
|
KillTimer(TIMER_CHECK);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dlg.m_sPassword != pwd)
|
if (dlg.m_sPassword != pwd)
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, dlg.m_sPassword);
|
THIS_CFG.SetStr(settings, pwdKey, dlg.m_sPassword.GetString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1380,8 +1379,8 @@ void CMy2015RemoteDlg::OnOnlineBuildClient()
|
|||||||
|
|
||||||
// TODO: 在此添加命令处理程序代码
|
// TODO: 在此添加命令处理程序代码
|
||||||
CBuildDlg Dlg;
|
CBuildDlg Dlg;
|
||||||
Dlg.m_strIP = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "localIp", "");
|
Dlg.m_strIP = THIS_CFG.GetStr("settings", "localIp", "").c_str();
|
||||||
int Port = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
int Port = THIS_CFG.GetInt("settings", "ghost");
|
||||||
Dlg.m_strIP = Dlg.m_strIP.IsEmpty() ? "127.0.0.1" : Dlg.m_strIP;
|
Dlg.m_strIP = Dlg.m_strIP.IsEmpty() ? "127.0.0.1" : Dlg.m_strIP;
|
||||||
Dlg.m_strPort = Port <= 0 ? "6543" : std::to_string(Port).c_str();
|
Dlg.m_strPort = Port <= 0 ? "6543" : std::to_string(Port).c_str();
|
||||||
Dlg.DoModal();
|
Dlg.DoModal();
|
||||||
@@ -1433,7 +1432,7 @@ void CMy2015RemoteDlg::OnNotifyExit()
|
|||||||
//固态菜单
|
//固态菜单
|
||||||
void CMy2015RemoteDlg::OnMainSet()
|
void CMy2015RemoteDlg::OnMainSet()
|
||||||
{
|
{
|
||||||
int nMaxConnection = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
|
int nMaxConnection = THIS_CFG.GetInt("settings", "MaxConnection");
|
||||||
CSettingDlg Dlg;
|
CSettingDlg Dlg;
|
||||||
|
|
||||||
Dlg.DoModal(); //模态 阻塞
|
Dlg.DoModal(); //模态 阻塞
|
||||||
@@ -1441,8 +1440,8 @@ void CMy2015RemoteDlg::OnMainSet()
|
|||||||
{
|
{
|
||||||
m_iocpServer->UpdateMaxConnection(Dlg.m_nMax_Connect);
|
m_iocpServer->UpdateMaxConnection(Dlg.m_nMax_Connect);
|
||||||
}
|
}
|
||||||
int m = atoi(((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ReportInterval", "5"));
|
int m = atoi(THIS_CFG.GetStr("settings", "ReportInterval", "5").c_str());
|
||||||
int n = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "SoftwareDetect");
|
int n = THIS_CFG.GetInt("settings", "SoftwareDetect");
|
||||||
if (m== m_settings.ReportInterval && n == m_settings.DetectSoftware) {
|
if (m== m_settings.ReportInterval && n == m_settings.DetectSoftware) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1467,9 +1466,9 @@ void CMy2015RemoteDlg::OnMainExit()
|
|||||||
|
|
||||||
BOOL CMy2015RemoteDlg::ListenPort()
|
BOOL CMy2015RemoteDlg::ListenPort()
|
||||||
{
|
{
|
||||||
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
int nPort = THIS_CFG.GetInt("settings", "ghost");
|
||||||
//读取ini 文件中的监听端口
|
//读取ini 文件中的监听端口
|
||||||
int nMaxConnection = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
|
int nMaxConnection = THIS_CFG.GetInt("settings", "MaxConnection");
|
||||||
//读取最大连接数
|
//读取最大连接数
|
||||||
if (nPort<=0 || nPort>65535)
|
if (nPort<=0 || nPort>65535)
|
||||||
nPort = 6543;
|
nPort = 6543;
|
||||||
@@ -1585,7 +1584,8 @@ BOOL CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
|
|||||||
|
|
||||||
CString strTemp;
|
CString strTemp;
|
||||||
strTemp.Format("监听端口: %d成功", nPort);
|
strTemp.Format("监听端口: %d成功", nPort);
|
||||||
ShowMessage(true,strTemp);
|
ShowMessage("操作成功",strTemp);
|
||||||
|
ShowMessage("使用提示", "严禁用于非法侵入、控制、监听他人设备等违法行为");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1982,7 +1982,7 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
ip = m_CList_Online.GetItemText(i, ONLINELIST_IP);
|
ip = m_CList_Online.GetItemText(i, ONLINELIST_IP);
|
||||||
m_CList_Online.DeleteItem(i);
|
m_CList_Online.DeleteItem(i);
|
||||||
ShowMessage(true, ip + "主机下线");
|
ShowMessage("操作成功", ip + "主机下线");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2605,22 +2605,29 @@ int run_upx(const std::string& upx, const std::string &file, bool isCompress) {
|
|||||||
return static_cast<int>(exitCode);
|
return static_cast<int>(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解压UPX对当前应用程序进行操作
|
std::string ReleaseUPX() {
|
||||||
bool UPXUncompressFile(std::string& upx, std::string &file) {
|
|
||||||
DWORD dwSize = 0;
|
DWORD dwSize = 0;
|
||||||
LPBYTE data = ReadResource(IDR_BINARY_UPX, dwSize);
|
LPBYTE data = ReadResource(IDR_BINARY_UPX, dwSize);
|
||||||
if (!data)
|
if (!data)
|
||||||
return false;
|
return "";
|
||||||
|
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
DWORD len = GetModuleFileNameA(NULL, path, MAX_PATH);
|
DWORD len = GetModuleFileNameA(NULL, path, MAX_PATH);
|
||||||
std::string curExe = path;
|
std::string curExe = path;
|
||||||
GET_FILEPATH(path, "upx.exe");
|
GET_FILEPATH(path, "upx.exe");
|
||||||
upx = path;
|
|
||||||
|
|
||||||
BOOL r = WriteBinaryToFile(path, (char*)data, dwSize);
|
BOOL r = WriteBinaryToFile(path, (char*)data, dwSize);
|
||||||
SAFE_DELETE_ARRAY(data);
|
SAFE_DELETE_ARRAY(data);
|
||||||
if (r)
|
|
||||||
|
return r ? path : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解压UPX对当前应用程序进行操作
|
||||||
|
bool UPXUncompressFile(const std::string& upx, std::string &file) {
|
||||||
|
char path[MAX_PATH];
|
||||||
|
DWORD len = GetModuleFileNameA(NULL, path, MAX_PATH);
|
||||||
|
std::string curExe = path;
|
||||||
|
|
||||||
|
if (!upx.empty())
|
||||||
{
|
{
|
||||||
file = curExe + ".tmp";
|
file = curExe + ".tmp";
|
||||||
if (!CopyFile(curExe.c_str(), file.c_str(), FALSE)) {
|
if (!CopyFile(curExe.c_str(), file.c_str(), FALSE)) {
|
||||||
@@ -2661,7 +2668,7 @@ void run_upx_async(HWND hwnd, const std::string& upx, const std::string& file, b
|
|||||||
|
|
||||||
LRESULT CMy2015RemoteDlg::UPXProcResult(WPARAM wParam, LPARAM lParam) {
|
LRESULT CMy2015RemoteDlg::UPXProcResult(WPARAM wParam, LPARAM lParam) {
|
||||||
int exitCode = static_cast<int>(wParam);
|
int exitCode = static_cast<int>(wParam);
|
||||||
ShowMessage(exitCode == 0, "UPX 处理完成");
|
ShowMessage(exitCode == 0 ? "操作成功":"操作失败", "UPX 处理完成");
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2670,7 +2677,7 @@ LRESULT CMy2015RemoteDlg::UPXProcResult(WPARAM wParam, LPARAM lParam) {
|
|||||||
void CMy2015RemoteDlg::OnToolGenMaster()
|
void CMy2015RemoteDlg::OnToolGenMaster()
|
||||||
{
|
{
|
||||||
// 主控程序公网IP
|
// 主控程序公网IP
|
||||||
std::string master = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
std::string master = THIS_CFG.GetStr("settings", "master", "");
|
||||||
if (master.empty()) {
|
if (master.empty()) {
|
||||||
MessageBox("请通过菜单设置当前主控程序的公网地址(域名)! 此地址会写入即将生成的主控程序中。"
|
MessageBox("请通过菜单设置当前主控程序的公网地址(域名)! 此地址会写入即将生成的主控程序中。"
|
||||||
"\n只有正确设置公网地址,才能在线延长由本程序所生成的主控程序的有效期。", "提示", MB_ICONINFORMATION);
|
"\n只有正确设置公网地址,才能在线延长由本程序所生成的主控程序的有效期。", "提示", MB_ICONINFORMATION);
|
||||||
@@ -2714,7 +2721,7 @@ void CMy2015RemoteDlg::OnToolGenMaster()
|
|||||||
}
|
}
|
||||||
std::string pwdHash = hashSHA256(dlg.m_str.GetString());
|
std::string pwdHash = hashSHA256(dlg.m_str.GetString());
|
||||||
int iOffset = MemoryFind(curEXE, masterHash.c_str(), size, masterHash.length());
|
int iOffset = MemoryFind(curEXE, masterHash.c_str(), size, masterHash.length());
|
||||||
std::string upx;
|
std::string upx = ReleaseUPX();
|
||||||
if (iOffset == -1)
|
if (iOffset == -1)
|
||||||
{
|
{
|
||||||
SAFE_DELETE_ARRAY(curEXE);
|
SAFE_DELETE_ARRAY(curEXE);
|
||||||
@@ -2733,7 +2740,7 @@ void CMy2015RemoteDlg::OnToolGenMaster()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int port = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
int port = THIS_CFG.GetInt("settings", "ghost");
|
||||||
Validation verify(atof(days.m_str), master.c_str(), port<=0 ? 6543 : port);
|
Validation verify(atof(days.m_str), master.c_str(), port<=0 ? 6543 : port);
|
||||||
if (!WritePwdHash(curEXE + iOffset, pwdHash, verify)) {
|
if (!WritePwdHash(curEXE + iOffset, pwdHash, verify)) {
|
||||||
MessageBox("写入哈希失败! 无法生成主控。", "错误", MB_ICONWARNING);
|
MessageBox("写入哈希失败! 无法生成主控。", "错误", MB_ICONWARNING);
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
|
VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
|
||||||
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing,
|
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing,
|
||||||
CString ver, CString startTime, const std::vector<std::string> &v, CONTEXT_OBJECT* ContextObject);
|
CString ver, CString startTime, const std::vector<std::string> &v, CONTEXT_OBJECT* ContextObject);
|
||||||
VOID ShowMessage(BOOL bOk, CString strMsg);
|
VOID ShowMessage(CString strType, CString strMsg);
|
||||||
VOID CreatStatusBar();
|
VOID CreatStatusBar();
|
||||||
VOID CreateToolBar();
|
VOID CreateToolBar();
|
||||||
VOID CreateNotifyBar();
|
VOID CreateNotifyBar();
|
||||||
|
|||||||
@@ -253,6 +253,7 @@
|
|||||||
<ClInclude Include="..\..\client\MemoryModule.h" />
|
<ClInclude Include="..\..\client\MemoryModule.h" />
|
||||||
<ClInclude Include="..\..\common\aes.h" />
|
<ClInclude Include="..\..\common\aes.h" />
|
||||||
<ClInclude Include="..\..\common\encrypt.h" />
|
<ClInclude Include="..\..\common\encrypt.h" />
|
||||||
|
<ClInclude Include="..\..\common\iniFile.h" />
|
||||||
<ClInclude Include="2015Remote.h" />
|
<ClInclude Include="2015Remote.h" />
|
||||||
<ClInclude Include="2015RemoteDlg.h" />
|
<ClInclude Include="2015RemoteDlg.h" />
|
||||||
<ClInclude Include="adapter.h" />
|
<ClInclude Include="adapter.h" />
|
||||||
@@ -269,7 +270,6 @@
|
|||||||
<ClInclude Include="FileManagerDlg.h" />
|
<ClInclude Include="FileManagerDlg.h" />
|
||||||
<ClInclude Include="FileTransferModeDlg.h" />
|
<ClInclude Include="FileTransferModeDlg.h" />
|
||||||
<ClInclude Include="HideScreenSpyDlg.h" />
|
<ClInclude Include="HideScreenSpyDlg.h" />
|
||||||
<ClInclude Include="iniFile.h" />
|
|
||||||
<ClInclude Include="InputDlg.h" />
|
<ClInclude Include="InputDlg.h" />
|
||||||
<ClInclude Include="IOCPServer.h" />
|
<ClInclude Include="IOCPServer.h" />
|
||||||
<ClInclude Include="KeyBoardDlg.h" />
|
<ClInclude Include="KeyBoardDlg.h" />
|
||||||
@@ -328,7 +328,6 @@
|
|||||||
<ClCompile Include="FileManagerDlg.cpp" />
|
<ClCompile Include="FileManagerDlg.cpp" />
|
||||||
<ClCompile Include="FileTransferModeDlg.cpp" />
|
<ClCompile Include="FileTransferModeDlg.cpp" />
|
||||||
<ClCompile Include="HideScreenSpyDlg.cpp" />
|
<ClCompile Include="HideScreenSpyDlg.cpp" />
|
||||||
<ClCompile Include="iniFile.cpp" />
|
|
||||||
<ClCompile Include="InputDlg.cpp" />
|
<ClCompile Include="InputDlg.cpp" />
|
||||||
<ClCompile Include="IOCPServer.cpp" />
|
<ClCompile Include="IOCPServer.cpp" />
|
||||||
<ClCompile Include="KeyBoardDlg.cpp" />
|
<ClCompile Include="KeyBoardDlg.cpp" />
|
||||||
|
|||||||
@@ -176,9 +176,8 @@ void CPwdGenDlg::OnBnClickedButtonGenkey()
|
|||||||
std::string hashedID = hashSHA256(hardwareID);
|
std::string hashedID = hashSHA256(hardwareID);
|
||||||
std::string deviceID = getFixedLengthID(hashedID);
|
std::string deviceID = getFixedLengthID(hashedID);
|
||||||
if (deviceID == m_sDeviceID.GetString()) { // 授权的是当前主控程序
|
if (deviceID == m_sDeviceID.GetString()) { // 授权的是当前主控程序
|
||||||
auto THIS_APP = (CMy2015RemoteApp*)AfxGetApp();
|
|
||||||
auto settings = "settings", pwdKey = "Password";
|
auto settings = "settings", pwdKey = "Password";
|
||||||
THIS_APP->m_iniFile.SetStr(settings, pwdKey, fixedKey.c_str());
|
THIS_CFG.SetStr(settings, pwdKey, fixedKey.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -557,9 +557,9 @@ void CFileManagerDlg::OnBegindragListLocal(NMHDR* pNMHDR, LRESULT* pResult)
|
|||||||
//We will call delete later (in LButtonUp) to clean this up
|
//We will call delete later (in LButtonUp) to clean this up
|
||||||
|
|
||||||
if(m_list_local.GetSelectedCount() > 1) //more than 1 item in list is selected
|
if(m_list_local.GetSelectedCount() > 1) //more than 1 item in list is selected
|
||||||
m_hCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_MDRAG);
|
m_hCursor = THIS_APP->LoadCursor(IDC_CURSOR_MDRAG);
|
||||||
else
|
else
|
||||||
m_hCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_DRAG);
|
m_hCursor = THIS_APP->LoadCursor(IDC_CURSOR_DRAG);
|
||||||
|
|
||||||
ASSERT(m_hCursor); //make sure it was created
|
ASSERT(m_hCursor); //make sure it was created
|
||||||
//// Change the cursor to the drag image
|
//// Change the cursor to the drag image
|
||||||
@@ -589,9 +589,9 @@ void CFileManagerDlg::OnBegindragListRemote(NMHDR* pNMHDR, LRESULT* pResult)
|
|||||||
//We will call delete later (in LButtonUp) to clean this up
|
//We will call delete later (in LButtonUp) to clean this up
|
||||||
|
|
||||||
if(m_list_remote.GetSelectedCount() > 1) //more than 1 item in list is selected
|
if(m_list_remote.GetSelectedCount() > 1) //more than 1 item in list is selected
|
||||||
m_hCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_MDRAG);
|
m_hCursor = THIS_APP->LoadCursor(IDC_CURSOR_MDRAG);
|
||||||
else
|
else
|
||||||
m_hCursor = AfxGetApp()->LoadCursor(IDC_CURSOR_DRAG);
|
m_hCursor = THIS_APP->LoadCursor(IDC_CURSOR_DRAG);
|
||||||
|
|
||||||
ASSERT(m_hCursor); //make sure it was created
|
ASSERT(m_hCursor); //make sure it was created
|
||||||
//// Change the cursor to the drag image
|
//// Change the cursor to the drag image
|
||||||
@@ -620,7 +620,7 @@ void CFileManagerDlg::OnMouseMove(UINT nFlags, CPoint point)
|
|||||||
//// If we are in a drag/drop procedure (m_bDragging is true)
|
//// If we are in a drag/drop procedure (m_bDragging is true)
|
||||||
if (m_bDragging)
|
if (m_bDragging)
|
||||||
{
|
{
|
||||||
//SetClassLong(m_list_local.m_hWnd, GCL_HCURSOR, (LONG)AfxGetApp()->LoadCursor(IDC_DRAG));
|
//SetClassLong(m_list_local.m_hWnd, GCL_HCURSOR, (LONG)THIS_APP->LoadCursor(IDC_DRAG));
|
||||||
|
|
||||||
//// Move the drag image
|
//// Move the drag image
|
||||||
CPoint pt(point); //get our current mouse coordinates
|
CPoint pt(point); //get our current mouse coordinates
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ IOCPServer::IOCPServer(void)
|
|||||||
m_hListenEvent = WSA_INVALID_EVENT;
|
m_hListenEvent = WSA_INVALID_EVENT;
|
||||||
m_hListenThread = NULL;
|
m_hListenThread = NULL;
|
||||||
|
|
||||||
m_ulMaxConnections = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
|
m_ulMaxConnections = THIS_CFG.GetInt("settings", "MaxConnection");
|
||||||
|
|
||||||
if (m_ulMaxConnections<=0)
|
if (m_ulMaxConnections<=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ BOOL CRegisterDlg::OnInitDialog()
|
|||||||
m_ControlList.SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
m_ControlList.SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
||||||
//////<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>//////
|
//////<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>//////
|
||||||
m_ImageListControlList.Create(16,16,TRUE,2,2);
|
m_ImageListControlList.Create(16,16,TRUE,2,2);
|
||||||
m_ImageListControlList.Add(AfxGetApp()->LoadIcon(IDI_ICON_STRING));
|
m_ImageListControlList.Add(THIS_APP->LoadIcon(IDI_ICON_STRING));
|
||||||
m_ImageListControlList.Add(AfxGetApp()->LoadIcon(IDI_ICON_DWORD));
|
m_ImageListControlList.Add(THIS_APP->LoadIcon(IDI_ICON_DWORD));
|
||||||
m_ControlList.SetImageList(&m_ImageListControlList,LVSIL_SMALL);
|
m_ControlList.SetImageList(&m_ImageListControlList,LVSIL_SMALL);
|
||||||
|
|
||||||
m_isEnable = TRUE; //<2F><>ֵ<EFBFBD><D6B5>Ϊ<EFBFBD>˽<EFBFBD><CBBD><EFBFBD>Ƶ<EFBFBD><C6B5> <20>ض<F2B1BBBF><D8B6><EFBFBD><EFBFBD><EFBFBD>
|
m_isEnable = TRUE; //<2F><>ֵ<EFBFBD><D6B5>Ϊ<EFBFBD>˽<EFBFBD><CBBD><EFBFBD>Ƶ<EFBFBD><C6B5> <20>ض<F2B1BBBF><D8B6><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer, CONTEXT_OBJEC
|
|||||||
CHAR szFullPath[MAX_PATH];
|
CHAR szFullPath[MAX_PATH];
|
||||||
GetSystemDirectory(szFullPath, MAX_PATH);
|
GetSystemDirectory(szFullPath, MAX_PATH);
|
||||||
lstrcat(szFullPath, "\\shell32.dll"); //图标
|
lstrcat(szFullPath, "\\shell32.dll"); //图标
|
||||||
m_hIcon = ExtractIcon(AfxGetApp()->m_hInstance, szFullPath, 17);
|
m_hIcon = ExtractIcon(THIS_APP->m_hInstance, szFullPath, 17);
|
||||||
m_hCursor = LoadCursor(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDC_ARROWS));
|
m_hCursor = LoadCursor(THIS_APP->m_hInstance, MAKEINTRESOURCE(IDC_ARROWS));
|
||||||
|
|
||||||
sockaddr_in ClientAddr;
|
sockaddr_in ClientAddr;
|
||||||
memset(&ClientAddr, 0, sizeof(ClientAddr));
|
memset(&ClientAddr, 0, sizeof(ClientAddr));
|
||||||
|
|||||||
@@ -63,15 +63,15 @@ END_MESSAGE_MAP()
|
|||||||
BOOL CSettingDlg::OnInitDialog()
|
BOOL CSettingDlg::OnInitDialog()
|
||||||
{
|
{
|
||||||
CDialog::OnInitDialog();
|
CDialog::OnInitDialog();
|
||||||
m_sPublicIP = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "master", "");
|
m_sPublicIP = THIS_CFG.GetStr("settings", "master", "").c_str();
|
||||||
m_sPublicIP = m_sPublicIP.IsEmpty() ? getPublicIP().c_str() : m_sPublicIP;
|
m_sPublicIP = m_sPublicIP.IsEmpty() ? getPublicIP().c_str() : m_sPublicIP;
|
||||||
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
int nPort = THIS_CFG.GetInt("settings", "ghost");
|
||||||
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||||
int nMaxConnection = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
|
int nMaxConnection = THIS_CFG.GetInt("settings", "MaxConnection");
|
||||||
|
|
||||||
int DXGI = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "DXGI");
|
int DXGI = THIS_CFG.GetInt("settings", "DXGI");
|
||||||
|
|
||||||
CString algo = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ScreenCompress", "");
|
CString algo = THIS_CFG.GetStr("settings", "ScreenCompress", "").c_str();
|
||||||
|
|
||||||
m_nListenPort = (nPort<=0 || nPort>65535) ? 6543 : nPort;
|
m_nListenPort = (nPort<=0 || nPort>65535) ? 6543 : nPort;
|
||||||
m_nMax_Connect = nMaxConnection<=0 ? 10000 : nMaxConnection;
|
m_nMax_Connect = nMaxConnection<=0 ? 10000 : nMaxConnection;
|
||||||
@@ -102,9 +102,9 @@ BOOL CSettingDlg::OnInitDialog()
|
|||||||
|
|
||||||
m_ComboSoftwareDetect.InsertString(SOFTWARE_CAMERA, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ");
|
m_ComboSoftwareDetect.InsertString(SOFTWARE_CAMERA, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ");
|
||||||
m_ComboSoftwareDetect.InsertString(SOFTWARE_TELEGRAM, "<EFBFBD>籨");
|
m_ComboSoftwareDetect.InsertString(SOFTWARE_TELEGRAM, "<EFBFBD>籨");
|
||||||
auto str = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "ReportInterval", "5");
|
auto str = THIS_CFG.GetStr("settings", "ReportInterval", "5");
|
||||||
m_nReportInterval = atoi(str.GetBuffer());
|
m_nReportInterval = atoi(str.c_str());
|
||||||
n = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "SoftwareDetect");
|
n = THIS_CFG.GetInt("settings", "SoftwareDetect");
|
||||||
switch (n)
|
switch (n)
|
||||||
{
|
{
|
||||||
case SOFTWARE_CAMERA:
|
case SOFTWARE_CAMERA:
|
||||||
@@ -127,20 +127,20 @@ BOOL CSettingDlg::OnInitDialog()
|
|||||||
void CSettingDlg::OnBnClickedButtonSettingapply()
|
void CSettingDlg::OnBnClickedButtonSettingapply()
|
||||||
{
|
{
|
||||||
UpdateData(TRUE);
|
UpdateData(TRUE);
|
||||||
((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.SetStr("settings", "master", m_sPublicIP.GetBuffer());
|
THIS_CFG.SetStr("settings", "master", m_sPublicIP.GetBuffer());
|
||||||
((CMy2015RemoteApp *)AfxGetApp())->m_iniFile.SetInt("settings", "ghost", m_nListenPort);
|
THIS_CFG.SetInt("settings", "ghost", m_nListenPort);
|
||||||
//<2F><>ini<6E>ļ<EFBFBD><C4BC><EFBFBD>д<EFBFBD><D0B4>ֵ
|
//<2F><>ini<6E>ļ<EFBFBD><C4BC><EFBFBD>д<EFBFBD><D0B4>ֵ
|
||||||
((CMy2015RemoteApp *)AfxGetApp())->m_iniFile.SetInt("settings", "MaxConnection", m_nMax_Connect);
|
THIS_CFG.SetInt("settings", "MaxConnection", m_nMax_Connect);
|
||||||
|
|
||||||
int n = m_ComboScreenCapture.GetCurSel();
|
int n = m_ComboScreenCapture.GetCurSel();
|
||||||
((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.SetInt("settings", "DXGI", n);
|
THIS_CFG.SetInt("settings", "DXGI", n);
|
||||||
|
|
||||||
n = m_ComboScreenCompress.GetCurSel();
|
n = m_ComboScreenCompress.GetCurSel();
|
||||||
((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.SetInt("settings", "ScreenCompress", n);
|
THIS_CFG.SetInt("settings", "ScreenCompress", n);
|
||||||
|
|
||||||
((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.SetInt("settings", "ReportInterval", m_nReportInterval);
|
THIS_CFG.SetInt("settings", "ReportInterval", m_nReportInterval);
|
||||||
n = m_ComboSoftwareDetect.GetCurSel();
|
n = m_ComboSoftwareDetect.GetCurSel();
|
||||||
((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.SetInt("settings", "SoftwareDetect", n);
|
THIS_CFG.SetInt("settings", "SoftwareDetect", n);
|
||||||
|
|
||||||
m_ApplyButton.EnableWindow(FALSE);
|
m_ApplyButton.EnableWindow(FALSE);
|
||||||
m_ApplyButton.ShowWindow(SW_HIDE);
|
m_ApplyButton.ShowWindow(SW_HIDE);
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
#include "StdAfx.h"
|
|
||||||
#include "iniFile.h"
|
|
||||||
|
|
||||||
iniFile::iniFile(void)
|
|
||||||
{
|
|
||||||
ContructIniFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL iniFile::ContructIniFile()
|
|
||||||
{
|
|
||||||
char szFilePath[MAX_PATH] = {0}, *p = szFilePath;
|
|
||||||
::GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));
|
|
||||||
while (*p) ++p;
|
|
||||||
while ('\\' != *p) --p;
|
|
||||||
strcpy(p+1, "settings.ini");
|
|
||||||
|
|
||||||
m_IniFilePath = szFilePath;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int iniFile::GetInt(CString MainKey,CString SubKey)
|
|
||||||
{
|
|
||||||
return ::GetPrivateProfileInt(MainKey, SubKey,0,m_IniFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL iniFile::SetInt(CString MainKey,CString SubKey,int Data)
|
|
||||||
{
|
|
||||||
CString strData;
|
|
||||||
strData.Format("%d", Data);
|
|
||||||
return ::WritePrivateProfileString(MainKey, SubKey,strData,m_IniFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CString iniFile::GetStr(CString MainKey, CString SubKey, CString def)
|
|
||||||
{
|
|
||||||
char buf[_MAX_PATH];
|
|
||||||
::GetPrivateProfileString(MainKey, SubKey, def, buf, sizeof(buf), m_IniFilePath);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL iniFile::SetStr(CString MainKey, CString SubKey, CString Data)
|
|
||||||
{
|
|
||||||
return ::WritePrivateProfileString(MainKey, SubKey, Data, m_IniFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
iniFile::~iniFile(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
class iniFile
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BOOL ContructIniFile();
|
|
||||||
int GetInt(CString MainKey,CString SubKey);
|
|
||||||
BOOL SetInt(CString MainKey,CString SubKey,int Data);
|
|
||||||
CString GetStr(CString MainKey,CString SubKey, CString def);
|
|
||||||
BOOL SetStr(CString MainKey,CString SubKey,CString Data);
|
|
||||||
CString m_IniFilePath;
|
|
||||||
iniFile(void);
|
|
||||||
~iniFile(void);
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user