fix Init check and apicall and addinstall_handle_monitor unload_handle_monitor
lock_protect_memory
This commit is contained in:
@@ -4,111 +4,157 @@
|
|||||||
#include "active_check.h"
|
#include "active_check.h"
|
||||||
#include "client_pipe.h"
|
#include "client_pipe.h"
|
||||||
#include "check_vmware.h"
|
#include "check_vmware.h"
|
||||||
|
#include "driver_func.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
string g_Version = "1.0.0.0";
|
string g_Version = "1.0.0.0";
|
||||||
|
|
||||||
MYAPI_API VOID Init(std::string& Version, bool& IsOsAvailable)
|
MYAPI_API BOOL MYAPI_CALL Init(std::string* Version, bool* IsOsAvailable, PDWORD status)
|
||||||
{
|
{
|
||||||
Version = g_Version;
|
*Version = g_Version;
|
||||||
|
|
||||||
OSVERSIONINFOW os{ 0 };
|
OSVERSIONINFOW os{ 0 };
|
||||||
RtlGetVersion(&os);
|
RtlGetVersion(&os);
|
||||||
|
|
||||||
if (os.dwBuildNumber == 7601 || os.dwBuildNumber == 7600)
|
if (os.dwBuildNumber == 7601 || os.dwBuildNumber == 7600)
|
||||||
IsOsAvailable = true;
|
*IsOsAvailable = true;
|
||||||
else if(os.dwBuildNumber >= 14393)
|
else if (os.dwBuildNumber >= 14393)
|
||||||
IsOsAvailable = true;
|
*IsOsAvailable = true;
|
||||||
else IsOsAvailable = false;
|
else { *IsOsAvailable = false;/* return FALSE;*/ }
|
||||||
|
|
||||||
|
|
||||||
|
if (utils::Is32BitOperatingSystem())
|
||||||
|
{
|
||||||
|
*IsOsAvailable = false;
|
||||||
|
*status = 107;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//判断一下是否开启了VBS和HVCI内存隔离
|
||||||
|
if (os.dwBuildNumber >= 14393)
|
||||||
|
{
|
||||||
|
BOOL VBS = FALSE;
|
||||||
|
BOOL HVCI = FALSE;
|
||||||
|
auto result = utils::CheckVBS(&VBS, &HVCI);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
if (VBS && HVCI)
|
||||||
|
{
|
||||||
|
*IsOsAvailable = false;
|
||||||
|
*status = 108;
|
||||||
|
}
|
||||||
|
else if (VBS)
|
||||||
|
{
|
||||||
|
*IsOsAvailable = false;
|
||||||
|
*status = 109;
|
||||||
|
}
|
||||||
|
else if (HVCI)
|
||||||
|
{
|
||||||
|
*IsOsAvailable = false;
|
||||||
|
*status = 110;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取系统详细信息
|
||||||
|
//上报系统详细信息 暂时不在这里使用
|
||||||
|
//WINDOWS_VERSION wVersion{ 0 };
|
||||||
|
|
||||||
|
//utils::GetWindowsVersion(&wVersion);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return driver_func::init(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL set_server_process_path(CONST char* Path, PDWORD status)
|
MYAPI_API BOOL MYAPI_CALL set_server_process_path(CONST char* Path, PDWORD status)
|
||||||
{
|
{
|
||||||
return client_shared_mapping::StartServerProcess(Path, status);
|
return client_shared_mapping::StartServerProcess(Path, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL check_server_process()
|
MYAPI_API BOOL MYAPI_CALL check_server_process()
|
||||||
{
|
{
|
||||||
return QueryServerAlreadyOpen();
|
return QueryServerAlreadyOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL driver_install_load(PDWORD status)
|
MYAPI_API BOOL MYAPI_CALL driver_install_load(PDWORD status)
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->driver_map_load(status);
|
return client_driver::fn_get_instance()->driver_map_load(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL check_install_status()
|
MYAPI_API BOOL MYAPI_CALL check_install_status()
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->check_load_driver();
|
return client_driver::fn_get_instance()->check_load_driver();
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL add_process_protect(DWORD Pid)
|
MYAPI_API BOOL MYAPI_CALL add_process_protect(DWORD Pid)
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->add_process_protect(Pid);
|
return client_driver::fn_get_instance()->add_process_protect(Pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL sub_process_protect(DWORD Pid)
|
MYAPI_API BOOL MYAPI_CALL sub_process_protect(DWORD Pid)
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->delete_process_protect(Pid);
|
return client_driver::fn_get_instance()->delete_process_protect(Pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL enjoin_remote_thread(BOOL val)
|
MYAPI_API BOOL MYAPI_CALL enjoin_remote_thread(BOOL val)
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->enjoin_remote_thread(val);
|
return client_driver::fn_get_instance()->enjoin_remote_thread(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL enable_reg_mouse_key()
|
MYAPI_API BOOL MYAPI_CALL enable_reg_mouse_key()
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->install_mouse_keyboard();
|
return client_driver::fn_get_instance()->install_mouse_keyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL disable_reg_mouse_key()
|
MYAPI_API BOOL MYAPI_CALL disable_reg_mouse_key()
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->unload_mouse_keyboard();
|
return client_driver::fn_get_instance()->unload_mouse_keyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL add_mouse_key_white_process(DWORD Pid)
|
MYAPI_API BOOL MYAPI_CALL add_mouse_key_white_process(DWORD Pid)
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->add_white_mouse_keyoard_process(Pid);
|
return client_driver::fn_get_instance()->add_white_mouse_keyoard_process(Pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL anit_window_scrren(HWND hwnd,UINT Flags)
|
MYAPI_API BOOL MYAPI_CALL anit_window_scrren(HWND hwnd,UINT Flags)
|
||||||
{
|
{
|
||||||
return client_driver::fn_get_instance()->window_anit_screen(hwnd, Flags);
|
return client_driver::fn_get_instance()->window_anit_screen(hwnd, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL check_remote_app_process()
|
MYAPI_API BOOL MYAPI_CALL check_remote_app_process()
|
||||||
{
|
{
|
||||||
return active_check::check_remote_app_process();
|
return active_check::check_remote_app_process();
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL check_virtual_system()
|
MYAPI_API BOOL MYAPI_CALL check_virtual_system()
|
||||||
{
|
{
|
||||||
uint64_t req;
|
uint64_t req;
|
||||||
|
return HBClientCall(static_cast<uint32_t>(CommandId::CheckVMware), &req, sizeof(req), nullptr, 0, nullptr);
|
||||||
return HBClientCall(
|
|
||||||
static_cast<uint32_t>(CommandId::CheckVMware),
|
|
||||||
&req,
|
|
||||||
sizeof(req),
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
nullptr);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL check_vmx_setting()
|
MYAPI_API BOOL MYAPI_CALL check_vmx_setting()
|
||||||
{
|
{
|
||||||
uint64_t req;
|
uint64_t req;
|
||||||
|
return HBClientCall(static_cast<uint32_t>(CommandId::CheckVmx), &req, sizeof(req), nullptr, 0, nullptr);
|
||||||
return HBClientCall(
|
|
||||||
static_cast<uint32_t>(CommandId::CheckVmx),
|
|
||||||
&req,
|
|
||||||
sizeof(req),
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MYAPI_API BOOL check_scan_process(DWORD Pid, void* Results)
|
MYAPI_API BOOL MYAPI_CALL check_scan_process(DWORD Pid, void* Results)
|
||||||
{
|
{
|
||||||
return active_check::ScanProcessHandles(Pid, (PROCESS_HANDLE_RESULTS*)Results);
|
return active_check::ScanProcessHandles(Pid, (PROCESS_HANDLE_RESULTS*)Results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MYAPI_API BOOL MYAPI_CALL install_handle_monitor()
|
||||||
|
{
|
||||||
|
return client_driver::fn_get_instance()->install_handle_monitor();
|
||||||
|
}
|
||||||
|
|
||||||
|
MYAPI_API BOOL MYAPI_CALL unload_handle_monitor()
|
||||||
|
{
|
||||||
|
return client_driver::fn_get_instance()->unload_handle_monitor();
|
||||||
|
}
|
||||||
|
|
||||||
|
MYAPI_API BOOL MYAPI_CALL lock_protect_memory(DWORD Pid, DWORD64 Address)
|
||||||
|
{
|
||||||
|
return client_driver::fn_get_instance()->lock_process_memory_region(Pid, Address);
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,58 +6,70 @@
|
|||||||
#define EXPROTS_API_FUNC
|
#define EXPROTS_API_FUNC
|
||||||
|
|
||||||
#ifdef EXPROTS_API_FUNC
|
#ifdef EXPROTS_API_FUNC
|
||||||
#define MYAPI_API __declspec(dllexport)
|
#define MYAPI_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define MYAPI_API __declspec(dllimport)
|
#define MYAPI_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MYAPI_CALL __stdcall
|
||||||
|
|
||||||
|
|
||||||
//初始化函数
|
//初始化函数
|
||||||
EXTERN_C MYAPI_API VOID Init(std::string& Version, bool& IsOsAvailable);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL Init(std::string* Version, bool* IsOsAvailable, PDWORD status);
|
||||||
|
|
||||||
//设置服务进程目录
|
//设置服务进程目录
|
||||||
EXTERN_C MYAPI_API BOOL set_server_process_path(CONST char* Path, PDWORD status);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL set_server_process_path(CONST char* Path, PDWORD status);
|
||||||
|
|
||||||
//服务进程是否已加载
|
//服务进程是否已加载
|
||||||
EXTERN_C MYAPI_API BOOL check_server_process();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL check_server_process();
|
||||||
|
|
||||||
//驱动安装
|
//驱动安装
|
||||||
EXTERN_C MYAPI_API BOOL driver_install_load(PDWORD status);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL driver_install_load(PDWORD status);
|
||||||
|
|
||||||
//驱动是否安装成功
|
//驱动是否安装成功
|
||||||
EXTERN_C MYAPI_API BOOL check_install_status();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL check_install_status();
|
||||||
|
|
||||||
//添加进程防护
|
//添加进程防护
|
||||||
EXTERN_C MYAPI_API BOOL add_process_protect(DWORD Pid);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL add_process_protect(DWORD Pid);
|
||||||
|
|
||||||
//移除进程防护
|
//移除进程防护
|
||||||
EXTERN_C MYAPI_API BOOL sub_process_protect(DWORD Pid);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL sub_process_protect(DWORD Pid);
|
||||||
|
|
||||||
//是否启用禁止远程线程
|
//是否启用禁止远程线程
|
||||||
EXTERN_C MYAPI_API BOOL enjoin_remote_thread(BOOL val);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL enjoin_remote_thread(BOOL val);
|
||||||
|
|
||||||
//启用键鼠保护回调
|
//启用键鼠保护回调
|
||||||
EXTERN_C MYAPI_API BOOL enable_reg_mouse_key();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL enable_reg_mouse_key();
|
||||||
|
|
||||||
//禁用键鼠保护回调
|
//禁用键鼠保护回调
|
||||||
EXTERN_C MYAPI_API BOOL disable_reg_mouse_key();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL disable_reg_mouse_key();
|
||||||
|
|
||||||
//添加键鼠移动白名单进程
|
//添加键鼠移动白名单进程
|
||||||
EXTERN_C MYAPI_API BOOL add_mouse_key_white_process(DWORD Pid);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL add_mouse_key_white_process(DWORD Pid);
|
||||||
|
|
||||||
//设置窗口反截图
|
//设置窗口反截图
|
||||||
EXTERN_C MYAPI_API BOOL anit_window_scrren(HWND hwnd, UINT Flags);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL anit_window_scrren(HWND hwnd, UINT Flags);
|
||||||
|
|
||||||
//检测远程软件进程
|
//检测远程软件进程
|
||||||
EXTERN_C MYAPI_API BOOL check_remote_app_process();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL check_remote_app_process();
|
||||||
|
|
||||||
//检测是否在虚拟机环境
|
//检测是否在虚拟机环境
|
||||||
EXTERN_C MYAPI_API BOOL check_virtual_system();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL check_virtual_system();
|
||||||
|
|
||||||
//检测是否在VT环境中
|
//检测是否在VT环境中
|
||||||
EXTERN_C MYAPI_API BOOL check_vmx_setting();
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL check_vmx_setting();
|
||||||
|
|
||||||
//检测持有进程句柄的进程
|
//检测持有进程句柄的进程
|
||||||
EXTERN_C MYAPI_API BOOL check_scan_process(DWORD Pid, void* Results);
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL check_scan_process(DWORD Pid, void* Results);
|
||||||
|
|
||||||
|
//安装全局进程句柄表监控
|
||||||
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL install_handle_monitor();
|
||||||
|
|
||||||
|
//卸载全局进程句柄表监控
|
||||||
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL unload_handle_monitor();
|
||||||
|
|
||||||
|
//内存锁页
|
||||||
|
EXTERN_C MYAPI_API BOOL MYAPI_CALL lock_protect_memory(DWORD Pid, DWORD64 Address);
|
||||||
|
|
||||||
#endif // !exprots_api_func
|
#endif // !exprots_api_func
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user