Impl get db names with sql
This commit is contained in:
@@ -153,6 +153,27 @@ PPRpcContact RpcGetContacts(int *pNum)
|
||||
return ppRpcContacts;
|
||||
}
|
||||
|
||||
BSTR *RpcGetDbNames(int *pNum)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long ulCode = 0;
|
||||
BSTR *pBstr = NULL;
|
||||
|
||||
RpcTryExcept { ret = client_GetDbNames(pNum, &pBstr); }
|
||||
RpcExcept(1)
|
||||
{
|
||||
ulCode = RpcExceptionCode();
|
||||
printf("RpcGetDbNames exception 0x%lx = %ld\n", ulCode, ulCode);
|
||||
}
|
||||
RpcEndExcept;
|
||||
if (ret != 0) {
|
||||
printf("RpcGetDbNames Failed: %d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pBstr;
|
||||
}
|
||||
|
||||
int server_ReceiveMsg(RpcMessage_t rpcMsg)
|
||||
{
|
||||
WxMessage_t msg;
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "rpc_h.h"
|
||||
|
||||
@@ -11,3 +11,4 @@ int RpcSendTextMsg(const wchar_t *wxid, const wchar_t *at_wxid, const wchar_t *m
|
||||
int RpcSendImageMsg(const wchar_t *wxid, const wchar_t *path);
|
||||
PPRpcIntBstrPair RpcGetMsgTypes(int *pNum);
|
||||
PPRpcContact RpcGetContacts(int *pNum);
|
||||
BSTR *RpcGetDbNames(int *pNum);
|
||||
|
||||
+16
@@ -171,3 +171,19 @@ ContactMap_t WxGetContacts()
|
||||
|
||||
return mContact;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> WxGetDbNames()
|
||||
{
|
||||
std::vector<std::wstring> vDbs;
|
||||
int size = 0;
|
||||
BSTR *pBstr = RpcGetDbNames(&size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
vDbs.push_back(GetWstringFromBstr(pBstr[i]));
|
||||
}
|
||||
|
||||
if (pBstr) {
|
||||
midl_user_free(pBstr);
|
||||
}
|
||||
|
||||
return vDbs;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
EXPORTS
|
||||
EXPORTS
|
||||
WxInitSDK
|
||||
WxSetTextMsgCb
|
||||
WxSendTextMsg
|
||||
WxGetMsgTypes
|
||||
WxSendImageMsg
|
||||
WxGetContacts
|
||||
WxGetContacts
|
||||
WxGetDbNames
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -18,13 +19,13 @@ typedef struct WxMessage {
|
||||
} WxMessage_t;
|
||||
|
||||
typedef struct WxContact {
|
||||
wstring wxId;
|
||||
wstring wxCode;
|
||||
wstring wxName;
|
||||
wstring wxCountry;
|
||||
wstring wxProvince;
|
||||
wstring wxCity;
|
||||
wstring wxGender;
|
||||
wstring wxId; // 微信ID
|
||||
wstring wxCode; // 微信号
|
||||
wstring wxName; // 微信昵称
|
||||
wstring wxCountry; // 国家
|
||||
wstring wxProvince; // 省/州
|
||||
wstring wxCity; // 城市
|
||||
wstring wxGender; // 性别
|
||||
} WxContact_t;
|
||||
|
||||
typedef map<int, wstring> MsgTypesMap_t;
|
||||
@@ -36,3 +37,4 @@ int WxSendTextMsg(wstring wxid, wstring at_wxid, wstring msg);
|
||||
int WxSendImageMsg(wstring wxid, wstring path);
|
||||
ContactMap_t WxGetContacts();
|
||||
MsgTypesMap_t WxGetMsgTypes();
|
||||
vector<wstring> WxGetDbNames();
|
||||
|
||||
@@ -187,6 +187,14 @@ wstring GetWstringFromBstr(BSTR p)
|
||||
return ws;
|
||||
}
|
||||
|
||||
BSTR GetBstrFromWstring(wstring ws)
|
||||
{
|
||||
if (!ws.empty()) {
|
||||
return SysAllocStringLen(ws.data(), ws.size());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GetRpcMessage(WxMessage_t *wxMsg, RpcMessage_t rpcMsg)
|
||||
{
|
||||
wxMsg->self = rpcMsg.self;
|
||||
|
||||
+8
-7
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "sdk.h"
|
||||
#include "rpc_h.h"
|
||||
#include "sdk.h"
|
||||
|
||||
#define WECHAREXE L"WeChat.exe"
|
||||
#define WECHATWINDLL L"WeChatWin.dll"
|
||||
@@ -19,9 +19,10 @@ int GetWeChatPath(wchar_t *path);
|
||||
int GetWeChatWinDLLPath(wchar_t *path);
|
||||
int GetWeChatVersion(wchar_t *version);
|
||||
bool GetFileVersion(const wchar_t *filePath, wchar_t *version);
|
||||
int GetWstringByAddress(DWORD address, wchar_t *buffer, DWORD buffer_size);
|
||||
BSTR GetBstrByAddress(DWORD address);
|
||||
int GetWstringByAddress(DWORD address, wchar_t *buffer, DWORD buffer_size);
|
||||
BSTR GetBstrByAddress(DWORD address);
|
||||
void GetRpcMessage(WxMessage_t *wxMsg, RpcMessage_t rpcMsg);
|
||||
DWORD GetMemoryIntByAddress(HANDLE hProcess, DWORD address);
|
||||
DWORD GetMemoryIntByAddress(HANDLE hProcess, DWORD address);
|
||||
std::wstring GetWstringFromBstr(BSTR p);
|
||||
BSTR GetBstrFromWstring(std::wstring ws);
|
||||
std::wstring GetUnicodeInfoByAddress(HANDLE hProcess, DWORD address);
|
||||
|
||||
Reference in New Issue
Block a user