2,640
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
int main() {
HANDLE hFile=CreateFile("\\\\.\\PhysicalDrive0",GENERIC_READ,
FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(INVALID_HANDLE_VALUE==hFile){
printf("open error %d\n",GetLastError());
}
return 0;
}
#include <windows.h>
#include <stdio.h>
int main() {
HANDLE hFile=CreateFile("\\\\.\\PhysicalDrive0", // drive to open
0, // no access to the drive
FILE_SHARE_READ | // share mode
FILE_SHARE_WRITE,
NULL, // default security attributes
OPEN_EXISTING, // disposition
0, // file attributes
NULL);
if(INVALID_HANDLE_VALUE==hFile){
printf("open error %d\n",GetLastError());
}
char buf[256];
DWORD nread;
ReadFile(hFile,buf,255,&nread,NULL);
return 0;//GENERIC_READ
}