gpt4 book ai didi

c - WinAPI 连接两个 VOID 缓冲区

转载 作者:行者123 更新时间:2023-11-30 14:22:07 26 4
gpt4 key购买 nike

do I need to manually do that ?Does CopyMemory  accept shifting the destination ?the following isn't working 
requestBuffer = VirtualAlloc(NULL, sizeof(fileBuffer) + sizeof(sendRequest) + 2, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
CopyMemory(requestBuffer,sendRequest, sizeof(sendRequest));
CopyMemory((PVOID)(requestBuffer+sizeof(requestBuffer)),fileBuffer, sizeof(fileBuffer));

最后一个 CopyMemory 给出语法错误表达式必须是指向完整对象类型的指针我想你不能取消引用 void ,但知道如何连接这两个缓冲区

最佳答案

听起来requestBuffer是一个void *。不能对 void 指针使用指针算术。在添加之前尝试转换为 (PBYTE):

CopyMemory((PVOID)((PBYTE)requestBuffer+sizeof(requestBuffer)), ...

关于c - WinAPI 连接两个 VOID 缓冲区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14068367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com