mình muốn đọc vào 512 byte đầu của ổ cứng , nhưng mà bị lỗi
#include<Windows.h>
#include<stdio.h>
#include<conio.h>
void main()
{
HANDLE hDevice;
hDevice = CreateFile(
L"\\\\.\\PhysicalDrive0", // drive to open
0 , // no access to the drive
FILE_SHARE_READ | FILE_SHARE_WRITE, // share mode
NULL, // default security attributes
OPEN_EXISTING, // disposition
0, //
NULL); // do not copy file attributes
if (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive
{
printf("Khong mo duoc");
return;
}
else printf("Da mo PhysicalDrive0\n");
char buffer[1024];
DWORD bytesRead;
if (!ReadFile(hDevice, buffer, 512, &bytesRead, 0))
printf("Error Code : %d", GetLastError());
getch();
}
Bạn nào có thể sửa giúp mình được không?Cám ơn nhé.
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?