Improve(settings): Save settings to register

This commit is contained in:
yuanyuanxiang
2025-06-18 04:22:48 +08:00
parent c04da3618b
commit 7c7c539305
19 changed files with 252 additions and 149 deletions

View File

@@ -12,6 +12,7 @@
#include "MemoryModule.h"
#include "common/dllRunner.h"
#include "server/2015Remote/pwd_gen.h"
#include <common/iniFile.h>
//////////////////////////////////////////////////////////////////////
// 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>
break;
CloseHandle(hMutex);
const char* pwdHash = m_conn->pwdHash;
#else
const char* pwdHash = MASTER_HASH;
#endif
char buf[100] = {}, *passCode = buf + 5;
memcpy(buf, szBuffer, min(sizeof(buf), ulLength));
char path[MAX_PATH] = { 0 };
GetModuleFileNameA(NULL, path, MAX_PATH);
if (passCode[0] == 0) {
std::string devId = getDeviceID();
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));
} else {
GET_FILEPATH(path, "settings.ini");
WritePrivateProfileStringA("settings", "Password", passCode, path);
iniFile cfg;
cfg.SetStr("settings", "Password", passCode);
}
break;
}