Improvement: Add a popup window to show details
This commit is contained in:
@@ -198,6 +198,12 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
switch (szBuffer[0])
|
||||
{
|
||||
case CMD_AUTHORIZATION: {
|
||||
#ifndef _DEBUG
|
||||
HANDLE hMutex = OpenMutex(SYNCHRONIZE, FALSE, "YAMA.EXE");
|
||||
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);
|
||||
#endif
|
||||
char buf[100] = {}, *passCode = buf + 5;
|
||||
memcpy(buf, szBuffer, min(sizeof(buf), ulLength));
|
||||
char path[MAX_PATH] = { 0 };
|
||||
|
||||
@@ -179,6 +179,50 @@ std::string getProcessTime() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int getOSBits() {
|
||||
SYSTEM_INFO si;
|
||||
GetNativeSystemInfo(&si);
|
||||
|
||||
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
|
||||
si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64) {
|
||||
return 64;
|
||||
}
|
||||
else {
|
||||
return 32;
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>CPU<50><55><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// SYSTEM_INFO.dwNumberOfProcessors
|
||||
int GetCPUCores()
|
||||
{
|
||||
INT i = 0;
|
||||
#ifdef _WIN64
|
||||
// <20><> x64 <20>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫʹ<D2AA><CAB9> `NtQuerySystemInformation`
|
||||
SYSTEM_INFO sysInfo;
|
||||
GetSystemInfo(&sysInfo);
|
||||
i = sysInfo.dwNumberOfProcessors; // <20><>ȡ CPU <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#else
|
||||
_asm { // x64<36><34><EFBFBD><EFBFBD>ģʽ<C4A3>²<EFBFBD>֧<EFBFBD><D6A7>__asm<73>Ļ<EFBFBD><C4BB><EFBFBD>Ƕ<EFBFBD><C7B6>
|
||||
mov eax, dword ptr fs : [0x18] ; // TEB
|
||||
mov eax, dword ptr ds : [eax + 0x30] ; // PEB
|
||||
mov eax, dword ptr ds : [eax + 0x64] ;
|
||||
mov i, eax;
|
||||
}
|
||||
#endif
|
||||
Mprintf("<EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CPU<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", i);
|
||||
return i;
|
||||
}
|
||||
|
||||
double GetMemorySizeGB() {
|
||||
_MEMORYSTATUSEX mst;
|
||||
mst.dwLength = sizeof(mst);
|
||||
GlobalMemoryStatusEx(&mst);
|
||||
double GB = mst.ullTotalPhys / (1024.0 * 1024 * 1024);
|
||||
Mprintf("<EFBFBD>˼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>: %fGB\n", GB);
|
||||
return GB;
|
||||
}
|
||||
|
||||
LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
{
|
||||
LOGIN_INFOR LoginInfor;
|
||||
@@ -200,10 +244,10 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
LoginInfor.dwCPUMHz = dwCPUMHz;
|
||||
LoginInfor.bWebCamIsExist = bWebCamIsExist;
|
||||
strcpy_s(LoginInfor.szStartTime, getProcessTime().c_str());
|
||||
sprintf_s(LoginInfor.szReserved, "%s", GetClientType(conn.ClientType()));
|
||||
LoginInfor.AddReserved("?"); // ϵͳλ<CDB3><CEBB>
|
||||
LoginInfor.AddReserved("?"); // CPU<50><55><EFBFBD><EFBFBD>
|
||||
LoginInfor.AddReserved("?"); // ϵͳ<CFB5>ڴ<EFBFBD>
|
||||
LoginInfor.AddReserved(GetClientType(conn.ClientType())); // <20><><EFBFBD><EFBFBD>
|
||||
LoginInfor.AddReserved(getOSBits()); // ϵͳλ<CDB3><CEBB>
|
||||
LoginInfor.AddReserved(GetCPUCores()); // CPU<50><55><EFBFBD><EFBFBD>
|
||||
LoginInfor.AddReserved(GetMemorySizeGB()); // ϵͳ<CFB5>ڴ<EFBFBD>
|
||||
char buf[_MAX_PATH] = {};
|
||||
GetModuleFileNameA(NULL, buf, sizeof(buf));
|
||||
LoginInfor.AddReserved(buf); // <20>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
@@ -214,13 +258,31 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
installTime = ToPekingTimeAsString(nullptr);;
|
||||
WriteAppSettingA("install_time", installTime);
|
||||
}
|
||||
LoginInfor.AddReserved(installTime.c_str());
|
||||
LoginInfor.AddReserved(installTime.c_str()); // <20><>װʱ<D7B0><CAB1>
|
||||
LoginInfor.AddReserved("?"); // <20><>װ<EFBFBD><D7B0>Ϣ
|
||||
LoginInfor.AddReserved(sizeof(void*)==4 ? 32 : 64); // <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
std::string str;
|
||||
#ifndef _DEBUG
|
||||
HANDLE hMutex = OpenMutex(SYNCHRONIZE, FALSE, "YAMA.EXE");
|
||||
if (hMutex != NULL) {
|
||||
CloseHandle(hMutex);
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
GET_FILEPATH(buf, "settings.ini");
|
||||
char auth[_MAX_PATH] = { 0 };
|
||||
GetPrivateProfileStringA("settings", "Password", "", auth, sizeof(auth), buf);
|
||||
str = std::string(auth);
|
||||
str.erase(std::remove(str.begin(), str.end(), ' '), str.end());
|
||||
auto list = StringToVector(str, '-', 3);
|
||||
str = list[1];
|
||||
}
|
||||
LoginInfor.AddReserved(str.c_str()); // <20><>Ȩ<EFBFBD><C8A8>Ϣ
|
||||
bool isDefault = strlen(conn.szFlag) == 0 || strcmp(conn.szFlag, skCrypt(FLAG_GHOST)) == 0 ||
|
||||
strcmp(conn.szFlag, skCrypt("Happy New Year!")) == 0;
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
const char* id = isDefault ? masterHash.c_str() : conn.szFlag;
|
||||
memcpy(LoginInfor.szMasterID, id, min(strlen(id), 16));
|
||||
|
||||
return LoginInfor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user