Код: Выделить всё
#include
#include
#include
#pragma comment(lib, "Kernel32.lib")
int main()
{
HANDLE hDevice;
char cDisk = 'c'; // Get metadata about the C:\ disk
// Build the logical drive path and get the drive device handle
std::wstring logicalDrive = L"\\\\.\\";
wchar_t drive[3];
drive[0] = cDisk;
drive[1] = L':';
drive[2] = L'\0';
logicalDrive.append(drive);
hDevice = CreateFile(
logicalDrive.c_str(),
0,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hDevice == INVALID_HANDLE_VALUE)
{
std::cerr
Подробнее здесь: [url]https://stackoverflow.com/questions/23445074/deviceiocontrol-returning-unexpected-physical-sector-size[/url]
Мобильная версия