Impl get self wxid
This commit is contained in:
parent
fdcb9cc54c
commit
878b152396
@ -106,6 +106,10 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 自己的 wxid
|
||||||
|
wstring selfWxid = WxGetSelfWxid();
|
||||||
|
wprintf(L"本号WXID:%s\n", selfWxid.c_str());
|
||||||
|
|
||||||
// 获取消息类型
|
// 获取消息类型
|
||||||
wprintf(L"获取消息类型\n");
|
wprintf(L"获取消息类型\n");
|
||||||
const MsgTypesMap_t WxMsgTypes = WxGetMsgTypes();
|
const MsgTypesMap_t WxMsgTypes = WxGetMsgTypes();
|
||||||
|
@ -56,6 +56,7 @@ interface ISpy
|
|||||||
typedef RpcSqlResult_t ***PPPRpcSqlResult;
|
typedef RpcSqlResult_t ***PPPRpcSqlResult;
|
||||||
|
|
||||||
int IsLogin();
|
int IsLogin();
|
||||||
|
int GetSelfWxId([ out, string ] wchar_t wxid[20]);
|
||||||
int SendTextMsg([ in, string ] const wchar_t *wxid, [ in, string ] const wchar_t *msg,
|
int SendTextMsg([ in, string ] const wchar_t *wxid, [ in, string ] const wchar_t *msg,
|
||||||
[ in, unique, string ] const wchar_t *atWxids);
|
[ in, unique, string ] const wchar_t *atWxids);
|
||||||
int SendImageMsg([ in, string ] const wchar_t *wxid, [ in, string ] const wchar_t *path);
|
int SendImageMsg([ in, string ] const wchar_t *wxid, [ in, string ] const wchar_t *path);
|
||||||
|
@ -96,6 +96,21 @@ int RpcIsLogin()
|
|||||||
return loginFlag;
|
return loginFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int RpcGetSelfWxId(wchar_t wxid[20])
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
unsigned long ulCode = 0;
|
||||||
|
RpcTryExcept { ret = client_GetSelfWxId(wxid); }
|
||||||
|
RpcExcept(1)
|
||||||
|
{
|
||||||
|
ulCode = RpcExceptionCode();
|
||||||
|
printf("RpcIsLogin exception 0x%lx = %ld\n", ulCode, ulCode);
|
||||||
|
}
|
||||||
|
RpcEndExcept;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int RpcSendTextMsg(const wchar_t *wxid, const wchar_t *msg, const wchar_t *atWxids)
|
int RpcSendTextMsg(const wchar_t *wxid, const wchar_t *msg, const wchar_t *atWxids)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -8,6 +8,7 @@ RPC_STATUS RpcDisconnectServer();
|
|||||||
int RpcEnableReceiveMsg();
|
int RpcEnableReceiveMsg();
|
||||||
int RpcDisableReceiveMsg();
|
int RpcDisableReceiveMsg();
|
||||||
int RpcIsLogin();
|
int RpcIsLogin();
|
||||||
|
int RpcGetSelfWxId(wchar_t wxid[20]);
|
||||||
int RpcSendTextMsg(const wchar_t *wxid, const wchar_t *msg, const wchar_t *atWxids);
|
int RpcSendTextMsg(const wchar_t *wxid, const wchar_t *msg, const wchar_t *atWxids);
|
||||||
int RpcSendImageMsg(const wchar_t *wxid, const wchar_t *path);
|
int RpcSendImageMsg(const wchar_t *wxid, const wchar_t *path);
|
||||||
PPRpcIntBstrPair RpcGetMsgTypes(int *pNum);
|
PPRpcIntBstrPair RpcGetMsgTypes(int *pNum);
|
||||||
|
@ -157,6 +157,13 @@ static int getAddrHandle(DWORD *addr, HANDLE *handle)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wstring WxGetSelfWxid()
|
||||||
|
{
|
||||||
|
wchar_t wxid[20] = { 0 };
|
||||||
|
RpcGetSelfWxId(wxid);
|
||||||
|
return wstring(wxid);
|
||||||
|
}
|
||||||
|
|
||||||
MsgTypesMap_t WxGetMsgTypes()
|
MsgTypesMap_t WxGetMsgTypes()
|
||||||
{
|
{
|
||||||
static MsgTypesMap_t WxMsgTypes;
|
static MsgTypesMap_t WxMsgTypes;
|
||||||
|
17
SDK/sdk.def
17
SDK/sdk.def
@ -1,12 +1,13 @@
|
|||||||
EXPORTS
|
EXPORTS
|
||||||
WxInitSDK
|
WxInitSDK
|
||||||
WxDestroySDK
|
WxDestroySDK
|
||||||
WxEnableRecvMsg
|
WxEnableRecvMsg
|
||||||
WxDisableRecvMsg
|
WxDisableRecvMsg
|
||||||
WxSendTextMsg
|
WxSendTextMsg
|
||||||
WxGetMsgTypes
|
WxGetSelfWxid
|
||||||
WxSendImageMsg
|
WxGetMsgTypes
|
||||||
WxGetContacts
|
WxSendImageMsg
|
||||||
|
WxGetContacts
|
||||||
WxGetDbNames
|
WxGetDbNames
|
||||||
WxGetDbTables
|
WxGetDbTables
|
||||||
WxExecDbQuery
|
WxExecDbQuery
|
||||||
|
@ -51,6 +51,7 @@ int WxEnableRecvMsg(const std::function<int(WxMessage_t)> &onMsg);
|
|||||||
int WxDisableRecvMsg();
|
int WxDisableRecvMsg();
|
||||||
int WxSendTextMsg(wstring wxid, wstring msg, wstring vAtWxids);
|
int WxSendTextMsg(wstring wxid, wstring msg, wstring vAtWxids);
|
||||||
int WxSendImageMsg(wstring wxid, wstring path);
|
int WxSendImageMsg(wstring wxid, wstring path);
|
||||||
|
wstring WxGetSelfWxid();
|
||||||
ContactMap_t WxGetContacts();
|
ContactMap_t WxGetContacts();
|
||||||
MsgTypesMap_t WxGetMsgTypes();
|
MsgTypesMap_t WxGetMsgTypes();
|
||||||
vector<wstring> WxGetDbNames();
|
vector<wstring> WxGetDbNames();
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#define WECHATINJECTDLL L"Spy.dll"
|
#define WECHATINJECTDLL L"Spy.dll"
|
||||||
|
|
||||||
#define GET_DWORD(addr) ((DWORD) * (DWORD *)(addr))
|
#define GET_DWORD(addr) ((DWORD) * (DWORD *)(addr))
|
||||||
#define GET_STRING(addr) ((CHAR *)(addr))
|
#define GET_STRING(addr) ((CHAR *)(*(DWORD *)(addr)))
|
||||||
#define GET_WSTRING(addr) ((WCHAR *)(*(DWORD *)(addr)))
|
#define GET_WSTRING(addr) ((WCHAR *)(*(DWORD *)(addr)))
|
||||||
|
|
||||||
int OpenWeChat(DWORD *pid);
|
int OpenWeChat(DWORD *pid);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <pybind11/functional.h>
|
#include <pybind11/functional.h>
|
||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
@ -75,6 +75,7 @@ PYBIND11_MODULE(wcferry, m)
|
|||||||
m.def("WxSendTextMsg", &WxSendTextMsg, "Send text message.", py::arg("wxid"), py::arg("msg"),
|
m.def("WxSendTextMsg", &WxSendTextMsg, "Send text message.", py::arg("wxid"), py::arg("msg"),
|
||||||
py::arg("atWxids") = L"");
|
py::arg("atWxids") = L"");
|
||||||
m.def("WxSendImageMsg", &WxSendImageMsg, "Send image message.", py::arg("wxid"), py::arg("path"));
|
m.def("WxSendImageMsg", &WxSendImageMsg, "Send image message.", py::arg("wxid"), py::arg("path"));
|
||||||
|
m.def("WxGetSelfWxid", &WxGetSelfWxid, "Get Self Wxid.");
|
||||||
m.def("WxGetContacts", &WxGetContacts, py::return_value_policy::reference, "Get contact list.");
|
m.def("WxGetContacts", &WxGetContacts, py::return_value_policy::reference, "Get contact list.");
|
||||||
m.def("WxGetMsgTypes", &WxGetMsgTypes, py::return_value_policy::reference, "Get message types.");
|
m.def("WxGetMsgTypes", &WxGetMsgTypes, py::return_value_policy::reference, "Get message types.");
|
||||||
m.def("WxGetDbNames", &WxGetDbNames, py::return_value_policy::reference, "Get DB names.");
|
m.def("WxGetDbNames", &WxGetDbNames, py::return_value_policy::reference, "Get DB names.");
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
extern int IsLogin(void); // Defined in spy.cpp
|
extern int IsLogin(void); // Defined in spy.cpp
|
||||||
|
extern wstring GetSelfWxid(); // Defined in spy.cpp
|
||||||
extern HANDLE g_hEvent; // New message signal
|
extern HANDLE g_hEvent; // New message signal
|
||||||
extern BOOL g_rpcKeepAlive; // Keep RPC server thread running
|
extern BOOL g_rpcKeepAlive; // Keep RPC server thread running
|
||||||
extern MsgQueue_t g_MsgQueue; // Queue for message
|
extern MsgQueue_t g_MsgQueue; // Queue for message
|
||||||
@ -77,6 +78,8 @@ int RpcStopServer()
|
|||||||
|
|
||||||
int server_IsLogin() { return IsLogin(); }
|
int server_IsLogin() { return IsLogin(); }
|
||||||
|
|
||||||
|
int server_GetSelfWxId(wchar_t wxid[20]) { return wcscpy_s(wxid, 20, GetSelfWxid().c_str()); }
|
||||||
|
|
||||||
void server_EnableReceiveMsg()
|
void server_EnableReceiveMsg()
|
||||||
{
|
{
|
||||||
unsigned long ulCode = 0;
|
unsigned long ulCode = 0;
|
||||||
|
@ -42,3 +42,5 @@ void DestroySpy(HMODULE hModule)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int IsLogin(void) { return (int)GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.login); }
|
int IsLogin(void) { return (int)GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.login); }
|
||||||
|
|
||||||
|
wstring GetSelfWxid() { return String2Wstring(GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.wxid)); }
|
||||||
|
Loading…
Reference in New Issue
Block a user