|
|
|
[求助]如何让DLL中的Cpp类执行析构函数
透过你的导出类看不出什么的,要看你的类对象定义才行。 |
|
|
|
[求助]请问如何能解析到正在运行进程的PE信息
1.使用GetModuleHandle 获得hModule; 2.hModule指向的就是PE文件的DOS HEADER。 3。根据PE文件结构,从hModule指向的地址,开始读取。。。 |
|
|
|
|
|
[求助][讨论]新版的microsft visual studio开发环境下做不出来不依赖.net的程序了吗?
哈,你是不是设置中选择了生成托管程序? |
|
[求助]请高手指教以下代码内容
呵呵,看得出,你对pe文件格式还是不太了解。 ImageBase对于EXE文件来说,由于每个文件总是使用独立的虚拟地址空间,EXE总是能够按照这个地址装入。通常是0x00400000,imagebase指向的内容是DOS文件头。对于内存中pe文件代码段的起始地址是ImageBase + BaseOfCode;对于磁盘文件中代码段的起始地址是相对于文件头偏移PointerToRawData的位置。 假设要在磁盘文件中的代码段缝隙中添加代码,则首先需要查看磁盘文件代码段缝隙大小,是否容的下插入的代码,如果能容下,则根据文件对齐的原则,首先将原来的磁盘文件中代码段按照文件对齐,找出起始插入代码的位置。例如: // 此段的真实长度. dwVirtSize=header->section_header[0].Misc.VirtualSize; // 此段的物理偏移. dwPhysAddress=header->section_header[0].PointerToRawData; // 此段的物理长度. dwPhysSize=header->section_header[0].SizeOfRawData; // 得到代码段的可用空间,用以判断可不可以写入我们的代码 // 用此段的物理长度减去此段的真实长度就可以得到. dwSpace=dwPhysSize-dwVirtSize; if(dwSpace < viruslength) return; // 代码写入的物理偏移. dwEntryWrite=header->section_header[0].PointerToRawData+header-> section_header[0].Misc.VirtualSize; //对齐边界. mods=dwEntryWrite%16; if(mods!=0) { dwEntryWrite+=(16-mods); } //计算加载到内存中的代码段与文件中的代码段的差。 dwCodeOffset=header->opt_head.BaseOfCode-dwPhysAddress; 这里的dwEntryWrite就是对齐后要插入代码的位置。现在有了物理文件中的位置,需要找出加载到内存中的位置。根据我在上面贴子中讲的“对于code代码段,在内存中存在的形式和硬盘中存储的形式是一样的,都是以二进制方式存在”,可以有公式: 内存中位置 - (ImageBase + BaseOfCode) = dwEntryWrite - dwPhysAddress; 由于pe中使用的都是PVA,因此假设内存中对应位置的RVA是dwNewEntryAddress, 则上面公式中: 内存中位置 = ImageBase + dwNewEntryAddress; 把这个代入上面公式就是: ImageBase + dwNewEntryAddress - (ImageBase + BaseOfCode) = dwEntryWrite - dwPhysAddress 于是:dwNewEntryAddress = dwEntryWrite - dwPhysAddress + BaseOfCode; dwNewEntryAddress = dwEntryWrite + (BaseOfCode - dwPhysAddress ); 而前面dwCodeOffset=header->opt_head.BaseOfCode-dwPhysAddress; 所以: dwNewEntryAddress = dwEntryWrite + dwCodeOffset; 到此为止,就推断出了你开头 计算新的程序入口地址的公式了。 哈哈,如果我的回答你能明白,那么别忘了给我加点声望值 |
|
[求助]请高手指教以下代码内容
这里要理解好PE文件存在的两种形态,一种是以硬盘文件存储的形式,一种是内存加载的形式。 对于code代码段,在内存中存在的形式和硬盘中存储的形式是一样的,都是以二进制方式存在。 BaseOfCode是code代码段在内存中加载的相对起始地址,PointerToRawData是code代码段在硬盘文件中的相对起始地址。PointerToRawData是以文件起头为基准。BaseOfCode是以ImageBase为基准。 因此,可以透过内存中的某个值的偏移计算出其在文件中的位置,也可以根据文件中的某个值的偏移,计算出其在内存中的位置。 |
|
[求助]定时器 SetTimer...
呵呵,不懂delphi.我用vc写了一个,你参考。这个可以运行。 #include "windows.h" void CALLBACK ProgTimer(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ) { MessageBeep(-1); } int main(int argc, char* argv[]) { MSG msg; SetTimer(NULL,100,1000,(TIMERPROC)ProgTimer); while(GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } 对于控制台的程序,只要在主程序中加入消息循环就可以了。 |
|
|
|
没问题了...已经解决了...
,同意楼上的说法,如果方便的话,可以把你的工程打包发过来。qq:391136515 |
|
[讨论]高手来看看一个是不是MFC框架本身存在的BUG??
哈哈,好像你写的函数参数个数不对啊。以下是我写的,测试通过。。 void CTestDlg::OnA() { // TODO: Add your control notification handler code here AfxMessageBox("wo"); ShellExecute(NULL,"open","C:\\Program Files\\Tencent\\QQ\\CoralQQ.exe",NULL,"C:\\Program Files\\Tencent\\QQ",SW_SHOW); AfxMessageBox("ni"); } |
|
[活动小结]『2007.看雪论坛.上海微软软件安全技术研讨会』小结
哈,不错,争取下次活动参加。 |
|
|
|
[求助]关于对话框资源!
可以把对话框资源封装成一个dll,然后到目标程序中加以利用。 |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值