I have the answer. The LVITEM
structure is wrong under 64-bit
systems. Pointers are 64-bit Now,so
the text pointer has to be followed by
a dummy value,to offset the length
member correctly.
我认为这将是最好的解决方案,因为我可以用一个exe运行x32和x64.我只是不知道如何做他正在谈论的事情.我已经包含了目前适用于x32的代码.如果有人可以帮助我.那太棒了.
LVITEMLVITEM lvi,*_lvi;char item[512];char *_item;unsigned long pID;HANDLE process;GetwindowThreadProcessID(procList,&pID);process = OpenProcess(0x001f0fff,FALSE,pID);_lvi = (LVITEM*)VirtualAllocEx(process,NulL,sizeof(LVITEM),0x1000,4);_item = (char*)VirtualAllocEx(process,512,4);lvi.cchTextMax = 512;int r,c;for (r = 0; r < rowCount; r++){ for (c = 0; c < columnCount; c++) { lvi.iSubItem = c; lvi.pszText =_item; // Insert lvi into programs's memory WriteProcessMemory(process,_lvi,&lvi,NulL); // Have program write text to in its memory where we told it to SendMessage(procList,LVM_GETITEMTEXT,(WParaM)r,(LParaM)_lvi); // Get TVITEM back from programs ReadProcessMemory(process,_item,item,NulL); } } // Clean up the mess we made VirtualFreeEx(process,MEM_RELEASE); VirtualFreeEx(process,MEM_RELEASE); CloseHandle(process);解决方法 我认为你无法做到这一点.在32位进程中,指针太短.我相信VirtualAllocEx在从32位进程调用并且使用64位进程句柄作为其第一个参数时将失败.如果您在代码中添加了错误检查,我想你会看到这个.
您唯一的解决方案是拥有2个版本,x86和x64.这应该不是真正的麻烦 – 通常可以用单一来源完成.
总结以上是内存溢出为你收集整理的x32的LVM_GETITEMTEXT和C的x64全部内容,希望文章能够帮你解决x32的LVM_GETITEMTEXT和C的x64所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)