2023-03-31 21:21:35 +08:00
|
|
|
|
#include "pch.h"
|
|
|
|
|
#include "global_context.h"
|
|
|
|
|
#include "http_server.h"
|
|
|
|
|
#include "hooks.h"
|
2023-05-20 17:10:14 +08:00
|
|
|
|
#include "thread_pool.h"
|
2023-03-31 21:21:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace wxhelper {
|
|
|
|
|
|
|
|
|
|
void GlobalContext::initialize(HMODULE module) {
|
|
|
|
|
module_ = module;
|
|
|
|
|
DWORD base = Utils::GetWeChatWinBase();
|
|
|
|
|
config.emplace();
|
2023-04-26 09:57:39 +08:00
|
|
|
|
config->Initialize();
|
2023-03-31 21:21:35 +08:00
|
|
|
|
log.emplace();
|
2023-04-26 09:57:39 +08:00
|
|
|
|
log->Initialize();
|
2023-03-31 21:21:35 +08:00
|
|
|
|
hide_module.emplace();
|
|
|
|
|
#ifndef _DEBUG
|
|
|
|
|
hide_module->Hide(module_);
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-04-26 09:57:39 +08:00
|
|
|
|
HttpServer::GetInstance().Init(config->GetPort());
|
2023-03-31 21:21:35 +08:00
|
|
|
|
HttpServer::GetInstance().HttpStart();
|
|
|
|
|
DB::GetInstance().init(base);
|
|
|
|
|
contact_mgr.emplace(ContactMgr{base});
|
|
|
|
|
misc_mgr.emplace(MiscMgr{base});
|
|
|
|
|
send_mgr.emplace(SendMessageMgr{base});
|
|
|
|
|
account_mgr.emplace(AccountMgr{base});
|
|
|
|
|
chat_room_mgr.emplace(ChatRoomMgr{base});
|
|
|
|
|
sns_mgr.emplace(SNSMgr{base});
|
2023-05-20 17:10:14 +08:00
|
|
|
|
ThreadPool::GetInstance().Create(1,512);
|
2023-03-31 21:21:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GlobalContext::finally() {
|
|
|
|
|
HttpServer::GetInstance().HttpClose();
|
|
|
|
|
hooks::UnHookLog();
|
|
|
|
|
hooks::UnHookRecvMsg();
|
|
|
|
|
hooks::UnHookSearchContact();
|
|
|
|
|
}
|
|
|
|
|
} // namespace wxhelper
|