为什么API函数: DeviceIoControl中FSCTL_LOCK_VOLUME没定义?
#include <Windows.h> #include <stdio.h>
DWORD readMBR()
{
DWORD dwBytesReturned;
BYTE pMBR[512]={0};
DWORD FSCTL_UNLOCK_VOLUME;
//打开物理磁盘
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;
}
DeviceIoControl(hDevice, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwBytesReturned, NULL);
//读磁盘文件
ReadFile(hDevice, pMBR, 512, &dwBytesReturned, NULL);
DeviceIoControl(hDevice, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &dwBytesReturned, NULL);
return 0;
}
int main(int argc, char* argv[])
{
readMBR();
return 0;
}
错误提示:C:\Windows\System32\hhhhh.cpp(20) : error C2065: 'FSCTL_LOCK_VOLUME' : undeclared identifier
搞了几次还是出错!