错误:E0018 需要支架 - 需要帮助

Error: E0018 expected a bracket - need assistance

本文关键字:帮助 错误 E0018      更新时间:2023-10-16
void RainbowSix::outlineEsp(bool enable) {
{
unsigned long pid = GetPID("RainbowSix.exe");
MODULEENTRY32 module = GetModule("RainbowSix.exe", pid);
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
unsigned long long addr; //address
uintptr_t outlineComponent = getOutlineComponent();
if (GetAsyncKeyState(VK_F7));
WriteProcessMemory(phandle, (byte*)((unsigned long long)outlineComponent + 0x348); //Writting the address to the value of g
}
}

我不知道哪里需要它,有人可以帮助我,编码不是我的强项,但我理解其中的大部分,这真的让我感到沮丧。

对于给定的代码,这里缺少一个大括号:

WriteProcessMemory(phandle, (byte*)((unsigned long long)outlineComponent + 0x348);

您可以通过添加新行和缩进来可视化它:

WriteProcessMemory( // <---- no matching closing brace for that one.
phandle, (byte*)
(
(unsigned long long)outlineComponent + 0x348
);

如果你有一个IDE或一个好的编辑器,那么如果你在一个大括号以上,它们将突出显示相应的匹配大括号,这有助于找到缺失的大括号。

在 GetAsyncKeyState(( 调用后有一个 ";",应该删除它。 除此之外,您的 WriteProcessMemory 调用没有足够的参数,您缺少最后 3 个参数。

正确的代码应该如下所示:

void RainbowSix::outlineEsp(bool enable)
{
unsigned long pid = GetPID("RainbowSix.exe");
MODULEENTRY32 module = GetModule("RainbowSix.exe", pid);
HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
unsigned long long addr; //address
uintptr_t outlineComponent = getOutlineComponent();
if (GetAsyncKeyState(VK_F7) &1)
{
WriteProcessMemory(phandle, (byte*)((unsigned long long)outlineComponent + 0x348, lpBuffer, nSize, 0); //Writting the address to the value of g
}
}

lpBuffer 是您将从中写入数据的 src 缓冲区,nSize 应该是您要复制的字节数,最后一个参数的 0 忽略了可选的输出变量,该变量将接收成功写入的字节数。 您需要定义 lpBuffer 和 nSize 才能使此代码正常工作。