
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、vc+信息安全编程(2)分析程序实现自我删除无数时候,我们制作自动安装程序,安装完成以后自动删除,软件仅仅安装一次就自动删除,以庇护软件学问产权。软件自动删除的代码是如何实现的呢,我们来看下ifdef _debug define new debug_new undef this_file ic char this_file = _file_; endif / / cselfdeldlg dialog cselfdeldlg:cselfdeldlg(cwnd* pparent /*=null*/) : cdialog(cselfdeldlg:idd, pparent) /afx_data_ini
2、t(cselfdeldlg) / note: the classwizard will a member initialization here /afx_data_init / note that loadicon does not require a bsequent desoyicon in win32 m_hicon = afxgetapp()- loadicon(idr_mainframe); vo cselfdeldlg:dodataexchange(cdataexchange* pdx) cdialog:dodataexchange(pdx); /afx_data_map(cse
3、lfdeldlg) / note: the classwizard will add ddx and ddv cal here /afx_data_map begin_message_map(cselfdeldlg, cdialog) /afx_msg_map(cselfdeldlg) on_wm_paint() on_wm_querydragicon() on_bn_clicked(idc_delete_1, ondelete1) on_bn_clicked(idc_delete_2, ondelete2) on_bn_clicked(idc_any, onany) /afx_msg_map
4、 end_message_map() / / cselfdeldlg message handlers bool cselfdeldlg:oninitdialog() cdialog:oninitdialog(); / set the icon for this dialog. the framework does this automatically / when the appliion's main window is not a dialog seticon(m_hicon, true); / set big icon seticon(m_hicon, false); / se
5、t small icon / todo: add tra initialization here return true; / return true un you the focus to a control / if you add a minimize button to your dialog, you will ne the code below / to draw the icon. for mfc applications using the document/view model, / this is automatically done for you by the fram
6、ework. void cselfdeldlg:onpaint() if (isiconic() cpaintdc dc(this); / device context for painting sendmessage(wm_iconerasebkgnd, (wparam) dc.getsafehdc(), 0); / center icon in client rectangle int cxicon = getsystemmetrics(sm_cxicon); int cyicon = getsystemmetrics(sm_cyicon); crect rect; getclientre
7、ct( rect); int x = (rect.width() - cxicon + 1) / 2; int y = (rect.height() - cyicon + 1) / 2; / draw the icon dc.drawicon(x, y, m_hicon); else cdialog:onpaint(); / the system calls this to obtain the cursor to display while the user drags / the minimized window. hcursor cselfdeldlg:onquerydragicon()
8、 return (hcursor) m_hicon; void cselfdeldlg:ondelete1() /*char name256; char *ptr=:getcommandline(); strpy(name,ptr,255); for(int i=1;i i+)if(namei=' ')break; char path256; for(int j=0;j hmodule mole = getmodulehandle(0); char bufmax_path; getmodulefilename(module, buf, sizeof(buf); if(delet
9、efile(buf)afxmessagebox( 自我删除胜利! else messagebox( 自我删除失败! , 挺直用 deletefile ,mb_ok|mb_iconexclamation); void cselfdeldlg:ondelete2() hmodule module = getmodulehandle(0); char bufmax_path; getmodulefilename(module, buf, sizeof buf); closehandle(handle(4); _asm lea eax, buf push 0 push 0 push eax push
10、exitprocess push module push deletefile push unmapviewoffile void cselfdeldlg:onany() osversioninfo ver; ver.dwosversioninfosize=sizeof(ver); getversionex( ver); /if(ver.dwplatfoid=ver_platform_win32_windows)/is win95 or 98 afxmessagebox( 98 hmodule h = getmodulehandle(0); char bufmax_path; getmodul
11、efilename(h, buf, sizeof buf); file *fp; if(!(fp=fopen( c:anyexe.bat , wb )return; cstring in; in= del in+=buf; in+= rn in+= del in+= c:anyexe.bat f(in.getbuffer(0),in.getlength(),1,fp); fclose(fp); afxmessagebox(in); :shellexee(0,null, command.exe , c:anyexe.bat ,null,0); else if(ver.dwplatformid=ver_platform_win32_nt)/is nt or 2000 /afxmessagebox( 2000 hmodule module = getmodulehandle(0); char bufmax_path; getmodulef
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 西师版二年级上数学学习计划
- 地方医院基建科个人总结范文
- 电力行业安全生产技术措施
- 人教版小学二年级英语下册教学计划
- 窗口响应速度提升-洞察阐释
- 2025年安保行业安全培训计划
- 2025年项目管理实践计划
- 福建三明三元区人社系统招收人员考试真题2024
- 中小学教师信息技术培训与职业规划
- 白猫情感表达在动物心理学中的意义探讨-洞察阐释
- 上海市嘉定区联考2023-2024学年五年级下学期期中数学试题(含答案)
- 铝屑粉尘清扫管理制度
- 司法雇员考试题目及答案
- 密盖息产品介绍
- 2025年河南省安阳市滑县中考模拟(创新人才选拔测评(一))化学试题(含答案)
- 吸氧并发症预防及处理
- 警企共建合作协议书范本
- 2025信息技术绿色发展行动计划
- CNAS-CL31-2011 内部校准要求
- 2024年7月国家开放大学专科《高等数学基础》期末纸质考试试题及答案
- 2025年小学一年级数学下册无纸笔化评价方案及检测题
评论
0/150
提交评论