Skip to content

设置默认内存Call方式 - SetMemoryCallMode

函数简介

设置默认内存 Call 方式(远程执行入口的行为)。type 取值与 AsmCalltype 1–6 一致。

影响 BindWindowEx mode=11/12Inject type=5/7、HideThisDLL 等默认 Call。

接口名称

SetMemoryCallMode

DLL调用

c
int32_t SetMemoryCallMode(int64_t instance, int32_t type);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
type整数型执行类型,与 AsmCall 的 type 1–6 一致,详见下表。

type 执行类型

说明
1目标进程创建远程线程。
2已注入进程内排队创建线程。
3已注入进程在窗口线程执行。
4本进程当前线程 inline。
5APC(需要已加载驱动)。
6窗口主线程劫持。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int ret = ola.SetMemoryCallMode(1);
if (ret == 1) {
    // 操作成功
}
csharp
using OLAPlug;

var ola = new OLAPlugServer();
int ret = ola.SetMemoryCallMode(1);
if (ret == 1)
{
    // 操作成功
}
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ret = ola.SetMemoryCallMode(1)
if ret == 1:
    pass  # 操作成功
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
int ret = ola.SetMemoryCallMode(1);
if (ret == 1) {
    // 操作成功
}
go
import "github.com/ola/olaplug/olaplug"

ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ret := ola.SetMemoryCallMode(1)
if ret == 1 {
    // 操作成功
}
rust
use olaplug::OLAPlugServer;

let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let ret = ola.set_memory_call_mode(1);
if ret == 1 {
    // 操作成功
}
cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.SetMemoryCallMode(1)
if(ret == 1) {
    // 操作成功
}
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.SetMemoryCallMode(1)
If ret = 1 Then
    ' 操作成功
End If
text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.SetMemoryCallMode(1)
.如果真 (ret = 1)
    ' 操作成功
.如果真结束
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.SetMemoryCallMode(1);
if(ret == 1){
    // 操作成功
}
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.SetMemoryCallMode(1)
如果真 (ret = 1)
{
    // 操作成功
}
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int32_t ret = ola.SetMemoryCallMode(1);
if (ret == 1) {
    // 操作成功
}

原生 DLL 调用

cpp
SetMemoryCallMode(instance, 1);
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int SetMemoryCallMode(long ola, int type);

SetMemoryCallMode(instance, 1);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.SetMemoryCallMode(instance, 1)

返回值

返回值说明
1成功。
0参数非法或无权限。

注意事项

项目说明
影响范围影响 BindWindowEx mode=11/12Inject type=5/7、HideThisDLL 等默认 Call。
不影响 BindWindowEx(mode=1) / Inject(type=1)固定 CreateRemoteThread + LoadLibrary。
不影响 AsmCallAsmCall 仍使用调用方传入的 type
不影响驱动自带注入BindWindow mode=2/3/4/10 驱动自带注入不受影响。
不影响 VMware 键鼠穿透固定远程线程 type=1
type=5 与驱动type=5 未加载驱动时本接口仍返回成功;真正 Call 时失败。可先 Set 再 LoadDriver

相关接口