From b16957ede43eef3aeeaea450608ef262daa0ce56 Mon Sep 17 00:00:00 2001 From: Changhua Date: Sun, 7 Aug 2022 21:17:04 +0800 Subject: [PATCH] Refine RPC --- SDK/SDK.vcxproj | 1 + SDK/rpc_client.cpp | 4 +--- Spy/Spy.vcxproj | 1 + Spy/rpc_server.cpp | 8 +++----- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/SDK/SDK.vcxproj b/SDK/SDK.vcxproj index 2f481de..cafe36f 100644 --- a/SDK/SDK.vcxproj +++ b/SDK/SDK.vcxproj @@ -119,6 +119,7 @@ true false sdk.def + Rpcrt4.lib;%(AdditionalDependencies) diff --git a/SDK/rpc_client.cpp b/SDK/rpc_client.cpp index 06beb8f..269e656 100644 --- a/SDK/rpc_client.cpp +++ b/SDK/rpc_client.cpp @@ -2,8 +2,6 @@ #include "sdk.h" #include "util.h" -#pragma comment(lib, "Rpcrt4.lib") - static RPC_WSTR pszStringBinding = NULL; extern std::function g_cbReceiveTextMsg; @@ -14,7 +12,7 @@ RPC_STATUS RpcConnectServer() status = RpcStringBindingCompose(NULL, // UUID to bind to reinterpret_cast((RPC_WSTR)L"ncalrpc"), // Use TCP/IP protocol NULL, // TCP/IP network address to use - reinterpret_cast((RPC_WSTR)L"tmp_endpoint"), // TCP/IP port to use + reinterpret_cast((RPC_WSTR)L"wcferry"), // TCP/IP port to use NULL, // Protocol dependent network options to use &pszStringBinding); // String binding output diff --git a/Spy/Spy.vcxproj b/Spy/Spy.vcxproj index 4ca44e3..8eae960 100644 --- a/Spy/Spy.vcxproj +++ b/Spy/Spy.vcxproj @@ -122,6 +122,7 @@ true true false + Rpcrt4.lib;%(AdditionalDependencies) /prefix client "client_" server "server_" diff --git a/Spy/rpc_server.cpp b/Spy/rpc_server.cpp index 344b34d..972d8d3 100644 --- a/Spy/rpc_server.cpp +++ b/Spy/rpc_server.cpp @@ -3,14 +3,12 @@ #include "get_contacts.h" #include "monitor.h" +#include "rpc_h.h" #include "rpc_server.h" #include "sdk.h" #include "send_msg.h" #include "spy_types.h" -#include "rpc_h.h" -#pragma comment(lib, "Rpcrt4.lib") - extern HANDLE g_hEvent; extern MsgQueue_t g_MsgQueue; extern const MsgTypesMap_t g_WxMsgTypes; @@ -129,8 +127,8 @@ int RpcStartServer(HMODULE hModule) // remote procedure calls. status = RpcServerUseProtseqEp(reinterpret_cast((RPC_WSTR)L"ncalrpc"), // Use TCP/IP protocol RPC_C_LISTEN_MAX_CALLS_DEFAULT, // Backlog queue length for TCP/IP. - reinterpret_cast((RPC_WSTR)L"tmp_endpoint"), // TCP/IP port to use - NULL // No security + reinterpret_cast((RPC_WSTR)L"wcferry"), // TCP/IP port to use + NULL // No security ); if (status)