退出微信登录

This commit is contained in:
Gy Hu 2023-01-02 11:45:04 +08:00
parent fd66a641f6
commit 8b68a347a0
4 changed files with 65 additions and 1 deletions

View File

@ -600,6 +600,43 @@ vcpkg
#### 44.退出登录**
###### 接口功能
> 退出登录微信相当于直接退出微信跟手动退出比少了重新打开登录的一步dll注入后也会随微信关闭而关闭。调用后不能再继续操作dll。
###### 接口地址
> [/api/?type=44](/api/?type=44)
###### HTTP请求方式
> POST JSON
###### 请求参数
|参数|必选|类型|说明|
|---|---|---|---|
###### 返回字段
|返回字段|字段类型|说明 |
|---|---|---|
|code|int|返回状态,非0成功|
|result|string|成功提示|
###### 接口示例
入参:
``` javascript
```
响应:
``` javascript
{"code":4344,"result":"OK"}
```
#### 46.联系人列表**
###### 接口功能
> 联系人列表

View File

@ -461,6 +461,9 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) {
break;
}
case WECHAT_LOGOUT: {
int success = Logout();
json ret_data = {{"code", success}, {"result", "OK"}};
ret = ret_data.dump();
break;
}
case WECHAT_GET_TRANSFER: {

View File

@ -19,7 +19,8 @@
#define WX_APP_DATA_SAVE_PATH_OFFSET 0x2c65728
#define WX_CURRENT_DATA_PATH_OFFSET 0x2c636fc
#define WX_LOGOUT_OFFSET 0xccc320
#define WX_ACCOUT_SERVICE_OFFSET 0x65bcc0
int GetSelfInfo(SelfInfoInner &out) {
DWORD base = GetWeChatWinBase();
@ -136,4 +137,25 @@ int GetSelfInfo(SelfInfoInner &out) {
int CheckLogin(){
DWORD base = GetWeChatWinBase();
return *(DWORD*) (base + WX_LOGIN_STATUS_OFFSET);
}
int Logout(){
int success = 0;
if(!CheckLogin()){
return success;
}
DWORD base = GetWeChatWinBase();
DWORD account_service_addr = base + WX_ACCOUT_SERVICE_OFFSET;
DWORD logout_addr = base + WX_LOGOUT_OFFSET;
__asm{
PUSHAD
CALL account_service_addr
PUSH 0x0
MOV ECX,EAX
CALL logout_addr
MOV success,EAX
POPAD
}
return success;
}

View File

@ -4,4 +4,6 @@
int GetSelfInfo(SelfInfoInner& out);
int CheckLogin();
int Logout();
#endif