diff --git a/client/Buffer.cpp b/client/Buffer.cpp index f3be6bd..b5c63d3 100644 --- a/client/Buffer.cpp +++ b/client/Buffer.cpp @@ -34,7 +34,7 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) { return 0; } - ULONG len = (ULONG)m_Ptr - (ULONG)m_Base; + ULONG len = m_Ptr - m_Base; if (ulLength > len) { ulLength = len; @@ -48,7 +48,7 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) m_Ptr -= ulLength; } - DeAllocateBuffer((ULONG)m_Ptr - (ULONG)m_Base); + DeAllocateBuffer(m_Ptr - m_Base); return ulLength; } @@ -57,11 +57,11 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) // 重新分配内存大小 VOID CBuffer::DeAllocateBuffer(ULONG ulLength) { - int len = (ULONG)m_Ptr - (ULONG)m_Base; + int len = m_Ptr - m_Base; if (ulLength < len) return; - ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; + ULONG ulNewMaxLength = ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; if (m_ulMaxLength <= ulNewMaxLength) { @@ -85,7 +85,7 @@ VOID CBuffer::DeAllocateBuffer(ULONG ulLength) BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength) { - if (ReAllocateBuffer(ulLength + ((ULONG)m_Ptr - (ULONG)m_Base)) == FALSE) + if (ReAllocateBuffer(ulLength + (m_Ptr - m_Base)) == FALSE) { return FALSE; } @@ -103,14 +103,14 @@ BOOL CBuffer::ReAllocateBuffer(ULONG ulLength) if (ulLength < m_ulMaxLength) return TRUE; - ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; + ULONG ulNewMaxLength = ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE); if (NewBase == NULL) { return FALSE; } - ULONG len = (ULONG)m_Ptr - (ULONG)m_Base; + ULONG len = m_Ptr - m_Base; CopyMemory(NewBase, m_Base, len); if (m_Base) @@ -136,13 +136,13 @@ VOID CBuffer::ClearBuffer() ULONG CBuffer::GetBufferLength() const { - return (ULONG)m_Ptr - (ULONG)m_Base; + return m_Ptr - m_Base; } PBYTE CBuffer::GetBuffer(ULONG ulPos) const { - if (m_Base==NULL || ulPos>=((ULONG)m_Ptr - (ULONG)m_Base)) + if (m_Base==NULL || ulPos>=(m_Ptr - m_Base)) { return NULL; } diff --git a/client/ClientDll.cpp b/client/ClientDll.cpp index 8173baf..57fcc79 100644 --- a/client/ClientDll.cpp +++ b/client/ClientDll.cpp @@ -309,7 +309,7 @@ DWORD WINAPI StartClient(LPVOID lParam) g_bThreadExit = false; while (!g_bExit) { - DWORD dwTickCount = GetTickCount64(); + ULONGLONG dwTickCount = GetTickCount64(); if (!ClientObject->ConnectServer(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort())) { for (int k = 500; !g_bExit && --k; Sleep(10)); diff --git a/client/ClientDll_vs2015.vcxproj b/client/ClientDll_vs2015.vcxproj index 45ac7ef..bb04143 100644 --- a/client/ClientDll_vs2015.vcxproj +++ b/client/ClientDll_vs2015.vcxproj @@ -75,8 +75,9 @@ $(Configuration)\dll - ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) - $(VLDPATH)\lib\Win64\;$(LibraryPath) + ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + $(Platform)\$(Configuration)\dll $(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath) @@ -84,8 +85,9 @@ $(Configuration)\dll - $(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath) - ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(Platform)\$(Configuration)\dll @@ -115,7 +117,7 @@ true - zlib.lib;%(AdditionalDependencies) + zlib\zlib_x64.lib;%(AdditionalDependencies) libcmt.lib @@ -153,7 +155,7 @@ true true true - zlib.lib;%(AdditionalDependencies) + zlib\zlib_x64.lib;%(AdditionalDependencies) /SAFESEH:NO %(AdditionalOptions) diff --git a/client/IOCPClient.cpp b/client/IOCPClient.cpp index 5950597..2738a38 100644 --- a/client/IOCPClient.cpp +++ b/client/IOCPClient.cpp @@ -19,7 +19,11 @@ #define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen)) #else #include "zstd/zstd.h" +#ifdef _WIN64 +#pragma comment(lib, "zstd/zstd_x64.lib") +#else #pragma comment(lib, "zstd/zstd.lib") +#endif #define Z_FAILED(p) ZSTD_isError(p) #define Z_SUCCESS(p) (!Z_FAILED(p)) #define compress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT) @@ -255,7 +259,7 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength) m_CompressedBuffer.ReadBuffer(CompressedBuffer, ulCompressedLength); - int iRet = uncompress(DeCompressedBuffer, + size_t iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength); if (Z_SUCCESS(iRet))//如果解压成功 diff --git a/client/ScreenManager.cpp b/client/ScreenManager.cpp index 05d2b34..0908369 100644 --- a/client/ScreenManager.cpp +++ b/client/ScreenManager.cpp @@ -201,7 +201,7 @@ VOID CScreenManager::SendClientClipboard() ::CloseClipboard(); return; } - int iPacketLength = GlobalSize(hGlobal) + 1; + size_t iPacketLength = GlobalSize(hGlobal) + 1; char* szClipboardVirtualAddress = (LPSTR) GlobalLock(hGlobal); //锁定 LPBYTE szBuffer = new BYTE[iPacketLength]; diff --git a/client/TestRun_vs2015.vcxproj b/client/TestRun_vs2015.vcxproj index bc5ae77..42ff978 100644 --- a/client/TestRun_vs2015.vcxproj +++ b/client/TestRun_vs2015.vcxproj @@ -73,8 +73,9 @@ $(Configuration)\test - $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) - $(VLDPATH)\lib\Win64\;$(LibraryPath) + $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + $(Platform)\$(Configuration)\test $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) @@ -82,8 +83,9 @@ $(Configuration)\test - $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) - $(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath) + $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + $(Platform)\$(Configuration)\test diff --git a/client/VideoManager.cpp b/client/VideoManager.cpp index 07e90f0..62c1811 100644 --- a/client/VideoManager.cpp +++ b/client/VideoManager.cpp @@ -30,7 +30,7 @@ CVideoManager::CVideoManager(IOCPClient* ClientObject, int n) : CManager(ClientO DWORD CVideoManager::WorkThread(LPVOID lParam) { CVideoManager *This = (CVideoManager *)lParam; - static DWORD dwLastScreen = GetTickCount(); + static ULONGLONG dwLastScreen = GetTickCount64(); if (This->Initialize()) //转到Initialize { diff --git a/client/ghost_vs2015.vcxproj b/client/ghost_vs2015.vcxproj index 2568d3b..2511f68 100644 --- a/client/ghost_vs2015.vcxproj +++ b/client/ghost_vs2015.vcxproj @@ -75,8 +75,9 @@ $(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath) - ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) - $(VLDPATH)\lib\Win64\;$(LibraryPath) + ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + $(Platform)\$(Configuration)\ghost $(Configuration)\ghost @@ -84,8 +85,9 @@ $(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath) - ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) - $(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath) + ./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + $(Platform)\$(Configuration)\ghost @@ -118,7 +120,7 @@ true - zlib.lib;%(AdditionalDependencies) + zlib\zlib_x64.lib;%(AdditionalDependencies) libcmt.lib @@ -161,7 +163,7 @@ true true true - zlib.lib;%(AdditionalDependencies) + zlib\zlib_x64.lib;%(AdditionalDependencies) /SAFESEH:NO %(AdditionalOptions) Windows mainCRTStartup diff --git a/compress/zlib/zlib_x64.lib b/compress/zlib/zlib_x64.lib new file mode 100644 index 0000000..6a1f361 Binary files /dev/null and b/compress/zlib/zlib_x64.lib differ diff --git a/compress/zstd/zstd_x64.lib b/compress/zstd/zstd_x64.lib new file mode 100644 index 0000000..302d6af Binary files /dev/null and b/compress/zstd/zstd_x64.lib differ diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index c8f8084..69efcb7 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -345,7 +345,7 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject) { EnterCriticalSection(&m_cs); - if (IsExitItem(m_CList_Online, (DWORD)ContextObject)) { + if (IsExitItem(m_CList_Online, (ULONG_PTR)ContextObject)) { LeaveCriticalSection(&m_cs); OutputDebugStringA(CString("===> '") + strIP + CString("' already exist!!\n")); return; @@ -978,7 +978,7 @@ VOID CALLBACK CMy2015RemoteDlg::OfflineProc(CONTEXT_OBJECT* ContextObject) { dlgInfo* dlg = ContextObject->v1 > 0 ? new dlgInfo(ContextObject->hDlg, ContextObject->v1) : NULL; - int nSocket = ContextObject->sClientSocket; + SOCKET nSocket = ContextObject->sClientSocket; g_2015RemoteDlg->PostMessage(WM_USEROFFLINEMSG, (WPARAM)dlg, (LPARAM)nSocket); diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj b/server/2015Remote/2015Remote_vs2015.vcxproj index 5047a54..57ff15e 100644 --- a/server/2015Remote/2015Remote_vs2015.vcxproj +++ b/server/2015Remote/2015Remote_vs2015.vcxproj @@ -79,8 +79,8 @@ true - $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) - $(VLDPATH)\lib\Win64\;$(LibraryPath) + $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) false @@ -89,8 +89,8 @@ false - $(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath) - $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath) + $(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath) + $(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath) @@ -132,7 +132,7 @@ Windows true - zlib.lib;%(AdditionalDependencies) + zlib\zlib_x64.lib;%(AdditionalDependencies) LIBCMT.lib;%(IgnoreSpecificDefaultLibraries) @@ -193,7 +193,7 @@ true true true - zlib.lib + zlib\zlib_x64.lib /SAFESEH:NO %(AdditionalOptions) diff --git a/server/2015Remote/AudioDlg.cpp b/server/2015Remote/AudioDlg.cpp index fc607be..15123c1 100644 --- a/server/2015Remote/AudioDlg.cpp +++ b/server/2015Remote/AudioDlg.cpp @@ -85,7 +85,7 @@ DWORD CAudioDlg::WorkThread(LPVOID lParam) { if (!This->m_bSend) { - WAIT(This->m_bIsWorking, 1, 50); + WAIT_n(This->m_bIsWorking, 1, 50); continue; } DWORD dwBufferSize = 0; diff --git a/server/2015Remote/Buffer.cpp b/server/2015Remote/Buffer.cpp index 4b67be3..e03fdfd 100644 --- a/server/2015Remote/Buffer.cpp +++ b/server/2015Remote/Buffer.cpp @@ -40,9 +40,9 @@ ULONG CBuffer::RemoveCompletedBuffer(ULONG ulLength) LeaveCriticalSection(&m_cs); return 0; } - if (ulLength > ((ULONG)m_Ptr - (ULONG)m_Base)) //如果传进的长度 比有效的数据长度还大 + if (ulLength > (m_Ptr - m_Base)) //如果传进的长度 比有效的数据长度还大 { - ulLength = (ULONG)m_Ptr - (ULONG)m_Base; + ulLength = m_Ptr - m_Base; } if (ulLength) @@ -52,7 +52,7 @@ ULONG CBuffer::RemoveCompletedBuffer(ULONG ulLength) m_Ptr -= ulLength; } - DeAllocateBuffer((ULONG)m_Ptr - (ULONG)m_Base); + DeAllocateBuffer(m_Ptr - m_Base); LeaveCriticalSection(&m_cs); return ulLength; @@ -68,9 +68,9 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) return 0; } - if (ulLength > ((ULONG)m_Ptr - (ULONG)m_Base)) + if (ulLength > (m_Ptr - m_Base)) { - ulLength = (ULONG)m_Ptr - (ULONG)m_Base; + ulLength = m_Ptr - m_Base; } if (ulLength) @@ -81,7 +81,7 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) m_Ptr -= ulLength; } - DeAllocateBuffer((ULONG)m_Ptr - (ULONG)m_Base); + DeAllocateBuffer(m_Ptr - m_Base); LeaveCriticalSection(&m_cs); return ulLength; @@ -90,7 +90,7 @@ ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) // 私有: 无需加锁 ULONG CBuffer::DeAllocateBuffer(ULONG ulLength) { - if (ulLength < ((ULONG)m_Ptr - (ULONG)m_Base)) + if (ulLength < (m_Ptr - m_Base)) return 0; ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; @@ -101,7 +101,7 @@ ULONG CBuffer::DeAllocateBuffer(ULONG ulLength) } PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE); - ULONG ulv1 = (ULONG)m_Ptr - (ULONG)m_Base; //算原先内存的有效长度 + ULONG ulv1 = m_Ptr - m_Base; //算原先内存的有效长度 CopyMemory(NewBase,m_Base,ulv1); VirtualFree(m_Base,0,MEM_RELEASE); @@ -120,7 +120,7 @@ BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength) { EnterCriticalSection(&m_cs); - if (ReAllocateBuffer(ulLength + ((ULONG)m_Ptr - (ULONG)m_Base)) == -1)//10 +1 1024 + if (ReAllocateBuffer(ulLength + (m_Ptr - m_Base)) == -1)//10 +1 1024 { LeaveCriticalSection(&m_cs); return false; @@ -147,7 +147,7 @@ ULONG CBuffer::ReAllocateBuffer(ULONG ulLength) } - ULONG ulv1 = (ULONG)m_Ptr - (ULONG)m_Base; //原先的有效数据长度 + ULONG ulv1 = m_Ptr - m_Base; //原先的有效数据长度 CopyMemory(NewBase,m_Base,ulv1); @@ -180,7 +180,7 @@ ULONG CBuffer::GetBufferLength() // LeaveCriticalSection(&m_cs); return 0; } - ULONG len = (ULONG)m_Ptr - (ULONG)m_Base; + ULONG len = m_Ptr - m_Base; LeaveCriticalSection(&m_cs); return len; @@ -190,7 +190,7 @@ ULONG CBuffer::GetBufferLength() // LPBYTE CBuffer::GetBuffer(ULONG ulPos) { EnterCriticalSection(&m_cs); - if (m_Base==NULL || ulPos >= ((ULONG)m_Ptr - (ULONG)m_Base)) + if (m_Base==NULL || ulPos >= (m_Ptr - m_Base)) { LeaveCriticalSection(&m_cs); return NULL; @@ -205,7 +205,7 @@ LPBYTE CBuffer::GetBuffer(ULONG ulPos) Buffer CBuffer::GetMyBuffer(ULONG ulPos) { EnterCriticalSection(&m_cs); - ULONG len = (ULONG)m_Ptr - (ULONG)m_Base; + ULONG len = m_Ptr - m_Base; if (m_Base == NULL || ulPos >= len) { LeaveCriticalSection(&m_cs); @@ -220,7 +220,7 @@ Buffer CBuffer::GetMyBuffer(ULONG ulPos) // 此函数是多线程安全的. 获取缓存指定位置处的数值. BYTE CBuffer::GetBYTE(ULONG ulPos) { EnterCriticalSection(&m_cs); - if (m_Base == NULL || ulPos >= ((ULONG)m_Ptr - (ULONG)m_Base)) + if (m_Base == NULL || ulPos >= (m_Ptr - m_Base)) { LeaveCriticalSection(&m_cs); return NULL; @@ -234,7 +234,7 @@ BYTE CBuffer::GetBYTE(ULONG ulPos) { // 此函数是多线程安全的. 将缓存拷贝至目标内存中. BOOL CBuffer::CopyBuffer(PVOID pDst, ULONG nLen, ULONG ulPos) { EnterCriticalSection(&m_cs); - ULONG len = (ULONG)m_Ptr - (ULONG)m_Base; + ULONG len = m_Ptr - m_Base; if (m_Base == NULL || len - ulPos < nLen) { LeaveCriticalSection(&m_cs); diff --git a/server/2015Remote/CpuUseage.cpp b/server/2015Remote/CpuUseage.cpp index 0e97916..f506a60 100644 --- a/server/2015Remote/CpuUseage.cpp +++ b/server/2015Remote/CpuUseage.cpp @@ -26,7 +26,7 @@ BOOL CCpuUsage::Init() //统计感兴趣的系统信息时,必须先将对应的计数器添加进来 PDH_STATUS pdh_status = PdhAddCounter(m_hQuery, (LPCSTR)szCounterName, - (DWORD) m_pCounterStruct, &(m_pCounterStruct->hCounter)); + (DWORD_PTR) m_pCounterStruct, &(m_pCounterStruct->hCounter)); if (ERROR_SUCCESS != pdh_status) { return FALSE; diff --git a/server/2015Remote/FileManagerDlg.cpp b/server/2015Remote/FileManagerDlg.cpp index 414704d..90d449e 100644 --- a/server/2015Remote/FileManagerDlg.cpp +++ b/server/2015Remote/FileManagerDlg.cpp @@ -1175,7 +1175,7 @@ BOOL CFileManagerDlg::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) TCHAR szFullText[256]; CString strTipText; - UINT nID = pNMHDR->idFrom; + UINT_PTR nID = pNMHDR->idFrom; //如果idFrom是一个子窗口,则得到其ID。 diff --git a/server/2015Remote/IOCPServer.cpp b/server/2015Remote/IOCPServer.cpp index 91b94ec..8413d2f 100644 --- a/server/2015Remote/IOCPServer.cpp +++ b/server/2015Remote/IOCPServer.cpp @@ -18,7 +18,11 @@ #define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen)) #else #include "zstd/zstd.h" +#ifdef _WIN64 +#pragma comment(lib, "zstd/zstd_x64.lib") +#else #pragma comment(lib, "zstd/zstd.lib") +#endif #define Z_FAILED(p) ZSTD_isError(p) #define Z_SUCCESS(p) (!Z_FAILED(p)) #define compress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT) @@ -482,7 +486,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans ContextObject->InCompressedBuffer.ReadBuffer(CompressedBuffer, ulCompressedLength); #if USING_COMPRESS PBYTE DeCompressedBuffer = new BYTE[ulOriginalLength]; //解压过的内存 436 - int iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength); + size_t iRet = uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength); #else PBYTE DeCompressedBuffer = CompressedBuffer; int iRet = 0; @@ -521,7 +525,7 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans return TRUE; } -VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, ULONG ulOriginalLength) +VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, size_t ulOriginalLength) { assert (ContextObject); // 输出服务端所发送的命令 @@ -547,7 +551,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe unsigned long ulCompressedLength = ZSTD_compressBound(ulOriginalLength); #endif LPBYTE CompressedBuffer = new BYTE[ulCompressedLength]; - int iRet = compress(CompressedBuffer, &ulCompressedLength, (LPBYTE)szBuffer, ulOriginalLength); + size_t iRet = compress(CompressedBuffer, &ulCompressedLength, (LPBYTE)szBuffer, ulOriginalLength); if (Z_FAILED(iRet)) { @@ -567,7 +571,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe } OVERLAPPEDPLUS* OverlappedPlus = new OVERLAPPEDPLUS(IOWrite); - BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)ContextObject, &OverlappedPlus->m_ol); + BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (ULONG_PTR)ContextObject, &OverlappedPlus->m_ol); if ( (!bOk && GetLastError() != ERROR_IO_PENDING) ) //如果投递失败 { int a = GetLastError(); @@ -681,7 +685,7 @@ void IOCPServer::OnAccept() ContextObject->wsaInBuf.buf = (char*)ContextObject->szBuffer; ContextObject->wsaInBuf.len = sizeof(ContextObject->szBuffer); - HANDLE Handle = CreateIoCompletionPort((HANDLE)sClientSocket, m_hCompletionPort, (DWORD)ContextObject, 0); + HANDLE Handle = CreateIoCompletionPort((HANDLE)sClientSocket, m_hCompletionPort, (ULONG_PTR)ContextObject, 0); if (Handle!=m_hCompletionPort) { @@ -719,7 +723,7 @@ void IOCPServer::OnAccept() OVERLAPPEDPLUS *OverlappedPlus = new OVERLAPPEDPLUS(IOInitialize); //注意这里的重叠IO请求是 用户请求上线 - BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (DWORD)ContextObject, &OverlappedPlus->m_ol); // 工作线程 + BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (ULONG_PTR)ContextObject, &OverlappedPlus->m_ol); // 工作线程 //因为我们接受到了一个用户上线的请求那么我们就将该请求发送给我们的完成端口 让我们的工作线程处理它 if ( (!bOk && GetLastError() != ERROR_IO_PENDING)) //如果投递失败 { diff --git a/server/2015Remote/IOCPServer.h b/server/2015Remote/IOCPServer.h index 79d1370..1b90a0b 100644 --- a/server/2015Remote/IOCPServer.h +++ b/server/2015Remote/IOCPServer.h @@ -112,7 +112,7 @@ public: BOOL HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans); BOOL OnClientInitializing(PCONTEXT_OBJECT ContextObject, DWORD dwTrans); BOOL OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans); - VOID OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer , ULONG ulOriginalLength); + VOID OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer , size_t ulOriginalLength); BOOL OnClientPostSending(CONTEXT_OBJECT* ContextObject,ULONG ulCompressedLength); void UpdateMaxConnection(int maxConn); IOCPServer(void); diff --git a/server/2015Remote/InputDlg.cpp b/server/2015Remote/InputDlg.cpp index 0d5598a..b192e14 100644 --- a/server/2015Remote/InputDlg.cpp +++ b/server/2015Remote/InputDlg.cpp @@ -132,7 +132,7 @@ WORD* CDlgTemplateBuilder::AddText(WORD* buf, LPCTSTR text) // Create string dialog. If no icon specified, use IDI_QUESTION. Note that // the order in which the controls are added is the TAB order. // -BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, WORD nIDIcon) +BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, INT_PTR nIDIcon) { const int CXDIALOG = 200; // dialog width const int DLGMARGIN = 7; // margins all around @@ -155,7 +155,7 @@ BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, WORD nID // create icon if needed if (nIDIcon) { - if (nIDIcon >= (WORD)IDI_APPLICATION) { + if (nIDIcon >= (INT_PTR)IDI_APPLICATION) { // if using a system icon, I load it here and set it in OnInitDialog // because can't specify system icon in template, only icons from // application resource file. diff --git a/server/2015Remote/InputDlg.h b/server/2015Remote/InputDlg.h index dede969..3c86ae1 100644 --- a/server/2015Remote/InputDlg.h +++ b/server/2015Remote/InputDlg.h @@ -66,7 +66,7 @@ public: // Call this to create the template with given caption and prompt. BOOL Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent=NULL, - WORD nIDIcon=(WORD)IDI_QUESTION); + INT_PTR nIDIcon=(INT_PTR)IDI_QUESTION); protected: CDlgTemplateBuilder m_dtb; // place to build/hold the dialog template diff --git a/server/2015Remote/RegisterDlg.cpp b/server/2015Remote/RegisterDlg.cpp index 7f389a5..71dab00 100644 --- a/server/2015Remote/RegisterDlg.cpp +++ b/server/2015Remote/RegisterDlg.cpp @@ -293,8 +293,8 @@ void CRegisterDlg::AddKey(char* szBuffer) { // 对注册表 REG_DWORD 类型的处理 char ValueDate[256] = {0}; - DWORD d=(DWORD)szValueDate; - memcpy((void*)&d,szValueDate,sizeof(DWORD)); + INT_PTR d=(INT_PTR)szValueDate; + memcpy((void*)&d,szValueDate,sizeof(INT_PTR)); CString strValue; strValue.Format("0x%x",d); sprintf(ValueDate," (%d)",d);