在沙箱中添加了RegisterComApis函数声明,并在InitEnv函数中调用该函数以注册COM相关API。还更新了头文件以包含新函数的声明。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "sandbox.h"
|
||||
|
||||
#include "sandbox_callbacks.h"
|
||||
#include "sandbox_api_com.h"
|
||||
|
||||
// 在文件开头添加AllocateMemory函数的声明
|
||||
auto Sandbox::AllocateMemory(size_t size) -> uint64_t {
|
||||
@@ -656,6 +656,26 @@ auto Sandbox::SetupVirtualMachine() -> void {
|
||||
GetTeb32()->TlsSlots[i] = 0x1337;
|
||||
}
|
||||
}
|
||||
/*
|
||||
// 在InitEnv函数之前添加这个函数
|
||||
void Sandbox::RegisterComApis() {
|
||||
// 注册COM相关API
|
||||
_fakeApi coInitializeEx = {Api_CoInitializeEx, 2}; // pvReserved, dwCoInit
|
||||
_fakeApi coCreateInstance = {
|
||||
Api_CoCreateInstance, 5}; // rclsid, pUnkOuter, dwClsContext, riid, ppv
|
||||
_fakeApi variantInit = {Api_VariantInit, 1}; // pvarg
|
||||
_fakeApi variantClear = {Api_VariantClear, 1}; // pvarg
|
||||
_fakeApi sysAllocString = {Api_SysAllocString, 1}; // psz
|
||||
|
||||
// 将API添加到映射表中
|
||||
m_apiMap["CoInitializeEx"] = coInitializeEx;
|
||||
m_apiMap["CoCreateInstance"] = coCreateInstance;
|
||||
m_apiMap["VariantInit"] = variantInit;
|
||||
m_apiMap["VariantClear"] = variantClear;
|
||||
m_apiMap["SysAllocString"] = sysAllocString;
|
||||
}
|
||||
*/
|
||||
// 在InitEnv函数中调用RegisterComApis
|
||||
auto Sandbox::InitEnv(std::shared_ptr<BasicPeInfo> peInfo) -> void {
|
||||
m_peInfo = peInfo;
|
||||
if (cs_open(CS_ARCH_X86, peInfo->isX64 ? CS_MODE_64 : CS_MODE_32,
|
||||
|
||||
Reference in New Issue
Block a user